diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-11-03 07:38:07 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-11-03 07:38:07 +0300 |
commit | de8e066a1ca29fe58295ee6b12b735d023528681 (patch) | |
tree | 6d8915448c801c634bb3f74cddf0abe9d4a429f9 /source/blender/editors | |
parent | 3db9233ae5a0a18a8d48edea1176c810303926e6 (diff) |
bugfix [#24505] Python command bpy.ops.transform.rotate(...) does not follow axis=(...) attribute
the axis was being constantly re-initialized from the view.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/transform/transform.c | 8 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.h | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 57298bdd0d3..e839a51561c 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1678,7 +1678,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int /* overwrite initial values if operator supplied a non-null vector */ if (RNA_property_is_set(op->ptr, "value")) { - float values[4]; + float values[4]= {0}; /* incase value isn't length 4, avoid uninitialized memory */ RNA_float_get_array(op->ptr, "value", values); QUATCOPY(t->values, values); QUATCOPY(t->auto_values, values); @@ -1690,6 +1690,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int { RNA_float_get_array(op->ptr, "axis", t->axis); normalize_v3(t->axis); + copy_v3_v3(t->axis_orig, t->axis); } /* Constraint init from operator */ @@ -2843,6 +2844,8 @@ void initRotation(TransInfo *t) negate_v3_v3(t->axis, t->viewinv[2]); normalize_v3(t->axis); + + copy_v3_v3(t->axis_orig, t->axis); } static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short around) { @@ -3109,8 +3112,7 @@ int Rotation(TransInfo *t, short UNUSED(mval[2])) t->con.applyRot(t, NULL, t->axis, NULL); } else { /* reset axis if constraint is not set */ - negate_v3_v3(t->axis, t->viewinv[2]); - normalize_v3(t->axis); + copy_v3_v3(t->axis, t->axis_orig); } applySnapping(t, &final); diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 49ce4d2e0dd..ec18b2f81a0 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -314,6 +314,7 @@ typedef struct TransInfo { float values[4]; float auto_values[4]; float axis[3]; + float axis_orig[3]; /* TransCon can change 'axis', store the original value here */ void *view; struct ScrArea *sa; |