diff options
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/main/main.cpp b/main/main.cpp index 9076d110bd..fc24010e7b 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -135,7 +135,6 @@ static int audio_driver_idx = -1; // Engine config/tools -static bool single_window = false; static bool editor = false; static bool project_manager = false; static bool cmdline_tool = false; @@ -145,6 +144,7 @@ static bool auto_quit = false; static OS::ProcessID allow_focus_steal_pid = 0; #ifdef TOOLS_ENABLED static bool auto_build_solutions = false; +static String debug_server_uri; #endif // Display @@ -286,6 +286,7 @@ void Main::print_help(const char *p_binary) { #ifdef TOOLS_ENABLED OS::get_singleton()->print(" -e, --editor Start the editor instead of running the scene.\n"); OS::get_singleton()->print(" -p, --project-manager Start the project manager, even if a project is auto-detected.\n"); + OS::get_singleton()->print(" --debug-server <uri> Start the editor debug server (<protocol>://<host/IP>[:<port>], e.g. tcp://127.0.0.1:6007)\n"); #endif OS::get_singleton()->print(" -q, --quit Quit after the first iteration.\n"); OS::get_singleton()->print(" -l, --language <locale> Use a specific locale (<locale> being a two-letter code).\n"); @@ -403,6 +404,7 @@ Error Main::test_setup() { GLOBAL_DEF("debug/settings/crash_handler/message", String("Please include this when reporting the bug on https://github.com/godotengine/godot/issues")); + GLOBAL_DEF_RST("rendering/occlusion_culling/bvh_build_quality", 2); translation_server = memnew(TranslationServer); @@ -453,10 +455,10 @@ void Main::test_cleanup() { ResourceLoader::remove_custom_loaders(); ResourceSaver::remove_custom_savers(); + unregister_driver_types(); #ifdef TOOLS_ENABLED EditorNode::unregister_editor_types(); #endif - unregister_driver_types(); unregister_module_types(); unregister_platform_apis(); unregister_scene_types(); @@ -752,7 +754,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } } else if (I->get() == "--single-window") { // force single window - single_window = true; + OS::get_singleton()->_single_window = true; } else if (I->get() == "-t" || I->get() == "--always-on-top") { // force always-on-top window init_always_on_top = true; @@ -874,6 +876,18 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "-p" || I->get() == "--project-manager") { // starts project manager project_manager = true; + } else if (I->get() == "--debug-server") { + if (I->next()) { + debug_server_uri = I->next()->get(); + if (debug_server_uri.find("://") == -1) { // wrong address + OS::get_singleton()->print("Invalid debug server uri. It should be of the form <protocol>://<bind_address>:<port>.\n"); + goto error; + } + N = I->next()->next(); + } else { + OS::get_singleton()->print("Missing remote debug server uri, aborting.\n"); + goto error; + } } else if (I->get() == "--build-solutions") { // Build the scripting solution such C# auto_build_solutions = true; @@ -1076,7 +1090,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph editor = false; #else const String error_msg = "Error: Couldn't load project data at path \"" + project_path + "\". Is the .pck file missing?\nIf you've renamed the executable, the associated .pck file should also be renamed to match the executable's name (without the extension).\n"; - OS::get_singleton()->print("%s", error_msg.ascii().get_data()); + OS::get_singleton()->print("%s", error_msg.utf8().get_data()); OS::get_singleton()->alert(error_msg); goto error; @@ -1170,7 +1184,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #ifdef TOOLS_ENABLED if (!editor && !project_manager) { #endif - OS::get_singleton()->print("Error: Can't run project: no main scene defined.\n"); + const String error_msg = "Error: Can't run project: no main scene defined in the project.\n"; + OS::get_singleton()->print("%s", error_msg.utf8().get_data()); + OS::get_singleton()->alert(error_msg); goto error; #ifdef TOOLS_ENABLED } @@ -1559,8 +1575,8 @@ Error Main::setup2(Thread::ID p_main_tid_override) { { GLOBAL_DEF_RST_NOVAL("input_devices/pen_tablet/driver", ""); - GLOBAL_DEF_RST_NOVAL("input_devices/pen_tablet/driver.Windows", ""); - ProjectSettings::get_singleton()->set_custom_property_info("input_devices/pen_tablet/driver.Windows", PropertyInfo(Variant::STRING, "input_devices/pen_tablet/driver.Windows", PROPERTY_HINT_ENUM, "wintab,winink")); + GLOBAL_DEF_RST_NOVAL("input_devices/pen_tablet/driver.windows", ""); + ProjectSettings::get_singleton()->set_custom_property_info("input_devices/pen_tablet/driver.windows", PropertyInfo(Variant::STRING, "input_devices/pen_tablet/driver.windows", PROPERTY_HINT_ENUM, "wintab,winink")); } if (tablet_driver == "") { // specified in project.godot @@ -2116,7 +2132,7 @@ bool Main::start() { bool embed_subwindows = GLOBAL_DEF("display/window/subwindows/embed_subwindows", false); - if (single_window || (!project_manager && !editor && embed_subwindows)) { + if (OS::get_singleton()->is_single_window() || (!project_manager && !editor && embed_subwindows)) { sml->get_root()->set_embed_subwindows_hint(true); } ResourceLoader::add_custom_loaders(); @@ -2346,6 +2362,9 @@ bool Main::start() { } } DisplayServer::get_singleton()->set_context(DisplayServer::CONTEXT_EDITOR); + if (!debug_server_uri.is_empty()) { + EditorDebuggerNode::get_singleton()->start(debug_server_uri); + } } #endif if (!editor) { @@ -2669,18 +2688,19 @@ void Main::cleanup(bool p_force) { //clear global shader variables before scene and other graphics stuff are deinitialized. rendering_server->global_variables_clear(); -#ifdef TOOLS_ENABLED - EditorNode::unregister_editor_types(); -#endif - if (xr_server) { // cleanup now before we pull the rug from underneath... memdelete(xr_server); } + unregister_driver_types(); + +#ifdef TOOLS_ENABLED + EditorNode::unregister_editor_types(); +#endif + ImageLoader::cleanup(); - unregister_driver_types(); unregister_module_types(); unregister_platform_apis(); unregister_scene_types(); |