From 4c3b3744ddb642507dee1692b0c2d158a77c80d6 Mon Sep 17 00:00:00 2001 From: jazztickets Date: Sun, 3 Mar 2024 11:13:39 -0700 Subject: [PATCH] Add separate Freelook Invert Y Axis option --- doc/classes/EditorSettings.xml | 5 ++++- editor/scene/3d/node_3d_editor_plugin.cpp | 2 +- editor/settings/editor_settings.cpp | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index b1ee344b24..a43a8edb35 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -392,6 +392,9 @@ The inertia of the 3D freelook camera. Higher values make the camera start and stop slower, which looks smoother but adds latency. + + If [code]true[/code], invert the vertical mouse axis when using freelook mode in the 3D editor. + The navigation scheme to use when freelook is enabled in the 3D editor. Some of the navigation schemes below may be more convenient when designing specific levels in the 3D editor. - [b]Default:[/b] The "Freelook Forward", "Freelook Backward", "Freelook Up" and "Freelook Down" keys will move relative to the camera, taking its pitch angle into account for the movement. @@ -443,7 +446,7 @@ If [code]true[/code], invert the horizontal mouse axis when panning or orbiting in the 3D editor. This setting does [i]not[/i] apply to freelook mode. - If [code]true[/code], invert the vertical mouse axis when panning, orbiting, or using freelook mode in the 3D editor. + If [code]true[/code], invert the vertical mouse axis when panning or orbiting in the 3D editor. The navigation scheme preset to use in the 3D editor. Changing this setting will affect the mouse button and modifier keys used to navigate the 3D editor viewport. diff --git a/editor/scene/3d/node_3d_editor_plugin.cpp b/editor/scene/3d/node_3d_editor_plugin.cpp index a83b89e489..de939266f5 100644 --- a/editor/scene/3d/node_3d_editor_plugin.cpp +++ b/editor/scene/3d/node_3d_editor_plugin.cpp @@ -2989,7 +2989,7 @@ void Node3DEditorViewport::_nav_look(Ref p_event, const // Scale mouse sensitivity with camera FOV scale when zoomed in to make it easier to point at things. const real_t degrees_per_pixel = real_t(EDITOR_GET("editors/3d/freelook/freelook_sensitivity")) * MIN(1.0, cursor.fov_scale); const real_t radians_per_pixel = Math::deg_to_rad(degrees_per_pixel); - const bool invert_y_axis = EDITOR_GET("editors/3d/navigation/invert_y_axis"); + const bool invert_y_axis = EDITOR_GET("editors/3d/freelook/freelook_invert_y_axis"); // Note: do NOT assume the camera has the "current" transform, because it is interpolated and may have "lag". const Transform3D prev_camera_transform = to_camera_transform(cursor); diff --git a/editor/settings/editor_settings.cpp b/editor/settings/editor_settings.cpp index f9d94c834e..5308691e23 100644 --- a/editor/settings/editor_settings.cpp +++ b/editor/settings/editor_settings.cpp @@ -978,6 +978,7 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/freelook/freelook_inertia", 0.0, "0,1,0.001") EDITOR_SETTING_BASIC(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/freelook/freelook_base_speed", 5.0, "0,10,0.01,or_greater") EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "editors/3d/freelook/freelook_activation_modifier", 0, "None,Shift,Alt,Meta,Ctrl") + _initial_set("editors/3d/freelook/freelook_invert_y_axis", false); _initial_set("editors/3d/freelook/freelook_speed_zoom_link", false); // 3D: Manipulator