summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/classes/EditorSettings.xml5
-rw-r--r--doc/classes/ProjectSettings.xml2
-rw-r--r--editor/editor_node.cpp8
-rw-r--r--editor/editor_node.h1
-rw-r--r--editor/editor_settings.cpp3
5 files changed, 18 insertions, 1 deletions
diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml
index 449f5639fd..20842e7535 100644
--- a/doc/classes/EditorSettings.xml
+++ b/doc/classes/EditorSettings.xml
@@ -629,6 +629,11 @@
If [code]true[/code], editor main menu is using embedded [MenuBar] instead of system global menu.
Specific to the macOS platform.
</member>
+ <member name="interface/editor/vsync_mode" type="int" setter="" getter="">
+ Sets the V-Sync mode for the editor. Does not affect the project when run from the editor (this is controlled by [member ProjectSettings.display/window/vsync/vsync_mode]).
+ Depending on the platform and used renderer, the engine will fall back to [b]Enabled[/b] if the desired mode is not supported.
+ [b]Note:[/b] V-Sync modes other than [b]Enabled[/b] are only supported in the Forward+ and Mobile rendering methods, not Compatibility.
+ </member>
<member name="interface/inspector/float_drag_speed" type="float" setter="" getter="">
Base speed for increasing/decreasing float values by dragging them in the inspector.
</member>
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index ae5eb435ba..f4109963a3 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -875,7 +875,7 @@
If [code]true[/code] subwindows are embedded in the main window.
</member>
<member name="display/window/vsync/vsync_mode" type="int" setter="" getter="" default="1">
- Sets the V-Sync mode for the main game window.
+ Sets the V-Sync mode for the main game window. The editor's own V-Sync mode can be set using [member EditorSettings.interface/editor/vsync_mode].
See [enum DisplayServer.VSyncMode] for possible values and how they affect the behavior of your application.
Depending on the platform and used renderer, the engine will fall back to [b]Enabled[/b] if the desired mode is not supported.
[b]Note:[/b] V-Sync modes other than [b]Enabled[/b] are only supported in the Forward+ and Mobile rendering methods, not Compatibility.
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 6711be3d06..25b828aff8 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -345,6 +345,11 @@ void EditorNode::shortcut_input(const Ref<InputEvent> &p_event) {
}
}
+void EditorNode::_update_vsync_mode() {
+ const DisplayServer::VSyncMode window_vsync_mode = DisplayServer::VSyncMode(int(EDITOR_GET("interface/editor/vsync_mode")));
+ DisplayServer::get_singleton()->window_set_vsync_mode(window_vsync_mode);
+}
+
void EditorNode::_update_from_settings() {
_update_title();
@@ -758,6 +763,7 @@ void EditorNode::_notification(int p_what) {
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
+ _update_vsync_mode();
FileDialog::set_default_show_hidden_files(EDITOR_GET("filesystem/file_dialog/show_hidden_files"));
EditorFileDialog::set_default_show_hidden_files(EDITOR_GET("filesystem/file_dialog/show_hidden_files"));
EditorFileDialog::set_default_display_mode((EditorFileDialog::DisplayMode)EDITOR_GET("filesystem/file_dialog/display_mode").operator int());
@@ -6268,6 +6274,8 @@ EditorNode::EditorNode() {
FileAccess::set_backup_save(EDITOR_GET("filesystem/on_save/safe_save_on_backup_then_rename"));
+ _update_vsync_mode();
+
// Warm up the surface upgrade tool as early as possible.
surface_upgrade_tool = memnew(SurfaceUpgradeTool);
run_surface_upgrade_tool = EditorSettings::get_singleton()->get_project_metadata("surface_upgrade_tool", "run_on_restart", false);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index e7011e921e..04d7b921c5 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -584,6 +584,7 @@ private:
void _dropped_files(const Vector<String> &p_files);
void _add_dropped_files_recursive(const Vector<String> &p_files, String to_path);
+ void _update_vsync_mode();
void _update_from_settings();
void _gdextensions_reloaded();
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 060f205416..9ba3eec817 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -439,6 +439,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
// low FPS limits, the editor can take a small while to become usable after
// being focused again, so this should be used at the user's discretion.
EDITOR_SETTING_USAGE(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/editor/unfocused_low_processor_mode_sleep_usec", 100000, "1,1000000,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)
+
+ EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/vsync_mode", 1, "Disabled,Enabled,Adaptive,Mailbox")
+
_initial_set("interface/editor/separate_distraction_mode", false);
_initial_set("interface/editor/automatically_open_screenshots", true);
EDITOR_SETTING_USAGE(Variant::BOOL, PROPERTY_HINT_NONE, "interface/editor/single_window_mode", false, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)