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:
authorJoerg Mueller <nexyon@gmail.com>2011-08-30 12:22:03 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-08-30 12:22:03 +0400
commit43ab8e86247b7889d16d915b4f370ceb618aaad4 (patch)
tree64b1fec1adcc399eb1de5cd86ebafd753a921d8d /source/blender/editors/space_view3d/view3d_edit.c
parent5b5e600db6f529ad7e1af9d4bb3a193be2265342 (diff)
parentd049a722fea3d150fbfad06ffdbbb5c150717134 (diff)
* Merge trunk up to r39790.soc-2011-pepper
* Subversion bump (also for init_userdef_do_versions). * Minor fix for compilation without ffmpeg.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_edit.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c53
1 files changed, 35 insertions, 18 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 979a602b4f5..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;
}
}
@@ -372,12 +378,12 @@ static void calctrackballvec(rcti *rect, int mx, int my, float *vec)
y/= (float)((rect->ymax - rect->ymin)/2);
d = sqrt(x*x + y*y);
- if (d < radius * (float)M_SQRT1_2) /* Inside sphere */
- z = sqrt(radius*radius - d*d);
- else
- { /* On hyperbola */
- t = radius / (float)M_SQRT2;
- z = t*t / d;
+ if (d < radius * (float)M_SQRT1_2) { /* Inside sphere */
+ z= sqrt(radius*radius - d*d);
+ }
+ else { /* On hyperbola */
+ t= radius / (float)M_SQRT2;
+ z= t*t / d;
}
vec[0]= x;
@@ -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;
@@ -1620,8 +1639,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
vod= op->customdata;
/* if one or the other zoom position aren't set, set from event */
- if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my"))
- {
+ if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my")) {
RNA_int_set(op->ptr, "mx", event->x);
RNA_int_set(op->ptr, "my", event->y);
}
@@ -1834,8 +1852,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, wmEvent *event)
vod= op->customdata;
/* if one or the other zoom position aren't set, set from event */
- if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my"))
- {
+ if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my")) {
RNA_int_set(op->ptr, "mx", event->x);
RNA_int_set(op->ptr, "my", event->y);
}