You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 19:31:35 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user