Fix oversight in bone index mapping generation

This commit is contained in:
ackwell 2024-01-01 23:52:37 +11:00
parent f71d922198
commit 215f807483

View file

@ -88,13 +88,13 @@ public class MeshExporter
var indexMap = new Dictionary<ushort, int>(); var indexMap = new Dictionary<ushort, int>();
foreach (var xivBoneIndex in xivBoneTable.BoneIndex.Take(xivBoneTable.BoneCount)) foreach (var (xivBoneIndex, tableIndex) in xivBoneTable.BoneIndex.Take(xivBoneTable.BoneCount).WithIndex())
{ {
var boneName = _mdl.Bones[xivBoneIndex]; var boneName = _mdl.Bones[xivBoneIndex];
if (!boneNameMap.TryGetValue(boneName, out var gltfBoneIndex)) if (!boneNameMap.TryGetValue(boneName, out var gltfBoneIndex))
throw new Exception($"Armature does not contain bone \"{boneName}\" requested by mesh {_meshIndex}."); throw new Exception($"Armature does not contain bone \"{boneName}\" requested by mesh {_meshIndex}.");
indexMap.Add(xivBoneIndex, gltfBoneIndex); indexMap.Add((ushort)tableIndex, gltfBoneIndex);
} }
return indexMap; return indexMap;