mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-14 04:34:19 +01:00
Fix bug with collections with inheritance saving on every launch.
This commit is contained in:
parent
ca51c3b107
commit
37a56c56af
4 changed files with 9 additions and 4 deletions
|
|
@ -339,7 +339,7 @@ public partial class ModCollection
|
||||||
changes = true;
|
changes = true;
|
||||||
Penumbra.Log.Warning( $"Inherited collection {subCollectionName} for {collection.Name} does not exist, removed." );
|
Penumbra.Log.Warning( $"Inherited collection {subCollectionName} for {collection.Name} does not exist, removed." );
|
||||||
}
|
}
|
||||||
else if( !collection.AddInheritance( subCollection ) )
|
else if( !collection.AddInheritance( subCollection, false ) )
|
||||||
{
|
{
|
||||||
changes = true;
|
changes = true;
|
||||||
Penumbra.Log.Warning( $"{collection.Name} can not inherit from {subCollectionName}, removed." );
|
Penumbra.Log.Warning( $"{collection.Name} can not inherit from {subCollectionName}, removed." );
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ public partial class ModCollection
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Penumbra.Log.Debug( $"Saving collection {AnonymizedName}..." );
|
||||||
var file = FileName;
|
var file = FileName;
|
||||||
file.Directory?.Create();
|
file.Directory?.Create();
|
||||||
using var s = file.Exists ? file.Open( FileMode.Truncate ) : file.Open( FileMode.CreateNew );
|
using var s = file.Exists ? file.Open( FileMode.Truncate ) : file.Open( FileMode.CreateNew );
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ public partial class ModCollection
|
||||||
// Add a new collection to the inheritance list.
|
// Add a new collection to the inheritance list.
|
||||||
// We do not check if this collection would be visited before,
|
// We do not check if this collection would be visited before,
|
||||||
// only that it is unique in the list itself.
|
// only that it is unique in the list itself.
|
||||||
public bool AddInheritance( ModCollection collection )
|
public bool AddInheritance( ModCollection collection, bool invokeEvent )
|
||||||
{
|
{
|
||||||
if( CheckValidInheritance( collection ) != ValidInheritance.Valid )
|
if( CheckValidInheritance( collection ) != ValidInheritance.Valid )
|
||||||
{
|
{
|
||||||
|
|
@ -80,7 +80,11 @@ public partial class ModCollection
|
||||||
// Changes in inherited collections may need to trigger further changes here.
|
// Changes in inherited collections may need to trigger further changes here.
|
||||||
collection.ModSettingChanged += OnInheritedModSettingChange;
|
collection.ModSettingChanged += OnInheritedModSettingChange;
|
||||||
collection.InheritanceChanged += OnInheritedInheritanceChange;
|
collection.InheritanceChanged += OnInheritedInheritanceChange;
|
||||||
|
if( invokeEvent )
|
||||||
|
{
|
||||||
InheritanceChanged.Invoke( false );
|
InheritanceChanged.Invoke( false );
|
||||||
|
}
|
||||||
|
|
||||||
Penumbra.Log.Debug( $"Added {collection.AnonymizedName} to {AnonymizedName} inheritances." );
|
Penumbra.Log.Debug( $"Added {collection.AnonymizedName} to {AnonymizedName} inheritances." );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ public partial class ConfigWindow
|
||||||
};
|
};
|
||||||
if( ImGuiUtil.DrawDisabledButton( FontAwesomeIcon.Plus.ToIconString(), _window._iconButtonSize, tt,
|
if( ImGuiUtil.DrawDisabledButton( FontAwesomeIcon.Plus.ToIconString(), _window._iconButtonSize, tt,
|
||||||
inheritance != ModCollection.ValidInheritance.Valid, true )
|
inheritance != ModCollection.ValidInheritance.Valid, true )
|
||||||
&& Penumbra.CollectionManager.Current.AddInheritance( _newInheritance! ) )
|
&& Penumbra.CollectionManager.Current.AddInheritance( _newInheritance!, true ) )
|
||||||
{
|
{
|
||||||
_newInheritance = null;
|
_newInheritance = null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue