Skip to content

Commit

Permalink
fix: check if bones referenced from a skinned mesh are actually expor…
Browse files Browse the repository at this point in the history
…ted, throw otherwise with meaningful error message
  • Loading branch information
hybridherbst committed Apr 20, 2021
1 parent 46ac3f7 commit 2f72e5c
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3226,10 +3226,16 @@ private void ExportSkinFromNode(Transform transform)

for (int i = 0; i < skin.bones.Length; ++i)
{
var nodeId = skin.bones[i].GetInstanceID();
if (!_exportedTransforms.ContainsKey(nodeId))
{
throw new KeyNotFoundException("Skin " + skin + " references bone " + skin.bones[i] + ", but that bone wasn't exported. Make sure referenced bones are part of the same export hierarchy.");
}

gltfSkin.Joints.Add(
new NodeId
{
Id = _exportedTransforms[skin.bones[i].GetInstanceID()],
Id = _exportedTransforms[nodeId],
Root = _root
});
}
Expand Down

0 comments on commit 2f72e5c

Please sign in to comment.