diff options
author | Ken Hughes <khughes@pacific.edu> | 2005-12-05 22:57:23 +0300 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2005-12-05 22:57:23 +0300 |
commit | 1a2ac4e64d6a8dfc1810d35bfc4c8fd7acbc37fe (patch) | |
tree | 9a7efbea6cd6b495167a2b2e62694d14100627a2 | |
parent | e209676d3d55c3d6a4e2fffd97cbd448a7bb556b (diff) |
-- Bugfix #3072: As discussed on IRC, matrix.invert() should throw a
ValueError exception if matrix is singular.
-rw-r--r-- | source/blender/python/api2_2x/doc/Mathutils.py | 11 | ||||
-rw-r--r-- | source/blender/python/api2_2x/matrix.c | 3 |
2 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/python/api2_2x/doc/Mathutils.py b/source/blender/python/api2_2x/doc/Mathutils.py index 4b00d045825..5f552a69494 100644 --- a/source/blender/python/api2_2x/doc/Mathutils.py +++ b/source/blender/python/api2_2x/doc/Mathutils.py @@ -653,19 +653,19 @@ class Quaternion: def negate(): """ - Set the quaternion to it's negative. + Set the quaternion to its negative. @return: a copy of itself """ def conjugate(): """ - Set the quaternion to it's conjugate. + Set the quaternion to its conjugate. @return: a copy of itself """ def inverse(): """ - Set the quaternion to it's inverse + Set the quaternion to its inverse @return: a copy of itself """ @@ -762,7 +762,7 @@ class Matrix: def transpose(): """ - Set the matrix to it's transpose. + Set the matrix to its transpose. @return: a copy of itself """ @@ -775,8 +775,9 @@ class Matrix: def invert(): """ - Set the matrix to it's inverse. + Set the matrix to its inverse. @return: a copy of itself + @raise ValueError: When matrix is singular. """ def rotationPart(): diff --git a/source/blender/python/api2_2x/matrix.c b/source/blender/python/api2_2x/matrix.c index 894643c5362..d1e6a53bae5 100644 --- a/source/blender/python/api2_2x/matrix.c +++ b/source/blender/python/api2_2x/matrix.c @@ -228,7 +228,8 @@ PyObject *Matrix_Invert(MatrixObject * self) //transpose //Matrix_Transpose(self); } else { - printf("Matrix.invert: matrix does not have an inverse\n"); + return EXPP_ReturnPyObjError(PyExc_ValueError, + "matrix does not have an inverse"); } return EXPP_incr_ret((PyObject*)self); } |