diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-10-09 08:42:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-09 08:42:16 +0200 |
commit | 564a258831005ecce537c3943440848ac07a893d (patch) | |
tree | 2a550b3ec95ea5598c2363fcab76060aecbe9b15 | |
parent | 55ef6a0f254b965c0db389c8bbd876160a5dab1c (diff) | |
parent | b5ff31a4336db5eaa482dc1771ba1c7372491ee5 (diff) |
Merge pull request #32672 from codecustard/fix_merge_scene_not_deselecting
Fixes deselection not working when merging scene
-rw-r--r-- | editor/editor_sub_scene.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/editor/editor_sub_scene.cpp b/editor/editor_sub_scene.cpp index 987033b123..a77051c80b 100644 --- a/editor/editor_sub_scene.cpp +++ b/editor/editor_sub_scene.cpp @@ -97,8 +97,14 @@ void EditorSubScene::_fill_tree(Node *p_node, TreeItem *p_parent) { } void EditorSubScene::_selected_changed() { - selection.clear(); - is_root = false; + TreeItem *item = tree->get_selected(); + ERR_FAIL_COND(!item); + Node *n = item->get_metadata(0); + + if (!n || !selection.find(n)) { + selection.clear(); + is_root = false; + } } void EditorSubScene::_item_multi_selected(Object *p_object, int p_cell, bool p_selected) { @@ -116,6 +122,11 @@ void EditorSubScene::_item_multi_selected(Object *p_object, int p_cell, bool p_s selection.clear(); } selection.push_back(n); + } else { + List<Node *>::Element *E = selection.find(n); + + if (E) + selection.erase(E); } } } |