summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2023-03-30 15:56:05 +0200
committerYuri Sizov <yuris@humnom.net>2023-03-30 19:18:35 +0200
commit74a35c9ca2c8084608a2caf36ee912d202c936b5 (patch)
tree5c92897725bd5feddab3ab2e775ddeb2e7b845aa /editor/plugins
parentb39cbe71b4abd053f2ea86948f3cb6ff6c1c8b9c (diff)
Don't allow selecting nodes without owner
(cherry picked from commit 2fcfef15daed68e2bcb83a706223dd8d3107290b)
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp10
1 files changed, 7 insertions, 3 deletions
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<CanvasItem>(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<InputEvent> &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<CanvasItem *> selitems;
@@ -2386,14 +2390,14 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &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;