Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r--source/blender/blenkernel/intern/mesh.c65
1 files changed, 39 insertions, 26 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 514380dc980..c7f6bf93831 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -128,18 +128,22 @@ 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;
@@ -148,12 +152,16 @@ 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;
@@ -1128,7 +1136,7 @@ void mesh_strip_loose_edges(Mesh *me)
MEdge *e;
MLoop *l;
int a, b;
- unsigned int *new_idx = MEM_mallocN(sizeof(int) * me->totedge, "strip_loose_edges old2new idx mapping for loops.");
+ unsigned int *new_idx = MEM_mallocN(sizeof(int) * me->totedge, __func__);
for (a = b = 0, e = me->medge; a < me->totedge; a++, e++) {
if (e->v1 != e->v2) {
@@ -1154,6 +1162,8 @@ void mesh_strip_loose_edges(Mesh *me)
for (a = 0, l = me->mloop; a < me->totloop; a++, l++) {
l->e = new_idx[l->e];
}
+
+ MEM_freeN(new_idx);
}
void mball_to_mesh(ListBase *lb, Mesh *me)
@@ -1606,7 +1616,7 @@ void mesh_to_curve(Scene *scene, Object *ob)
BLI_edgehash_free(eh, NULL);
if (edges.first) {
- Curve *cu = add_curve(ob->id.name+2, OB_CURVE);
+ Curve *cu = BKE_curve_add(ob->id.name+2, OB_CURVE);
cu->flag |= CU_3D;
while (edges.first) {
@@ -1865,8 +1875,8 @@ void mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpolys,
BLI_array_empty(vertcos);
BLI_array_empty(vertnos);
- BLI_array_growitems(vertcos, mp->totloop);
- BLI_array_growitems(vertnos, mp->totloop);
+ BLI_array_grow_items(vertcos, mp->totloop);
+ BLI_array_grow_items(vertnos, mp->totloop);
for (j=0; j < mp->totloop; j++) {
int vindex = ml[j].v;
@@ -1875,7 +1885,7 @@ void mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpolys,
}
BLI_array_empty(edgevecbuf);
- BLI_array_growitems(edgevecbuf, mp->totloop);
+ BLI_array_grow_items(edgevecbuf, mp->totloop);
accumulate_vertex_normals_poly(vertnos, pnors[i], vertcos, edgevecbuf, mp->totloop);
}
@@ -2412,8 +2422,8 @@ int mesh_recalcTessellation(CustomData *fdata,
#ifdef USE_TESSFACE_SPEEDUP
#define ML_TO_MF(i1, i2, i3) \
- BLI_array_growone(mface_to_poly_map); \
- BLI_array_growone(mface); \
+ BLI_array_grow_one(mface_to_poly_map); \
+ BLI_array_grow_one(mface); \
mface_to_poly_map[mface_index] = poly_index; \
mf= &mface[mface_index]; \
/* set loop indices, transformed to vert indices later */ \
@@ -2431,8 +2441,8 @@ int mesh_recalcTessellation(CustomData *fdata,
/* ALMOST IDENTICAL TO DEFINE ABOVE (see EXCEPTION) */
#define ML_TO_MF_QUAD() \
- BLI_array_growone(mface_to_poly_map); \
- BLI_array_growone(mface); \
+ BLI_array_grow_one(mface_to_poly_map); \
+ BLI_array_grow_one(mface); \
mface_to_poly_map[mface_index] = poly_index; \
mf= &mface[mface_index]; \
/* set loop indices, transformed to vert indices later */ \
@@ -2490,10 +2500,10 @@ int mesh_recalcTessellation(CustomData *fdata,
totfilltri = BLI_edgefill(&sf_ctx, FALSE);
if (totfilltri) {
- BLI_array_growitems(mface_to_poly_map, totfilltri);
- BLI_array_growitems(mface, totfilltri);
+ BLI_array_grow_items(mface_to_poly_map, totfilltri);
+ BLI_array_grow_items(mface, totfilltri);
if (poly_orig_index) {
- BLI_array_growitems(mface_orig_index, totfilltri);
+ BLI_array_grow_items(mface_orig_index, totfilltri);
}
for (f = sf_ctx.fillfacebase.first; f; f = f->next, mf++) {
@@ -2662,7 +2672,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_growone(mface);
+ BLI_array_grow_one(mface);
mf = &mface[k];
mf->mat_nr = mp->mat_nr;
@@ -3052,10 +3062,13 @@ 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];