diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-02-26 21:00:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-26 21:00:12 +0100 |
commit | 7b685a1558aaa7e014d358c2db8be83aef5d8b8f (patch) | |
tree | 86b784923c186721b07ac32b25cac6fe0a3bfb95 /editor/plugins | |
parent | 75d03f1fbd94efb5f8756e405de03cf271435336 (diff) | |
parent | 1810654369dab53c4544f78f537f5bc246ef0c1b (diff) |
Merge pull request #46452 from hilfazer/click_mesh_instance_crash_40
Prevent crash when clicking Mesh in MeshInstance when is scene root
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 66c4890c45..bb6cc50a31 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -535,7 +535,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; @@ -694,7 +697,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")) { |