You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Merge pull request #22323 from williamd1k0/ignore-main-scene
Editor: Skip loading main scene if restore_scenes_on_load is used
This commit is contained in:
@@ -3645,6 +3645,7 @@ void EditorNode::_load_docks() {
|
|||||||
|
|
||||||
_load_docks_from_config(config, "docks");
|
_load_docks_from_config(config, "docks");
|
||||||
_load_open_scenes_from_config(config, "EditorNode");
|
_load_open_scenes_from_config(config, "EditorNode");
|
||||||
|
|
||||||
editor_data.set_plugin_window_layout(config);
|
editor_data.set_plugin_window_layout(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3839,6 +3840,23 @@ void EditorNode::_load_open_scenes_from_config(Ref<ConfigFile> p_layout, const S
|
|||||||
restoring_scenes = false;
|
restoring_scenes = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EditorNode::has_scenes_in_session() {
|
||||||
|
if (!bool(EDITOR_GET("interface/scene_tabs/restore_scenes_on_load"))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Ref<ConfigFile> config;
|
||||||
|
config.instance();
|
||||||
|
Error err = config->load(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("editor_layout.cfg"));
|
||||||
|
if (err != OK) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!config->has_section("EditorNode") || !config->has_section_key("EditorNode", "open_scenes")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Array scenes = config->get_value("EditorNode", "open_scenes");
|
||||||
|
return !scenes.empty();
|
||||||
|
}
|
||||||
|
|
||||||
void EditorNode::_update_layouts_menu() {
|
void EditorNode::_update_layouts_menu() {
|
||||||
|
|
||||||
editor_layouts->clear();
|
editor_layouts->clear();
|
||||||
|
|||||||
@@ -789,6 +789,7 @@ public:
|
|||||||
void edit_current() { _edit_current(); };
|
void edit_current() { _edit_current(); };
|
||||||
|
|
||||||
void update_keying() const { inspector_dock->update_keying(); };
|
void update_keying() const { inspector_dock->update_keying(); };
|
||||||
|
bool has_scenes_in_session();
|
||||||
|
|
||||||
EditorNode();
|
EditorNode();
|
||||||
~EditorNode();
|
~EditorNode();
|
||||||
|
|||||||
@@ -1697,9 +1697,11 @@ bool Main::start() {
|
|||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
if (editor) {
|
if (editor) {
|
||||||
|
|
||||||
|
if (game_path != GLOBAL_GET("application/run/main_scene") || !editor_node->has_scenes_in_session()) {
|
||||||
Error serr = editor_node->load_scene(local_game_path);
|
Error serr = editor_node->load_scene(local_game_path);
|
||||||
if (serr != OK)
|
if (serr != OK)
|
||||||
ERR_PRINT("Failed to load scene");
|
ERR_PRINT("Failed to load scene");
|
||||||
|
}
|
||||||
OS::get_singleton()->set_context(OS::CONTEXT_EDITOR);
|
OS::get_singleton()->set_context(OS::CONTEXT_EDITOR);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user