diff options
Diffstat (limited to 'source/blender/editors/transform/transform.c')
-rw-r--r-- | source/blender/editors/transform/transform.c | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 164d101ebb6..ffd5d425194 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -710,9 +710,9 @@ void transformEvent(TransInfo *t, wmEvent *event) stopConstraint(t); } else { - if (event->keymodifier == 0) + if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0) setUserConstraint(t, (CON_AXIS0), "along %s X"); - else if (event->keymodifier == KM_SHIFT) + else if (t->modifiers & MOD_CONSTRAINT_PLANE) setUserConstraint(t, (CON_AXIS1|CON_AXIS2), "locking %s X"); } } @@ -722,9 +722,9 @@ void transformEvent(TransInfo *t, wmEvent *event) setConstraint(t, mati, (CON_AXIS0), "along X axis"); } else { - if (event->keymodifier == 0) + if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0) setConstraint(t, mati, (CON_AXIS0), "along global X"); - else if (event->keymodifier == KM_SHIFT) + else if (t->modifiers & MOD_CONSTRAINT_PLANE) setConstraint(t, mati, (CON_AXIS1|CON_AXIS2), "locking global X"); } } @@ -742,9 +742,9 @@ void transformEvent(TransInfo *t, wmEvent *event) stopConstraint(t); } else { - if (event->keymodifier == 0) + if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0) setUserConstraint(t, (CON_AXIS1), "along %s Y"); - else if (event->keymodifier == KM_SHIFT) + else if (t->modifiers & MOD_CONSTRAINT_PLANE) setUserConstraint(t, (CON_AXIS0|CON_AXIS2), "locking %s Y"); } } @@ -754,9 +754,9 @@ void transformEvent(TransInfo *t, wmEvent *event) setConstraint(t, mati, (CON_AXIS1), "along Y axis"); } else { - if (event->keymodifier == 0) + if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0) setConstraint(t, mati, (CON_AXIS1), "along global Y"); - else if (event->keymodifier == KM_SHIFT) + else if (t->modifiers & MOD_CONSTRAINT_PLANE) setConstraint(t, mati, (CON_AXIS0|CON_AXIS2), "locking global Y"); } } @@ -770,16 +770,16 @@ void transformEvent(TransInfo *t, wmEvent *event) stopConstraint(t); } else { - if (event->keymodifier == 0) + if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0) setUserConstraint(t, (CON_AXIS2), "along %s Z"); - else if ((event->keymodifier == KM_SHIFT) && ((t->flag & T_2D_EDIT)==0)) + else if ((t->modifiers & MOD_CONSTRAINT_PLANE) && ((t->flag & T_2D_EDIT)==0)) setUserConstraint(t, (CON_AXIS0|CON_AXIS1), "locking %s Z"); } } else if ((t->flag & T_2D_EDIT)==0) { - if (event->keymodifier == 0) + if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0) setConstraint(t, mati, (CON_AXIS2), "along global Z"); - else if (event->keymodifier == KM_SHIFT) + else if (t->modifiers & MOD_CONSTRAINT_PLANE) setConstraint(t, mati, (CON_AXIS0|CON_AXIS1), "locking global Z"); } t->redraw = 1; @@ -963,9 +963,16 @@ void drawTransform(const struct bContext *C, struct ARegion *ar, void *arg) void saveTransform(bContext *C, TransInfo *t, wmOperator *op) { + short twmode= (t->spacetype==SPACE_VIEW3D)? ((View3D*)t->view)->twmode: V3D_MANIP_GLOBAL; + RNA_int_set(op->ptr, "mode", t->mode); RNA_int_set(op->ptr, "options", t->options); RNA_float_set_array(op->ptr, "values", t->values); + + + RNA_int_set(op->ptr, "constraint_mode", t->con.mode); + RNA_int_set(op->ptr, "constraint_orientation", twmode); + RNA_float_set_array(op->ptr, "constraint_matrix", (float*)t->con.mtx); } void initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) @@ -1105,6 +1112,19 @@ void initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) QUATCOPY(t->values, values); /* vec-4 */ } + /* Constraint init from operator */ + { + t->con.mode = RNA_int_get(op->ptr, "constraint_mode"); + + if (t->con.mode & CON_APPLY) + { + //int options = RNA_int_get(op->ptr, "options"); + RNA_float_get_array(op->ptr, "constraint_matrix", (float*)t->spacemtx); + + setUserConstraint(t, t->con.mode, "%s"); + } + + } } void transformApply(bContext *C, TransInfo *t) |