diff options
-rw-r--r-- | source/blender/editors/include/ED_view3d.h | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 35 |
2 files changed, 29 insertions, 10 deletions
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index dfe0a304748..f8682d3935b 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -288,7 +288,7 @@ unsigned int ED_viewedit_datamask(struct bScreen *screen); int ED_view3d_camera_lock_check(struct View3D *v3d, struct RegionView3D *rv3d); /* copy the camera to the view before starting a view transformation */ void ED_view3d_camera_lock_init(struct View3D *v3d, struct RegionView3D *rv3d); -/* copy the view to the camera */ -void ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d); +/* copy the view to the camera, return TRUE if */ +int ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d); #endif /* ED_VIEW3D_H */ diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 0e8dd38c02c..e9ed5dac3de 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -97,7 +97,8 @@ void ED_view3d_camera_lock_init(View3D *v3d, RegionView3D *rv3d) } } -void ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) +/* return TRUE if the camera is moved */ +int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) { if(ED_view3d_camera_lock_check(v3d, rv3d)) { Object *root_parent; @@ -132,6 +133,11 @@ void ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB); WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, v3d->camera); } + + return TRUE; + } + else { + return FALSE; } } @@ -944,17 +950,22 @@ void ndof_to_quat(struct wmNDOFMotionData* ndof, float q[4]) axis_angle_to_quat(q, axis, angle); } +/* -- "orbit" navigation (trackball/turntable) + * -- zooming + * -- panning in rotationally-locked views + */ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) -// -- "orbit" navigation (trackball/turntable) -// -- zooming -// -- panning in rotationally-locked views { - if (event->type != NDOF_MOTION) + if (event->type != NDOF_MOTION) { return OPERATOR_CANCELLED; + } else { + View3D *v3d= CTX_wm_view3d(C); RegionView3D* rv3d = CTX_wm_region_view3d(C); wmNDOFMotionData* ndof = (wmNDOFMotionData*) event->customdata; + ED_view3d_camera_lock_init(v3d, rv3d); + rv3d->rot_angle = 0.f; // off by default, until changed later this function if (ndof->progress != P_FINISHING) { @@ -1064,6 +1075,8 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event } } + ED_view3d_camera_lock_sync(v3d, rv3d); + ED_region_tag_redraw(CTX_wm_region(C)); return OPERATOR_FINISHED; @@ -1085,16 +1098,20 @@ void VIEW3D_OT_ndof_orbit(struct wmOperatorType *ot) ot->flag = 0; } +/* -- "pan" navigation + * -- zoom or dolly? + */ static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) -// -- "pan" navigation -// -- zoom or dolly? { - if (event->type != NDOF_MOTION) + if (event->type != NDOF_MOTION) { return OPERATOR_CANCELLED; + } else { + View3D *v3d= CTX_wm_view3d(C); RegionView3D* rv3d = CTX_wm_region_view3d(C); wmNDOFMotionData* ndof = (wmNDOFMotionData*) event->customdata; + ED_view3d_camera_lock_init(v3d, rv3d); rv3d->rot_angle = 0.f; // we're panning here! so erase any leftover rotation from other operators @@ -1141,6 +1158,8 @@ static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) sub_v3_v3(rv3d->ofs, pan_vec); } + ED_view3d_camera_lock_sync(v3d, rv3d); + ED_region_tag_redraw(CTX_wm_region(C)); return OPERATOR_FINISHED; |