summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2024-01-31 06:23:26 -0600
committerAaron Franke <arnfranke@yahoo.com>2024-01-31 06:26:24 -0600
commitd1de00a2c8f3605faee9a8b81c78ded2ed89a3fe (patch)
tree3e1ddf33b94c0bf8ba491a0cbb4c2fc37f1ab6fd
parentf8a039e9b54875a3435ace4b9953cefa591a0753 (diff)
downloadredot-engine-d1de00a2c8f3605faee9a8b81c78ded2ed89a3fe.tar.gz
Fix crash when previewing a scene with a mesh as the root node
-rw-r--r--editor/import/3d/scene_import_settings.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/editor/import/3d/scene_import_settings.cpp b/editor/import/3d/scene_import_settings.cpp
index 736f941aa4..53d7e63dbb 100644
--- a/editor/import/3d/scene_import_settings.cpp
+++ b/editor/import/3d/scene_import_settings.cpp
@@ -311,7 +311,10 @@ void SceneImportSettingsDialog::_fill_scene(Node *p_node, TreeItem *p_parent_ite
Ref<ImporterMesh> editor_mesh = src_mesh_node->get_mesh();
mesh_node->set_mesh(editor_mesh->get_mesh());
}
-
+ // Replace the original mesh node in the scene tree with the new one.
+ if (unlikely(p_node == scene)) {
+ scene = mesh_node;
+ }
p_node->replace_by(mesh_node);
memdelete(p_node);
p_node = mesh_node;