diff options
author | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-08-17 08:31:38 -0700 |
---|---|---|
committer | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-08-17 08:31:38 -0700 |
commit | 91fdf7c15b9e60a89916e50d43e66ecc8afca204 (patch) | |
tree | 6f9dd25a3cff83befe4bffce2ef3df90b1f92cc7 /scene/3d | |
parent | 913a7a63d5260e32ac992ff419f35992446ead0b (diff) |
Fix Skeleton3D regression when bones are not sorted from root to leaves
Tentative fix for missing bones when bones are not sorted as expected.
For example, if the root comes last, all child bones are removed and
the skeleton ends up with just the root.
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/skeleton_3d.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp index 857916e23d..94fb49ae81 100644 --- a/scene/3d/skeleton_3d.cpp +++ b/scene/3d/skeleton_3d.cpp @@ -173,12 +173,15 @@ void Skeleton3D::_update_process_order() { parentless_bones.clear(); for (int i = 0; i < len; i++) { + bonesptr[i].child_bones.clear(); + } + + for (int i = 0; i < len; i++) { if (bonesptr[i].parent >= len) { //validate this just in case ERR_PRINT("Bone " + itos(i) + " has invalid parent: " + itos(bonesptr[i].parent)); bonesptr[i].parent = -1; } - bonesptr[i].child_bones.clear(); if (bonesptr[i].parent != -1) { int parent_bone_idx = bonesptr[i].parent; |