summaryrefslogtreecommitdiff
path: root/editor/plugins/canvas_item_editor_plugin.cpp
diff options
context:
space:
mode:
authorGilles Roudiere <gilles.roudiere@laas.fr>2018-05-15 09:37:23 +0200
committerGilles Roudiere <gilles.roudiere@laas.fr>2018-05-15 09:37:23 +0200
commite6147898826cf45017e972d0cb9785e4a0d55d3e (patch)
treefe57689762c6f90b9e371be420b784fdeb0112cd /editor/plugins/canvas_item_editor_plugin.cpp
parent47d4a011d8cacbdf95f9cae6d29db1f4dc1de734 (diff)
Fixes hovered Nodes2D display in the editor (remove duplicates)
Diffstat (limited to 'editor/plugins/canvas_item_editor_plugin.cpp')
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp11
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 {