patch [#28032] swapped matrix multiplication order, reverse it back, tested with FBX, BVH import/export which are very sensitive to changes in matrix rotation.

This commit is contained in:
Campbell Barton 2011-07-20 06:41:51 +00:00
parent 60ae40a0ed
commit 8b5e7f2650

@ -1587,7 +1587,7 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
if(mat1 && mat2) { if(mat1 && mat2) {
/*MATRIX * MATRIX*/ /*MATRIX * MATRIX*/
if(mat1->row_size != mat2->col_size){ if(mat2->row_size != mat1->col_size){
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,
"Matrix multiplication: " "Matrix multiplication: "
"matrix A rowsize must equal matrix B colsize"); "matrix A rowsize must equal matrix B colsize");
@ -1597,15 +1597,15 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
float mat[16]= {0.0f}; float mat[16]= {0.0f};
int x, y, z; int x, y, z;
for(x = 0; x < mat1->row_size; x++) { for(x = 0; x < mat2->row_size; x++) {
for(y = 0; y < mat2->col_size; y++) { for(y = 0; y < mat1->col_size; y++) {
for(z = 0; z < mat2->row_size; z++) { for(z = 0; z < mat1->row_size; z++) {
mat[x * mat1->col_size + y] += (mat1->matrix[x][z] * mat2->matrix[z][y]); 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) { else if(mat2) {