summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorhilfazer <az13337@gmail.com>2021-02-26 19:28:09 +0100
committerhilfazer <az13337@gmail.com>2021-02-26 19:28:09 +0100
commit1810654369dab53c4544f78f537f5bc246ef0c1b (patch)
tree391220535d39a253992efdaff336557a50ab9888 /editor/plugins
parentcb29e6c49cde181999435c7f8284bce2d20ab7d8 (diff)
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.cpp10
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 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")) {