diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-29 02:46:10 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-29 02:46:10 +0400 |
commit | 1297f72f787dc71168a4766c1f7234626fbfe9db (patch) | |
tree | c80dd18875b39031ceadad97bd28760f9af9777d /source/blender/blenkernel/intern/mesh.c | |
parent | becc094119d1aec9c94d55ca9589751c050d0dd0 (diff) |
sync changes from bmesh r42951 + some other minor edits.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 61604bf1432..408a141608d 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -370,9 +370,9 @@ void mesh_get_texspace(Mesh *me, float *loc_r, float *rot_r, float *size_r) tex_space_mesh(me); } - if (loc_r) VECCOPY(loc_r, me->loc); - if (rot_r) VECCOPY(rot_r, me->rot); - if (size_r) VECCOPY(size_r, me->size); + if (loc_r) copy_v3_v3(loc_r, me->loc); + if (rot_r) copy_v3_v3(rot_r, me->rot); + if (size_r) copy_v3_v3(size_r, me->size); } float *get_mesh_orco_verts(Object *ob) @@ -829,7 +829,7 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int a= dl->parts*dl->nr; data= dl->verts; while(a--) { - VECCOPY(mvert->co, data); + copy_v3_v3(mvert->co, data); data+=3; vertcount++; mvert++; @@ -852,7 +852,7 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int a= dl->parts*dl->nr; data= dl->verts; while(a--) { - VECCOPY(mvert->co, data); + copy_v3_v3(mvert->co, data); data+=3; vertcount++; mvert++; @@ -875,7 +875,7 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int a= dl->nr; data= dl->verts; while(a--) { - VECCOPY(mvert->co, data); + copy_v3_v3(mvert->co, data); data+=3; vertcount++; mvert++; @@ -903,7 +903,7 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int a= dl->parts*dl->nr; data= dl->verts; while(a--) { - VECCOPY(mvert->co, data); + copy_v3_v3(mvert->co, data); data+=3; vertcount++; mvert++; @@ -992,8 +992,8 @@ void nurbs_to_mesh(Object *ob) me->totedge= totedge; me->mvert= CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, allvert, me->totvert); - me->mface= CustomData_add_layer(&me->fdata, CD_MFACE, CD_ASSIGN, allface, me->totface); me->medge= CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, alledge, me->totedge); + me->mface= CustomData_add_layer(&me->fdata, CD_MFACE, CD_ASSIGN, allface, me->totface); mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL); } else { @@ -1452,19 +1452,22 @@ void create_vert_edge_map(ListBase **map, IndexNode **mem, const MEdge *medge, c #ifdef USE_BMESH_FORWARD_COMPAT void mesh_loops_to_mface_corners(CustomData *fdata, CustomData *ldata, - CustomData *pdata, int lindex[4], int findex, - const int polyindex, - const int mf_len /* 3 or 4 */ - ) + CustomData *pdata, int lindex[4], int findex, + const int polyindex, + const int mf_len, /* 3 or 4 */ + + /* cache values to avoid lookups every time */ + const int numTex, /* CustomData_number_of_layers(pdata, CD_MTEXPOLY) */ + const int numCol, /* CustomData_number_of_layers(ldata, CD_MLOOPCOL) */ + const int hasWCol /* CustomData_has_layer(ldata, CD_WEIGHT_MLOOPCOL) */ + ) { MTFace *texface; MTexPoly *texpoly; MCol *mcol; MLoopCol *mloopcol; MLoopUV *mloopuv; - int i, j, hasWCol = CustomData_has_layer(ldata, CD_WEIGHT_MLOOPCOL); - int numTex = CustomData_number_of_layers(pdata, CD_MTEXPOLY); - int numCol = CustomData_number_of_layers(ldata, CD_MLOOPCOL); + int i, j; for(i=0; i < numTex; i++){ texface = CustomData_get_n(fdata, CD_MTFACE, findex, i); @@ -1527,6 +1530,10 @@ int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata, MFace *mface = NULL, *mf; BLI_array_declare(mface); + const int numTex = CustomData_number_of_layers(pdata, CD_MTEXPOLY); + const int numCol = CustomData_number_of_layers(ldata, CD_MLOOPCOL); + const int hasWCol = CustomData_has_layer(ldata, CD_WEIGHT_MLOOPCOL); + mpoly = CustomData_get_layer(pdata, CD_MPOLY); mloop = CustomData_get_layer(ldata, CD_MLOOP); @@ -1582,7 +1589,8 @@ int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata, mf->v3 = mloop[mf->v3].v; mesh_loops_to_mface_corners(fdata, ldata, pdata, - lindex, k, i, 3); + lindex, k, i, 3, + numTex, numCol, hasWCol); test_index_face(mf, fdata, totface, 3); } else { @@ -1601,7 +1609,8 @@ int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata, mf->v4 = mloop[mf->v4].v; mesh_loops_to_mface_corners(fdata, ldata, pdata, - lindex, k, i, 4); + lindex, k, i, 4, + numTex, numCol, hasWCol); test_index_face(mf, fdata, totface, 4); } |