[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26334] trunk/blender/source/blender/ python/generic/Mathutils.c: crash fix from own recent updates to Mathutils. RotationMatrix()

Campbell Barton ideasman42 at gmail.com
Wed Jan 27 13:53:25 CET 2010


Revision: 26334
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26334
Author:   campbellbarton
Date:     2010-01-27 13:53:25 +0100 (Wed, 27 Jan 2010)

Log Message:
-----------
crash fix from own recent updates to Mathutils.RotationMatrix()

Modified Paths:
--------------
    trunk/blender/source/blender/python/generic/Mathutils.c

Modified: trunk/blender/source/blender/python/generic/Mathutils.c
===================================================================
--- trunk/blender/source/blender/python/generic/Mathutils.c	2010-01-27 11:58:04 UTC (rev 26333)
+++ trunk/blender/source/blender/python/generic/Mathutils.c	2010-01-27 12:53:25 UTC (rev 26334)
@@ -207,7 +207,11 @@
 	angle = angle * (float) (Py_PI / 180);
 #endif
 
-	if(axis == NULL && matSize == 2) {
+	/* check for valid vector/axis above */
+	if(vec) {
+		axis_angle_to_mat3( (float (*)[3])mat,vec->vec, angle);
+	}
+	else if(matSize == 2) {
 		//2D rotation matrix
 		mat[0] = (float) cos (angle);
 		mat[1] = (float) sin (angle);
@@ -234,10 +238,12 @@
 		mat[3] = -((float) sin(angle));
 		mat[4] = (float) cos(angle);
 		mat[8] = 1.0f;
-	} else {
-		/* check for valid vector/axis above */
-		axis_angle_to_mat3( (float (*)[3])mat,vec->vec, angle);
 	}
+	else {
+		/* should never get here */
+		PyErr_SetString(PyExc_AttributeError, "Mathutils.RotationMatrix(): unknown error\n");
+		return NULL;
+	}
 
 	if(matSize == 4) {
 		//resize matrix





More information about the Bf-blender-cvs mailing list