Skip to content

Commit 7589823

Browse files
committed
[FMV] Fix for materials getting out of order
1 parent d5e6f70 commit 7589823

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

xivModdingFramework/Models/DataContainers/ModelTextureData.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,7 @@ public class ModelTextureData
3434
public byte[] Alpha { get; set; }
3535

3636
public byte[] Emissive { get; set; }
37+
38+
public string MaterialPath { get; set; }
3739
}
3840
}

xivModdingFramework/Models/FileTypes/Mdl.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,9 @@ public static async Task ExportMaterialsForModel(TTModel model, string outputFil
326326
// Set source race to match so that it doesn't get replaced
327327
if (targetRace != XivRace.All_Races)
328328
{
329-
if (materialName.Contains("b0001"))
329+
var bodyRegex = new Regex("(b[0-9]{4})");
330+
331+
if (bodyRegex.Match(materialName).Success)
330332
{
331333
var currentRace = model.Source.Substring(model.Source.LastIndexOf('c') + 1, 4);
332334
mdlPath = model.Source.Replace(currentRace, targetRace.GetRaceCode());

xivModdingFramework/Models/ModelTextures/ModelTexture.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ public static async Task<ModelTextureData> GetModelMaps(Tex tex, XivMtrl mtrl, C
178178
Diffuse = new byte[0],
179179
Specular = new byte[0],
180180
Emissive = new byte[0],
181-
Alpha = new byte[0]
181+
Alpha = new byte[0],
182+
MaterialPath = mtrl.MTRLPath.Substring(mtrl.MTRLPath.LastIndexOf('/'))
182183
};
183184
return empty;
184185
}
@@ -251,7 +252,8 @@ await Task.Run(() =>
251252
Diffuse = diffuseMap.ToArray(),
252253
Specular = specularMap.ToArray(),
253254
Emissive = emissiveMap.ToArray(),
254-
Alpha = alphaMap.ToArray()
255+
Alpha = alphaMap.ToArray(),
256+
MaterialPath = mtrl.MTRLPath.Substring(mtrl.MTRLPath.LastIndexOf('/'))
255257
};
256258

257259
return modelTextureData;

0 commit comments

Comments
 (0)