diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-05-15 10:24:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-15 10:24:44 +0200 |
commit | 911d01c10242d7437c866d6abc1dbbb3c00cce21 (patch) | |
tree | d9f92362695a8f381e4329313e8f0861bacde840 /editor | |
parent | e928473190f72ed8ee121f48ad483512f3af1292 (diff) | |
parent | e6147898826cf45017e972d0cb9785e4a0d55d3e (diff) |
Merge pull request #18881 from groud/fix_hovered_nodes2D
Fixes hovered Nodes2D display in the editor (remove duplicates)
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 93aeca6632..f27796db5e 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -520,8 +520,17 @@ void CanvasItemEditor::_get_canvas_items_at_pos(const Point2 &p_pos, Vector<_Sel node = node->get_parent(); } + // Check if the canvas item is already in the list (for groups or scenes) + bool duplicate = false; + for (int j = 0; j < i; j++) { + if (r_items[j].item == canvas_item) { + duplicate = true; + break; + } + } + //Remove the item if invalid - if (!canvas_item || (canvas_item != scene && canvas_item->get_owner() != scene && !scene->is_editable_instance(canvas_item->get_owner())) || (canvas_item->has_meta("_edit_lock_") && canvas_item->get_meta("_edit_lock_"))) { + if (!canvas_item || duplicate || (canvas_item != scene && canvas_item->get_owner() != scene && !scene->is_editable_instance(canvas_item->get_owner())) || (canvas_item->has_meta("_edit_lock_") && canvas_item->get_meta("_edit_lock_"))) { r_items.remove(i); i--; } else { |