|
92 | 92 | #include "editor/debugger/editor_debugger_node.h"
|
93 | 93 | #include "editor/doc_data_class_path.gen.h"
|
94 | 94 | #include "editor/doc_tools.h"
|
| 95 | +#include "editor/editor_file_system.h" |
95 | 96 | #include "editor/editor_help.h"
|
96 | 97 | #include "editor/editor_node.h"
|
97 | 98 | #include "editor/editor_paths.h"
|
@@ -184,6 +185,7 @@ static OS::ProcessID editor_pid = 0;
|
184 | 185 | static bool found_project = false;
|
185 | 186 | static bool auto_build_solutions = false;
|
186 | 187 | static String debug_server_uri;
|
| 188 | +static bool wait_for_import = false; |
187 | 189 | #ifndef DISABLE_DEPRECATED
|
188 | 190 | static int converter_max_kb_file = 4 * 1024; // 4MB
|
189 | 191 | static int converter_max_line_length = 100000;
|
@@ -617,6 +619,7 @@ void Main::print_help(const char *p_binary) {
|
617 | 619 | print_help_option("--main-loop <main_loop_name>", "Run a MainLoop specified by its global class name.\n");
|
618 | 620 | print_help_option("--check-only", "Only parse for errors and quit (use with --script).\n");
|
619 | 621 | #ifdef TOOLS_ENABLED
|
| 622 | + print_help_option("--import", "Starts the editor, waits for any resources to be imported, and then quits.\n", CLI_OPTION_AVAILABILITY_EDITOR); |
620 | 623 | print_help_option("--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", CLI_OPTION_AVAILABILITY_EDITOR);
|
621 | 624 | print_help_option("", "<path> should be absolute or relative to the project directory, and include the filename for the binary (e.g. \"builds/game.exe\").\n");
|
622 | 625 | print_help_option("", "The target directory must exist.\n");
|
@@ -1420,12 +1423,17 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
1420 | 1423 | OS::get_singleton()->print("Missing file to load argument after --validate-extension-api, aborting.");
|
1421 | 1424 | goto error;
|
1422 | 1425 | }
|
1423 |
| - |
| 1426 | + } else if (I->get() == "--import") { |
| 1427 | + editor = true; |
| 1428 | + cmdline_tool = true; |
| 1429 | + wait_for_import = true; |
| 1430 | + quit_after = 1; |
1424 | 1431 | } else if (I->get() == "--export-release" || I->get() == "--export-debug" ||
|
1425 | 1432 | I->get() == "--export-pack") { // Export project
|
1426 | 1433 | // Actually handling is done in start().
|
1427 | 1434 | editor = true;
|
1428 | 1435 | cmdline_tool = true;
|
| 1436 | + wait_for_import = true; |
1429 | 1437 | main_args.push_back(I->get());
|
1430 | 1438 | #ifndef DISABLE_DEPRECATED
|
1431 | 1439 | } else if (I->get() == "--export") { // For users used to 3.x syntax.
|
@@ -4084,6 +4092,12 @@ bool Main::iteration() {
|
4084 | 4092 | exit = true;
|
4085 | 4093 | }
|
4086 | 4094 |
|
| 4095 | +#ifdef TOOLS_ENABLED |
| 4096 | + if (wait_for_import && EditorFileSystem::get_singleton()->doing_first_scan()) { |
| 4097 | + exit = false; |
| 4098 | + } |
| 4099 | +#endif |
| 4100 | + |
4087 | 4101 | if (fixed_fps != -1) {
|
4088 | 4102 | return exit;
|
4089 | 4103 | }
|
|
0 commit comments