MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / new_scene

Method new_scene

editor/editor_node.cpp:4346–4364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4344}
4345
4346int 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
4366Error 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()) {

Callers 1

_make_scene_confirmMethod · 0.80

Calls 10

add_edited_sceneMethod · 0.80
is_history_unsavedMethod · 0.80
get_scene_history_idMethod · 0.80
remove_sceneMethod · 0.80
clear_editor_statesMethod · 0.80
update_scene_tabsMethod · 0.80
is_emptyMethod · 0.45
get_scene_pathMethod · 0.45
get_edited_scene_rootMethod · 0.45

Tested by

no test coverage detected