From 74a35c9ca2c8084608a2caf36ee912d202c936b5 Mon Sep 17 00:00:00 2001 From: kobewi Date: Thu, 30 Mar 2023 15:56:05 +0200 Subject: Don't allow selecting nodes without owner (cherry picked from commit 2fcfef15daed68e2bcb83a706223dd8d3107290b) --- editor/plugins/canvas_item_editor_plugin.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'editor/plugins') diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index fd44e9221e..06cb3bc9b1 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -697,6 +697,10 @@ void CanvasItemEditor::_find_canvas_items_in_rect(const Rect2 &p_rect, Node *p_n CanvasItem *ci = Object::cast_to(p_node); Node *scene = EditorNode::get_singleton()->get_edited_scene(); + if (p_node != scene && !p_node->get_owner()) { + return; + } + bool editable = p_node == scene || p_node->get_owner() == scene || p_node == scene->get_deepest_editable_node(p_node); bool lock_children = p_node->get_meta("_edit_group_", false); bool locked = _is_node_locked(p_node); @@ -2357,7 +2361,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref &p_event) { if (drag_type == DRAG_BOX_SELECTION) { if (b.is_valid() && !b->is_pressed() && b->get_button_index() == MouseButton::LEFT) { - // Confirms box selection + // Confirms box selection. Node *scene = EditorNode::get_singleton()->get_edited_scene(); if (scene) { List selitems; @@ -2386,14 +2390,14 @@ bool CanvasItemEditor::_gui_input_select(const Ref &p_event) { } if (b.is_valid() && b->is_pressed() && b->get_button_index() == MouseButton::RIGHT) { - // Cancel box selection + // Cancel box selection. _reset_drag(); viewport->queue_redraw(); return true; } if (m.is_valid()) { - // Update box selection + // Update box selection. box_selecting_to = transform.affine_inverse().xform(m->get_position()); viewport->queue_redraw(); return true; -- cgit v1.2.3