From d5f1fc13b7cd9ab3e4a3d2519433b7359ae6fab0 Mon Sep 17 00:00:00 2001 From: Joseph Gilbert Date: Mon, 21 Nov 2005 19:42:20 +0000 Subject: [PATCH] * [ #3376 ] Blender.Mathutils.Matrix().toQuat() broken - a 0-degree rotation gives a abitrary axis of 1,0,0 not 0,0,0 --- source/blender/python/api2_2x/quat.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/python/api2_2x/quat.c b/source/blender/python/api2_2x/quat.c index 11b16e89c87..2b5fcc5966c 100644 --- a/source/blender/python/api2_2x/quat.c +++ b/source/blender/python/api2_2x/quat.c @@ -186,6 +186,10 @@ static PyObject *Quaternion_getattr(QuaternionObject * self, char *name) vec[x] = (float)(self->quat[x + 1] / mag); } Normalise(vec); + //If the axis of rotation is 0,0,0 set it to 1,0,0 - for zero-degree rotations + if (vec[0] < 1e-44 && vec[1] < 1e-44 && vec[2] < 1e-44){ + vec[0] = 1.0f; + } return (PyObject *) newVectorObject(vec, 3, Py_NEW); } if(STREQ(name, "wrapped")){