Fix T100953: Zooming with NDOF is inverted in the camera view

Use convention for applying zoom in other 2D views.
This commit is contained in:
Campbell Barton 2022-10-07 17:44:17 +11:00 committed by Philipp Oeser
parent c98268d3f5
commit 6004e9d62b
Notes: blender-bot 2023-02-14 11:42:40 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3
Referenced by issue #100953, Zooming with NDOF device is inverted in Camera View
1 changed files with 5 additions and 2 deletions

View File

@ -376,6 +376,9 @@ static int view3d_ndof_cameraview_pan_zoom(bContext *C, const wmEvent *event)
float pan_vec[3];
WM_event_ndof_pan_get(ndof, pan_vec, true);
mul_v2_fl(pan_vec, ndof->dt);
pan_vec[2] *= -ndof->dt;
/* NOTE(@campbellbarton): In principle rotating could pass through to regular
* non-camera NDOF behavior (exiting the camera-view and rotating).
* Disabled this block since in practice it's difficult to control NDOF devices
@ -390,7 +393,7 @@ static int view3d_ndof_cameraview_pan_zoom(bContext *C, const wmEvent *event)
bool changed = false;
if (has_translate) {
const float speed = ndof->dt * NDOF_PIXELS_PER_SECOND;
const float speed = NDOF_PIXELS_PER_SECOND;
float event_ofs[2] = {pan_vec[0] * speed, pan_vec[1] * speed};
if (ED_view3d_camera_view_pan(region, event_ofs)) {
changed = true;
@ -398,7 +401,7 @@ static int view3d_ndof_cameraview_pan_zoom(bContext *C, const wmEvent *event)
}
if (has_zoom) {
const float scale = 1.0f + (ndof->dt * pan_vec[2]);
const float scale = 1.0f + pan_vec[2];
if (ED_view3d_camera_view_zoom_scale(rv3d, scale)) {
changed = true;
}