Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2007-09-07 11:55:36 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-09-07 11:55:36 +0400
commit8a11629602990a8c3a793d2509eb20ec6394d0e5 (patch)
tree46252cc7ed4e66259315b8237ebfb6bf74e2d03f /source/blender/python/api2_2x/matrix.c
parent0ba5295404dd1c2ee04a9e7823eafc664562f4eb (diff)
matrix to scale fixes from stable
Diffstat (limited to 'source/blender/python/api2_2x/matrix.c')
-rw-r--r--source/blender/python/api2_2x/matrix.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/source/blender/python/api2_2x/matrix.c b/source/blender/python/api2_2x/matrix.c
index 6a427bfe7f6..fadadbb5c6a 100644
--- a/source/blender/python/api2_2x/matrix.c
+++ b/source/blender/python/api2_2x/matrix.c
@@ -202,16 +202,27 @@ PyObject *Matrix_RotationPart(MatrixObject * self)
/*---------------------------Matrix.scalePart() --------------------*/
PyObject *Matrix_scalePart(MatrixObject * self)
{
- float scale[3];
-
+ float scale[3], rot[3];
+ float mat[3][3], imat[3][3], tmat[3][3];
+
/*must be 3-4 cols, 3-4 rows, square matrix*/
if(self->colSize == 4 && self->rowSize == 4)
- Mat4ToSize((float (*)[4])*self->matrix, scale);
+ Mat3CpyMat4(mat, (float (*)[4])*self->matrix);
else if(self->colSize == 3 && self->rowSize == 3)
- Mat3ToSize((float (*)[3])*self->matrix, scale);
+ Mat3CpyMat3(mat, (float (*)[3])*self->matrix);
else
return EXPP_ReturnPyObjError(PyExc_AttributeError,
"Matrix.scalePart(): inappropriate matrix size - expects 3x3 or 4x4 matrix\n");
+
+ /* functionality copied from editobject.c apply_obmat */
+ Mat3ToEul(mat, rot);
+ EulToMat3(rot, tmat);
+ Mat3Inv(imat, tmat);
+ Mat3MulMat3(tmat, imat, mat);
+
+ scale[0]= tmat[0][0];
+ scale[1]= tmat[1][1];
+ scale[2]= tmat[2][2];
return newVectorObject(scale, 3, Py_NEW);
}
/*---------------------------Matrix.invert() ---------------------*/