[Bf-blender-cvs] [b3791d59f66] master: Fix T60507: Constrained transform shows all axes

Campbell Barton noreply at git.blender.org
Tue Jan 15 08:41:18 CET 2019


Commit: b3791d59f66998ef0552c1c01a95bbecd35afa09
Author: Campbell Barton
Date:   Tue Jan 15 18:39:11 2019 +1100
Branches: master
https://developer.blender.org/rBb3791d59f66998ef0552c1c01a95bbecd35afa09

Fix T60507: Constrained transform shows all axes

Regression in 579c01da600dd

Move values_modal_offset use out of applyMouseInput
to resolve order of initialization issue.

===================================================================

M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform_input.c

===================================================================

diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index c70bfc63b33..c42e350fd5f 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2413,41 +2413,6 @@ 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);
-	}
-
-	if ((prop = RNA_struct_find_property(op->ptr, "axis_ortho")) && RNA_property_is_set(op->ptr, prop)) {
-		RNA_property_float_get_array(op->ptr, prop, t->axis_ortho);
-		normalize_v3(t->axis_ortho);
-	}
-
-	/* Constraint init from operator */
-	if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop)) {
-		bool 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->orientation.user, t->con.mode, "%s");
-		}
-	}
-
 	if (event) {
 		/* Initialize accurate transform to settings requested by keymap. */
 		bool use_accurate = false;
@@ -2601,6 +2566,54 @@ 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);
+	}
+
+	if ((prop = RNA_struct_find_property(op->ptr, "axis_ortho")) && RNA_property_is_set(op->ptr, prop)) {
+		RNA_property_float_get_array(op->ptr, prop, t->axis_ortho);
+		normalize_v3(t->axis_ortho);
+	}
+
+	/* Constraint init from operator */
+	if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop)) {
+		bool 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->orientation.user, t->con.mode, "%s");
+		}
+	}
+	/* Apply values_modal_offset (after we have constraints). */
+	if (t->flag & T_MODAL) {
+		if (!is_zero_v3(t->values_modal_offset)) {
+			float values_ofs[3];
+			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);
+		}
+	}
+
 	if ((prop = RNA_struct_find_property(op->ptr, "preserve_clnor"))) {
 		if ((t->flag & T_EDIT) && t->obedit_type == OB_MESH) {
 
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index 2721bccb7de..20c442d5881 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -435,17 +435,6 @@ void applyMouseInput(TransInfo *t, MouseInput *mi, const int mval[2], float outp
 		mi->apply(t, mi, mval_db, output);
 	}
 
-	if (!is_zero_v3(t->values_modal_offset)) {
-		float values_ofs[3];
-		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);
-	}
-
 	if (mi->post) {
 		mi->post(t, output);
 	}



More information about the Bf-blender-cvs mailing list