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>2011-08-27 15:52:59 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-08-27 15:52:59 +0400
commit01230b137438881d2bdd9f651143880c84b85bf1 (patch)
treeb47d20eb7d4678730b9193faf4427ce0a5e26fab /source/blender/editors/space_view3d/view3d_edit.c
parenta347f0267b70c35e33d25c05df4a89fa7a95dd04 (diff)
fix [#28373] "Lock camera to view" doew not work with 3D-mouse
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_edit.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c35
1 files changed, 27 insertions, 8 deletions
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;