diff options
Diffstat (limited to 'source/blender/python/mathutils/mathutils_Matrix.c')
-rw-r--r-- | source/blender/python/mathutils/mathutils_Matrix.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 1e85ece124d..a44f42bc337 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -725,7 +725,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args) "cannot create a 2x2 rotation matrix around arbitrary axis"); return NULL; } - if ((ELEM(matSize, 3, 4)) && (axis == NULL) && (vec == NULL)) { + if (ELEM(matSize, 3, 4) && (axis == NULL) && (vec == NULL)) { PyErr_SetString(PyExc_ValueError, "Matrix.Rotation(): " "axis of rotation for 3d and 4d matrices is required"); @@ -1244,12 +1244,11 @@ static PyObject *Matrix_to_quaternion(MatrixObject *self) return NULL; } if (self->row_num == 3) { - mat3_to_quat(quat, (float(*)[3])self->matrix); + mat3_to_quat(quat, (const float(*)[3])self->matrix); } else { mat4_to_quat(quat, (const float(*)[4])self->matrix); } - return Quaternion_CreatePyObject(quat, NULL); } @@ -1888,7 +1887,7 @@ static PyObject *Matrix_decompose(MatrixObject *self) } mat4_to_loc_rot_size(loc, rot, size, (const float(*)[4])self->matrix); - mat3_to_quat(quat, rot); + mat3_normalized_to_quat_fast(quat, rot); ret = PyTuple_New(3); PyTuple_SET_ITEMS(ret, @@ -3322,8 +3321,7 @@ PyDoc_STRVAR( " This object gives access to Matrices in Blender, supporting square and rectangular\n" " matrices from 2x2 up to 4x4.\n" "\n" - " :param rows: Sequence of rows.\n" - " When omitted, a 4x4 identity matrix is constructed.\n" + " :arg rows: Sequence of rows. When omitted, a 4x4 identity matrix is constructed.\n" " :type rows: 2d number sequence\n"); PyTypeObject matrix_Type = { PyVarObject_HEAD_INIT(NULL, 0) "Matrix", /*tp_name*/ @@ -3368,7 +3366,7 @@ PyTypeObject matrix_Type = { NULL, /*tp_alloc*/ Matrix_new, /*tp_new*/ NULL, /*tp_free*/ - NULL, /*tp_is_gc*/ + (inquiry)BaseMathObject_is_gc, /*tp_is_gc*/ NULL, /*tp_bases*/ NULL, /*tp_mro*/ NULL, /*tp_cache*/ @@ -3476,6 +3474,7 @@ PyObject *Matrix_CreatePyObject_cb( self->cb_user = cb_user; self->cb_type = cb_type; self->cb_subtype = cb_subtype; + BLI_assert(!PyObject_GC_IsTracked((PyObject *)self)); PyObject_GC_Track(self); } return (PyObject *)self; |