diff options
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_edit.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 80515e32487..6f45013ce42 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -565,22 +565,20 @@ typedef struct ViewOpsData { static void calctrackballvec(const rcti *rect, int mx, int my, float vec[3]) { - float x, y, radius, d, z, t; - - radius = TRACKBALLSIZE; + const float radius = TRACKBALLSIZE; + const float t = radius / (float)M_SQRT2; + float x, y, z, d; /* normalize x and y */ x = BLI_rcti_cent_x(rect) - mx; x /= (float)(BLI_rcti_size_x(rect) / 4); y = BLI_rcti_cent_y(rect) - my; y /= (float)(BLI_rcti_size_y(rect) / 2); - d = sqrtf(x * x + y * y); - if (d < radius * (float)M_SQRT1_2) { /* Inside sphere */ + if (d < t) { /* Inside sphere */ z = sqrtf(radius * radius - d * d); } else { /* On hyperbola */ - t = radius / (float)M_SQRT2; z = t * t / d; } @@ -4778,13 +4776,10 @@ static int manipulator_invoke(bContext *C, wmOperator *op, const wmEvent *event) if (!(v3d->twflag & V3D_USE_MANIPULATOR)) return OPERATOR_PASS_THROUGH; if (!(v3d->twflag & V3D_DRAW_MANIPULATOR)) return OPERATOR_PASS_THROUGH; - /* only no modifier or shift */ - if (event->keymodifier != 0 && event->keymodifier != KM_SHIFT) return OPERATOR_PASS_THROUGH; - /* note; otherwise opengl won't work */ view3d_operator_needs_opengl(C); - if (0 == BIF_do_manipulator(C, event, op)) + if (BIF_do_manipulator(C, event, op) == 0) return OPERATOR_PASS_THROUGH; return OPERATOR_FINISHED; @@ -4805,6 +4800,9 @@ void VIEW3D_OT_manipulator(wmOperatorType *ot) /* properties to pass to transform */ Transform_Properties(ot, P_CONSTRAINT); + + RNA_def_boolean(ot->srna, "use_planar_constraint", false, "Planar Constraint", "Limit the transformation to the " + "two axes that have not been clicked (translate/scale only)"); } static int enable_manipulator_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) |