mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-13 22:09:53 -05:00
fix vrm-1.0 export that SkinedMeshRenderer.bones contains null
This commit is contained in:
parent
768b77b49f
commit
5ebae3b9e2
|
|
@ -307,7 +307,17 @@ namespace UniVRM10
|
|||
skin.Root = nodes[skinnedMeshRenderer.rootBone.gameObject];
|
||||
}
|
||||
|
||||
skin.Joints = skinnedMeshRenderer.bones.Select(x => nodes[x.gameObject]).ToList();
|
||||
skin.Joints = skinnedMeshRenderer.bones.Select(x =>
|
||||
{
|
||||
if (x != null)
|
||||
{
|
||||
return nodes[x.gameObject];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}).ToList();
|
||||
return skin;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,18 @@ namespace UniVRM10
|
|||
{
|
||||
gltfSkin = new glTFSkin()
|
||||
{
|
||||
joints = skin.Joints.Select(joint => nodes.IndexOfThrow(joint)).ToArray()
|
||||
joints = skin.Joints.Select(joint =>
|
||||
{
|
||||
var index = nodes.IndexOf(joint);
|
||||
if (index < 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return index;
|
||||
}
|
||||
}).ToArray()
|
||||
};
|
||||
if (skin.InverseMatrices == null)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user