Allow running with a custom resource without a main scene

After 3f8a4cc719 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.
This commit is contained in:
Hein-Pieter van Braam 2018-02-26 17:16:29 +01:00
parent 7568a45539
commit b4215c991a

View file

@ -349,6 +349,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
Vector<String> breakpoints; Vector<String> breakpoints;
bool use_custom_res = true; bool use_custom_res = true;
bool force_res = false; bool force_res = false;
bool found_project = false;
packed_data = PackedData::get_singleton(); packed_data = PackedData::get_singleton();
if (!packed_data) if (!packed_data)
@ -760,7 +761,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#endif #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 #ifdef TOOLS_ENABLED
editor = false; editor = false;
@ -768,15 +771,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Error: Could not load game path '%s'.\n", game_path.ascii().get_data()); OS::get_singleton()->print("Error: Could not load game path '%s'.\n", game_path.ascii().get_data());
goto error; 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 #endif
} }
@ -801,14 +795,21 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
if (!project_manager) { if (!project_manager) {
// Determine if the project manager should be requested // Determine if the project manager should be requested
project_manager = project_manager = main_args.size() == 0 && !found_project;
main_args.size() == 0 &&
!ProjectSettings::get_singleton()->has_setting("application/run/main_loop_type") &&
(!ProjectSettings::get_singleton()->has_setting("application/run/main_scene") ||
String(ProjectSettings::get_singleton()->get("application/run/main_scene")) == "");
} }
#endif #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) { if (editor || project_manager) {
use_custom_res = false; use_custom_res = false;
input_map->load_default(); //keys for editor input_map->load_default(); //keys for editor