diff options
author | ajreckof <tbonhoure@ymail.com> | 2024-03-28 20:26:44 +0100 |
---|---|---|
committer | ajreckof <tbonhoure@ymail.com> | 2024-04-03 12:19:38 +0200 |
commit | ae472865d0978e79b6e2993f76771d82daa431bf (patch) | |
tree | 5500d79f382647f06662597801e46458a850a6b6 /editor/editor_data.cpp | |
parent | 7d151c83811f8ac8873439826c16d88c83aba12f (diff) | |
download | redot-engine-ae472865d0978e79b6e2993f76771d82daa431bf.tar.gz |
fix node duplication in update after external changes.
Diffstat (limited to 'editor/editor_data.cpp')
-rw-r--r-- | editor/editor_data.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 4b68a21cb9..6ab29c1850 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -722,15 +722,8 @@ bool EditorData::check_and_update_scene(int p_idx) { new_scene->set_scene_file_path(edited_scene[p_idx].root->get_scene_file_path()); Node *old_root = edited_scene[p_idx].root; - for (int i = 0; i < old_root->get_child_count(); i++) { - memdelete(old_root->get_child(i)); - } - old_root->replace_by(new_scene); + old_root->replace_by(new_scene, false, false); memdelete(old_root); - edited_scene.write[p_idx].root = new_scene; - if (!new_scene->get_scene_file_path().is_empty()) { - edited_scene.write[p_idx].path = new_scene->get_scene_file_path(); - } edited_scene.write[p_idx].selection = new_selection; return true; |