Fix bones that parent no children on dae export
This commit is contained in:
parent
b225c942e5
commit
21a459846e
@ -616,16 +616,25 @@ namespace Toolbox.Library
|
|||||||
Node root = new Node("skeleton_root");
|
Node root = new Node("skeleton_root");
|
||||||
parentNode.Children.Add(root);
|
parentNode.Children.Add(root);
|
||||||
|
|
||||||
|
Console.WriteLine($"bones {skeleton.bones.Count}");
|
||||||
|
|
||||||
if (skeleton.bones.Count > 0)
|
if (skeleton.bones.Count > 0)
|
||||||
{
|
{
|
||||||
Node boneNode = new Node(skeleton.bones[0].Text);
|
foreach (var bone in skeleton.bones)
|
||||||
boneNode.Transform = AssimpHelper.GetBoneMatrix(skeleton.bones[0]);
|
{
|
||||||
|
//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);
|
root.Children.Add(boneNode);
|
||||||
|
|
||||||
foreach (STBone child in skeleton.bones[0].GetChildren())
|
foreach (STBone child in bone.GetChildren())
|
||||||
SaveBones(boneNode, child, skeleton);
|
SaveBones(boneNode, child, skeleton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
private void SaveBones(Node parentBone, STBone bone, STSkeleton skeleton)
|
private void SaveBones(Node parentBone, STBone bone, STSkeleton skeleton)
|
||||||
{
|
{
|
||||||
Node boneNode = new Node(bone.Text);
|
Node boneNode = new Node(bone.Text);
|
||||||
|
Loading…
Reference in New Issue
Block a user