diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/main/main.cpp b/main/main.cpp index 15166ce152..b2667d11e6 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -87,6 +87,7 @@ #include "editor/editor_settings.h" #include "editor/editor_translation.h" #include "editor/progress_dialog.h" +#include "editor/project_converter_3_to_4.h" #include "editor/project_manager.h" #ifndef NO_EDITOR_SPLASH #include "main/splash_editor.gen.h" @@ -368,6 +369,8 @@ void Main::print_help(const char *p_binary) { 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'). The target directory should exist.\n"); OS::get_singleton()->print(" --export-debug <preset> <path> Same as --export, but using the debug template.\n"); OS::get_singleton()->print(" --export-pack <preset> <path> Same as --export, but only export the game pack for the given preset. The <path> extension determines whether it will be in PCK or ZIP format.\n"); + OS::get_singleton()->print(" --convert-3to4 Converts project from Godot 3.x to Godot 4.x.\n"); + OS::get_singleton()->print(" --validate-conversion-3to4 Shows what elements will be renamed when converting project from Godot 3.x to Godot 4.x.\n"); OS::get_singleton()->print(" --doctool [<path>] Dump the engine API reference to the given <path> (defaults to current dir) in XML format, merging if existing files are found.\n"); OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n"); OS::get_singleton()->print(" --build-solutions Build the scripting solutions (e.g. for C# projects). Implies --editor and requires a valid project to edit.\n"); @@ -996,6 +999,14 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph editor = true; cmdline_tool = true; main_args.push_back(I->get()); + } else if (I->get() == "--convert-3to4") { + // Actually handling is done in start(). + cmdline_tool = true; + main_args.push_back(I->get()); + } else if (I->get() == "--validate-conversion-3to4") { + // Actually handling is done in start(). + cmdline_tool = true; + main_args.push_back(I->get()); } else if (I->get() == "--doctool") { // Actually handling is done in start(). cmdline_tool = true; @@ -2035,6 +2046,8 @@ bool Main::start() { String _export_preset; bool export_debug = false; bool export_pack_only = false; + bool converting_project = false; + bool validating_converting_project = false; #endif main_timer_sync.init(OS::get_singleton()->get_ticks_usec()); @@ -2050,6 +2063,10 @@ bool Main::start() { #ifdef TOOLS_ENABLED } else if (args[i] == "--no-docbase") { doc_base = false; + } else if (args[i] == "--convert-3to4") { + converting_project = true; + } else if (args[i] == "--validate-conversion-3to4") { + validating_converting_project = true; } else if (args[i] == "-e" || args[i] == "--editor") { editor = true; } else if (args[i] == "-p" || args[i] == "--project-manager") { @@ -2203,6 +2220,18 @@ bool Main::start() { NativeExtensionAPIDump::generate_extension_json_file("extension_api.json"); return false; } + + if (converting_project) { + int exit_code = ProjectConverter3To4().convert(); + OS::get_singleton()->set_exit_code(exit_code); + return false; + } + if (validating_converting_project) { + int exit_code = ProjectConverter3To4().validate_conversion(); + OS::get_singleton()->set_exit_code(exit_code); + return false; + } + #endif if (script.is_empty() && game_path.is_empty() && String(GLOBAL_GET("application/run/main_scene")) != "") { |