This commit is contained in:
Tomek 2024-10-22 22:11:35 +02:00 committed by GitHub
commit e20ad512f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 11 deletions

View File

@ -632,6 +632,18 @@ int EditorData::add_edited_scene(int p_at_pos) {
if (current_edited_scene < 0) {
current_edited_scene = 0;
}
// Remove placeholder empty scene.
if (get_edited_scene_count() > 1) {
for (int i = 0; i < get_edited_scene_count() - 1; i++) {
bool unsaved = EditorUndoRedoManager::get_singleton()->is_history_unsaved(get_scene_history_id(i));
if (!unsaved && get_scene_path(i).is_empty() && get_edited_scene_root(i) == nullptr) {
remove_scene(i);
p_at_pos--;
}
}
}
return p_at_pos;
}

View File

@ -3906,17 +3906,6 @@ int EditorNode::new_scene() {
int idx = editor_data.add_edited_scene(-1);
_set_current_scene(idx); // Before trying to remove an empty scene, set the current tab index to the newly added tab index.
// Remove placeholder empty scene.
if (editor_data.get_edited_scene_count() > 1) {
for (int i = 0; i < editor_data.get_edited_scene_count() - 1; i++) {
bool unsaved = EditorUndoRedoManager::get_singleton()->is_history_unsaved(editor_data.get_scene_history_id(i));
if (!unsaved && editor_data.get_scene_path(i).is_empty() && editor_data.get_edited_scene_root(i) == nullptr) {
editor_data.remove_scene(i);
idx--;
}
}
}
editor_data.clear_editor_states();
scene_tabs->update_scene_tabs();
return idx;