[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38527] trunk/blender/source/blender/ python/mathutils/mathutils_Matrix.c: patch [#28032] swapped matrix multiplication order, reverse it back, tested with FBX, BVH import/export which are very sensitive to changes in matrix rotation.

Campbell Barton ideasman42 at gmail.com
Wed Jul 20 08:41:51 CEST 2011


Revision: 38527
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38527
Author:   campbellbarton
Date:     2011-07-20 06:41:51 +0000 (Wed, 20 Jul 2011)
Log Message:
-----------
patch [#28032] swapped matrix multiplication order, reverse it back, tested with FBX, BVH import/export which are very sensitive to changes in matrix rotation.

Modified Paths:
--------------
    trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c	2011-07-20 06:22:16 UTC (rev 38526)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c	2011-07-20 06:41:51 UTC (rev 38527)
@@ -1587,7 +1587,7 @@
 
 	if(mat1 && mat2) {
 		/*MATRIX * MATRIX*/
-		if(mat1->row_size != mat2->col_size){
+		if(mat2->row_size != mat1->col_size){
 			PyErr_SetString(PyExc_ValueError,
 			                "Matrix multiplication: "
 			                "matrix A rowsize must equal matrix B colsize");
@@ -1597,15 +1597,15 @@
 			float mat[16]= {0.0f};
 			int x, y, z;
 
-			for(x = 0; x < mat1->row_size; x++) {
-				for(y = 0; y < mat2->col_size; y++) {
-					for(z = 0; z < mat2->row_size; z++) {
-						mat[x * mat1->col_size + y] += (mat1->matrix[x][z] * mat2->matrix[z][y]);
+			for(x = 0; x < mat2->row_size; x++) {
+				for(y = 0; y < mat1->col_size; y++) {
+					for(z = 0; z < mat1->row_size; z++) {
+						mat[x * mat2->col_size + y] += (mat2->matrix[x][z] * mat1->matrix[z][y]);
 					}
 				}
 			}
 
-			return newMatrixObject(mat, mat2->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1));
+			return newMatrixObject(mat, mat1->row_size, mat2->col_size, Py_NEW, Py_TYPE(mat1));
 		}
 	}
 	else if(mat2) {




More information about the Bf-blender-cvs mailing list