|
89 | 89 | #include "editor/debugger/editor_debugger_node.h"
|
90 | 90 | #include "editor/doc_data_class_path.gen.h"
|
91 | 91 | #include "editor/doc_tools.h"
|
| 92 | +#include "editor/editor_file_system.h" |
92 | 93 | #include "editor/editor_help.h"
|
93 | 94 | #include "editor/editor_node.h"
|
94 | 95 | #include "editor/editor_paths.h"
|
@@ -179,6 +180,7 @@ static OS::ProcessID editor_pid = 0;
|
179 | 180 | static bool found_project = false;
|
180 | 181 | static bool auto_build_solutions = false;
|
181 | 182 | static String debug_server_uri;
|
| 183 | +static bool wait_for_import = false; |
182 | 184 | #ifndef DISABLE_DEPRECATED
|
183 | 185 | static int converter_max_kb_file = 4 * 1024; // 4MB
|
184 | 186 | static int converter_max_line_length = 100000;
|
@@ -505,6 +507,7 @@ void Main::print_help(const char *p_binary) {
|
505 | 507 | OS::get_singleton()->print(" --main-loop <main_loop_name> Run a MainLoop specified by its global class name.\n");
|
506 | 508 | OS::get_singleton()->print(" --check-only Only parse for errors and quit (use with --script).\n");
|
507 | 509 | #ifdef TOOLS_ENABLED
|
| 510 | + OS::get_singleton()->print(" --import Starts the editor, waits for any resources to be imported, and then quits.\n"); |
508 | 511 | 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");
|
509 | 512 | OS::get_singleton()->print(" <path> should be absolute or relative to the project directory, and include the filename for the binary (e.g. 'builds/game.exe').\n");
|
510 | 513 | OS::get_singleton()->print(" The target directory must exist.\n");
|
@@ -1288,12 +1291,17 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
1288 | 1291 | OS::get_singleton()->print("Missing file to load argument after --validate-extension-api, aborting.");
|
1289 | 1292 | goto error;
|
1290 | 1293 | }
|
1291 |
| - |
| 1294 | + } else if (I->get() == "--import") { |
| 1295 | + editor = true; |
| 1296 | + cmdline_tool = true; |
| 1297 | + wait_for_import = true; |
| 1298 | + quit_after = 1; |
1292 | 1299 | } else if (I->get() == "--export-release" || I->get() == "--export-debug" ||
|
1293 | 1300 | I->get() == "--export-pack") { // Export project
|
1294 | 1301 | // Actually handling is done in start().
|
1295 | 1302 | editor = true;
|
1296 | 1303 | cmdline_tool = true;
|
| 1304 | + wait_for_import = true; |
1297 | 1305 | main_args.push_back(I->get());
|
1298 | 1306 | #ifndef DISABLE_DEPRECATED
|
1299 | 1307 | } else if (I->get() == "--export") { // For users used to 3.x syntax.
|
@@ -3746,6 +3754,12 @@ bool Main::iteration() {
|
3746 | 3754 | exit = true;
|
3747 | 3755 | }
|
3748 | 3756 |
|
| 3757 | +#ifdef TOOLS_ENABLED |
| 3758 | + if (wait_for_import && EditorFileSystem::get_singleton()->doing_first_scan()) { |
| 3759 | + exit = false; |
| 3760 | + } |
| 3761 | +#endif |
| 3762 | + |
3749 | 3763 | if (fixed_fps != -1) {
|
3750 | 3764 | return exit;
|
3751 | 3765 | }
|
|
0 commit comments