Skip to content

Commit d84127c

Browse files
committed
Replace null material sets during item conversion with valid material sets.
1 parent 64048d3 commit d84127c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

xivModdingFramework/Mods/RootCloner.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,19 @@ public static async Task CloneRoot(XivDependencyRoot Source, XivDependencyRoot D
353353
{
354354
ProgressReporter.Report("Copying metdata...");
355355
}
356+
357+
// Poke through the variants and adjust any that point to null Material Sets to instead use a valid one.
358+
var valid = newMetadata.ImcEntries.FirstOrDefault(x => x.MaterialSet != 0).MaterialSet;
359+
360+
for(int i = 0; i < newMetadata.ImcEntries.Count; i++)
361+
{
362+
var entry = newMetadata.ImcEntries[i];
363+
if (entry.MaterialSet == 0)
364+
{
365+
entry.MaterialSet = valid;
366+
}
367+
}
368+
356369
// Save the new Metadata file.
357370
await ItemMetadata.SaveMetadata(newMetadata, ApplicationSource);
358371

0 commit comments

Comments
 (0)