Explorar o código

Fixed error when creating physical skeleton

An error was systematically triggered on the root bone, when trying to access its parent (the return value wasn't used in this case anyway).

Fixes #23920
PouleyKetchoupp %!s(int64=5) %!d(string=hai) anos
pai
achega
f0fdd7de80
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      editor/plugins/skeleton_editor_plugin.cpp

+ 2 - 1
editor/plugins/skeleton_editor_plugin.cpp

@@ -65,7 +65,6 @@ void SkeletonEditor::create_physical_skeleton() {
 	for (int bone_id = 0; bc > bone_id; ++bone_id) {
 
 		const int parent = skeleton->get_bone_parent(bone_id);
-		const int parent_parent = skeleton->get_bone_parent(parent);
 
 		if (parent < 0) {
 
@@ -73,6 +72,8 @@ void SkeletonEditor::create_physical_skeleton() {
 
 		} else {
 
+			const int parent_parent = skeleton->get_bone_parent(parent);
+
 			bones_infos.write[bone_id].relative_rest = bones_infos[parent].relative_rest * skeleton->get_bone_rest(bone_id);
 
 			/// create physical bone on parent