aboutsummaryrefslogtreecommitdiff
path: root/tools/editor/plugins/spatial_editor_plugin.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2015-01-02 11:56:32 -0300
committerJuan Linietsky2015-01-02 11:56:32 -0300
commitd34f1da861e66fac40f76045292202ad76efe5d2 (patch)
treefb43cc353eafd7f5e4f82d10e07bb6e351d5b59e /tools/editor/plugins/spatial_editor_plugin.cpp
parentcda249c6add9bc662eaee69a4850a623576f1ca7 (diff)
parentd128ec926369afca89155361c68249df17bdc278 (diff)
downloadgodot-d34f1da861e66fac40f76045292202ad76efe5d2.tar.gz
godot-d34f1da861e66fac40f76045292202ad76efe5d2.tar.zst
godot-d34f1da861e66fac40f76045292202ad76efe5d2.zip
Merge pull request #1068 from jaromirhribal/master
Blender/Maya zoom style.
Diffstat (limited to 'tools/editor/plugins/spatial_editor_plugin.cpp')
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index a1f1ccf5e..0960a961e 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -535,6 +535,14 @@ SpatialEditorViewport::NavigationScheme SpatialEditorViewport::_get_navigation_s
return NAVIGATION_GODOT;
}
+SpatialEditorViewport::NavigationZoomStyle SpatialEditorViewport::_get_navigation_zoom_style(const String& p_property) {
+ switch(EditorSettings::get_singleton()->get(p_property).operator int()) {
+ case 0: return NAVIGATION_ZOOM_VERTICAL;
+ case 1: return NAVIGATION_ZOOM_HORIZONTAL;
+ }
+ return NAVIGATION_ZOOM_VERTICAL;
+}
+
bool SpatialEditorViewport::_gizmo_select(const Vector2& p_screenpos,bool p_hilite_only) {
if (!spatial_editor->is_gizmo_visible())
@@ -1429,10 +1437,19 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
if (nav_scheme==NAVIGATION_MAYA && m.mod.shift)
zoom_speed *= zoom_speed_modifier;
- if ( m.relative_y > 0)
- cursor.distance*=1+m.relative_y*zoom_speed;
- else if (m.relative_y < 0)
- cursor.distance/=1-m.relative_y*zoom_speed;
+ NavigationZoomStyle zoom_style = _get_navigation_zoom_style("3d_editor/zoom_style");
+ if (zoom_style == NAVIGATION_ZOOM_HORIZONTAL) {
+ if ( m.relative_x > 0)
+ cursor.distance*=1-m.relative_x*zoom_speed;
+ else if (m.relative_x < 0)
+ cursor.distance/=1+m.relative_x*zoom_speed;
+ }
+ else {
+ if ( m.relative_y > 0)
+ cursor.distance*=1+m.relative_y*zoom_speed;
+ else if (m.relative_y < 0)
+ cursor.distance/=1-m.relative_y*zoom_speed;
+ }
} break;