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.
This commit is contained in:
parent
913a7a63d5
commit
91fdf7c15b
1 changed files with 4 additions and 1 deletions
|
@ -172,13 +172,16 @@ 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;
|
||||
|
|
Loading…
Reference in a new issue