Skip to content

Commit

Permalink
Merge pull request #95048 from KoBeWi/keep_the_party_going
Browse files Browse the repository at this point in the history
Add `keep_screen_on` editor setting
  • Loading branch information
akien-mga committed Aug 27, 2024
2 parents 9e1c63a + ab4c235 commit 012ccbc
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
4 changes: 0 additions & 4 deletions core/config/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1472,10 +1472,6 @@ 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);
#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
3 changes: 3 additions & 0 deletions doc/classes/EditorSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,9 @@
<member name="interface/editor/import_resources_when_unfocused" type="bool" setter="" getter="">
If [code]true[/code], (re)imports resources even if the editor window is unfocused or minimized. If [code]false[/code], resources are only (re)imported when the editor window is focused. This can be set to [code]true[/code] to speed up iteration by starting the import process earlier when saving files in the project folder. This also allows getting visual feedback on changes without having to click the editor window, which is useful with multi-monitor setups. The downside of setting this to [code]true[/code] is that it increases idle CPU usage and may steal CPU time from other applications when importing resources.
</member>
<member name="interface/editor/keep_screen_on" type="bool" setter="" getter="">
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="interface/editor/localize_settings" type="bool" setter="" getter="">
If [code]true[/code], setting names in the editor are localized when possible.
[b]Note:[/b] This setting affects most [EditorInspector]s in the editor UI, primarily Project Settings and Editor Settings. To control names displayed in the Inspector dock, use [member interface/inspector/default_property_name_style] instead.
Expand Down
3 changes: 0 additions & 3 deletions doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -813,9 +813,6 @@
<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_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.
[b]Note:[/b] When set to a portrait orientation, this project setting does not flip the project resolution's width and height automatically. Instead, you have to set [member display/window/size/viewport_width] and [member display/window/size/viewport_height] accordingly.
Expand Down
2 changes: 2 additions & 0 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,7 @@ void EditorNode::_notification(int p_what) {

RenderingServer::get_singleton()->viewport_set_disable_2d(get_scene_root()->get_viewport_rid(), true);
RenderingServer::get_singleton()->viewport_set_environment_mode(get_viewport()->get_viewport_rid(), RenderingServer::VIEWPORT_ENVIRONMENT_DISABLED);
DisplayServer::get_singleton()->screen_set_keep_on(EDITOR_GET("interface/editor/keep_screen_on"));

feature_profile_manager->notify_changed();

Expand Down Expand Up @@ -838,6 +839,7 @@ void EditorNode::_notification(int p_what) {
if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor")) {
_update_update_spinner();
_update_vsync_mode();
DisplayServer::get_singleton()->screen_set_keep_on(EDITOR_GET("interface/editor/keep_screen_on"));
}

#if defined(MODULE_GDSCRIPT_ENABLED) || defined(MODULE_MONO_ENABLED)
Expand Down
1 change: 1 addition & 0 deletions editor/editor_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/show_update_spinner", 0, "Auto (Disabled),Enabled,Disabled")
#endif

_initial_set("interface/editor/keep_screen_on", false);
EDITOR_SETTING_USAGE(Variant::INT, PROPERTY_HINT_RANGE, "interface/editor/low_processor_mode_sleep_usec", 6900, "1,100000,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)
// Default unfocused usec sleep is for 10 FPS. Allow an unfocused FPS limit
// as low as 1 FPS for those who really need low power usage (but don't need
Expand Down
1 change: 1 addition & 0 deletions editor/project_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ void ProjectManager::_notification(int p_what) {
} break;

case NOTIFICATION_READY: {
DisplayServer::get_singleton()->screen_set_keep_on(EDITOR_GET("interface/editor/keep_screen_on"));
const int default_sorting = (int)EDITOR_GET("project_manager/sorting_order");
filter_option->select(default_sorting);
project_list->set_order_option(default_sorting);
Expand Down

0 comments on commit 012ccbc

Please sign in to comment.