diff options
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 63 |
1 files changed, 26 insertions, 37 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index c7f6bf93831..2bcf17a8fc6 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -128,22 +128,18 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2 CustomDataLayer *l1, *l2; int i, i1=0, i2=0, tot, j; - for (i = 0; i < c1->totlayer; i++) { - if (ELEM7(c1->layers[i].type, CD_MVERT, CD_MEDGE, CD_MPOLY, - CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT)) - { + for (i=0; i<c1->totlayer; i++) { + if (ELEM7(c1->layers[i].type, CD_MVERT, CD_MEDGE, CD_MPOLY, + CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT)) i1++; - } } - - for (i = 0; i < c2->totlayer; i++) { - if (ELEM7(c2->layers[i].type, CD_MVERT, CD_MEDGE, CD_MPOLY, - CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT)) - { + + for (i=0; i<c2->totlayer; i++) { + if (ELEM7(c2->layers[i].type, CD_MVERT, CD_MEDGE, CD_MPOLY, + CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT)) i2++; - } } - + if (i1 != i2) return MESHCMP_CDLAYERS_MISMATCH; @@ -152,16 +148,12 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2 i1 = 0; i2 = 0; for (i=0; i < tot; i++) { while (i1 < c1->totlayer && !ELEM7(l1->type, CD_MVERT, CD_MEDGE, CD_MPOLY, - CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT)) - { + CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT)) i1++, l1++; - } - while (i2 < c2->totlayer && !ELEM7(l2->type, CD_MVERT, CD_MEDGE, CD_MPOLY, - CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT)) - { + while (i2 < c2->totlayer && !ELEM7(l2->type, CD_MVERT, CD_MEDGE, CD_MPOLY, + CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT)) i2++, l2++; - } if (l1->type == CD_MVERT) { MVert *v1 = l1->data; @@ -1616,7 +1608,7 @@ void mesh_to_curve(Scene *scene, Object *ob) BLI_edgehash_free(eh, NULL); if (edges.first) { - Curve *cu = BKE_curve_add(ob->id.name+2, OB_CURVE); + Curve *cu = add_curve(ob->id.name+2, OB_CURVE); cu->flag |= CU_3D; while (edges.first) { @@ -1783,7 +1775,7 @@ void mesh_calc_normals_mapping(MVert *mverts, int numVerts, { mesh_calc_normals_mapping_ex(mverts, numVerts, mloop, mpolys, numLoops, numPolys, polyNors_r, mfaces, numFaces, - origIndexFace, faceNors_r, TRUE); + origIndexFace, faceNors_r, FALSE); } void mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts, @@ -1875,8 +1867,8 @@ void mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpolys, BLI_array_empty(vertcos); BLI_array_empty(vertnos); - BLI_array_grow_items(vertcos, mp->totloop); - BLI_array_grow_items(vertnos, mp->totloop); + BLI_array_growitems(vertcos, mp->totloop); + BLI_array_growitems(vertnos, mp->totloop); for (j=0; j < mp->totloop; j++) { int vindex = ml[j].v; @@ -1885,7 +1877,7 @@ void mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpolys, } BLI_array_empty(edgevecbuf); - BLI_array_grow_items(edgevecbuf, mp->totloop); + BLI_array_growitems(edgevecbuf, mp->totloop); accumulate_vertex_normals_poly(vertnos, pnors[i], vertcos, edgevecbuf, mp->totloop); } @@ -2422,8 +2414,8 @@ int mesh_recalcTessellation(CustomData *fdata, #ifdef USE_TESSFACE_SPEEDUP #define ML_TO_MF(i1, i2, i3) \ - BLI_array_grow_one(mface_to_poly_map); \ - BLI_array_grow_one(mface); \ + BLI_array_growone(mface_to_poly_map); \ + BLI_array_growone(mface); \ mface_to_poly_map[mface_index] = poly_index; \ mf= &mface[mface_index]; \ /* set loop indices, transformed to vert indices later */ \ @@ -2441,8 +2433,8 @@ int mesh_recalcTessellation(CustomData *fdata, /* ALMOST IDENTICAL TO DEFINE ABOVE (see EXCEPTION) */ #define ML_TO_MF_QUAD() \ - BLI_array_grow_one(mface_to_poly_map); \ - BLI_array_grow_one(mface); \ + BLI_array_growone(mface_to_poly_map); \ + BLI_array_growone(mface); \ mface_to_poly_map[mface_index] = poly_index; \ mf= &mface[mface_index]; \ /* set loop indices, transformed to vert indices later */ \ @@ -2500,10 +2492,10 @@ int mesh_recalcTessellation(CustomData *fdata, totfilltri = BLI_edgefill(&sf_ctx, FALSE); if (totfilltri) { - BLI_array_grow_items(mface_to_poly_map, totfilltri); - BLI_array_grow_items(mface, totfilltri); + BLI_array_growitems(mface_to_poly_map, totfilltri); + BLI_array_growitems(mface, totfilltri); if (poly_orig_index) { - BLI_array_grow_items(mface_orig_index, totfilltri); + BLI_array_growitems(mface_orig_index, totfilltri); } for (f = sf_ctx.fillfacebase.first; f; f = f->next, mf++) { @@ -2672,7 +2664,7 @@ int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata, k = 0; for (i = 0; i<totpoly; i++, mp++) { if (ELEM(mp->totloop, 3, 4)) { - BLI_array_grow_one(mface); + BLI_array_growone(mface); mf = &mface[k]; mf->mat_nr = mp->mat_nr; @@ -3062,13 +3054,10 @@ void mesh_flush_hidden_from_verts(const MVert *mvert, for (i = 0; i < totedge; i++) { MEdge *e = &medge[i]; if (mvert[e->v1].flag & ME_HIDE || - mvert[e->v2].flag & ME_HIDE) - { + mvert[e->v2].flag & ME_HIDE) e->flag |= ME_HIDE; - } - else { + else e->flag &= ~ME_HIDE; - } } for (i = 0; i < totpoly; i++) { MPoly *p = &mpoly[i]; |