diff options
Diffstat (limited to 'source/blender/python/mathutils/mathutils_Matrix.c')
-rw-r--r-- | source/blender/python/mathutils/mathutils_Matrix.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index c158ec1da15..87d16656d70 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -514,7 +514,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args) angle = angle_wrap_rad(angle); - if (matSize != 2 && matSize != 3 && matSize != 4) { + if (!ELEM(matSize, 2, 3, 4)) { PyErr_SetString(PyExc_ValueError, "Matrix.Rotation(): " "can only return a 2x2 3x3 or 4x4 matrix"); @@ -653,7 +653,7 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args) if (!PyArg_ParseTuple(args, "fi|O:Matrix.Scale", &factor, &matSize, &vec)) { return NULL; } - if (matSize != 2 && matSize != 3 && matSize != 4) { + if (!ELEM(matSize, 2, 3, 4)) { PyErr_SetString(PyExc_ValueError, "Matrix.Scale(): " "can only return a 2x2 3x3 or 4x4 matrix"); @@ -759,7 +759,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args) if (!PyArg_ParseTuple(args, "Oi:Matrix.OrthoProjection", &axis, &matSize)) { return NULL; } - if (matSize != 2 && matSize != 3 && matSize != 4) { + if (!ELEM(matSize, 2, 3, 4)) { PyErr_SetString(PyExc_ValueError, "Matrix.OrthoProjection(): " "can only return a 2x2 3x3 or 4x4 matrix"); @@ -895,7 +895,7 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args) if (!PyArg_ParseTuple(args, "siO:Matrix.Shear", &plane, &matSize, &fac)) { return NULL; } - if (matSize != 2 && matSize != 3 && matSize != 4) { + if (!ELEM(matSize, 2, 3, 4)) { PyErr_SetString(PyExc_ValueError, "Matrix.Shear(): " "can only return a 2x2 3x3 or 4x4 matrix"); @@ -1687,7 +1687,7 @@ PyDoc_STRVAR( "\n" " Set the matrix to its adjugate.\n" "\n" - " .. note:: When the matrix cannot be adjugated a :exc:`ValueError` exception is raised.\n" + " :raises ValueError: if the matrix cannot be adjugate.\n" "\n" " .. seealso:: `Adjugate matrix <https://en.wikipedia.org/wiki/Adjugate_matrix>`__ on " "Wikipedia.\n"); @@ -1718,16 +1718,14 @@ static PyObject *Matrix_adjugate(MatrixObject *self) Py_RETURN_NONE; } -PyDoc_STRVAR( - Matrix_adjugated_doc, - ".. method:: adjugated()\n" - "\n" - " Return an adjugated copy of the matrix.\n" - "\n" - " :return: the adjugated matrix.\n" - " :rtype: :class:`Matrix`\n" - "\n" - " .. note:: When the matrix cant be adjugated a :exc:`ValueError` exception is raised.\n"); +PyDoc_STRVAR(Matrix_adjugated_doc, + ".. method:: adjugated()\n" + "\n" + " Return an adjugated copy of the matrix.\n" + "\n" + " :return: the adjugated matrix.\n" + " :rtype: :class:`Matrix`\n" + " :raises ValueError: if the matrix cannot be adjugated\n"); static PyObject *Matrix_adjugated(MatrixObject *self) { return matrix__apply_to_copy(Matrix_adjugate, self); |