1
0
mirror of synced 2024-12-01 02:27:22 +01:00

Fix bones that parent no children on dae export

This commit is contained in:
KillzXGaming 2019-11-12 16:50:43 -05:00
parent b225c942e5
commit 21a459846e
2 changed files with 15 additions and 6 deletions

View File

@ -616,16 +616,25 @@ namespace Toolbox.Library
Node root = new Node("skeleton_root");
parentNode.Children.Add(root);
Console.WriteLine($"bones {skeleton.bones.Count}");
if (skeleton.bones.Count > 0)
{
Node boneNode = new Node(skeleton.bones[0].Text);
boneNode.Transform = AssimpHelper.GetBoneMatrix(skeleton.bones[0]);
foreach (var bone in skeleton.bones)
{
//Get each root bone and find children
if (bone.parentIndex == -1)
{
Node boneNode = new Node(bone.Text);
boneNode.Transform = AssimpHelper.GetBoneMatrix(bone);
root.Children.Add(boneNode);
foreach (STBone child in skeleton.bones[0].GetChildren())
foreach (STBone child in bone.GetChildren())
SaveBones(boneNode, child, skeleton);
}
}
}
}
private void SaveBones(Node parentBone, STBone bone, STSkeleton skeleton)
{
Node boneNode = new Node(bone.Text);