diff options
| author | Hein-Pieter van Braam | 2018-02-26 17:16:29 +0100 |
|---|---|---|
| committer | Hein-Pieter van Braam | 2018-02-26 20:39:48 +0100 |
| commit | 3b96b3fd120c9b41b2374bb5beb08b73a78917d8 (patch) | |
| tree | c77c4c6be3931bf5104d4ee3b014bbeffc723ba9 | |
| parent | e499b9b4b6676e31d2cb6f19d38e217a4fd905f3 (diff) | |
| download | godot-3b96b3fd120c9b41b2374bb5beb08b73a78917d8.tar.gz godot-3b96b3fd120c9b41b2374bb5beb08b73a78917d8.tar.zst godot-3b96b3fd120c9b41b2374bb5beb08b73a78917d8.zip | |
Allow running with a custom resource without a main scene
After 3f8a4cc7193e964f716fde2cd28a946669e2d8d6 trying to run an
individual scene on a project without a main scene fails. We move the
check until after we've determined whether or not we're trying to run an
individual scene.
We also stop trying to show the project manager if any game pack is
found at all, unless the user explicitly asks for the project manager to
be shown.
(cherry picked from commit b4215c991aa6a43464dcb983e85d4374dea23c69)
| -rw-r--r-- | main/main.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/main/main.cpp b/main/main.cpp index 2810c2370..662f0bf30 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -347,6 +347,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph Vector<String> breakpoints; bool use_custom_res = true; bool force_res = false; + bool found_project = false; packed_data = PackedData::get_singleton(); if (!packed_data) @@ -755,7 +756,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #endif - if (globals->setup(game_path, main_pack, upwards) != OK) { + if (globals->setup(game_path, main_pack, upwards) == OK) { + found_project = true; + } else { #ifdef TOOLS_ENABLED editor = false; @@ -764,15 +767,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph goto error; #endif - } else if (String(GLOBAL_DEF("application/run/main_scene", "")) == "") { -#ifdef TOOLS_ENABLED - if (!editor) { -#endif - OS::get_singleton()->print("Error: Can't run project: no main scene defined.\n"); - goto error; -#ifdef TOOLS_ENABLED - } -#endif } GLOBAL_DEF("logging/file_logging/enable_file_logging", false); @@ -791,6 +785,26 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph init_maximized = true; video_mode.maximized = true; } + } + + if (!project_manager) { + // Determine if the project manager should be requested + project_manager = main_args.size() == 0 && !found_project; + } +#endif + + if (main_args.size() == 0 && String(GLOBAL_DEF("application/run/main_scene", "")) == "") { +#ifdef TOOLS_ENABLED + if (!editor && !project_manager) { +#endif + OS::get_singleton()->print("Error: Can't run project: no main scene defined.\n"); + goto error; +#ifdef TOOLS_ENABLED + } +#endif + } + + if (editor || project_manager) { use_custom_res = false; } |
