diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-20 22:49:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-20 22:49:04 +0300 |
commit | 02e7871149fb369a12725a319cb09accad7790b9 (patch) | |
tree | a089869d8044c79f3d3031923492393961eef53a /source/blender/python/generic/vector.c | |
parent | 65a4dafcff41f8575263095b62437f854bdeb2b4 (diff) |
Mathutils API: Euler support for rotation order.
Examples.
euler = Euler(1, 2, 3)
euler.order = 'ZXY'
euler = matrix.to_euler('XZY')
Still missing rna support. this still wont give the right order, defaulting to XYZ.
eul = object.rotation_euler
Diffstat (limited to 'source/blender/python/generic/vector.c')
-rw-r--r-- | source/blender/python/generic/vector.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/source/blender/python/generic/vector.c b/source/blender/python/generic/vector.c index 06e0a0480b4..d5ff44ae5ad 100644 --- a/source/blender/python/generic/vector.c +++ b/source/blender/python/generic/vector.c @@ -159,17 +159,17 @@ static char Vector_Resize2D_doc[] = static PyObject *Vector_Resize2D(VectorObject * self) { if(self->wrapped==Py_WRAP) { - PyErr_SetString(PyExc_TypeError, "vector.resize2d(): cannot resize wrapped data - only python vectors\n"); + PyErr_SetString(PyExc_TypeError, "vector.resize2D(): cannot resize wrapped data - only python vectors\n"); return NULL; } if(self->cb_user) { - PyErr_SetString(PyExc_TypeError, "vector.resize2d(): cannot resize a vector that has an owner"); + PyErr_SetString(PyExc_TypeError, "vector.resize2D(): cannot resize a vector that has an owner"); return NULL; } self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 2)); if(self->vec == NULL) { - PyErr_SetString(PyExc_MemoryError, "vector.resize2d(): problem allocating pointer space\n\n"); + PyErr_SetString(PyExc_MemoryError, "vector.resize2D(): problem allocating pointer space\n\n"); return NULL; } @@ -189,17 +189,17 @@ static char Vector_Resize3D_doc[] = static PyObject *Vector_Resize3D(VectorObject * self) { if (self->wrapped==Py_WRAP) { - PyErr_SetString(PyExc_TypeError, "vector.resize3d(): cannot resize wrapped data - only python vectors\n"); + PyErr_SetString(PyExc_TypeError, "vector.resize3D(): cannot resize wrapped data - only python vectors\n"); return NULL; } if(self->cb_user) { - PyErr_SetString(PyExc_TypeError, "vector.resize3d(): cannot resize a vector that has an owner"); + PyErr_SetString(PyExc_TypeError, "vector.resize3D(): cannot resize a vector that has an owner"); return NULL; } self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 3)); if(self->vec == NULL) { - PyErr_SetString(PyExc_MemoryError, "vector.resize3d(): problem allocating pointer space\n\n"); + PyErr_SetString(PyExc_MemoryError, "vector.resize3D(): problem allocating pointer space\n\n"); return NULL; } @@ -222,17 +222,17 @@ static char Vector_Resize4D_doc[] = static PyObject *Vector_Resize4D(VectorObject * self) { if(self->wrapped==Py_WRAP) { - PyErr_SetString(PyExc_TypeError, "vector.resize4d(): cannot resize wrapped data - only python vectors"); + PyErr_SetString(PyExc_TypeError, "vector.resize4D(): cannot resize wrapped data - only python vectors"); return NULL; } if(self->cb_user) { - PyErr_SetString(PyExc_TypeError, "vector.resize4d(): cannot resize a vector that has an owner"); + PyErr_SetString(PyExc_TypeError, "vector.resize4D(): cannot resize a vector that has an owner"); return NULL; } self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 4)); if(self->vec == NULL) { - PyErr_SetString(PyExc_MemoryError, "vector.resize4d(): problem allocating pointer space\n\n"); + PyErr_SetString(PyExc_MemoryError, "vector.resize4D(): problem allocating pointer space\n\n"); return NULL; } if(self->size == 2){ @@ -265,7 +265,7 @@ static PyObject *Vector_ToTuple(VectorObject * self, PyObject *value) PyObject *ret; if(ndigits > 22 || ndigits < 0) { /* accounts for non ints */ - PyErr_SetString(PyExc_TypeError, "vector.key(ndigits): ndigits must be between 0 and 21"); + PyErr_SetString(PyExc_TypeError, "vector.to_tuple(ndigits): ndigits must be between 0 and 21"); return NULL; } @@ -300,7 +300,7 @@ static PyObject *Vector_ToTrackQuat( VectorObject * self, PyObject * args ) char *strack, *sup; short track = 2, up = 1; - if( !PyArg_ParseTuple ( args, "|ss", &strack, &sup ) ) { + if(!PyArg_ParseTuple( args, "|ss:to_track_quat", &strack, &sup)) { PyErr_SetString( PyExc_TypeError, "expected optional two strings\n" ); return NULL; } @@ -558,11 +558,7 @@ static PyObject *Vector_Angle(VectorObject * self, VectorObject * value) angleRads = (double)saacos(dot); -#ifdef USE_MATHUTILS_DEG - return PyFloat_FromDouble(angleRads * (180/ Py_PI)); -#else return PyFloat_FromDouble(angleRads); -#endif } static char Vector_Difference_doc[] = @@ -666,12 +662,12 @@ static PyObject *Vector_Lerp(VectorObject * self, PyObject * args) float fac, ifac, vec[4]; int x; - if(!PyArg_ParseTuple(args, "O!f", &vector_Type, &vec2, &fac)) { + if(!PyArg_ParseTuple(args, "O!f:lerp", &vector_Type, &vec2, &fac)) { PyErr_SetString(PyExc_TypeError, "vector.lerp(): expects a vector of the same size and float"); return NULL; } if(self->size != vec2->size) { - PyErr_SetString(PyExc_AttributeError, "Mathutils.MidpointVecs(): expects (2) vector objects of the same size"); + PyErr_SetString(PyExc_AttributeError, "vector.lerp(): expects (2) vector objects of the same size"); return NULL; } |