Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-02-24 05:36:57 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-02-24 05:56:17 +0400
commitcb3909f721551e0b22015a067cb84e0ab25772f0 (patch)
tree74b0d320b0bf769ddf9ec20b496a94c2da008c69 /source/blender/editors/space_view3d/view3d_edit.c
parent056d86ec83c5e66c636893b3ab19032dd4876d49 (diff)
NDOF: fix for use with locked offset
- when locked to cursor or object. fallback to orbit and allow zoom. - correct speed calculation in perspective mode.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_edit.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 77b0e945c9c..05af1e2bd49 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -1144,9 +1144,8 @@ void VIEW3D_OT_rotate(wmOperatorType *ot)
ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_POINTER;
}
-/* NDOF utility functions
- * (should these functions live in this file?)
- */
+/** \name NDOF Utility Functions
+ * \{ */
#define NDOF_HAS_TRANSLATE ((!ED_view3d_offset_lock_check(v3d, rv3d)) && !is_zero_v3(ndof->tvec))
#define NDOF_HAS_ROTATE (((rv3d->viewlock & RV3D_LOCKED) == 0) && !is_zero_v3(ndof->rvec))
@@ -1156,7 +1155,9 @@ static float view3d_ndof_pan_speed_calc(RegionView3D *rv3d)
float speed = rv3d->pixsize * NDOF_PIXELS_PER_SECOND;
if (rv3d->is_persp) {
- speed *= ED_view3d_calc_zfac(rv3d, rv3d->ofs, NULL);
+ float tvec[3];
+ negate_v3_v3(tvec, rv3d->ofs);
+ speed *= ED_view3d_calc_zfac(rv3d, tvec, NULL);
}
return speed;
@@ -1427,6 +1428,9 @@ void view3d_ndof_fly(
*r_has_rotate = has_rotate;
}
+/** \} */
+
+
/* -- "orbit" navigation (trackball/turntable)
* -- zooming
* -- panning in rotationally-locked views
@@ -1460,7 +1464,7 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *op, const wmEvent *event)
const bool has_rotation = NDOF_HAS_ROTATE;
/* if we can't rotate, fallback to translate (locked axis views) */
const bool has_translate = NDOF_HAS_TRANSLATE && (rv3d->viewlock & RV3D_LOCKED);
- const bool has_zoom = !rv3d->is_persp;
+ const bool has_zoom = (ndof->tvec[2] != 0.0f) && !rv3d->is_persp;
if (has_translate || has_zoom) {
view3d_ndof_pan_zoom(ndof, vod->sa, vod->ar, has_translate, has_zoom);
@@ -1527,12 +1531,15 @@ static int ndof_orbit_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *ev
else if (RV3D_VIEW_IS_AXIS(rv3d->view)) {
/* if we can't rotate, fallback to translate (locked axis views) */
const bool has_translate = NDOF_HAS_TRANSLATE;
+ const bool has_zoom = (ndof->tvec[2] != 0.0f) && ED_view3d_offset_lock_check(v3d, rv3d);
- if (has_translate) {
+ if (has_translate || has_zoom) {
view3d_ndof_pan_zoom(ndof, vod->sa, vod->ar, has_translate, true);
}
}
- else if (U.ndof_flag & NDOF_MODE_ORBIT) {
+ else if ((U.ndof_flag & NDOF_MODE_ORBIT) ||
+ ED_view3d_offset_lock_check(v3d, rv3d))
+ {
const bool has_rotation = NDOF_HAS_ROTATE;
const bool has_zoom = (ndof->tvec[2] != 0.0f);
@@ -1604,7 +1611,7 @@ static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *e
const wmNDOFMotionData *ndof = event->customdata;
const bool has_translate = NDOF_HAS_TRANSLATE;
- const bool has_zoom = !rv3d->is_persp;
+ const bool has_zoom = (ndof->tvec[2] != 0.0f) && !rv3d->is_persp;
/* we're panning here! so erase any leftover rotation from other operators */
rv3d->rot_angle = 0.0f;