From 3ebb5b84a0053c4a2ba560ac06dc9f1fe57769b8 Mon Sep 17 00:00:00 2001 From: kobewi Date: Sat, 2 Dec 2023 18:55:27 +0100 Subject: [PATCH] Add separate feature tags for editor runtime --- core/config/project_settings.cpp | 8 +++++++- core/os/os.cpp | 5 +++++ core/os/os.h | 1 + doc/classes/ProjectSettings.xml | 8 ++++++-- editor/project_settings_editor.cpp | 2 ++ main/main.cpp | 1 + scene/main/viewport.cpp | 2 +- 7 files changed, 23 insertions(+), 4 deletions(-) diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index 104b17961d6..c1fb5363164 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -1473,7 +1473,9 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF(PropertyInfo(Variant::INT, "display/window/size/window_height_override", PROPERTY_HINT_RANGE, "0,4320,1,or_greater"), 0); // 8K resolution GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true); - GLOBAL_DEF("display/window/energy_saving/keep_screen_on.editor", false); +#ifdef TOOLS_ENABLED + GLOBAL_DEF("display/window/energy_saving/keep_screen_on.editor_hint", false); +#endif GLOBAL_DEF("animation/warnings/check_invalid_track_paths", true); GLOBAL_DEF("animation/warnings/check_angle_interpolation_type_conflicting", true); @@ -1531,6 +1533,10 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF_BASIC("internationalization/rendering/root_node_auto_translate", true); GLOBAL_DEF(PropertyInfo(Variant::INT, "gui/timers/incremental_search_max_interval_msec", PROPERTY_HINT_RANGE, "0,10000,1,or_greater"), 2000); + GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "gui/timers/tooltip_delay_sec", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater"), 0.5); +#ifdef TOOLS_ENABLED + GLOBAL_DEF("gui/timers/tooltip_delay_sec.editor_hint", 0.5); +#endif GLOBAL_DEF_BASIC("gui/common/snap_controls_to_pixels", true); GLOBAL_DEF_BASIC("gui/fonts/dynamic_fonts/use_oversampling", true); diff --git a/core/os/os.cpp b/core/os/os.cpp index 8582888740c..fa7f23ded0a 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -398,6 +398,11 @@ bool OS::has_feature(const String &p_feature) { if (p_feature == "editor") { return true; } + if (p_feature == "editor_hint") { + return _in_editor; + } else if (p_feature == "editor_runtime") { + return !_in_editor; + } #else if (p_feature == "template") { return true; diff --git a/core/os/os.h b/core/os/os.h index 069a3876af7..d20f84b4ff0 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -63,6 +63,7 @@ class OS { bool _stdout_enabled = true; bool _stderr_enabled = true; bool _writing_movie = false; + bool _in_editor = false; CompositeLogger *_logger = nullptr; diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 1daa1b04e45..0d4d8bbebbf 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -254,6 +254,7 @@ Path to an image used as the boot splash. If left empty, the default Godot Engine splash will be displayed instead. [b]Note:[/b] Only effective if [member application/boot_splash/show_image] is [code]true[/code]. [b]Note:[/b] The only supported format is PNG. Using another image format will result in an error. + [b]Note:[/b] The image will also show when opening the project in the editor. If you want to display the default splash image in the editor, add an empty override for [code]editor_hint[/code] feature. Minimum boot splash display time (in milliseconds). It is not recommended to set too high values for this setting. @@ -797,8 +798,8 @@ If [code]true[/code], keeps the screen on (even in case of inactivity), so the screensaver does not take over. Works on desktop and mobile platforms. - - Editor-only override for [member display/window/energy_saving/keep_screen_on]. Does not affect exported projects in debug or release mode. + + Editor-only override for [member display/window/energy_saving/keep_screen_on]. Does not affect running project. The default screen orientation to use on mobile devices. See [enum DisplayServer.ScreenOrientation] for possible values. @@ -1071,6 +1072,9 @@ Default delay for tooltips (in seconds). + + Delay for tooltips in the editor. + Default [InputEventAction] to confirm a focused button, menu or list item, or validate input. [b]Note:[/b] Default [code]ui_*[/code] actions cannot be removed as they are necessary for the internal logic of several [Control]s. The events assigned to the action can however be modified. diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 70e8484a78c..c4aeac434bb 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -287,6 +287,8 @@ void ProjectSettingsEditor::_add_feature_overrides() { presets.insert("s3tc"); presets.insert("etc2"); presets.insert("editor"); + presets.insert("editor_hint"); + presets.insert("editor_runtime"); presets.insert("template_debug"); presets.insert("template_release"); presets.insert("debug"); diff --git a/main/main.cpp b/main/main.cpp index 905740fd90a..eee634086e3 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1746,6 +1746,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } } + OS::get_singleton()->_in_editor = editor; if (globals->setup(project_path, main_pack, upwards, editor) == OK) { #ifdef TOOLS_ENABLED found_project = true; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 2d30ea345de..73ce1661237 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -4954,7 +4954,7 @@ Viewport::Viewport() { unhandled_key_input_group = "_vp_unhandled_key_input" + id; // Window tooltip. - gui.tooltip_delay = GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "gui/timers/tooltip_delay_sec", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater"), 0.5); + gui.tooltip_delay = GLOBAL_GET("gui/timers/tooltip_delay_sec"); #ifndef _3D_DISABLED set_scaling_3d_mode((Viewport::Scaling3DMode)(int)GLOBAL_GET("rendering/scaling_3d/mode"));