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:
authorMartin Poirier <theeth@yahoo.com>2010-01-04 23:49:42 +0300
committerMartin Poirier <theeth@yahoo.com>2010-01-04 23:49:42 +0300
commit05258297356fc2366506ac5dacc3feb74dcbba35 (patch)
tree01b62c502525b0f673230875ce5b7c604e05e685 /source/blender/editors/transform/transform.c
parenta325b8b3b9c68b0c554ce91211280c640b50e981 (diff)
transform:
Rotation operator now saves axis of rotation (when not using a constraint). Better for operator redo and tweak (would use a Z axis because of matrix init) Also fix crash in Translation operator redo and tweak (rv3d is not always available).
Diffstat (limited to 'source/blender/editors/transform/transform.c')
-rw-r--r--source/blender/editors/transform/transform.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 7de2006a35c..e8e7e323496 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1384,6 +1384,11 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
RNA_float_set(op->ptr, "proportional_size", t->prop_size);
}
+ if (RNA_struct_find_property(op->ptr, "axis"))
+ {
+ RNA_float_set_array(op->ptr, "axis", t->axis);
+ }
+
if (RNA_struct_find_property(op->ptr, "mirror"))
{
RNA_boolean_set(op->ptr, "mirror", t->flag & T_MIRROR);
@@ -1577,6 +1582,13 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
t->flag |= T_AUTOVALUES;
}
+ /* Transformation axis from operator */
+ if (RNA_struct_find_property(op->ptr, "axis") && RNA_property_is_set(op->ptr, "axis"))
+ {
+ RNA_float_get_array(op->ptr, "axis", t->axis);
+ normalize_v3(t->axis);
+ }
+
/* Constraint init from operator */
if (RNA_struct_find_property(op->ptr, "constraint_axis") && RNA_property_is_set(op->ptr, "constraint_axis"))
{
@@ -2662,6 +2674,10 @@ void initRotation(TransInfo *t)
if (t->flag & T_2D_EDIT)
t->flag |= T_NO_CONSTRAINT;
+
+ VECCOPY(t->axis, t->viewinv[2]);
+ mul_v3_fl(t->axis, -1.0f);
+ normalize_v3(t->axis);
}
static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short around) {
@@ -2906,13 +2922,8 @@ int Rotation(TransInfo *t, short mval[2])
float final;
- float axis[3];
float mat[3][3];
- VECCOPY(axis, t->viewinv[2]);
- mul_v3_fl(axis, -1.0f);
- normalize_v3(axis);
-
final = t->values[0];
applyNDofInput(&t->ndof, &final);
@@ -2920,7 +2931,7 @@ int Rotation(TransInfo *t, short mval[2])
snapGrid(t, &final);
if (t->con.applyRot) {
- t->con.applyRot(t, NULL, axis, &final);
+ t->con.applyRot(t, NULL, t->axis, &final);
}
applySnapping(t, &final);
@@ -2947,13 +2958,13 @@ int Rotation(TransInfo *t, short mval[2])
sprintf(str, "Rot: %.2f%s %s", 180.0*final/M_PI, t->con.text, t->proptext);
}
- vec_rot_to_mat3( mat,axis, final);
+ vec_rot_to_mat3( mat, t->axis, final);
// TRANSFORM_FIX_ME
// t->values[0] = final; // used in manipulator
// copy_m3_m3(t->mat, mat); // used in manipulator
- applyRotation(t, final, axis);
+ applyRotation(t, final, t->axis);
recalcData(t);
@@ -3085,9 +3096,11 @@ void initTranslation(TransInfo *t)
if(t->spacetype == SPACE_VIEW3D) {
RegionView3D *rv3d = t->ar->regiondata;
- t->snap[0] = 0.0f;
- t->snap[1] = rv3d->gridview * 1.0f;
- t->snap[2] = t->snap[1] * 0.1f;
+ if (rv3d) {
+ t->snap[0] = 0.0f;
+ t->snap[1] = rv3d->gridview * 1.0f;
+ t->snap[2] = t->snap[1] * 0.1f;
+ }
}
else if(t->spacetype == SPACE_IMAGE) {
t->snap[0] = 0.0f;