| 4344 | } |
| 4345 | |
| 4346 | int EditorNode::new_scene() { |
| 4347 | int idx = editor_data.add_edited_scene(-1); |
| 4348 | _set_current_scene(idx); // Before trying to remove an empty scene, set the current tab index to the newly added tab index. |
| 4349 | |
| 4350 | // Remove placeholder empty scene. |
| 4351 | if (editor_data.get_edited_scene_count() > 1) { |
| 4352 | for (int i = 0; i < editor_data.get_edited_scene_count() - 1; i++) { |
| 4353 | bool unsaved = EditorUndoRedoManager::get_singleton()->is_history_unsaved(editor_data.get_scene_history_id(i)); |
| 4354 | if (!unsaved && editor_data.get_scene_path(i).is_empty() && editor_data.get_edited_scene_root(i) == nullptr) { |
| 4355 | editor_data.remove_scene(i); |
| 4356 | idx--; |
| 4357 | } |
| 4358 | } |
| 4359 | } |
| 4360 | |
| 4361 | editor_data.clear_editor_states(); |
| 4362 | scene_tabs->update_scene_tabs(); |
| 4363 | return idx; |
| 4364 | } |
| 4365 | |
| 4366 | Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, bool p_set_inherited, bool p_force_open_imported, bool p_silent_change_tab) { |
| 4367 | if (!is_inside_tree()) { |
no test coverage detected