diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2022-03-08 12:39:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-08 12:39:36 +0100 |
commit | 85149303a5db621405e3415723fc810d3355d563 (patch) | |
tree | 6e6358ad9873dd4bf622e1a715105ba44fa5159f | |
parent | 31b3bda36ad65eb4b65d9102194c09093e8961e3 (diff) | |
parent | 40f2eefe7821daf6b38edc3153bfb0c23b405590 (diff) |
Merge pull request #58893 from TokageItLab/fix-deselect-skeleton-gizmo
-rw-r--r-- | editor/plugins/skeleton_3d_editor_plugin.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index aec1a09e48..aadc7a2e66 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -528,22 +528,25 @@ 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) { - return; - } - const String path = selected->get_metadata(0); - if (!path.begins_with("bones/")) { - return; + if (selected) { + 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); + } } - 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); + + if (pose_editor && pose_editor->is_inside_tree()) { pose_editor->set_visible(selected); } set_bone_options_enabled(selected); + _update_properties(); _update_gizmo_visible(); } |