mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-26 14:30:26 +00:00
Fix bones that parent no children on dae export
This commit is contained in:
parent
b225c942e5
commit
21a459846e
2 changed files with 15 additions and 6 deletions
|
@ -327,7 +327,7 @@ namespace FirstPlugin
|
||||||
if (Buffer.BoneIndex.Count > 0)
|
if (Buffer.BoneIndex.Count > 0)
|
||||||
vertex.boneIds = new List<int>(Buffer.BoneIndex[v]);
|
vertex.boneIds = new List<int>(Buffer.BoneIndex[v]);
|
||||||
// if (Buffer.Colors1.Count > 0)
|
// if (Buffer.Colors1.Count > 0)
|
||||||
// vertex.col = Buffer.Colors1[v] / 255f;
|
// vertex.col = Buffer.Colors1[v] / 255f;
|
||||||
if (Buffer.Binormals.Count > 0)
|
if (Buffer.Binormals.Count > 0)
|
||||||
vertex.bitan = Buffer.Binormals[v];
|
vertex.bitan = Buffer.Binormals[v];
|
||||||
|
|
||||||
|
|
|
@ -616,14 +616,23 @@ 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]);
|
{
|
||||||
root.Children.Add(boneNode);
|
//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);
|
SaveBones(boneNode, child, skeleton);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void SaveBones(Node parentBone, STBone bone, STSkeleton skeleton)
|
private void SaveBones(Node parentBone, STBone bone, STSkeleton skeleton)
|
||||||
|
|
Loading…
Reference in a new issue