From fe0adc4f7757d73d0b906ec758453665de52cea1 Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Thu, 9 Jul 2020 09:32:42 +0200 Subject: [PATCH] Keep debug & verbose options after loading project from project manager (cherry picked from commit b2d27214aa0bee3cf0dc091846bf087e007c9607) --- core/os/os.cpp | 5 +++++ core/os/os.h | 2 ++ editor/project_manager.cpp | 8 ++++++++ main/main.cpp | 1 + 4 files changed, 16 insertions(+) diff --git a/core/os/os.cpp b/core/os/os.cpp index 408d85a6365..71db0e5b3a5 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -197,6 +197,10 @@ bool OS::is_stdout_verbose() const { return _verbose_stdout; } +bool OS::is_stdout_debug_enabled() const { + return _debug_stdout; +} + void OS::dump_memory_to_file(const char *p_file) { //Memory::dump_static_mem_to_file(p_file); @@ -812,6 +816,7 @@ OS::OS() { low_processor_usage_mode = false; low_processor_usage_mode_sleep_usec = 10000; _verbose_stdout = false; + _debug_stdout = false; _no_window = false; _exit_code = 0; _orientation = SCREEN_LANDSCAPE; diff --git a/core/os/os.h b/core/os/os.h index 8b55414917e..c03c3229f05 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -53,6 +53,7 @@ class OS { bool low_processor_usage_mode; int low_processor_usage_mode_sleep_usec; bool _verbose_stdout; + bool _debug_stdout; String _local_clipboard; uint64_t _msec_splash; bool _no_window; @@ -359,6 +360,7 @@ public: virtual bool is_userfs_persistent() const { return true; } bool is_stdout_verbose() const; + bool is_stdout_debug_enabled() const; virtual void disable_crash_handler() {} virtual bool is_disable_crash_handler() const { return false; } diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 817afa7be29..a69452088fb 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -2040,6 +2040,14 @@ void ProjectManager::_open_selected_projects() { args.push_back("--editor"); + if (OS::get_singleton()->is_stdout_debug_enabled()) { + args.push_back("--debug"); + } + + if (OS::get_singleton()->is_stdout_verbose()) { + args.push_back("--verbose"); + } + if (OS::get_singleton()->is_disable_crash_handler()) { args.push_back("--disable-crash-handler"); } diff --git a/main/main.cpp b/main/main.cpp index ad4b39dd7e4..f16ffa5bdbd 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -799,6 +799,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "-d" || I->get() == "--debug") { debug_mode = "local"; + OS::get_singleton()->_debug_stdout = true; #if defined(DEBUG_ENABLED) && !defined(SERVER_ENABLED) } else if (I->get() == "--debug-collisions") { debug_collisions = true;