1
0
mirror of synced 2024-11-30 18:24:39 +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

@ -327,7 +327,7 @@ namespace FirstPlugin
if (Buffer.BoneIndex.Count > 0)
vertex.boneIds = new List<int>(Buffer.BoneIndex[v]);
// if (Buffer.Colors1.Count > 0)
// vertex.col = Buffer.Colors1[v] / 255f;
// vertex.col = Buffer.Colors1[v] / 255f;
if (Buffer.Binormals.Count > 0)
vertex.bitan = Buffer.Binormals[v];

View File

@ -616,14 +616,23 @@ 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]);
root.Children.Add(boneNode);
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())
SaveBones(boneNode, child, skeleton);
foreach (STBone child in bone.GetChildren())
SaveBones(boneNode, child, skeleton);
}
}
}
}
private void SaveBones(Node parentBone, STBone bone, STSkeleton skeleton)