Skip to content

Commit

Permalink
Add separate feature tags for editor runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
KoBeWi committed Apr 26, 2024
1 parent 86bf835 commit 3ebb5b8
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 4 deletions.
8 changes: 7 additions & 1 deletion core/config/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions core/os/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions core/os/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 6 additions & 2 deletions doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
</member>
<member name="application/boot_splash/minimum_display_time" type="int" setter="" getter="" default="0">
Minimum boot splash display time (in milliseconds). It is not recommended to set too high values for this setting.
Expand Down Expand Up @@ -797,8 +798,8 @@
<member name="display/window/energy_saving/keep_screen_on" type="bool" setter="" getter="" default="true">
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.
</member>
<member name="display/window/energy_saving/keep_screen_on.editor" type="bool" setter="" getter="" default="false">
Editor-only override for [member display/window/energy_saving/keep_screen_on]. Does not affect exported projects in debug or release mode.
<member name="display/window/energy_saving/keep_screen_on.editor_hint" type="bool" setter="" getter="" default="false">
Editor-only override for [member display/window/energy_saving/keep_screen_on]. Does not affect running project.
</member>
<member name="display/window/handheld/orientation" type="int" setter="" getter="" default="0">
The default screen orientation to use on mobile devices. See [enum DisplayServer.ScreenOrientation] for possible values.
Expand Down Expand Up @@ -1071,6 +1072,9 @@
<member name="gui/timers/tooltip_delay_sec" type="float" setter="" getter="" default="0.5">
Default delay for tooltips (in seconds).
</member>
<member name="gui/timers/tooltip_delay_sec.editor_hint" type="float" setter="" getter="" default="0.5">
Delay for tooltips in the editor.
</member>
<member name="input/ui_accept" type="Dictionary" setter="" getter="">
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.
Expand Down
2 changes: 2 additions & 0 deletions editor/project_settings_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion scene/main/viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

0 comments on commit 3ebb5b8

Please sign in to comment.