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/bmesh/operators')
-rw-r--r--source/blender/bmesh/operators/bmo_bevel.c12
-rw-r--r--source/blender/bmesh/operators/bmo_connect.c12
-rw-r--r--source/blender/bmesh/operators/bmo_create.c12
-rw-r--r--source/blender/bmesh/operators/bmo_dupe.c4
-rw-r--r--source/blender/bmesh/operators/bmo_extrude.c6
-rw-r--r--source/blender/bmesh/operators/bmo_inset.c26
-rw-r--r--source/blender/bmesh/operators/bmo_join_triangles.c2
-rw-r--r--source/blender/bmesh/operators/bmo_mirror.c2
-rw-r--r--source/blender/bmesh/operators/bmo_removedoubles.c10
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide.c18
-rw-r--r--source/blender/bmesh/operators/bmo_triangulate.c4
-rw-r--r--source/blender/bmesh/operators/bmo_utils.c10
12 files changed, 70 insertions, 48 deletions
diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c
index 46dd7606940..b6b54b82f3d 100644
--- a/source/blender/bmesh/operators/bmo_bevel.c
+++ b/source/blender/bmesh/operators/bmo_bevel.c
@@ -242,7 +242,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
if (!BMO_elem_flag_test(bm, e, EDGE_OLD)) {
BM_elem_index_set(e, BLI_array_count(etags)); /* set_dirty! */
- BLI_array_growone(etags);
+ BLI_array_grow_one(etags);
BMO_elem_flag_enable(bm, e, EDGE_OLD);
}
@@ -256,11 +256,11 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
BM_ITER_ELEM (l2, &liter2, l->f, BM_LOOPS_OF_FACE) {
BM_elem_index_set(l2, BLI_array_count(tags)); /* set_loop */
- BLI_array_growone(tags);
+ BLI_array_grow_one(tags);
if (!BMO_elem_flag_test(bm, l2->e, EDGE_OLD)) {
BM_elem_index_set(l2->e, BLI_array_count(etags)); /* set_dirty! */
- BLI_array_growone(etags);
+ BLI_array_grow_one(etags);
BMO_elem_flag_enable(bm, l2->e, EDGE_OLD);
}
@@ -291,7 +291,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
}
if (!BLI_smallhash_haskey(&hash, (intptr_t)e)) {
- BLI_array_growone(etags);
+ BLI_array_grow_one(etags);
BM_elem_index_set(e, BLI_array_count(etags) - 1); /* set_dirty! */
BLI_smallhash_insert(&hash, (intptr_t)e, NULL);
BMO_elem_flag_enable(bm, e, EDGE_OLD);
@@ -309,11 +309,11 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
/* create tags for all loops in l-> */
BM_ITER_ELEM (l2, &liter2, l->f, BM_LOOPS_OF_FACE) {
- BLI_array_growone(tags);
+ BLI_array_grow_one(tags);
BM_elem_index_set(l2, BLI_array_count(tags) - 1); /* set_loop */
if (!BLI_smallhash_haskey(&hash, (intptr_t)l2->e)) {
- BLI_array_growone(etags);
+ BLI_array_grow_one(etags);
BM_elem_index_set(l2->e, BLI_array_count(etags) - 1); /* set_dirty! */
BLI_smallhash_insert(&hash, (intptr_t)l2->e, NULL);
BMO_elem_flag_enable(bm, l2->e, EDGE_OLD);
diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c
index 3c1f10be4c4..b8abe112c4d 100644
--- a/source/blender/bmesh/operators/bmo_connect.c
+++ b/source/blender/bmesh/operators/bmo_connect.c
@@ -71,10 +71,10 @@ void bmo_connectverts_exec(BMesh *bm, BMOperator *op)
}
if (lastl != l->prev && lastl != l->next) {
- BLI_array_growone(loops);
+ BLI_array_grow_one(loops);
loops[BLI_array_count(loops) - 1] = lastl;
- BLI_array_growone(loops);
+ BLI_array_grow_one(loops);
loops[BLI_array_count(loops) - 1] = l;
}
@@ -87,10 +87,10 @@ void bmo_connectverts_exec(BMesh *bm, BMOperator *op)
}
if (BLI_array_count(loops) > 2) {
- BLI_array_growone(loops);
+ BLI_array_grow_one(loops);
loops[BLI_array_count(loops) - 1] = loops[BLI_array_count(loops) - 2];
- BLI_array_growone(loops);
+ BLI_array_grow_one(loops);
loops[BLI_array_count(loops) - 1] = loops[0];
}
@@ -101,10 +101,10 @@ void bmo_connectverts_exec(BMesh *bm, BMOperator *op)
continue;
}
- BLI_array_growone(verts);
+ BLI_array_grow_one(verts);
verts[BLI_array_count(verts) - 1] = loops[i * 2]->v;
- BLI_array_growone(verts);
+ BLI_array_grow_one(verts);
verts[BLI_array_count(verts) - 1] = loops[i * 2 + 1]->v;
}
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c
index f2ba110b43d..6f08ab421f3 100644
--- a/source/blender/bmesh/operators/bmo_create.c
+++ b/source/blender/bmesh/operators/bmo_create.c
@@ -766,7 +766,7 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
i = 0;
BLI_array_empty(verts);
for (i = 0, node = path->nodes.first; node; node = node->next, i++) {
- BLI_array_growone(verts);
+ BLI_array_grow_one(verts);
verts[i] = node->v;
}
@@ -999,7 +999,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
}
edata[BM_elem_index_get(e)].ftag++;
- BLI_array_growone(edges);
+ BLI_array_grow_one(edges);
edges[i++] = e;
BLI_array_append(verts, node->v);
@@ -1009,7 +1009,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
vote_on_winding(edge, path->nodes.last, winding);
}
- BLI_array_growone(edges);
+ BLI_array_grow_one(edges);
edges[i++] = edge;
edata[BM_elem_index_get(edge)].ftag++;
@@ -1157,7 +1157,7 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
i = 0;
while (e) {
BMO_elem_flag_enable(bm, e, EDGE_VIS);
- BLI_array_growone(edges);
+ BLI_array_grow_one(edges);
edges[i] = e;
e = edge_next(bm, e);
@@ -1166,11 +1166,11 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
if (!count) {
edges1 = edges;
- BLI_array_set_length(edges1, BLI_array_count(edges));
+ BLI_array_length_set(edges1, BLI_array_count(edges));
}
else {
edges2 = edges;
- BLI_array_set_length(edges2, BLI_array_count(edges));
+ BLI_array_length_set(edges2, BLI_array_count(edges));
}
BLI_array_empty(edges);
diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c
index 36d446a0a8c..0659a42c26d 100644
--- a/source/blender/bmesh/operators/bmo_dupe.c
+++ b/source/blender/bmesh/operators/bmo_dupe.c
@@ -277,8 +277,8 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target)
BLI_array_empty(vtar);
BLI_array_empty(edar);
- BLI_array_growitems(vtar, f->len);
- BLI_array_growitems(edar, f->len);
+ BLI_array_grow_items(vtar, f->len);
+ BLI_array_grow_items(edar, f->len);
copy_face(op, source, f, target, vtar, edar, vhash, ehash);
BMO_elem_flag_enable(source, f, DUPE_DONE);
diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c
index 19e2dd85b0e..4fced09c588 100644
--- a/source/blender/bmesh/operators/bmo_extrude.c
+++ b/source/blender/bmesh/operators/bmo_extrude.c
@@ -58,7 +58,7 @@ void bmo_extrude_face_indiv_exec(BMesh *bm, BMOperator *op)
BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
BLI_array_empty(edges);
- BLI_array_growitems(edges, f->len);
+ BLI_array_grow_items(edges, f->len);
i = 0;
firstv = lastv = NULL;
@@ -573,12 +573,12 @@ static void solidify_add_thickness(BMesh *bm, const float dist)
continue;
}
- BLI_array_growitems(verts, f->len);
+ BLI_array_grow_items(verts, f->len);
BM_ITER_ELEM_INDEX (l, &loopIter, f, BM_LOOPS_OF_FACE, i) {
verts[i] = l->v->co;
}
- BLI_array_growitems(face_angles, f->len);
+ BLI_array_grow_items(face_angles, f->len);
angle_poly_v3(face_angles, (const float **)verts, f->len);
i = 0;
diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c
index ee52f8bc0a9..712f6b736d6 100644
--- a/source/blender/bmesh/operators/bmo_inset.c
+++ b/source/blender/bmesh/operators/bmo_inset.c
@@ -495,8 +495,6 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
BM_face_copy_shared(bm, f);
}
- MEM_freeN(edge_info);
-
/* we could flag new edges/verts too, is it useful? */
BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, ELE_NEW);
@@ -505,6 +503,28 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
float (*varr_co)[3];
BMOIter oiter;
+ /* we need to re-calculate tagged normals, but for this purpose we can copy tagged verts from the
+ * faces they inset from, */
+ for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
+ zero_v3(es->e_new->v1->no);
+ zero_v3(es->e_new->v2->no);
+ }
+ for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
+ float *no = es->l->f->no;
+ add_v3_v3(es->e_new->v1->no, no);
+ add_v3_v3(es->e_new->v2->no, no);
+ }
+ for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
+ /* annoying, avoid normalizing twice */
+ if (len_squared_v3(es->e_new->v1->no) != 1.0f) {
+ normalize_v3(es->e_new->v1->no);
+ }
+ if (len_squared_v3(es->e_new->v2->no) != 1.0f) {
+ normalize_v3(es->e_new->v2->no);
+ }
+ }
+ /* done correcting edge verts normals */
+
/* untag verts */
BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_TAG, FALSE);
@@ -537,4 +557,6 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
}
MEM_freeN(varr_co);
}
+
+ MEM_freeN(edge_info);
}
diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c
index 582039fc1a2..d780e309118 100644
--- a/source/blender/bmesh/operators/bmo_join_triangles.c
+++ b/source/blender/bmesh/operators/bmo_join_triangles.c
@@ -293,7 +293,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op)
measure = measure_facepair(v1, v2, v3, v4, limit);
if (measure < limit) {
- BLI_array_growone(jedges);
+ BLI_array_grow_one(jedges);
jedges[i].e = e;
jedges[i].weight = measure;
diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c
index cf1669d441e..53c51dfd483 100644
--- a/source/blender/bmesh/operators/bmo_mirror.c
+++ b/source/blender/bmesh/operators/bmo_mirror.c
@@ -71,7 +71,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
i = 0;
/* v2 = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); */ /* UNUSED */
BMO_ITER (v, &siter, bm, &dupeop, "newout", BM_VERT) {
- BLI_array_growone(vmap);
+ BLI_array_grow_one(vmap);
vmap[i] = v;
/* v2 = BM_iter_step(&iter); */ /* UNUSED */
i++;
diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c
index 149f2537a12..70dcc6fa3ae 100644
--- a/source/blender/bmesh/operators/bmo_removedoubles.c
+++ b/source/blender/bmesh/operators/bmo_removedoubles.c
@@ -191,8 +191,8 @@ void bmo_weldverts_exec(BMesh *bm, BMOperator *op)
continue;
}
- BLI_array_growone(edges);
- BLI_array_growone(loops);
+ BLI_array_grow_one(edges);
+ BLI_array_grow_one(loops);
edges[a] = e2;
loops[a] = l;
@@ -393,7 +393,7 @@ void bmo_collapse_exec(BMesh *bm, BMOperator *op)
INIT_MINMAX(min, max);
for (tot = 0; e; tot++, e = BMW_step(&walker)) {
- BLI_array_growone(edges);
+ BLI_array_grow_one(edges);
edges[tot] = e;
DO_MINMAX(e->v1->co, min, max);
@@ -454,7 +454,7 @@ static void bmo_collapsecon_do_layer(BMesh *bm, BMOperator *op, int layer)
CustomData_data_initminmax(type, &min, &max);
for (tot = 0; l2; tot++, l2 = BMW_step(&walker)) {
- BLI_array_growone(blocks);
+ BLI_array_grow_one(blocks);
blocks[tot] = CustomData_bmesh_get_layer_n(&bm->ldata, l2->head.data, layer);
CustomData_data_dominmax(type, blocks[tot], &min, &max);
}
@@ -501,7 +501,7 @@ void bmesh_finddoubles_common(BMesh *bm, BMOperator *op, BMOperator *optarget, c
i = 0;
BMO_ITER (v, &oiter, bm, op, "verts", BM_VERT) {
- BLI_array_growone(verts);
+ BLI_array_grow_one(verts);
verts[i++] = v;
}
diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c
index 7da02a594d5..d96d0f6c74d 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.c
+++ b/source/blender/bmesh/operators/bmo_subdivide.c
@@ -778,8 +778,8 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
BLI_array_empty(edges);
BLI_array_empty(verts);
- BLI_array_growitems(edges, face->len);
- BLI_array_growitems(verts, face->len);
+ BLI_array_grow_items(edges, face->len);
+ BLI_array_grow_items(verts, face->len);
matched = 0;
@@ -825,7 +825,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
}
}
if (matched) {
- BLI_array_growone(facedata);
+ BLI_array_grow_one(facedata);
b = BLI_array_count(facedata) - 1;
facedata[b].pat = pat;
facedata[b].start = verts[i];
@@ -861,7 +861,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
}
}
if (matched) {
- BLI_array_growone(facedata);
+ BLI_array_grow_one(facedata);
j = BLI_array_count(facedata) - 1;
BMO_elem_flag_enable(bm, face, SUBD_SPLIT);
@@ -877,7 +877,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
}
if (!matched && totesel) {
- BLI_array_growone(facedata);
+ BLI_array_grow_one(facedata);
j = BLI_array_count(facedata) - 1;
BMO_elem_flag_enable(bm, face, SUBD_SPLIT);
@@ -918,7 +918,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
/* for case of two edges, connecting them shouldn't be too hard */
BM_ITER_ELEM (l, &liter, face, BM_LOOPS_OF_FACE) {
- BLI_array_growone(loops);
+ BLI_array_grow_one(loops);
loops[BLI_array_count(loops) - 1] = l;
}
@@ -951,10 +951,10 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
b += numcuts - 1;
for (j = 0; j < numcuts; j++) {
- BLI_array_growone(splits);
+ BLI_array_grow_one(splits);
splits[BLI_array_count(splits) - 1] = loops[a];
- BLI_array_growone(splits);
+ BLI_array_grow_one(splits);
splits[BLI_array_count(splits) - 1] = loops[b];
b = (b - 1) % vlen;
@@ -989,7 +989,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
}
for (j = 0; j < face->len; j++) {
- BLI_array_growone(verts);
+ BLI_array_grow_one(verts);
}
j = 0;
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index 7fd6cf6769c..9632a79b7dd 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -59,8 +59,8 @@ void bmo_triangulate_exec(BMesh *bm, BMOperator *op)
BLI_array_empty(projectverts);
BLI_array_empty(newfaces);
- BLI_array_growitems(projectverts, face->len * 3);
- BLI_array_growitems(newfaces, face->len);
+ BLI_array_grow_items(projectverts, face->len * 3);
+ BLI_array_grow_items(newfaces, face->len);
BM_face_triangulate(bm, face, projectverts, EDGE_NEW, FACE_NEW, newfaces, use_beauty);
diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c
index 3cfa70f6e6c..8409c5b76b8 100644
--- a/source/blender/bmesh/operators/bmo_utils.c
+++ b/source/blender/bmesh/operators/bmo_utils.c
@@ -348,7 +348,7 @@ void bmo_righthandfaces_exec(BMesh *bm, BMOperator *op)
* stack (if we use simple function recursion, we'd end up overloading
* the stack on large meshes). */
- BLI_array_growone(fstack);
+ BLI_array_grow_one(fstack);
fstack[0] = startf;
BMO_elem_flag_enable(bm, startf, FACE_VIS);
@@ -382,7 +382,7 @@ void bmo_righthandfaces_exec(BMesh *bm, BMOperator *op)
}
if (i == maxi) {
- BLI_array_growone(fstack);
+ BLI_array_grow_one(fstack);
maxi++;
}
@@ -420,7 +420,7 @@ void bmo_vertexsmooth_exec(BMesh *bm, BMOperator *op)
i = 0;
BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
- BLI_array_growone(cos);
+ BLI_array_grow_one(cos);
co = cos[i];
j = 0;
@@ -1035,7 +1035,7 @@ void bmo_face_reverseuvs_exec(BMesh *bm, BMOperator *op)
int i;
BLI_array_empty(uvs);
- BLI_array_growitems(uvs, fs->len);
+ BLI_array_grow_items(uvs, fs->len);
BM_ITER_ELEM_INDEX (lf, &l_iter, fs, BM_LOOPS_OF_FACE, i) {
MLoopUV *luv = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPUV);
@@ -1141,7 +1141,7 @@ void bmo_face_reversecolors_exec(BMesh *bm, BMOperator *op)
int i;
BLI_array_empty(cols);
- BLI_array_growitems(cols, fs->len);
+ BLI_array_grow_items(cols, fs->len);
BM_ITER_ELEM_INDEX (lf, &l_iter, fs, BM_LOOPS_OF_FACE, i) {
cols[i] = *((MLoopCol *)CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPCOL));