Skip to content

Commit df677f5

Browse files
committed
Update 2.3.1.1
2 parents a7bf7d1 + 3020992 commit df677f5

File tree

2 files changed

+35
-9
lines changed

2 files changed

+35
-9
lines changed

xivModdingFramework/Materials/DataContainers/XivMtrl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ private void RegenerateShaderParameterList(ShaderInfo info)
891891
args.Add(MtrlShaderParameterId.SkinTileMultiplier, null);
892892
}
893893

894-
if (info.Preset == MtrlShaderPreset.Face && info.Preset == MtrlShaderPreset.FaceNoPores)
894+
if (info.Preset == MtrlShaderPreset.Face || info.Preset == MtrlShaderPreset.FaceNoPores)
895895
{
896896
args.Add(MtrlShaderParameterId.Face1, null);
897897
}

xivModdingFramework/Mods/RootCloner.cs

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static class RootCloner
2929
/// <param name="Destination">Destination root to copy to.</param>
3030
/// <param name="ApplicationSource">Application to list as the source for the resulting mod entries.</param>
3131
/// <returns></returns>
32-
public static async Task CloneRoot(XivDependencyRoot Source, XivDependencyRoot Destination, string ApplicationSource, IProgress<string> ProgressReporter = null)
32+
public static async Task CloneRoot(XivDependencyRoot Source, XivDependencyRoot Destination, string ApplicationSource, int singleVariant = -1, IProgress<string> ProgressReporter = null)
3333
{
3434

3535
if (ProgressReporter != null)
@@ -40,7 +40,6 @@ public static async Task CloneRoot(XivDependencyRoot Source, XivDependencyRoot D
4040
XivCache.CacheWorkerEnabled = false;
4141
try
4242
{
43-
4443
var df = IOUtil.GetDataFileFromPath(Source.ToString());
4544

4645
var _imc = new Imc(XivCache.GameInfo.GameDirectory);
@@ -51,7 +50,11 @@ public static async Task CloneRoot(XivDependencyRoot Source, XivDependencyRoot D
5150
var _modding = new Modding(XivCache.GameInfo.GameDirectory);
5251

5352

54-
53+
bool locked = _index.IsIndexLocked(df);
54+
if(locked)
55+
{
56+
throw new Exception("Game files currently in use.");
57+
}
5558

5659

5760
if (ProgressReporter != null)
@@ -79,10 +82,6 @@ public static async Task CloneRoot(XivDependencyRoot Source, XivDependencyRoot D
7982
}
8083
}
8184

82-
83-
84-
85-
8685
// Time to start editing things.
8786

8887
// First, get a new, clean copy of the metadata, pointed at the new root.
@@ -133,6 +132,7 @@ public static async Task CloneRoot(XivDependencyRoot Source, XivDependencyRoot D
133132
}
134133

135134
var destItem = Destination.GetFirstItem();
135+
var srcItem = (await Source.GetAllItems(singleVariant))[0];
136136
var iCat = destItem.SecondaryCategory;
137137
var iName = destItem.Name;
138138

@@ -263,6 +263,32 @@ public static async Task CloneRoot(XivDependencyRoot Source, XivDependencyRoot D
263263
newMetadata.ImcEntries.Add((XivImc)newMetadata.ImcEntries[cloneNum].Clone());
264264
}
265265

266+
267+
if (singleVariant >= 0)
268+
{
269+
if (ProgressReporter != null)
270+
{
271+
ProgressReporter.Report("Setting single-variant data...");
272+
}
273+
274+
if (singleVariant < newMetadata.ImcEntries.Count)
275+
{
276+
var v = newMetadata.ImcEntries[singleVariant];
277+
278+
for(int i = 0; i < newMetadata.ImcEntries.Count; i++)
279+
{
280+
newMetadata.ImcEntries[i] = (XivImc)v.Clone();
281+
}
282+
}
283+
}
284+
285+
// Update Skeleton references to be for the correct set Id.
286+
var setId = Destination.Info.SecondaryId == null ? (ushort)Destination.Info.PrimaryId : (ushort)Destination.Info.SecondaryId;
287+
foreach(var entry in newMetadata.EstEntries)
288+
{
289+
entry.Value.SetId = setId;
290+
}
291+
266292
if (ProgressReporter != null)
267293
{
268294
ProgressReporter.Report("Copying metdata...");
@@ -334,7 +360,7 @@ public static async Task CloneRoot(XivDependencyRoot Source, XivDependencyRoot D
334360
}
335361

336362

337-
var modPack = new ModPack() { author = "System", name = "Item Copy - " + iName, url = "", version = "1.0" };
363+
var modPack = new ModPack() { author = "System", name = "Item Copy - " + srcItem.Name, url = "", version = "1.0" };
338364
foreach (var mod in modlist.Mods)
339365
{
340366
if (allFiles.Contains(mod.fullPath))

0 commit comments

Comments
 (0)