Commit: 137ca0b241f6bda1577121d655d3e0f257dab900
Author: Campbell Barton
Date: Thu Nov 12 02:12:03 2015 +1100
Branches: master
https://developer.blender.org/rB137ca0b241f6bda1577121d655d3e0f257dab900
Fix T46741: Transform ignores constraint space
Calling transform operator from Python didn't apply the constraints space.
===================================================================
M source/blender/editors/transform/transform.c
===================================================================
diff --git a/source/blender/editors/transform/transform.c
b/source/blender/editors/transform/transform.c
index 2fcdb19..e735151 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1903,7 +1903,14 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator
*op)
}
if ((prop = RNA_struct_find_property(op->ptr, "value"))) {
- const float *values = (t->flag & T_AUTOVALUES) ? t->auto_values
: t->values;
+ float values[4];
+
+ copy_v4_v4(values, (t->flag & T_AUTOVALUES) ? t->auto_values :
t->values);
+
+ if (t->con.mode & CON_APPLY) {
+ mul_v3_m3v3(values, t->con.imtx, values);
+ }
+
if (RNA_property_array_check(prop)) {
RNA_property_float_set_array(op->ptr, prop, values);
}
@@ -2302,22 +2309,6 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator
*op, const wmEvent *eve
return 0;
}
- /* overwrite initial values if operator supplied a non-null vector */
- if ((prop = RNA_struct_find_property(op->ptr, "value")) &&
RNA_property_is_set(op->ptr, prop)) {
- float values[4] = {0}; /* in case value isn't length 4, avoid
uninitialized memory */
-
- if (RNA_property_array_check(prop)) {
- RNA_float_get_array(op->ptr, "value", values);
- }
- else {
- values[0] = RNA_float_get(op->ptr, "value");
- }
-
- copy_v4_v4(t->values, values);
- copy_v4_v4(t->auto_values, values);
- t->flag |= T_AUTOVALUES;
- }
-
/* 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);
@@ -2348,6 +2339,29 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator
*op, const wmEvent *eve
}
}
+ /* overwrite initial values if operator supplied a non-null vector
+ *
+ * keep last so we can apply the constraints space.
+ */
+ if ((prop = RNA_struct_find_property(op->ptr, "value")) &&
RNA_property_is_set(op->ptr, prop)) {
+ float values[4] = {0}; /* in case value isn't length 4, avoid
uninitialized memory */
+
+ if (RNA_property_array_check(prop)) {
+ RNA_float_get_array(op->ptr, "value", values);
+ }
+ else {
+ values[0] = RNA_float_get(op->ptr, "value");
+ }
+
+ if (t->con.mode & CON_APPLY) {
+ mul_m3_v3(t->con.mtx, values);
+ }
+
+ copy_v4_v4(t->values, values);
+ copy_v4_v4(t->auto_values, values);
+ t->flag |= T_AUTOVALUES;
+ }
+
t->context = NULL;
return 1;
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs