[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32850] trunk/blender/source/blender/ editors/transform: bugfix [#24505] Python command bpy.ops.transform.rotate( ...) does not follow axis=(...) attribute

Campbell Barton ideasman42 at gmail.com
Wed Nov 3 05:38:41 CET 2010


Revision: 32850
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32850
Author:   campbellbarton
Date:     2010-11-03 05:38:07 +0100 (Wed, 03 Nov 2010)

Log Message:
-----------
bugfix [#24505] Python command bpy.ops.transform.rotate(...) does not follow axis=(...) attribute
the axis was being constantly re-initialized from the view.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/transform/transform.c
    trunk/blender/source/blender/editors/transform/transform.h

Modified: trunk/blender/source/blender/editors/transform/transform.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform.c	2010-11-03 03:45:09 UTC (rev 32849)
+++ trunk/blender/source/blender/editors/transform/transform.c	2010-11-03 04:38:07 UTC (rev 32850)
@@ -1678,7 +1678,7 @@
 	/* 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 @@
 	{
 		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 @@
 
 	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 @@
 		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);

Modified: trunk/blender/source/blender/editors/transform/transform.h
===================================================================
--- trunk/blender/source/blender/editors/transform/transform.h	2010-11-03 03:45:09 UTC (rev 32849)
+++ trunk/blender/source/blender/editors/transform/transform.h	2010-11-03 04:38:07 UTC (rev 32850)
@@ -314,6 +314,7 @@
 	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;





More information about the Bf-blender-cvs mailing list