Skip to content

Commit b1d00bd

Browse files
committed
- Bump Version numbers
- Fix for potential crash/deadlock when switching between certain models. - Fix for Shape Data not being Racially Deformed.
1 parent 372f00e commit b1d00bd

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

xivModdingFramework/Cache/XivCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static class XivCache
2929
private static GameInfo _gameInfo;
3030
private static DirectoryInfo _dbPath;
3131
private static DirectoryInfo _rootCachePath;
32-
public static readonly Version CacheVersion = new Version("1.0.1.6");
32+
public static readonly Version CacheVersion = new Version("1.0.2.0");
3333
private const string dbFileName = "mod_cache.db";
3434
private const string rootCacheFileName = "item_sets.db";
3535
private const string creationScript = "CreateCacheDB.sql";

xivModdingFramework/Models/Helpers/ModelModifiers.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,48 @@ public static void ApplyRacialDeform(TTModel model, XivRace targetRace, bool inv
10931093
v.Tangent = tangent;
10941094
}
10951095
}
1096+
1097+
// Same thing, but for the Shape Data parts.
1098+
foreach(var p in m.ShapeParts)
1099+
{
1100+
foreach(var v in p.Vertices)
1101+
{
1102+
Vector3 position = Vector3.Zero;
1103+
Vector3 normal = Vector3.Zero;
1104+
Vector3 binormal = Vector3.Zero;
1105+
Vector3 tangent = Vector3.Zero;
1106+
1107+
// And each bone in that vertex.
1108+
for (var b = 0; b < 4; b++)
1109+
{
1110+
if (v.Weights[b] == 0) continue;
1111+
var boneName = m.Bones[v.BoneIds[b]];
1112+
var boneWeight = (v.Weights[b]) / 255f;
1113+
1114+
var matrix = Matrix.Identity;
1115+
var normalMatrix = Matrix.Identity;
1116+
matrix = deformations[boneName];
1117+
normalMatrix = normalmatrixes[boneName];
1118+
1119+
if (invert)
1120+
{
1121+
matrix = inverted[boneName];
1122+
normalMatrix = invertednormalmatrixes[boneName];
1123+
}
1124+
1125+
1126+
position += MatrixTransform(v.Position, matrix) * boneWeight;
1127+
normal += MatrixTransform(v.Normal, normalMatrix) * boneWeight;
1128+
binormal += MatrixTransform(v.Binormal, normalMatrix) * boneWeight;
1129+
tangent += MatrixTransform(v.Tangent, normalMatrix) * boneWeight;
1130+
}
1131+
1132+
v.Position = position;
1133+
v.Normal = normal;
1134+
v.Binormal = binormal;
1135+
v.Tangent = tangent;
1136+
}
1137+
}
10961138
}
10971139
}
10981140
catch(Exception ex)

0 commit comments

Comments
 (0)