From 45bf5adefa0a89db44d20737b2cb1888f4b028a9 Mon Sep 17 00:00:00 2001 From: Kiisu_Master <142301391+Kiisu-Master@users.noreply.github.com> Date: Tue, 30 Jul 2024 15:17:05 +0300 Subject: [PATCH 1/3] Add setting for Godots low processor usage mode --- src/Autoload/Global.gd | 7 +++++++ src/Preferences/PreferencesDialog.gd | 6 ++++++ src/Preferences/PreferencesDialog.tscn | 13 +++++++++++++ 3 files changed, 26 insertions(+) diff --git a/src/Autoload/Global.gd b/src/Autoload/Global.gd index f29a267c221b..a3a4c4ec6fbc 100644 --- a/src/Autoload/Global.gd +++ b/src/Autoload/Global.gd @@ -475,6 +475,12 @@ var fps_limit := 0: ## Found in Preferences. Affects the per_pixel_transparency project setting. ## If [code]true[/code], it allows for the window to be transparent. ## This affects performance, so keep it [code]false[/code] if you don't need it. +var low_processor_usage := true: + set(value): + if value == low_processor_usage: + return + low_processor_usage = value + OS.low_processor_usage_mode = value var window_transparency := false: set(value): if value == window_transparency: @@ -680,6 +686,7 @@ func _init() -> void: if ProjectSettings.get_setting("display/window/tablet_driver") == "winink": tablet_driver = 1 single_window_mode = ProjectSettings.get_setting("display/window/subwindows/embed_subwindows") + low_processor_usage = ProjectSettings.get_setting("application/run/low_processor_mode") window_transparency = ProjectSettings.get_setting( "display/window/per_pixel_transparency/allowed" ) diff --git a/src/Preferences/PreferencesDialog.gd b/src/Preferences/PreferencesDialog.gd index 8272434081f8..f5ae95ea6c21 100644 --- a/src/Preferences/PreferencesDialog.gd +++ b/src/Preferences/PreferencesDialog.gd @@ -175,6 +175,12 @@ var preferences: Array[Preference] = [ "button_pressed", true ), + Preference.new( + "low_processor_usage", + "Performance/PerformanceContainer/LowProcessorUsage", + "button_pressed", + true + ), Preference.new( "window_transparency", "Performance/PerformanceContainer/WindowTransparency", diff --git a/src/Preferences/PreferencesDialog.tscn b/src/Preferences/PreferencesDialog.tscn index 2d3a404a9ed5..809313e05985 100644 --- a/src/Preferences/PreferencesDialog.tscn +++ b/src/Preferences/PreferencesDialog.tscn @@ -1058,6 +1058,19 @@ mouse_default_cursor_shape = 2 button_pressed = true text = "On" +[node name="LowProcessorUsageLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer"] +layout_mode = 2 +tooltip_text = "If this is toggled on, the application will slow down when not used. This helps lower CPU usage when idle." +mouse_filter = 0 +text = "Lower processing speed when not in use" + +[node name="LowProcessorUsage" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer"] +layout_mode = 2 +tooltip_text = "If this is toggled on, the application will slow down when not used. This helps lower CPU usage when idle." +mouse_default_cursor_shape = 2 +button_pressed = true +text = "On" + [node name="WindowTransparencyLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer"] layout_mode = 2 tooltip_text = "If enabled, the application window can become transparent. This affects performance, so keep it off if you don't need it." From e7060bb1e012e06d2381a629d02b2cea67eea72b Mon Sep 17 00:00:00 2001 From: Kiisu_Master <142301391+Kiisu-Master@users.noreply.github.com> Date: Tue, 30 Jul 2024 17:59:40 +0300 Subject: [PATCH 2/3] Update name and description of low processor usage mode setting in preferences --- src/Autoload/Global.gd | 9 +++------ src/Preferences/PreferencesDialog.gd | 6 +++--- src/Preferences/PreferencesDialog.tscn | 10 +++++----- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/Autoload/Global.gd b/src/Autoload/Global.gd index a3a4c4ec6fbc..3eddf04c145a 100644 --- a/src/Autoload/Global.gd +++ b/src/Autoload/Global.gd @@ -475,12 +475,10 @@ var fps_limit := 0: ## Found in Preferences. Affects the per_pixel_transparency project setting. ## If [code]true[/code], it allows for the window to be transparent. ## This affects performance, so keep it [code]false[/code] if you don't need it. -var low_processor_usage := true: +var update_continuously := true: set(value): - if value == low_processor_usage: - return - low_processor_usage = value - OS.low_processor_usage_mode = value + update_continuously = value + OS.low_processor_usage_mode = !value var window_transparency := false: set(value): if value == window_transparency: @@ -686,7 +684,6 @@ func _init() -> void: if ProjectSettings.get_setting("display/window/tablet_driver") == "winink": tablet_driver = 1 single_window_mode = ProjectSettings.get_setting("display/window/subwindows/embed_subwindows") - low_processor_usage = ProjectSettings.get_setting("application/run/low_processor_mode") window_transparency = ProjectSettings.get_setting( "display/window/per_pixel_transparency/allowed" ) diff --git a/src/Preferences/PreferencesDialog.gd b/src/Preferences/PreferencesDialog.gd index f5ae95ea6c21..bea75ff3eb13 100644 --- a/src/Preferences/PreferencesDialog.gd +++ b/src/Preferences/PreferencesDialog.gd @@ -176,10 +176,10 @@ var preferences: Array[Preference] = [ true ), Preference.new( - "low_processor_usage", - "Performance/PerformanceContainer/LowProcessorUsage", + "update_continuously", + "Performance/PerformanceContainer/UpdateContinuously", "button_pressed", - true + false ), Preference.new( "window_transparency", diff --git a/src/Preferences/PreferencesDialog.tscn b/src/Preferences/PreferencesDialog.tscn index 809313e05985..dd1a040fdab7 100644 --- a/src/Preferences/PreferencesDialog.tscn +++ b/src/Preferences/PreferencesDialog.tscn @@ -1058,15 +1058,15 @@ mouse_default_cursor_shape = 2 button_pressed = true text = "On" -[node name="LowProcessorUsageLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer"] +[node name="UpdateContinuouslyLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer"] layout_mode = 2 -tooltip_text = "If this is toggled on, the application will slow down when not used. This helps lower CPU usage when idle." +tooltip_text = "If this is toggled on, the application will redraw the screen continuously, even while it's not used. Turning this off helps lower CPU and GPU usage when idle." mouse_filter = 0 -text = "Lower processing speed when not in use" +text = "Update Continuously" -[node name="LowProcessorUsage" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer"] +[node name="UpdateContinuously" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer"] layout_mode = 2 -tooltip_text = "If this is toggled on, the application will slow down when not used. This helps lower CPU usage when idle." +tooltip_text = "If this is toggled on, the application will redraw the screen continuously, even while it's not used. Turning this off helps lower CPU and GPU usage when idle." mouse_default_cursor_shape = 2 button_pressed = true text = "On" From 3ecdf4bdcb606e3b45454fe7d2c6b810d09f7348 Mon Sep 17 00:00:00 2001 From: Kiisu_Master <142301391+Kiisu-Master@users.noreply.github.com> Date: Tue, 30 Jul 2024 18:01:18 +0300 Subject: [PATCH 3/3] Fix a tiny mistake --- src/Autoload/Global.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Autoload/Global.gd b/src/Autoload/Global.gd index 3eddf04c145a..52f5b35a43ac 100644 --- a/src/Autoload/Global.gd +++ b/src/Autoload/Global.gd @@ -475,7 +475,7 @@ var fps_limit := 0: ## Found in Preferences. Affects the per_pixel_transparency project setting. ## If [code]true[/code], it allows for the window to be transparent. ## This affects performance, so keep it [code]false[/code] if you don't need it. -var update_continuously := true: +var update_continuously := false: set(value): update_continuously = value OS.low_processor_usage_mode = !value