Skip to content

Commit efc3e3a

Browse files
committed
Fix crash when reimporting nested gltf scenes
1 parent 97241ff commit efc3e3a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

editor/editor_node.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6457,6 +6457,18 @@ void EditorNode::reload_instances_with_path_in_edited_scenes() {
64576457

64586458
get_scene_editor_data_for_node(owner, original_node, scene_editor_data_table);
64596459

6460+
// The current node being reloaded may also be an additional node for another node
6461+
// that is in the process of being reloaded.
6462+
// Replacing the additional node with the new one prevents a crash where nodes
6463+
// in 'addition_list' are removed from the scene tree and queued for deletion.
6464+
for (InstanceModificationsEntry &im : scene_modifications->instance_list) {
6465+
for (AdditiveNodeEntry &additive_node_entry : im.addition_list) {
6466+
if (additive_node_entry.node == original_node) {
6467+
additive_node_entry.node = instantiated_node;
6468+
}
6469+
}
6470+
}
6471+
64606472
bool original_node_scene_instance_load_placeholder = original_node->get_scene_instance_load_placeholder();
64616473

64626474
// Delete all the remaining node children.

0 commit comments

Comments
 (0)