diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-03-08 07:49:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-08 07:49:34 +0100 |
commit | 86b0faf2ec3b76a09e898fcaa7dbfdd56189bed8 (patch) | |
tree | 5ab70f4466a21789716d296dc037cd649a4af596 /editor/plugins | |
parent | 1561737055bcececfd9661832665000dce7d61a9 (diff) | |
parent | fd411e580a192369e7d320981414c9c82752a238 (diff) |
Merge pull request #58882 from V-Sekai/avoid-gizmo-crashes
Avoid gizmo crashes in cases where the points are null
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/skeleton_3d_editor_plugin.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index 282ee9a5b7..aec1a09e48 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -528,19 +528,21 @@ void Skeleton3DEditor::move_skeleton_bone(NodePath p_skeleton_path, int32_t p_se void Skeleton3DEditor::_joint_tree_selection_changed() { TreeItem *selected = joint_tree->get_selected(); - if (selected) { - const String path = selected->get_metadata(0); - - if (path.begins_with("bones/")) { - const int b_idx = path.get_slicec('/', 1).to_int(); - const String bone_path = "bones/" + itos(b_idx) + "/"; - - pose_editor->set_target(bone_path); - pose_editor->set_keyable(keyable); - selected_bone = b_idx; - } + if (!selected) { + return; + } + const String path = selected->get_metadata(0); + if (!path.begins_with("bones/")) { + return; + } + const int b_idx = path.get_slicec('/', 1).to_int(); + selected_bone = b_idx; + if (pose_editor) { + const String bone_path = "bones/" + itos(b_idx) + "/"; + pose_editor->set_target(bone_path); + pose_editor->set_keyable(keyable); + pose_editor->set_visible(selected); } - pose_editor->set_visible(selected); set_bone_options_enabled(selected); _update_properties(); _update_gizmo_visible(); |