diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-02-18 03:19:41 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-02-18 04:57:48 +0400 |
commit | c67b9f4c3774d72d160901b3d410a685ae8e2359 (patch) | |
tree | 23d398acbac48d46ce3ebfd5158500cf250d704e /source/blender/editors/space_image/image_ops.c | |
parent | f468904e9be6a34b8bd266fe5a251abd83dfd4ca (diff) |
NDOF: image and clip views ignored axis invert preferences
also X/Y invert was swapped for 3d view.
Diffstat (limited to 'source/blender/editors/space_image/image_ops.c')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index bbc24004937..f48532dbac7 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -599,6 +599,7 @@ static int image_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), const wmE else { SpaceImage *sima = CTX_wm_space_image(C); ARegion *ar = CTX_wm_region(C); + float pan_vec[2]; wmNDOFMotionData *ndof = (wmNDOFMotionData *) event->customdata; @@ -607,9 +608,6 @@ static int image_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), const wmE const float zoom_sensitivity = 0.5f; // 50% per second (I think) const float pan_sensitivity = 300.f; // screen pixels per second - float pan_x = pan_sensitivity * dt * ndof->tvec[0] / sima->zoom; - float pan_y = pan_sensitivity * dt * ndof->tvec[1] / sima->zoom; - /* "mouse zoom" factor = 1 + (dx + dy) / 300 * what about "ndof zoom" factor? should behave like this: * at rest -> factor = 1 @@ -618,12 +616,17 @@ static int image_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), const wmE */ float zoom_factor = 1.f + zoom_sensitivity * dt * -ndof->tvec[2]; + pan_vec[0] = ndof->tvec[0] * ((U.ndof_flag & NDOF_PANX_INVERT_AXIS) ? -1.0f : 1.0f); + pan_vec[1] = ndof->tvec[1] * ((U.ndof_flag & NDOF_PANY_INVERT_AXIS) ? -1.0f : 1.0f); + + mul_v2_fl(pan_vec, (pan_sensitivity * dt) / sima->zoom); + if (U.ndof_flag & NDOF_ZOOM_INVERT) zoom_factor = -zoom_factor; sima_zoom_set_factor(sima, ar, zoom_factor, NULL); - sima->xof += pan_x; - sima->yof += pan_y; + sima->xof += pan_vec[0]; + sima->yof += pan_vec[1]; ED_region_tag_redraw(ar); |