From 81245a634b9dff041b0f2373c643166267a03857 Mon Sep 17 00:00:00 2001 From: toger5 Date: Tue, 19 Sep 2017 01:30:14 +0200 Subject: [PATCH] zoom inertia uses its own setting (not the same then translation) --- editor/editor_settings.cpp | 3 +++ editor/plugins/spatial_editor_plugin.cpp | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index d4ee6b2d17b..e5fbf7915d0 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -677,6 +677,9 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { set("editors/3d/orbit_sensitivity", 0.4); + set("editors/3d/zoom_inertia", 0.1); + hints["editors/3d/zoom_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/zoom_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01"); + set("editors/3d/orbit_inertia", 0.2); hints["editors/3d/orbit_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/orbit_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01"); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index a6ab36ed276..f50e7921781 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -83,6 +83,8 @@ void SpatialEditorViewport::_update_camera(float p_interp_delta) { float manip_orbit_inertia = EDITOR_DEF("editors/3d/manipulation_orbit_inertia", 0.075); float manip_translation_inertia = EDITOR_DEF("editors/3d/manipulation_translation_inertia", 0.075); + float zoom_inertia = EDITOR_DEF("editors/3d/zoom_inertia", 0.0); + //determine if being manipulated bool manipulated = (Input::get_singleton()->get_mouse_button_mask() & (2 | 4)) || Input::get_singleton()->is_key_pressed(KEY_SHIFT) || Input::get_singleton()->is_key_pressed(KEY_ALT) || Input::get_singleton()->is_key_pressed(KEY_CONTROL); @@ -96,7 +98,7 @@ void SpatialEditorViewport::_update_camera(float p_interp_delta) { camera_cursor.y_rot = Math::lerp(old_camera_cursor.y_rot, cursor.y_rot, MIN(1.f, p_interp_delta * (1 / orbit_inertia))); camera_cursor.pos = old_camera_cursor.pos.linear_interpolate(cursor.pos, MIN(1.f, p_interp_delta * (1 / translation_inertia))); - camera_cursor.distance = Math::lerp(old_camera_cursor.distance, cursor.distance, MIN(1.f, p_interp_delta * (1 / translation_inertia))); + camera_cursor.distance = Math::lerp(old_camera_cursor.distance, cursor.distance, MIN(1.f, p_interp_delta * (1 / zoom_inertia))); if (p_interp_delta == 0 || is_freelook_active()) { camera_cursor = cursor;