diff options
author | Luka Dornhecker <luka.dornhecker@gmail.com> | 2018-12-18 14:17:43 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2019-06-20 16:55:52 +0200 |
commit | ad504b926f9a0cfabde78254f6a4b40901cb8592 (patch) | |
tree | d1b76baffd09ff75cd4edf75457de8bb1e5f8df0 /editor | |
parent | d6f8a43b600cc5236c5860c8f266b6f8afc9c23c (diff) |
Add option to toggle console window on Windows
This is an editor setting and its value can also be toggled
using an entry in the Editor toolbar. The console will still
appear briefly when starting the project manager or editor,
as it's still compiled as console application.
Does not impact exported games, which will still run without
console in release and with console in debug mode.
A project setting or export option could be added to disable
it in debug mode if there's demand for it, but that would
greatly reduce the usefulness of debug builds if Windows users
can no longer report error and crash messages.
Fixes #17889.
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_node.cpp | 10 | ||||
-rw-r--r-- | editor/editor_node.h | 1 | ||||
-rw-r--r-- | editor/editor_settings.cpp | 1 |
3 files changed, 12 insertions, 0 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 2d2f67314d..21ed478159 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2475,6 +2475,13 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { OS::get_singleton()->set_window_fullscreen(!OS::get_singleton()->is_window_fullscreen()); } break; + case SETTINGS_TOGGLE_CONSOLE: { + + bool was_visible = OS::get_singleton()->is_console_visible(); + OS::get_singleton()->set_console_visible(!was_visible); + EditorSettings::get_singleton()->set_setting("interface/editor/hide_console_window", !was_visible); + + } break; case SETTINGS_PICK_MAIN_SCENE: { file->set_mode(EditorFileDialog::MODE_OPEN_FILE); @@ -5874,6 +5881,9 @@ EditorNode::EditorNode() { #else p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREEN); #endif +#ifdef WINDOWS_ENABLED + p->add_item(TTR("Toggle System Console"), SETTINGS_TOGGLE_CONSOLE); +#endif p->add_separator(); if (OS::get_singleton()->get_data_path() == OS::get_singleton()->get_config_path()) { diff --git a/editor/editor_node.h b/editor/editor_node.h index f3bc95c409..366d9c2770 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -193,6 +193,7 @@ private: SETTINGS_MANAGE_EXPORT_TEMPLATES, SETTINGS_MANAGE_FEATURE_PROFILES, SETTINGS_PICK_MAIN_SCENE, + SETTINGS_TOGGLE_CONSOLE, SETTINGS_TOGGLE_FULLSCREEN, SETTINGS_HELP, SCENE_TAB_CLOSE, diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 58e3cc6fc1..5e04bf4953 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -345,6 +345,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("interface/editor/unfocused_low_processor_mode_sleep_usec", 50000); // 20 FPS hints["interface/editor/unfocused_low_processor_mode_sleep_usec"] = PropertyInfo(Variant::REAL, "interface/editor/unfocused_low_processor_mode_sleep_usec", PROPERTY_HINT_RANGE, "1,100000,1", PROPERTY_USAGE_DEFAULT); _initial_set("interface/editor/separate_distraction_mode", false); + _initial_set("interface/editor/hide_console_window", false); _initial_set("interface/editor/save_each_scene_on_quit", true); // Regression _initial_set("interface/editor/quit_confirmation", true); |