diff options
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 10 | ||||
-rw-r--r-- | scene/main/node.cpp | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 713837df44..b5a6698866 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -534,7 +534,10 @@ ObjectID Node3DEditorViewport::_select_ray(const Point2 &p_pos, bool p_append, b } if (dist < closest_dist) { - item = edited_scene->get_deepest_editable_node(Object::cast_to<Node>(spat)); + item = Object::cast_to<Node>(spat); + if (item != edited_scene) { + item = edited_scene->get_deepest_editable_node(item); + } closest = item->get_instance_id(); closest_dist = dist; @@ -693,7 +696,10 @@ void Node3DEditorViewport::_select_region() { continue; } - Node *item = edited_scene->get_deepest_editable_node(Object::cast_to<Node>(sp)); + Node *item = Object::cast_to<Node>(sp); + if (item != edited_scene) { + item = edited_scene->get_deepest_editable_node(item); + } // Replace the node by the group if grouped if (item->is_class("Node3D")) { diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 893621fbc4..df00af8f5b 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1976,7 +1976,7 @@ bool Node::is_editable_instance(const Node *p_node) const { Node *Node::get_deepest_editable_node(Node *p_start_node) const { ERR_FAIL_NULL_V(p_start_node, nullptr); - ERR_FAIL_COND_V(!is_a_parent_of(p_start_node), nullptr); + ERR_FAIL_COND_V(!is_a_parent_of(p_start_node), p_start_node); Node const *iterated_item = p_start_node; Node *node = p_start_node; |