mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Move CollectionManager out of ModManager
This commit is contained in:
parent
0eff4e2e67
commit
9c0fc8a8c7
19 changed files with 94 additions and 102 deletions
|
|
@ -16,7 +16,7 @@ public class ModsController : WebApiController
|
|||
[Route( HttpVerbs.Get, "/mods" )]
|
||||
public object? GetMods()
|
||||
{
|
||||
return Penumbra.ModManager.Collections.CurrentCollection.Cache?.AvailableMods.Values.Select( x => new
|
||||
return Penumbra.CollectionManager.CurrentCollection.Cache?.AvailableMods.Values.Select( x => new
|
||||
{
|
||||
x.Settings.Enabled,
|
||||
x.Settings.Priority,
|
||||
|
|
@ -34,7 +34,7 @@ public class ModsController : WebApiController
|
|||
[Route( HttpVerbs.Get, "/files" )]
|
||||
public object GetFiles()
|
||||
{
|
||||
return Penumbra.ModManager.Collections.CurrentCollection.Cache?.ResolvedFiles.ToDictionary(
|
||||
return Penumbra.CollectionManager.CurrentCollection.Cache?.ResolvedFiles.ToDictionary(
|
||||
o => o.Key.ToString(),
|
||||
o => o.Value.FullName
|
||||
)
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
_penumbra!.ObjectReloader.RedrawAll( setting );
|
||||
}
|
||||
|
||||
private static string ResolvePath( string path, ModManager manager, ModCollection collection )
|
||||
private static string ResolvePath( string path, ModManager _, ModCollection collection )
|
||||
{
|
||||
if( !Penumbra.Config.EnableMods )
|
||||
{
|
||||
|
|
@ -85,21 +85,21 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
|
||||
var gamePath = Utf8GamePath.FromString( path, out var p, true ) ? p : Utf8GamePath.Empty;
|
||||
var ret = collection.Cache?.ResolveSwappedOrReplacementPath( gamePath );
|
||||
ret ??= manager.Collections.ForcedCollection.Cache?.ResolveSwappedOrReplacementPath( gamePath );
|
||||
ret ??= Penumbra.CollectionManager.ForcedCollection.Cache?.ResolveSwappedOrReplacementPath( gamePath );
|
||||
return ret?.ToString() ?? path;
|
||||
}
|
||||
|
||||
public string ResolvePath( string path )
|
||||
{
|
||||
CheckInitialized();
|
||||
return ResolvePath( path, Penumbra.ModManager, Penumbra.ModManager.Collections.DefaultCollection );
|
||||
return ResolvePath( path, Penumbra.ModManager, Penumbra.CollectionManager.DefaultCollection );
|
||||
}
|
||||
|
||||
public string ResolvePath( string path, string characterName )
|
||||
{
|
||||
CheckInitialized();
|
||||
return ResolvePath( path, Penumbra.ModManager,
|
||||
Penumbra.ModManager.Collections.CharacterCollection.TryGetValue( characterName, out var collection )
|
||||
Penumbra.CollectionManager.CharacterCollection.TryGetValue( characterName, out var collection )
|
||||
? collection
|
||||
: ModCollection.Empty );
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
CheckInitialized();
|
||||
try
|
||||
{
|
||||
if( !Penumbra.ModManager.Collections.Collections.TryGetValue( collectionName, out var collection ) )
|
||||
if( !Penumbra.CollectionManager.Collections.TryGetValue( collectionName, out var collection ) )
|
||||
{
|
||||
collection = ModCollection.Empty;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,12 +68,12 @@ public unsafe partial class PathResolver
|
|||
CharacterBaseCreateHook?.Enable();
|
||||
EnableDrawHook?.Enable();
|
||||
CharacterBaseDestructorHook?.Enable();
|
||||
Penumbra.ModManager.Collections.CollectionChanged += CheckCollections;
|
||||
Penumbra.CollectionManager.CollectionChanged += CheckCollections;
|
||||
}
|
||||
|
||||
private void DisableDataHooks()
|
||||
{
|
||||
Penumbra.ModManager.Collections.CollectionChanged -= CheckCollections;
|
||||
Penumbra.CollectionManager.CollectionChanged -= CheckCollections;
|
||||
CharacterBaseCreateHook?.Disable();
|
||||
EnableDrawHook?.Disable();
|
||||
CharacterBaseDestructorHook?.Disable();
|
||||
|
|
@ -161,7 +161,7 @@ public unsafe partial class PathResolver
|
|||
{
|
||||
if( gameObject == null )
|
||||
{
|
||||
return Penumbra.ModManager.Collections.DefaultCollection;
|
||||
return Penumbra.CollectionManager.DefaultCollection;
|
||||
}
|
||||
|
||||
var name = gameObject->ObjectIndex switch
|
||||
|
|
@ -174,9 +174,9 @@ public unsafe partial class PathResolver
|
|||
}
|
||||
?? new Utf8String( gameObject->Name ).ToString();
|
||||
|
||||
return Penumbra.ModManager.Collections.CharacterCollection.TryGetValue( name, out var col )
|
||||
return Penumbra.CollectionManager.CharacterCollection.TryGetValue( name, out var col )
|
||||
? col
|
||||
: Penumbra.ModManager.Collections.DefaultCollection;
|
||||
: Penumbra.CollectionManager.DefaultCollection;
|
||||
}
|
||||
|
||||
// Update collections linked to Game/DrawObjects due to a change in collection configuration.
|
||||
|
|
|
|||
|
|
@ -163,12 +163,12 @@ public unsafe partial class PathResolver
|
|||
private ModCollection? GetCollection( IntPtr drawObject )
|
||||
{
|
||||
var parent = FindParent( drawObject, out var collection );
|
||||
if( parent == null || collection == Penumbra.ModManager.Collections.DefaultCollection )
|
||||
if( parent == null || collection == Penumbra.CollectionManager.DefaultCollection )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return collection.Cache == null ? Penumbra.ModManager.Collections.ForcedCollection : collection;
|
||||
return collection.Cache == null ? Penumbra.CollectionManager.ForcedCollection : collection;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ public unsafe partial class PathResolver
|
|||
{
|
||||
collection = IdentifyCollection( resolver.LastGameObject );
|
||||
#if USE_CMP
|
||||
if( collection != Penumbra.ModManager.Collections.DefaultCollection && collection.Cache != null )
|
||||
if( collection != Penumbra.CollectionManager.DefaultCollection && collection.Cache != null )
|
||||
{
|
||||
collection.SetCmpFiles();
|
||||
return new MetaChanger( MetaManipulation.Type.Rsp );
|
||||
|
|
@ -309,25 +309,25 @@ public unsafe partial class PathResolver
|
|||
case MetaManipulation.Type.Eqdp:
|
||||
if( --_eqdpCounter == 0 )
|
||||
{
|
||||
Penumbra.ModManager.Collections.DefaultCollection.SetEqdpFiles();
|
||||
Penumbra.CollectionManager.DefaultCollection.SetEqdpFiles();
|
||||
}
|
||||
|
||||
break;
|
||||
case MetaManipulation.Type.Eqp:
|
||||
if( --_eqpCounter == 0 )
|
||||
{
|
||||
Penumbra.ModManager.Collections.DefaultCollection.SetEqpFiles();
|
||||
Penumbra.CollectionManager.DefaultCollection.SetEqpFiles();
|
||||
}
|
||||
|
||||
break;
|
||||
case MetaManipulation.Type.Est:
|
||||
Penumbra.ModManager.Collections.DefaultCollection.SetEstFiles();
|
||||
Penumbra.CollectionManager.DefaultCollection.SetEstFiles();
|
||||
break;
|
||||
case MetaManipulation.Type.Gmp:
|
||||
Penumbra.ModManager.Collections.DefaultCollection.SetGmpFiles();
|
||||
Penumbra.CollectionManager.DefaultCollection.SetGmpFiles();
|
||||
break;
|
||||
case MetaManipulation.Type.Rsp:
|
||||
Penumbra.ModManager.Collections.DefaultCollection.SetCmpFiles();
|
||||
Penumbra.CollectionManager.DefaultCollection.SetCmpFiles();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public unsafe partial class PathResolver
|
|||
[MethodImpl( MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization )]
|
||||
private IntPtr ResolvePathDetour( IntPtr drawObject, IntPtr path )
|
||||
=> ResolvePathDetour( FindParent( drawObject, out var collection ) == null
|
||||
? Penumbra.ModManager.Collections.DefaultCollection
|
||||
? Penumbra.CollectionManager.DefaultCollection
|
||||
: collection, path );
|
||||
|
||||
// Weapons have the characters DrawObject as a parent,
|
||||
|
|
@ -123,7 +123,7 @@ public unsafe partial class PathResolver
|
|||
{
|
||||
var parent = FindParent( ( IntPtr )parentObject, out var collection );
|
||||
return ResolvePathDetour( parent == null
|
||||
? Penumbra.ModManager.Collections.DefaultCollection
|
||||
? Penumbra.CollectionManager.DefaultCollection
|
||||
: collection, path );
|
||||
}
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ public unsafe partial class PathResolver
|
|||
}
|
||||
|
||||
var gamePath = new Utf8String( ( byte* )path );
|
||||
if( collection == Penumbra.ModManager.Collections.DefaultCollection )
|
||||
if( collection == Penumbra.CollectionManager.DefaultCollection )
|
||||
{
|
||||
SetCollection( gamePath, null );
|
||||
return path;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public partial class PathResolver : IDisposable
|
|||
var nonDefault = HandleMaterialSubFiles( gamePath, out var collection ) || PathCollections.TryGetValue( gamePath.Path, out collection );
|
||||
if( !nonDefault )
|
||||
{
|
||||
collection = Penumbra.ModManager.Collections.DefaultCollection;
|
||||
collection = Penumbra.CollectionManager.DefaultCollection;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -49,7 +49,7 @@ public partial class PathResolver : IDisposable
|
|||
var resolved = collection!.ResolveSwappedOrReplacementPath( gamePath );
|
||||
if( resolved == null )
|
||||
{
|
||||
resolved = Penumbra.ModManager.Collections.ForcedCollection.ResolveSwappedOrReplacementPath( gamePath );
|
||||
resolved = Penumbra.CollectionManager.ForcedCollection.ResolveSwappedOrReplacementPath( gamePath );
|
||||
if( resolved == null )
|
||||
{
|
||||
// We also need to handle defaulted materials against a non-default collection.
|
||||
|
|
@ -61,7 +61,7 @@ public partial class PathResolver : IDisposable
|
|||
return ( null, collection );
|
||||
}
|
||||
|
||||
collection = Penumbra.ModManager.Collections.ForcedCollection;
|
||||
collection = Penumbra.CollectionManager.ForcedCollection;
|
||||
}
|
||||
|
||||
// Since mtrl files load their files separately, we need to add the new, resolved path
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ public partial class MetaManager
|
|||
fileDescriptor->ResourceHandle->FileNameLength = split[ 1 ].Length;
|
||||
|
||||
var ret = Penumbra.ResourceLoader.ReadSqPackHook.Original( resourceManager, fileDescriptor, priority, isSync );
|
||||
if( Penumbra.ModManager.Collections.Collections.TryGetValue( split[ 0 ].ToString(), out var collection )
|
||||
if( Penumbra.CollectionManager.Collections.TryGetValue( split[ 0 ].ToString(), out var collection )
|
||||
&& collection.Cache != null
|
||||
&& collection.Cache.MetaManipulations.Imc.Files.TryGetValue(
|
||||
Utf8GamePath.FromSpan( split[ 1 ].Span, out var p, false ) ? p : Utf8GamePath.Empty, out var file ) )
|
||||
|
|
|
|||
|
|
@ -521,7 +521,7 @@ public class ModCleanup
|
|||
}
|
||||
}
|
||||
|
||||
foreach( var collection in Penumbra.ModManager.Collections.Collections.Values )
|
||||
foreach( var collection in Penumbra.CollectionManager.Collections.Values )
|
||||
{
|
||||
collection.UpdateSetting( baseDir, meta, true );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -260,8 +260,8 @@ public class ModManager
|
|||
|
||||
public FullPath? ResolveSwappedOrReplacementPath( Utf8GamePath gameResourcePath )
|
||||
{
|
||||
var ret = Collections.DefaultCollection.ResolveSwappedOrReplacementPath( gameResourcePath );
|
||||
ret ??= Collections.ForcedCollection.ResolveSwappedOrReplacementPath( gameResourcePath );
|
||||
var ret = Penumbra.CollectionManager.DefaultCollection.ResolveSwappedOrReplacementPath( gameResourcePath );
|
||||
ret ??= Penumbra.CollectionManager.ForcedCollection.ResolveSwappedOrReplacementPath( gameResourcePath );
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
@ -82,7 +82,7 @@ public static class ModManagerEditExtensions
|
|||
manager.Config.Save();
|
||||
}
|
||||
|
||||
foreach( var collection in manager.Collections.Collections.Values )
|
||||
foreach( var collection in Penumbra.CollectionManager.Collections.Values )
|
||||
{
|
||||
if( collection.Settings.TryGetValue( oldBasePath.Name, out var settings ) )
|
||||
{
|
||||
|
|
@ -140,7 +140,7 @@ public static class ModManagerEditExtensions
|
|||
|
||||
mod.SaveMeta();
|
||||
|
||||
foreach( var collection in manager.Collections.Collections.Values )
|
||||
foreach( var collection in Penumbra.CollectionManager.Collections.Values )
|
||||
{
|
||||
if( !collection.Settings.TryGetValue( mod.BasePath.Name, out var settings ) )
|
||||
{
|
||||
|
|
@ -176,7 +176,7 @@ public static class ModManagerEditExtensions
|
|||
return ( oldSetting & bitmaskFront ) | ( ( oldSetting & bitmaskBack ) >> 1 );
|
||||
}
|
||||
|
||||
foreach( var collection in manager.Collections.Collections.Values )
|
||||
foreach( var collection in Penumbra.CollectionManager.Collections.Values )
|
||||
{
|
||||
if( !collection.Settings.TryGetValue( mod.BasePath.Name, out var settings ) )
|
||||
{
|
||||
|
|
@ -202,7 +202,7 @@ public static class ModManagerEditExtensions
|
|||
if( collection.Cache != null && settings.Enabled )
|
||||
{
|
||||
collection.CalculateEffectiveFileList( mod.Resources.MetaManipulations.Count > 0,
|
||||
manager.Collections.IsActive( collection ) );
|
||||
Penumbra.CollectionManager.IsActive( collection ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ public class Penumbra : IDalamudPlugin
|
|||
|
||||
var collection = string.Equals( collectionName, ModCollection.Empty.Name, StringComparison.InvariantCultureIgnoreCase )
|
||||
? ModCollection.Empty
|
||||
: ModManager.Collections.Collections.Values.FirstOrDefault( c
|
||||
: CollectionManager.Collections.Values.FirstOrDefault( c
|
||||
=> string.Equals( c.Name, collectionName, StringComparison.InvariantCultureIgnoreCase ) );
|
||||
if( collection == null )
|
||||
{
|
||||
|
|
@ -225,24 +225,24 @@ public class Penumbra : IDalamudPlugin
|
|||
switch( type )
|
||||
{
|
||||
case "default":
|
||||
if( collection == ModManager.Collections.DefaultCollection )
|
||||
if( collection == CollectionManager.DefaultCollection )
|
||||
{
|
||||
Dalamud.Chat.Print( $"{collection.Name} already is the default collection." );
|
||||
return false;
|
||||
}
|
||||
|
||||
ModManager.Collections.SetCollection( collection, CollectionType.Default );
|
||||
CollectionManager.SetCollection( collection, CollectionType.Default );
|
||||
Dalamud.Chat.Print( $"Set {collection.Name} as default collection." );
|
||||
SettingsInterface.ResetDefaultCollection();
|
||||
return true;
|
||||
case "forced":
|
||||
if( collection == ModManager.Collections.ForcedCollection )
|
||||
if( collection == CollectionManager.ForcedCollection )
|
||||
{
|
||||
Dalamud.Chat.Print( $"{collection.Name} already is the forced collection." );
|
||||
return false;
|
||||
}
|
||||
|
||||
ModManager.Collections.SetCollection( collection, CollectionType.Forced );
|
||||
CollectionManager.SetCollection( collection, CollectionType.Forced );
|
||||
Dalamud.Chat.Print( $"Set {collection.Name} as forced collection." );
|
||||
SettingsInterface.ResetForcedCollection();
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ public partial class SettingsInterface
|
|||
}
|
||||
|
||||
var modManager = Penumbra.ModManager;
|
||||
var items = modManager.Collections.DefaultCollection.Cache?.ChangedItems ?? new Dictionary< string, object? >();
|
||||
var forced = modManager.Collections.ForcedCollection.Cache?.ChangedItems ?? new Dictionary< string, object? >();
|
||||
var items = Penumbra.CollectionManager.DefaultCollection.Cache?.ChangedItems ?? new Dictionary< string, object? >();
|
||||
var forced = Penumbra.CollectionManager.ForcedCollection.Cache?.ChangedItems ?? new Dictionary< string, object? >();
|
||||
|
||||
using var raii = ImGuiRaii.DeferredEnd( ImGui.EndTabItem );
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public partial class SettingsInterface
|
|||
|
||||
private void UpdateNames()
|
||||
{
|
||||
_collections = Penumbra.ModManager.Collections.Collections.Values.Prepend( ModCollection.Empty ).ToArray();
|
||||
_collections = Penumbra.CollectionManager.Collections.Values.Prepend( ModCollection.Empty ).ToArray();
|
||||
_collectionNames = string.Join( "\0", _collections.Skip( 1 ).Select( c => c.Name ) ) + '\0';
|
||||
_collectionNamesWithNone = "None\0" + _collectionNames;
|
||||
UpdateIndices();
|
||||
|
|
@ -51,18 +51,18 @@ public partial class SettingsInterface
|
|||
}
|
||||
|
||||
private void UpdateIndex()
|
||||
=> _currentCollectionIndex = GetIndex( Penumbra.ModManager.Collections.CurrentCollection ) - 1;
|
||||
=> _currentCollectionIndex = GetIndex( Penumbra.CollectionManager.CurrentCollection ) - 1;
|
||||
|
||||
public void UpdateForcedIndex()
|
||||
=> _currentForcedIndex = GetIndex( Penumbra.ModManager.Collections.ForcedCollection );
|
||||
=> _currentForcedIndex = GetIndex( Penumbra.CollectionManager.ForcedCollection );
|
||||
|
||||
public void UpdateDefaultIndex()
|
||||
=> _currentDefaultIndex = GetIndex( Penumbra.ModManager.Collections.DefaultCollection );
|
||||
=> _currentDefaultIndex = GetIndex( Penumbra.CollectionManager.DefaultCollection );
|
||||
|
||||
private void UpdateCharacterIndices()
|
||||
{
|
||||
_currentCharacterIndices.Clear();
|
||||
foreach( var kvp in Penumbra.ModManager.Collections.CharacterCollection )
|
||||
foreach( var kvp in Penumbra.CollectionManager.CharacterCollection )
|
||||
{
|
||||
_currentCharacterIndices[ kvp.Key ] = GetIndex( kvp.Value );
|
||||
}
|
||||
|
|
@ -84,11 +84,10 @@ public partial class SettingsInterface
|
|||
|
||||
private void CreateNewCollection( Dictionary< string, ModSettings > settings )
|
||||
{
|
||||
var manager = Penumbra.ModManager;
|
||||
if( manager.Collections.AddCollection( _newCollectionName, settings ) )
|
||||
if( Penumbra.CollectionManager.AddCollection( _newCollectionName, settings ) )
|
||||
{
|
||||
UpdateNames();
|
||||
SetCurrentCollection( manager.Collections.Collections[ _newCollectionName ], true );
|
||||
SetCurrentCollection( Penumbra.CollectionManager.Collections[ _newCollectionName ], true );
|
||||
}
|
||||
|
||||
_newCollectionName = string.Empty;
|
||||
|
|
@ -98,10 +97,9 @@ public partial class SettingsInterface
|
|||
{
|
||||
if( ImGui.Button( "Clean Settings" ) )
|
||||
{
|
||||
var manager = Penumbra.ModManager;
|
||||
var changes = ModFunctions.CleanUpCollection( manager.Collections.CurrentCollection.Settings,
|
||||
manager.BasePath.EnumerateDirectories() );
|
||||
manager.Collections.CurrentCollection.UpdateSettings( changes );
|
||||
var changes = ModFunctions.CleanUpCollection( Penumbra.CollectionManager.CurrentCollection.Settings,
|
||||
Penumbra.ModManager.BasePath.EnumerateDirectories() );
|
||||
Penumbra.CollectionManager.CurrentCollection.UpdateSettings( changes );
|
||||
}
|
||||
|
||||
ImGuiCustom.HoverTooltip(
|
||||
|
|
@ -126,10 +124,9 @@ public partial class SettingsInterface
|
|||
|
||||
var hover = ImGui.IsItemHovered();
|
||||
ImGui.SameLine();
|
||||
var manager = Penumbra.ModManager;
|
||||
if( ImGui.Button( "Duplicate Current Collection" ) && _newCollectionName.Length > 0 )
|
||||
{
|
||||
CreateNewCollection( manager.Collections.CurrentCollection.Settings );
|
||||
CreateNewCollection( Penumbra.CollectionManager.CurrentCollection.Settings );
|
||||
}
|
||||
|
||||
hover |= ImGui.IsItemHovered();
|
||||
|
|
@ -140,13 +137,13 @@ public partial class SettingsInterface
|
|||
ImGui.SetTooltip( "Please enter a name before creating a collection." );
|
||||
}
|
||||
|
||||
var deleteCondition = manager.Collections.Collections.Count > 1
|
||||
&& manager.Collections.CurrentCollection.Name != ModCollection.DefaultCollection;
|
||||
var deleteCondition = Penumbra.CollectionManager.Collections.Count > 1
|
||||
&& Penumbra.CollectionManager.CurrentCollection.Name != ModCollection.DefaultCollection;
|
||||
ImGui.SameLine();
|
||||
if( ImGuiCustom.DisableButton( "Delete Current Collection", deleteCondition ) )
|
||||
{
|
||||
manager.Collections.RemoveCollection( manager.Collections.CurrentCollection.Name );
|
||||
SetCurrentCollection( manager.Collections.CurrentCollection, true );
|
||||
Penumbra.CollectionManager.RemoveCollection( Penumbra.CollectionManager.CurrentCollection.Name );
|
||||
SetCurrentCollection( Penumbra.CollectionManager.CurrentCollection, true );
|
||||
UpdateNames();
|
||||
}
|
||||
|
||||
|
|
@ -169,7 +166,7 @@ public partial class SettingsInterface
|
|||
return;
|
||||
}
|
||||
|
||||
Penumbra.ModManager.Collections.SetCollection( _collections[ idx + 1 ], CollectionType.Current );
|
||||
Penumbra.CollectionManager.SetCollection( _collections[ idx + 1 ], CollectionType.Current );
|
||||
_currentCollectionIndex = idx;
|
||||
_selector.Cache.TriggerListReset();
|
||||
if( _selector.Mod != null )
|
||||
|
|
@ -208,7 +205,7 @@ public partial class SettingsInterface
|
|||
ImGui.SetNextItemWidth( SettingsMenu.InputTextWidth );
|
||||
if( ImGui.Combo( "##Default Collection", ref index, _collectionNamesWithNone ) && index != _currentDefaultIndex )
|
||||
{
|
||||
Penumbra.ModManager.Collections.SetCollection( _collections[ index ], CollectionType.Default );
|
||||
Penumbra.CollectionManager.SetCollection( _collections[ index ], CollectionType.Default );
|
||||
_currentDefaultIndex = index;
|
||||
}
|
||||
|
||||
|
|
@ -225,18 +222,17 @@ public partial class SettingsInterface
|
|||
{
|
||||
var index = _currentForcedIndex;
|
||||
ImGui.SetNextItemWidth( SettingsMenu.InputTextWidth );
|
||||
var manager = Penumbra.ModManager;
|
||||
using var style = ImGuiRaii.PushStyle( ImGuiStyleVar.Alpha, 0.5f, manager.Collections.CharacterCollection.Count == 0 );
|
||||
using var style = ImGuiRaii.PushStyle( ImGuiStyleVar.Alpha, 0.5f, Penumbra.CollectionManager.CharacterCollection.Count == 0 );
|
||||
if( ImGui.Combo( "##Forced Collection", ref index, _collectionNamesWithNone )
|
||||
&& index != _currentForcedIndex
|
||||
&& manager.Collections.CharacterCollection.Count > 0 )
|
||||
&& Penumbra.CollectionManager.CharacterCollection.Count > 0 )
|
||||
{
|
||||
manager.Collections.SetCollection( _collections[ index ], CollectionType.Forced );
|
||||
Penumbra.CollectionManager.SetCollection( _collections[ index ], CollectionType.Forced );
|
||||
_currentForcedIndex = index;
|
||||
}
|
||||
|
||||
style.Pop();
|
||||
if( manager.Collections.CharacterCollection.Count == 0 && ImGui.IsItemHovered() )
|
||||
if( Penumbra.CollectionManager.CharacterCollection.Count == 0 && ImGui.IsItemHovered() )
|
||||
{
|
||||
ImGui.SetTooltip(
|
||||
"Forced Collections only provide value if you have at least one Character Collection. There is no need to set one until then." );
|
||||
|
|
@ -262,7 +258,7 @@ public partial class SettingsInterface
|
|||
if( ImGuiCustom.DisableButton( "Create New Character Collection",
|
||||
_newCharacterName.Length > 0 && Penumbra.Config.HasReadCharacterCollectionDesc ) )
|
||||
{
|
||||
Penumbra.ModManager.Collections.CreateCharacterCollection( _newCharacterName );
|
||||
Penumbra.CollectionManager.CreateCharacterCollection( _newCharacterName );
|
||||
_currentCharacterIndices[ _newCharacterName ] = 0;
|
||||
_newCharacterName = string.Empty;
|
||||
}
|
||||
|
|
@ -344,15 +340,14 @@ public partial class SettingsInterface
|
|||
DrawDefaultCollectionSelector();
|
||||
DrawForcedCollectionSelector();
|
||||
|
||||
var manager = Penumbra.ModManager;
|
||||
foreach( var name in manager.Collections.CharacterCollection.Keys.ToArray() )
|
||||
foreach( var name in Penumbra.CollectionManager.CharacterCollection.Keys.ToArray() )
|
||||
{
|
||||
var idx = _currentCharacterIndices[ name ];
|
||||
var tmp = idx;
|
||||
ImGui.SetNextItemWidth( SettingsMenu.InputTextWidth );
|
||||
if( ImGui.Combo( $"##{name}collection", ref tmp, _collectionNamesWithNone ) && idx != tmp )
|
||||
{
|
||||
manager.Collections.SetCollection( _collections[ tmp ], CollectionType.Character, name );
|
||||
Penumbra.CollectionManager.SetCollection( _collections[ tmp ], CollectionType.Character, name );
|
||||
_currentCharacterIndices[ name ] = tmp;
|
||||
}
|
||||
|
||||
|
|
@ -362,7 +357,7 @@ public partial class SettingsInterface
|
|||
|
||||
if( ImGui.Button( $"{FontAwesomeIcon.Trash.ToIconString()}##{name}", Vector2.One * ImGui.GetFrameHeight() ) )
|
||||
{
|
||||
manager.Collections.RemoveCharacterCollection( name );
|
||||
Penumbra.CollectionManager.RemoveCharacterCollection( name );
|
||||
}
|
||||
|
||||
font.Pop();
|
||||
|
|
|
|||
|
|
@ -49,17 +49,16 @@ public partial class SettingsInterface
|
|||
using var raii = ImGuiRaii.DeferredEnd( ImGui.EndTable );
|
||||
|
||||
var manager = Penumbra.ModManager;
|
||||
PrintValue( "Current Collection", manager.Collections.CurrentCollection.Name );
|
||||
PrintValue( " has Cache", ( manager.Collections.CurrentCollection.Cache != null ).ToString() );
|
||||
PrintValue( "Default Collection", manager.Collections.DefaultCollection.Name );
|
||||
PrintValue( " has Cache", ( manager.Collections.DefaultCollection.Cache != null ).ToString() );
|
||||
PrintValue( "Forced Collection", manager.Collections.ForcedCollection.Name );
|
||||
PrintValue( " has Cache", ( manager.Collections.ForcedCollection.Cache != null ).ToString() );
|
||||
PrintValue( "Mod Manager BasePath", manager.BasePath?.Name ?? "NULL" );
|
||||
PrintValue( "Mod Manager BasePath-Full", manager.BasePath?.FullName ?? "NULL" );
|
||||
PrintValue( "Current Collection", Penumbra.CollectionManager.CurrentCollection.Name );
|
||||
PrintValue( " has Cache", ( Penumbra.CollectionManager.CurrentCollection.Cache != null ).ToString() );
|
||||
PrintValue( "Default Collection", Penumbra.CollectionManager.DefaultCollection.Name );
|
||||
PrintValue( " has Cache", ( Penumbra.CollectionManager.DefaultCollection.Cache != null ).ToString() );
|
||||
PrintValue( "Forced Collection", Penumbra.CollectionManager.ForcedCollection.Name );
|
||||
PrintValue( " has Cache", ( Penumbra.CollectionManager.ForcedCollection.Cache != null ).ToString() );
|
||||
PrintValue( "Mod Manager BasePath", manager.BasePath.Name );
|
||||
PrintValue( "Mod Manager BasePath-Full", manager.BasePath.FullName );
|
||||
PrintValue( "Mod Manager BasePath IsRooted", Path.IsPathRooted( Penumbra.Config.ModDirectory ).ToString() );
|
||||
PrintValue( "Mod Manager BasePath Exists",
|
||||
manager.BasePath != null ? Directory.Exists( manager.BasePath.FullName ).ToString() : false.ToString() );
|
||||
PrintValue( "Mod Manager BasePath Exists", Directory.Exists( manager.BasePath.FullName ).ToString() );
|
||||
PrintValue( "Mod Manager Valid", manager.Valid.ToString() );
|
||||
//PrintValue( "Resource Loader Enabled", _penumbra.ResourceLoader.IsEnabled.ToString() );
|
||||
}
|
||||
|
|
@ -122,7 +121,7 @@ public partial class SettingsInterface
|
|||
return;
|
||||
}
|
||||
|
||||
var cache = Penumbra.ModManager.Collections.CurrentCollection.Cache;
|
||||
var cache = Penumbra.CollectionManager.CurrentCollection.Cache;
|
||||
if( cache == null || !ImGui.BeginTable( "##MissingFilesDebugList", 1, ImGuiTableFlags.RowBg, -Vector2.UnitX ) )
|
||||
{
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -141,8 +141,8 @@ public partial class SettingsInterface
|
|||
const ImGuiTableFlags flags = ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollX;
|
||||
|
||||
var modManager = Penumbra.ModManager;
|
||||
var defaultCollection = modManager.Collections.DefaultCollection.Cache;
|
||||
var forcedCollection = modManager.Collections.ForcedCollection.Cache;
|
||||
var defaultCollection = Penumbra.CollectionManager.DefaultCollection.Cache;
|
||||
var forcedCollection = Penumbra.CollectionManager.ForcedCollection.Cache;
|
||||
|
||||
var (defaultResolved, defaultMeta) = defaultCollection != null
|
||||
? ( defaultCollection.ResolvedFiles.Count, defaultCollection.MetaManipulations.Count )
|
||||
|
|
|
|||
|
|
@ -120,13 +120,13 @@ namespace Penumbra.UI
|
|||
var lower = filter.ToLowerInvariant();
|
||||
if( lower.StartsWith( "c:" ) )
|
||||
{
|
||||
_modFilterChanges = lower.Substring( 2 );
|
||||
_modFilterChanges = lower[ 2.. ];
|
||||
_modFilter = string.Empty;
|
||||
_modFilterAuthor = string.Empty;
|
||||
}
|
||||
else if( lower.StartsWith( "a:" ) )
|
||||
{
|
||||
_modFilterAuthor = lower.Substring( 2 );
|
||||
_modFilterAuthor = lower[ 2.. ];
|
||||
_modFilter = string.Empty;
|
||||
_modFilterChanges = string.Empty;
|
||||
}
|
||||
|
|
@ -147,11 +147,11 @@ namespace Penumbra.UI
|
|||
_visibleFolders.Clear();
|
||||
|
||||
PluginLog.Debug( "Resetting mod selector list..." );
|
||||
if( !_modsInOrder.Any() )
|
||||
if( _modsInOrder.Count == 0 )
|
||||
{
|
||||
foreach( var modData in _manager.StructuredMods.AllMods( _manager.Config.SortFoldersFirst ) )
|
||||
{
|
||||
var mod = _manager.Collections.CurrentCollection.GetMod( modData );
|
||||
var mod = Penumbra.CollectionManager.CurrentCollection.GetMod( modData );
|
||||
_modsInOrder.Add( mod );
|
||||
_visibleMods.Add( CheckFilters( mod ) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ public partial class SettingsInterface
|
|||
|
||||
private void Save()
|
||||
{
|
||||
Penumbra.ModManager.Collections.CurrentCollection.Save();
|
||||
Penumbra.CollectionManager.CurrentCollection.Save();
|
||||
}
|
||||
|
||||
private void DrawAboutTab()
|
||||
|
|
@ -422,11 +422,10 @@ public partial class SettingsInterface
|
|||
_fullFilenameList = null;
|
||||
_selector.SaveCurrentMod();
|
||||
// Since files may have changed, we need to recompute effective files.
|
||||
var modManager = Penumbra.ModManager;
|
||||
foreach( var collection in modManager.Collections.Collections.Values
|
||||
foreach( var collection in Penumbra.CollectionManager.Collections.Values
|
||||
.Where( c => c.Cache != null && c.Settings[ Mod!.Data.BasePath.Name ].Enabled ) )
|
||||
{
|
||||
collection.CalculateEffectiveFileList( false, modManager.Collections.IsActive( collection ) );
|
||||
collection.CalculateEffectiveFileList( false, Penumbra.CollectionManager.IsActive( collection ) );
|
||||
}
|
||||
|
||||
// If the mod is enabled in the current collection, its conflicts may have changed.
|
||||
|
|
|
|||
|
|
@ -526,10 +526,10 @@ public partial class SettingsInterface
|
|||
}
|
||||
|
||||
Cache.TriggerFilterReset();
|
||||
var collection = Penumbra.ModManager.Collections.CurrentCollection;
|
||||
var collection = Penumbra.CollectionManager.CurrentCollection;
|
||||
if( collection.Cache != null )
|
||||
{
|
||||
collection.CalculateEffectiveFileList( metaManips, Penumbra.ModManager.Collections.IsActive( collection ) );
|
||||
collection.CalculateEffectiveFileList( metaManips, Penumbra.CollectionManager.IsActive( collection ) );
|
||||
}
|
||||
|
||||
collection.Save();
|
||||
|
|
@ -609,7 +609,7 @@ public partial class SettingsInterface
|
|||
private void DrawCollectionButton( string label, string tooltipLabel, float size, ModCollection collection )
|
||||
{
|
||||
if( collection == ModCollection.Empty
|
||||
|| collection == Penumbra.ModManager.Collections.CurrentCollection )
|
||||
|| collection == Penumbra.CollectionManager.CurrentCollection )
|
||||
{
|
||||
using var _ = ImGuiRaii.PushStyle( ImGuiStyleVar.Alpha, 0.5f );
|
||||
ImGui.Button( label, Vector2.UnitX * size );
|
||||
|
|
@ -638,10 +638,10 @@ public partial class SettingsInterface
|
|||
- 4 * ImGui.GetStyle().ItemSpacing.X )
|
||||
/ 2, 5f );
|
||||
ImGui.SameLine();
|
||||
DrawCollectionButton( "Default", "default", buttonSize, Penumbra.ModManager.Collections.DefaultCollection );
|
||||
DrawCollectionButton( "Default", "default", buttonSize, Penumbra.CollectionManager.DefaultCollection );
|
||||
|
||||
ImGui.SameLine();
|
||||
DrawCollectionButton( "Forced", "forced", buttonSize, Penumbra.ModManager.Collections.ForcedCollection );
|
||||
DrawCollectionButton( "Forced", "forced", buttonSize, Penumbra.CollectionManager.ForcedCollection );
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGui.SetNextItemWidth( comboSize );
|
||||
|
|
|
|||
|
|
@ -57,18 +57,17 @@ public partial class SettingsInterface : IDisposable
|
|||
|
||||
private void SaveCurrentCollection( bool recalculateMeta )
|
||||
{
|
||||
var current = Penumbra.ModManager.Collections.CurrentCollection;
|
||||
var current = Penumbra.CollectionManager.CurrentCollection;
|
||||
current.Save();
|
||||
RecalculateCurrent( recalculateMeta );
|
||||
}
|
||||
|
||||
private void RecalculateCurrent( bool recalculateMeta )
|
||||
{
|
||||
var modManager = Penumbra.ModManager;
|
||||
var current = modManager.Collections.CurrentCollection;
|
||||
var current = Penumbra.CollectionManager.CurrentCollection;
|
||||
if( current.Cache != null )
|
||||
{
|
||||
current.CalculateEffectiveFileList( recalculateMeta, modManager.Collections.IsActive( current ) );
|
||||
current.CalculateEffectiveFileList( recalculateMeta, Penumbra.CollectionManager.IsActive( current ) );
|
||||
_menu.InstalledTab.Selector.Cache.TriggerFilterReset();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue