diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-08-28 18:06:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-28 18:06:44 +0200 |
commit | 006915b4824a91c0e0fc95ac6aa2f70908a0a027 (patch) | |
tree | 37be01920c95d15a0fe9b390e4131b2d0613ec73 /editor | |
parent | f7f8af232c2867435b84f83001ebe46d5ee030ba (diff) | |
parent | ed54a7be3d01b571ccaab4bb7dcf35f4846357f1 (diff) |
Merge pull request #64961 from faisal-alam09/Bugfix-#64836-Placeholder-scene-tab-not-removed-when-new-scene-created
Added a placeholder tab check before creating a new scene.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_node.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index ed3f540fb4..9a188bbe38 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3702,6 +3702,18 @@ void EditorNode::fix_dependencies(const String &p_for_file) { int EditorNode::new_scene() { int idx = editor_data.add_edited_scene(-1); + // 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 = get_undo_redo()->is_history_unsaved(editor_data.get_scene_history_id(i)); + if (!unsaved && editor_data.get_scene_path(i).is_empty()) { + editor_data.remove_scene(i); + idx--; + } + } + } + idx = MAX(idx, 0); + _scene_tab_changed(idx); editor_data.clear_editor_states(); _update_scene_tabs(); |