diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-08 21:28:40 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-08 21:30:29 +0300 |
commit | 579c01da600ddc1b2567997d037c43ec472081f4 (patch) | |
tree | ebb9e4b009311b7445d1e0384af65bcc2f1e8ecd /source/blender/editors/transform | |
parent | b7b59a72f3f78be61b29aa9fbb7cbe42ea4fa579 (diff) |
Extrude Widget: with/without axis constraint
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r-- | source/blender/editors/transform/transform.c | 60 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_input.c | 7 |
2 files changed, 36 insertions, 31 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 41cc2087dea..632779d50a4 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2257,6 +2257,36 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve } } + /* Transformation axis from operator */ + if ((prop = RNA_struct_find_property(op->ptr, "axis")) && RNA_property_is_set(op->ptr, prop)) { + RNA_property_float_get_array(op->ptr, prop, t->axis); + normalize_v3(t->axis); + copy_v3_v3(t->axis_orig, t->axis); + } + + /* Constraint init from operator */ + if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop)) { + int constraint_axis[3]; + + RNA_property_boolean_get_array(op->ptr, prop, constraint_axis); + + if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) { + t->con.mode |= CON_APPLY; + + if (constraint_axis[0]) { + t->con.mode |= CON_AXIS0; + } + if (constraint_axis[1]) { + t->con.mode |= CON_AXIS1; + } + if (constraint_axis[2]) { + t->con.mode |= CON_AXIS2; + } + + setUserConstraint(t, t->current_orientation, t->con.mode, "%s"); + } + } + if (event) { /* Initialize accurate transform to settings requested by keymap. */ bool use_accurate = false; @@ -2405,36 +2435,6 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve return 0; } - /* Transformation axis from operator */ - if ((prop = RNA_struct_find_property(op->ptr, "axis")) && RNA_property_is_set(op->ptr, prop)) { - RNA_property_float_get_array(op->ptr, prop, t->axis); - normalize_v3(t->axis); - copy_v3_v3(t->axis_orig, t->axis); - } - - /* Constraint init from operator */ - if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop)) { - int constraint_axis[3]; - - RNA_property_boolean_get_array(op->ptr, prop, constraint_axis); - - if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) { - t->con.mode |= CON_APPLY; - - if (constraint_axis[0]) { - t->con.mode |= CON_AXIS0; - } - if (constraint_axis[1]) { - t->con.mode |= CON_AXIS1; - } - if (constraint_axis[2]) { - t->con.mode |= CON_AXIS2; - } - - setUserConstraint(t, t->current_orientation, t->con.mode, "%s"); - } - } - t->context = NULL; return 1; diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index 799d2acb918..3e4efaa939b 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -419,7 +419,12 @@ void applyMouseInput(TransInfo *t, MouseInput *mi, const int mval[2], float outp if (!is_zero_v3(t->values_modal_offset)) { float values_ofs[3]; - mul_v3_m3v3(values_ofs, t->spacemtx, t->values_modal_offset); + if (t->con.mode & CON_APPLY) { + mul_v3_m3v3(values_ofs, t->spacemtx, t->values_modal_offset); + } + else { + copy_v3_v3(values_ofs, t->values_modal_offset); + } add_v3_v3(t->values, values_ofs); } |