Skip to content

Commit d5e6f70

Browse files
committed
Fix for full model body textures on export
1 parent 6945c66 commit d5e6f70

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

xivModdingFramework/Models/Helpers/ModelModifiers.cs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,8 @@ public static void CalculateTangentsFromBinormals(TTModel model, Action<bool, st
11361136

11371137
private static readonly Regex _skinMaterialRegex = new Regex("^/mt_c([0-9]{4})b([0-9]{4})_.+\\.mtrl$");
11381138

1139+
1140+
11391141
/// <summary>
11401142
/// Fixes up the racial skin references in the model's materials.
11411143
/// this isn't actually necessary as the game will auto-resolve these regardless, but it's nice to do.
@@ -1153,13 +1155,12 @@ public static void FixUpSkinReferences(TTModel model, string newInternalPath, Ac
11531155
// It's not actually -NEEDED-, as the game will dynamically resolve them anyways to the player's skin material, but it's good for user expectation and sanity.
11541156

11551157
var raceRegex = new Regex("(c[0-9]{4})");
1156-
var bodyRegex = new Regex("(b[0-9]{4})");
11571158

11581159
// So we have to do this step first.
11591160
var newRaceMatch = raceRegex.Match(newInternalPath);
11601161

11611162
// Now model doesn't exist in a racial folder. Nothing to fix up/impossible to.
1162-
if(!newRaceMatch.Success)
1163+
if (!newRaceMatch.Success)
11631164
{
11641165
return;
11651166
}
@@ -1168,10 +1169,31 @@ public static void FixUpSkinReferences(TTModel model, string newInternalPath, Ac
11681169

11691170
// Need to find the racial skin for this race.
11701171
var baseRace = XivRaces.GetXivRace(newRaceMatch.Groups[1].Value.Substring(1));
1172+
1173+
FixUpSkinReferences(model, baseRace, loggingFunction);
1174+
}
1175+
1176+
1177+
1178+
1179+
/// <summary>
1180+
/// Fixes up the racial skin references in the model's materials.
1181+
/// this isn't actually necessary as the game will auto-resolve these regardless, but it's nice to do.
1182+
/// </summary>
1183+
/// <param name="model"></param>
1184+
/// <param name="newInternalPath"></param>
1185+
public static void FixUpSkinReferences(TTModel model, XivRace baseRace, Action<bool, string> loggingFunction = null)
1186+
{
1187+
if (loggingFunction == null)
1188+
{
1189+
loggingFunction = NoOp;
1190+
}
1191+
11711192
var skinRace = XivRaceTree.GetSkinRace(baseRace);
11721193
var skinRaceString = "c" + XivRaces.GetRaceCode(skinRace);
11731194

1174-
1195+
var raceRegex = new Regex("(c[0-9]{4})");
1196+
var bodyRegex = new Regex("(b[0-9]{4})");
11751197

11761198
foreach (var m in model.MeshGroups)
11771199
{

0 commit comments

Comments
 (0)