diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/api2_2x/Mesh.c | 15 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Mesh.h | 4 |
2 files changed, 10 insertions, 9 deletions
diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c index 7f6f6734074..1bdb6ee679f 100644 --- a/source/blender/python/api2_2x/Mesh.c +++ b/source/blender/python/api2_2x/Mesh.c @@ -5867,8 +5867,8 @@ static PyObject *Mesh_transform( BPy_Mesh *self, PyObject *args ) if( recalc_normals ) { /* loop through all the verts and transform normals by the inverse * of the transpose of the supplied matrix */ - float invmat[4][4]; - + float invmat[4][4], vec[3], nx, ny, nz; + /* * we only need to invert a 3x3 submatrix, because the 4th component of * affine vectors is 0, but Mat4Invert reports non invertible matrices @@ -5884,11 +5884,12 @@ static PyObject *Mesh_transform( BPy_Mesh *self, PyObject *args ) mv = mesh->mvert; for( i = 0; i < mesh->totvert; i++, mv++ ) { - float vec[3]; - vec[0] = (float)(mv->no[0] / 32767.0); - vec[1] = (float)(mv->no[1] / 32767.0); - vec[2] = (float)(mv->no[2] / 32767.0); - Mat4MulVecfl( (float(*)[4])*invmat, vec ); + nx= vec[0] = (float)(mv->no[0] / 32767.0); + ny= vec[1] = (float)(mv->no[1] / 32767.0); + nz= vec[2] = (float)(mv->no[2] / 32767.0); + vec[0] = nx*invmat[0][0] + ny*invmat[0][1] + nz*invmat[0][2]; + vec[1] = nx*invmat[1][0] + ny*invmat[1][1] + nz*invmat[1][2]; + vec[2] = nx*invmat[2][0] + ny*invmat[2][1] + nz*invmat[2][2]; Normalise( vec ); mv->no[0] = (short)(vec[0] * 32767.0); mv->no[1] = (short)(vec[1] * 32767.0); diff --git a/source/blender/python/api2_2x/Mesh.h b/source/blender/python/api2_2x/Mesh.h index 43a1154b11e..2599ae38fe3 100644 --- a/source/blender/python/api2_2x/Mesh.h +++ b/source/blender/python/api2_2x/Mesh.h @@ -89,7 +89,7 @@ typedef struct { PyObject_VAR_HEAD /* required python macro */ Mesh *mesh; /* points to a Mesh */ int index; - char iter; /* char because it can only ever be between -1 and 2 */ + short iter; /* char because it can only ever be between -1 and 2 */ } BPy_MEdge; /* a Mesh edge */ typedef struct { @@ -102,7 +102,7 @@ typedef struct { PyObject_VAR_HEAD /* required python macro */ Mesh * mesh; int index; - char iter; /* char because it can only ever be between -1 and 4 */ + short iter; /* char because it can only ever be between -1 and 4 */ } BPy_MFace; /* a Mesh face */ typedef struct { |