mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Fix for reloading penumbra and default IMCs (forgot a clone)
This commit is contained in:
parent
db5ce7a2e4
commit
9daffc9382
3 changed files with 20 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Lumina.Data.Files;
|
||||
using Penumbra.Game;
|
||||
using Penumbra.Mods;
|
||||
|
|
@ -77,5 +78,22 @@ namespace Penumbra.MetaData
|
|||
|
||||
return ref parts[ idx ].Variants[ imc.Variant - 1 ];
|
||||
}
|
||||
|
||||
public static ImcFile Clone( this ImcFile file )
|
||||
{
|
||||
var ret = new ImcFile
|
||||
{
|
||||
Count = file.Count,
|
||||
PartMask = file.PartMask
|
||||
};
|
||||
var parts = file.GetParts().Select( P => new ImcFile.ImageChangeParts()
|
||||
{
|
||||
DefaultVariant = P.DefaultVariant,
|
||||
Variants = ( ImcFile.ImageChangeData[] )P.Variants.Clone()
|
||||
} ).ToArray();
|
||||
var prop = ret.GetType().GetField( "Parts", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance );
|
||||
prop!.SetValue( ret, parts );
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -96,7 +96,7 @@ namespace Penumbra.MetaData
|
|||
=> GetDefaultEstFile( type, equip, body )?.Clone();
|
||||
|
||||
public ImcFile? GetNewImcFile( ObjectType type, ushort primarySetId, ushort secondarySetId = 0 )
|
||||
=> GetDefaultImcFile( type, primarySetId, secondarySetId ); // todo ?.Clone();
|
||||
=> GetDefaultImcFile( type, primarySetId, secondarySetId )?.Clone();
|
||||
|
||||
|
||||
public MetaDefaults( DalamudPluginInterface pi )
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using Dalamud.Plugin;
|
||||
using Lumina.Data.Files;
|
||||
using Penumbra.Game;
|
||||
using Penumbra.Hooks;
|
||||
using Penumbra.Util;
|
||||
using Penumbra.MetaData;
|
||||
|
|
@ -77,6 +76,7 @@ namespace Penumbra.Mods
|
|||
_currentManipulations.Clear();
|
||||
_currentFiles.Clear();
|
||||
ClearDirectory();
|
||||
_resourceManagement.ReloadPlayerResources();
|
||||
}
|
||||
|
||||
private void ClearDirectory()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue