diff options
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/main/main.cpp b/main/main.cpp index 397476ae39..7e2741648d 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -474,6 +474,7 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print("Standalone tools:\n"); OS::get_singleton()->print(" -s, --script <script> Run a script.\n"); + OS::get_singleton()->print(" --main-loop <main_loop_name> Run a MainLoop specified by its global class name.\n"); OS::get_singleton()->print(" --check-only Only parse for errors and quit (use with --script).\n"); #ifdef TOOLS_ENABLED OS::get_singleton()->print(" --export-release <preset> <path> Export the project in release mode using the given preset and output path. The preset name should match one defined in export_presets.cfg.\n"); @@ -2602,6 +2603,7 @@ bool Main::start() { String positional_arg; String game_path; String script; + String main_loop_type; bool check_only = false; #ifdef TOOLS_ENABLED @@ -2665,6 +2667,8 @@ bool Main::start() { bool parsed_pair = true; if (args[i] == "-s" || args[i] == "--script") { script = args[i + 1]; + } else if (args[i] == "--main-loop") { + main_loop_type = args[i + 1]; #ifdef TOOLS_ENABLED } else if (args[i] == "--doctool") { doc_tool_path = args[i + 1]; @@ -2706,6 +2710,9 @@ bool Main::start() { } uint64_t minimum_time_msec = GLOBAL_DEF(PropertyInfo(Variant::INT, "application/boot_splash/minimum_display_time", PROPERTY_HINT_RANGE, "0,100,1,or_greater,suffix:ms"), 0); + if (Engine::get_singleton()->is_editor_hint()) { + minimum_time_msec = 0; + } #ifdef TOOLS_ENABLED #ifdef MODULE_GDSCRIPT_ENABLED @@ -2884,7 +2891,9 @@ bool Main::start() { if (editor) { main_loop = memnew(SceneTree); } - String main_loop_type = GLOBAL_GET("application/run/main_loop_type"); + if (main_loop_type.is_empty()) { + main_loop_type = GLOBAL_GET("application/run/main_loop_type"); + } if (!script.is_empty()) { Ref<Script> script_res = ResourceLoader::load(script); @@ -2911,7 +2920,7 @@ bool Main::start() { ERR_FAIL_V_MSG(false, vformat("Can't load the script \"%s\" as it doesn't inherit from SceneTree or MainLoop.", script)); } - script_loop->set_initialize_script(script_res); + script_loop->set_script(script_res); main_loop = script_loop; } else { return false; @@ -2934,7 +2943,7 @@ bool Main::start() { OS::get_singleton()->alert("Error: Invalid MainLoop script base type: " + script_base); ERR_FAIL_V_MSG(false, vformat("The global class %s does not inherit from SceneTree or MainLoop.", main_loop_type)); } - script_loop->set_initialize_script(script_res); + script_loop->set_script(script_res); main_loop = script_loop; } } @@ -2959,6 +2968,8 @@ bool Main::start() { } } + OS::get_singleton()->set_main_loop(main_loop); + SceneTree *sml = Object::cast_to<SceneTree>(main_loop); if (sml) { #ifdef DEBUG_ENABLED @@ -3278,8 +3289,6 @@ bool Main::start() { DisplayServer::get_singleton()->set_icon(icon); } - OS::get_singleton()->set_main_loop(main_loop); - if (movie_writer) { movie_writer->begin(DisplayServer::get_singleton()->window_get_size(), fixed_fps, Engine::get_singleton()->get_write_movie_path()); } |