[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11960] branches/pyapi_devel/source/ blender/python/api2_2x: comments in gen_utils.c had typo's

Campbell Barton cbarton at metavr.com
Fri Sep 7 10:09:41 CEST 2007


Revision: 11960
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11960
Author:   campbellbarton
Date:     2007-09-07 10:09:41 +0200 (Fri, 07 Sep 2007)

Log Message:
-----------
comments in gen_utils.c had typo's
updated matrix.scalePart()

Modified Paths:
--------------
    branches/pyapi_devel/source/blender/python/api2_2x/gen_utils.c
    branches/pyapi_devel/source/blender/python/api2_2x/matrix.c

Modified: branches/pyapi_devel/source/blender/python/api2_2x/gen_utils.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/gen_utils.c	2007-09-07 08:04:15 UTC (rev 11959)
+++ branches/pyapi_devel/source/blender/python/api2_2x/gen_utils.c	2007-09-07 08:09:41 UTC (rev 11960)
@@ -796,9 +796,9 @@
 }
 
 /*
- * Helper function for subtypes that what the base types methods.
+ * Helper function for subtypes that use the base types methods.
  * The command below needs to have args modified to have 'self' added at the start
- * ret = PyObject_Call(PyDict_GetItemString(PyList_Type.tp_dict, "sort"), newargs, keywds);
+ * ret = PyObject_Call(PyDict_GetItemString(PyList_Type.tp_dict, "sort"), args, keywds);
  * 
  * This is not easy with the python API so adding a function here,
  * remember to Py_DECREF the tuple after

Modified: branches/pyapi_devel/source/blender/python/api2_2x/matrix.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/matrix.c	2007-09-07 08:04:15 UTC (rev 11959)
+++ branches/pyapi_devel/source/blender/python/api2_2x/matrix.c	2007-09-07 08:09:41 UTC (rev 11960)
@@ -242,22 +242,33 @@
 /*---------------------------Matrix.scalePart() --------------------*/
 PyObject *Matrix_scalePart(BPyMatrixObject * self)
 {
-	float scale[3];
+	float scale[3], rot[3];
+	float mat[3][3], imat[3][3], tmat[3][3];
 	
 	CHECK_MAT_ERROR_PY(self);
 	
 	/*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 Vector_CreatePyObject(scale, 3, (PyObject *)NULL);
 }
 
-
 /* this is also called by __invert__ from the the number
  * protocol so make sure it stays compatible */
 





More information about the Bf-blender-cvs mailing list