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:
authorCampbell Barton <ideasman42@gmail.com>2010-01-27 15:53:25 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-01-27 15:53:25 +0300
commitf8200f14ae2991b97e0c0edb4b8ecfb1c60d0e22 (patch)
tree4506adc491027e88d5723990b262b32afba1ec0d /source/blender/python/generic
parenta22eb04b19e65c957aca97a378d4122b24e4681e (diff)
crash fix from own recent updates to Mathutils.RotationMatrix()
Diffstat (limited to 'source/blender/python/generic')
-rw-r--r--source/blender/python/generic/Mathutils.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/python/generic/Mathutils.c b/source/blender/python/generic/Mathutils.c
index 2e4b6dbb490..256965a2b87 100644
--- a/source/blender/python/generic/Mathutils.c
+++ b/source/blender/python/generic/Mathutils.c
@@ -207,7 +207,11 @@ static PyObject *M_Mathutils_RotationMatrix(PyObject * self, PyObject * args)
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,9 +238,11 @@ static PyObject *M_Mathutils_RotationMatrix(PyObject * self, PyObject * args)
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) {