From 5d25115e80b0dd5c001ff70c5304cecdd19bac67 Mon Sep 17 00:00:00 2001 From: kleonc <9283098+kleonc@users.noreply.github.com> Date: Sat, 28 Aug 2021 01:55:06 +0200 Subject: [PATCH] SceneTreeDock Ensure to deactivate multi edit when selection changes to a single node --- editor/scene_tree_dock.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 2ec4a088a25..11d4f0a0349 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -844,7 +844,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { break; } Ref mne = memnew(MultiNodeEdit); - for (const Map::Element *E = EditorNode::get_singleton()->get_editor_selection()->get_selection().front(); E; E = E->next()) { + for (const Map::Element *E = editor_selection->get_selection().front(); E; E = E->next()) { mne->add_node(root->get_path_to(E->key())); } @@ -2097,11 +2097,11 @@ void SceneTreeDock::_update_script_button() { if (!profile_allow_script_editing) { button_create_script->hide(); button_detach_script->hide(); - } else if (EditorNode::get_singleton()->get_editor_selection()->get_selection().size() == 0) { + } else if (editor_selection->get_selection().size() == 0) { button_create_script->hide(); button_detach_script->hide(); - } else if (EditorNode::get_singleton()->get_editor_selection()->get_selection().size() == 1) { - Node *n = EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list()[0]; + } else if (editor_selection->get_selection().size() == 1) { + Node *n = editor_selection->get_selected_node_list()[0]; if (n->get_script().is_null()) { button_create_script->show(); button_detach_script->hide(); @@ -2124,10 +2124,12 @@ void SceneTreeDock::_update_script_button() { } void SceneTreeDock::_selection_changed() { - int selection_size = EditorNode::get_singleton()->get_editor_selection()->get_selection().size(); + int selection_size = editor_selection->get_selection().size(); if (selection_size > 1) { //automatically turn on multi-edit _tool_selected(TOOL_MULTI_EDIT); + } else if (selection_size == 1) { + editor->push_item(editor_selection->get_selection().front()->key()); } else if (selection_size == 0) { editor->push_item(nullptr); }