Merge pull request #18881 from groud/fix_hovered_nodes2D

Fixes hovered Nodes2D display in the editor (remove duplicates)
This commit is contained in:
Rémi Verschelde 2018-05-15 10:24:44 +02:00 committed by GitHub
commit 911d01c102
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {