diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-01 21:38:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-01 21:38:04 +0400 |
commit | 522b73a63519903f57b65f57d94006f50bcab1ae (patch) | |
tree | 3ff915cdc1d15bb7d3c944a0ef6b094e43d07dca | |
parent | 1f473a78b80aa4de53d304e4700b98d4a0ae8f1e (diff) |
bmesh api:
* name bmesh operator func's BMO_slot_buffer_* rather then BMO_slot_* since it wasnt obvious some only dealt with buffer, some both.
* more typechecks and asserts of BMO_ functions (I lost some time calling a map with a buffer function that failed silently).
* small speedup for extrude check - test if the edge is wire _before_ doign a hash lookup.
-rw-r--r-- | source/blender/bmesh/bmesh_operator_api.h | 12 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_operators.c | 125 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_bevel.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_connect.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_create.c | 8 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_dissolve.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_dupe.c | 6 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_edgesplit.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_extrude.c | 14 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_mirror.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_primitive.c | 14 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_subdivide.c | 14 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_triangulate.c | 8 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_utils.c | 14 | ||||
-rw-r--r-- | source/blender/editors/mesh/bmesh_tools.c | 5 |
15 files changed, 116 insertions, 118 deletions
diff --git a/source/blender/bmesh/bmesh_operator_api.h b/source/blender/bmesh/bmesh_operator_api.h index e1e06fa9657..c4fbae4da8e 100644 --- a/source/blender/bmesh/bmesh_operator_api.h +++ b/source/blender/bmesh/bmesh_operator_api.h @@ -291,8 +291,8 @@ void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *op, const char htype, cons /* puts every element of type type (which is a bitmask) with tool flag flag, * into a slot. */ -void BMO_slot_from_flag(BMesh *bm, BMOperator *op, const char *slotname, - const short oflag, const char htype); +void BMO_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slotname, + const short oflag, const char htype); /* tool-flags all elements inside an element slot array with flag flag. */ void BMO_slot_buffer_flag_enable(BMesh *bm, BMOperator *op, const char *slotname, @@ -311,11 +311,11 @@ void BMO_slot_buffer_hflag_disable(BMesh *bm, BMOperator *op, const char *slotna /* puts every element of type type (which is a bitmask) with header flag * flag, into a slot. note: ignores hidden elements (e.g. elements with * header flag BM_ELEM_HIDDEN set).*/ -void BMO_slot_from_hflag(BMesh *bm, BMOperator *op, const char *slotname, - const char hflag, const char htype); +void BMO_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *slotname, + const char hflag, const char htype); /* counts number of elements inside a slot array. */ -int BMO_slot_buf_count(BMesh *bm, BMOperator *op, const char *slotname); +int BMO_slot_buffer_count(BMesh *bm, BMOperator *op, const char *slotname); int BMO_slot_map_count(BMesh *bm, BMOperator *op, const char *slotname); void BMO_slot_map_insert(BMesh *UNUSED(bm), BMOperator *op, const char *slotname, @@ -371,7 +371,7 @@ typedef struct BMOIter { char restrictmask; /* bitwise '&' with BMHeader.htype */ } BMOIter; -void *BMO_slot_elem_first(BMOperator *op, const char *slotname); +void *BMO_slot_buffer_elem_first(BMOperator *op, const char *slotname); /* restrictmask restricts the iteration to certain element types * (e.g. combination of BM_VERT, BM_EDGE, BM_FACE), if iterating diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index ddb63a42400..31b291f7a36 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -248,46 +248,46 @@ void BMO_slot_copy(BMOperator *source_op, BMOperator *dest_op, const char *src, if (source_slot == dest_slot) return; - if (source_slot->slottype != dest_slot->slottype) + if (source_slot->slottype != dest_slot->slottype) { + /* possibly assert here? */ return; - - if (dest_slot->slottype > BMO_OP_SLOT_VEC) { - if (dest_slot->slottype != BMO_OP_SLOT_MAPPING) { - /* do buffer copy */ - dest_slot->data.buf = NULL; - dest_slot->len = source_slot->len; - if (dest_slot->len) { - const int slot_alloc_size = BMO_OPSLOT_TYPEINFO[dest_slot->slottype] * dest_slot->len; - dest_slot->data.buf = BLI_memarena_alloc(dest_op->arena, slot_alloc_size); - memcpy(dest_slot->data.buf, source_slot->data.buf, slot_alloc_size); - } + } + + if (dest_slot->slottype == BMO_OP_SLOT_ELEMENT_BUF) { + /* do buffer copy */ + dest_slot->data.buf = NULL; + dest_slot->len = source_slot->len; + if (dest_slot->len) { + const int slot_alloc_size = BMO_OPSLOT_TYPEINFO[dest_slot->slottype] * dest_slot->len; + dest_slot->data.buf = BLI_memarena_alloc(dest_op->arena, slot_alloc_size); + memcpy(dest_slot->data.buf, source_slot->data.buf, slot_alloc_size); } - else { - GHashIterator it; - BMOElemMapping *srcmap, *dstmap; + } + else if (dest_slot->slottype == BMO_OP_SLOT_MAPPING) { + GHashIterator it; + BMOElemMapping *srcmap, *dstmap; - /* sanity check */ - if (!source_slot->data.ghash) { - return; - } - - if (!dest_slot->data.ghash) { - dest_slot->data.ghash = BLI_ghash_new(BLI_ghashutil_ptrhash, - BLI_ghashutil_ptrcmp, "bmesh operator 2"); - } + /* sanity check */ + if (!source_slot->data.ghash) { + return; + } - BLI_ghashIterator_init(&it, source_slot->data.ghash); - for ( ; (srcmap = BLI_ghashIterator_getValue(&it)); - BLI_ghashIterator_step(&it)) - { - dstmap = BLI_memarena_alloc(dest_op->arena, sizeof(*dstmap) + srcmap->len); + if (!dest_slot->data.ghash) { + dest_slot->data.ghash = BLI_ghash_new(BLI_ghashutil_ptrhash, + BLI_ghashutil_ptrcmp, "bmesh operator 2"); + } - dstmap->element = srcmap->element; - dstmap->len = srcmap->len; - memcpy(dstmap + 1, srcmap + 1, srcmap->len); + BLI_ghashIterator_init(&it, source_slot->data.ghash); + for ( ; (srcmap = BLI_ghashIterator_getValue(&it)); + BLI_ghashIterator_step(&it)) + { + dstmap = BLI_memarena_alloc(dest_op->arena, sizeof(*dstmap) + srcmap->len); - BLI_ghash_insert(dest_slot->data.ghash, dstmap->element, dstmap); - } + dstmap->element = srcmap->element; + dstmap->len = srcmap->len; + memcpy(dstmap + 1, srcmap + 1, srcmap->len); + + BLI_ghash_insert(dest_slot->data.ghash, dstmap->element, dstmap); } } else { @@ -504,13 +504,13 @@ void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *UNUSED(op), const char hty } } -int BMO_slot_buf_count(BMesh *UNUSED(bm), BMOperator *op, const char *slotname) +int BMO_slot_buffer_count(BMesh *UNUSED(bm), BMOperator *op, const char *slotname) { BMOpSlot *slot = BMO_slot_get(op, slotname); - BLI_assert(slot->slottype > BMO_OP_SLOT_VEC); + BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF); /* check if its actually a buffer */ - if (!(slot->slottype > BMO_OP_SLOT_VEC)) + if (slot->slottype != BMO_OP_SLOT_ELEMENT_BUF) return 0; return slot->len; @@ -553,14 +553,16 @@ void BMO_slot_map_insert(BMesh *UNUSED(bm), BMOperator *op, const char *slotname } #if 0 -void *BMO_Grow_Array(BMesh *bm, BMOperator *op, int slotcode, int totadd) +void *bmo_slot_buffer_grow(BMesh *bm, BMOperator *op, int slotcode, int totadd) { BMOpSlot *slot = &op->slots[slotcode]; void *tmp; ssize_t allocsize; + BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF); + /* check if its actually a buffer */ - if (!(slot->slottype > BMO_OP_SLOT_VEC)) + if (slot->slottype != BMO_OP_SLOT_ELEMENT_BUF) return NULL; if (slot->flag & BMOS_DYNAMIC_ARRAY) { @@ -616,11 +618,10 @@ void BMO_slot_map_to_flag(BMesh *bm, BMOperator *op, const char *slotname, static void *bmo_slot_buffer_alloc(BMOperator *op, const char *slotname, int len) { BMOpSlot *slot = BMO_slot_get(op, slotname); - - BLI_assert(slot->slottype > BMO_OP_SLOT_VEC); + BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF); /* check if its actually a buffer */ - if (!(slot->slottype > BMO_OP_SLOT_VEC)) + if (slot->slottype != BMO_OP_SLOT_ELEMENT_BUF) return NULL; slot->len = len; @@ -634,7 +635,7 @@ static void *bmo_slot_buffer_alloc(BMOperator *op, const char *slotname, int len * * Copies all elements of a certain type into an operator slot. */ -static void BMO_slot_from_all(BMesh *bm, BMOperator *op, const char *slotname, const char htype) +static void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slotname, const char htype) { BMIter elements; BMHeader *e; @@ -677,7 +678,7 @@ static void BMO_slot_from_all(BMesh *bm, BMOperator *op, const char *slotname, c * Copies elements of a certain type, which have a certain header flag set * into a slot for an operator. */ -void BMO_slot_from_hflag(BMesh *bm, BMOperator *op, const char *slotname, +void BMO_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *slotname, const char hflag, const char htype) { BMIter elements; @@ -685,7 +686,7 @@ void BMO_slot_from_hflag(BMesh *bm, BMOperator *op, const char *slotname, BMOpSlot *output = BMO_slot_get(op, slotname); int totelement = 0, i = 0; - totelement = BM_mesh_count_flag(bm, htype, hflag, 1); + totelement = BM_mesh_count_flag(bm, htype, hflag, TRUE); if (totelement) { bmo_slot_buffer_alloc(op, slotname, totelement); @@ -728,23 +729,27 @@ void BMO_slot_from_hflag(BMesh *bm, BMOperator *op, const char *slotname, * Copies elements of a certain type, which have a certain flag set * into an output slot for an operator. */ -void BMO_slot_from_flag(BMesh *bm, BMOperator *op, const char *slotname, - const short oflag, const char htype) +void BMO_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slotname, + const short oflag, const char htype) { BMIter elements; - BMHeader *ele; - BMOpSlot *output = BMO_slot_get(op, slotname); + BMOpSlot *slot = BMO_slot_get(op, slotname); int totelement = BMO_mesh_flag_count(bm, oflag, htype), i = 0; - BLI_assert(output->slottype > BMO_OP_SLOT_VEC); + BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF); if (totelement) { + BMHeader *ele; + BMHeader **ele_array; + bmo_slot_buffer_alloc(op, slotname, totelement); + ele_array = (BMHeader **)slot->data.p; + if (htype & BM_VERT) { for (ele = BM_iter_new(&elements, bm, BM_VERTS_OF_MESH, bm); ele; ele = BM_iter_step(&elements)) { if (BMO_elem_flag_test(bm, (BMElemF *)ele, oflag)) { - ((BMHeader **)output->data.p)[i] = ele; + ele_array[i] = ele; i++; } } @@ -753,7 +758,7 @@ void BMO_slot_from_flag(BMesh *bm, BMOperator *op, const char *slotname, if (htype & BM_EDGE) { for (ele = BM_iter_new(&elements, bm, BM_EDGES_OF_MESH, bm); ele; ele = BM_iter_step(&elements)) { if (BMO_elem_flag_test(bm, (BMElemF *)ele, oflag)) { - ((BMHeader **)output->data.p)[i] = ele; + ele_array[i] = ele; i++; } } @@ -762,14 +767,14 @@ void BMO_slot_from_flag(BMesh *bm, BMOperator *op, const char *slotname, if (htype & BM_FACE) { for (ele = BM_iter_new(&elements, bm, BM_FACES_OF_MESH, bm); ele; ele = BM_iter_step(&elements)) { if (BMO_elem_flag_test(bm, (BMElemF *)ele, oflag)) { - ((BMHeader **)output->data.p)[i] = ele; + ele_array[i] = ele; i++; } } } } else { - output->len = 0; + slot->len = 0; } } @@ -786,7 +791,7 @@ void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOperator *op, const char *slotnam BMElem **data = slot->data.p; int i; - BLI_assert(slot->slottype > BMO_OP_SLOT_VEC); + BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF); if (!(hflag & BM_ELEM_SELECT)) { do_flush_select = FALSE; @@ -816,7 +821,7 @@ void BMO_slot_buffer_hflag_disable(BMesh *bm, BMOperator *op, const char *slotna BMElem **data = slot->data.p; int i; - BLI_assert(slot->slottype > BMO_OP_SLOT_VEC); + BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF); if (!(hflag & BM_ELEM_SELECT)) { do_flush_select = FALSE; @@ -1027,7 +1032,7 @@ static void bmo_flag_layer_clear(BMesh *bm) bm->elem_index_dirty &= ~(BM_VERT|BM_EDGE|BM_FACE); } -void *BMO_slot_elem_first(BMOperator *op, const char *slotname) +void *BMO_slot_buffer_elem_first(BMOperator *op, const char *slotname) { BMOpSlot *slot = BMO_slot_get(op, slotname); @@ -1372,13 +1377,13 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist) } if (type == 'h') { - BMO_slot_from_hflag(bm, op, slotname, va_arg(vlist, int), ret); + BMO_slot_buffer_from_hflag(bm, op, slotname, va_arg(vlist, int), ret); } else if (type == 'a') { - BMO_slot_from_all(bm, op, slotname, ret); + BMO_slot_buffer_from_all(bm, op, slotname, ret); } else { - BMO_slot_from_flag(bm, op, slotname, va_arg(vlist, int), ret); + BMO_slot_buffer_from_flag(bm, op, slotname, va_arg(vlist, int), ret); } } diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c index 6cdea3657f6..e6262f52282 100644 --- a/source/blender/bmesh/operators/bmo_bevel.c +++ b/source/blender/bmesh/operators/bmo_bevel.c @@ -876,6 +876,6 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) BLI_array_free(edges); BLI_array_free(faces); - BMO_slot_from_flag(bm, op, "face_spans", FACE_SPAN, BM_FACE); - BMO_slot_from_flag(bm, op, "face_holes", FACE_HOLE, BM_FACE); + BMO_slot_buffer_from_flag(bm, op, "face_spans", FACE_SPAN, BM_FACE); + BMO_slot_buffer_from_flag(bm, op, "face_holes", FACE_HOLE, BM_FACE); } diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c index 0c71df000c0..03f10cc8814 100644 --- a/source/blender/bmesh/operators/bmo_connect.c +++ b/source/blender/bmesh/operators/bmo_connect.c @@ -116,7 +116,7 @@ void bmo_connectverts_exec(BMesh *bm, BMOperator *op) } } - BMO_slot_from_flag(bm, op, "edgeout", EDGE_OUT, BM_EDGE); + BMO_slot_buffer_from_flag(bm, op, "edgeout", EDGE_OUT, BM_EDGE); BLI_array_free(loops); BLI_array_free(verts); diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index 8798155845e..93121a6198b 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -1035,7 +1035,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op) edge_free_path(pathbase, path); } - BMO_slot_from_flag(bm, op, "faceout", FACE_NEW, BM_FACE); + BMO_slot_buffer_from_flag(bm, op, "faceout", FACE_NEW, BM_FACE); BLI_array_free(edges); BLI_array_free(verts); @@ -1232,7 +1232,7 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op) } } - BMO_slot_from_flag(bm, op, "edgeout", ELE_NEW, BM_EDGE); + BMO_slot_buffer_from_flag(bm, op, "edgeout", ELE_NEW, BM_EDGE); BLI_array_free(edges1); BLI_array_free(edges2); @@ -1340,7 +1340,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) BMO_op_exec(bm, &op2); /* return if edge net create did somethin */ - if (BMO_slot_buf_count(bm, &op2, "faceout")) { + if (BMO_slot_buffer_count(bm, &op2, "faceout")) { BMO_slot_copy(&op2, op, "faceout", "faceout"); BMO_op_finish(bm, &op2); return; @@ -1353,7 +1353,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) BMO_op_exec(bm, &op2); /* if we dissolved anything, then return */ - if (BMO_slot_buf_count(bm, &op2, "regionout")) { + if (BMO_slot_buffer_count(bm, &op2, "regionout")) { BMO_slot_copy(&op2, op, "regionout", "faceout"); BMO_op_finish(bm, &op2); return; diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index 94a6c43e838..2d8f99475d6 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -176,7 +176,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op) if (BMO_error_occurred(bm)) goto cleanup; - BMO_slot_from_flag(bm, op, "regionout", FACE_NEW, BM_FACE); + BMO_slot_buffer_from_flag(bm, op, "regionout", FACE_NEW, BM_FACE); cleanup: /* free/cleanu */ diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c index 20f1920c07f..7c8192d1ccf 100644 --- a/source/blender/bmesh/operators/bmo_dupe.c +++ b/source/blender/bmesh/operators/bmo_dupe.c @@ -335,7 +335,7 @@ void bmo_dupe_exec(BMesh *bm, BMOperator *op) BMO_slot_copy(dupeop, dupeop, "geom", "origout"); /* Now alloc the new output buffer */ - BMO_slot_from_flag(bm, dupeop, "newout", DUPE_NEW, BM_ALL); + BMO_slot_buffer_from_flag(bm, dupeop, "newout", DUPE_NEW, BM_ALL); } #if 0 /* UNUSED */ @@ -348,7 +348,7 @@ void BMO_dupe_from_flag(BMesh *bm, int etypeflag, const char hflag) BMOperator dupeop; BMO_op_init(bm, &dupeop, "dupe"); - BMO_slot_from_hflag(bm, &dupeop, "geom", hflag, etypeflag); + BMO_slot_buffer_from_hflag(bm, &dupeop, "geom", hflag, etypeflag); BMO_op_exec(bm, &dupeop); BMO_op_finish(bm, &dupeop); @@ -429,7 +429,7 @@ void bmo_split_exec(BMesh *bm, BMOperator *op) /* connect outputs of dupe to delete, exluding keep geometr */ BMO_slot_int_set(&delop, "context", DEL_FACES); - BMO_slot_from_flag(bm, &delop, "geom", SPLIT_INPUT, BM_ALL); + BMO_slot_buffer_from_flag(bm, &delop, "geom", SPLIT_INPUT, BM_ALL); BMO_op_exec(bm, &delop); diff --git a/source/blender/bmesh/operators/bmo_edgesplit.c b/source/blender/bmesh/operators/bmo_edgesplit.c index 8055da41728..4d4d429a237 100644 --- a/source/blender/bmesh/operators/bmo_edgesplit.c +++ b/source/blender/bmesh/operators/bmo_edgesplit.c @@ -414,8 +414,8 @@ void bmo_edgesplit_exec(BMesh *bm, BMOperator *op) #endif tag_out_edges(bm, etags, op); - BMO_slot_from_flag(bm, op, "edgeout1", EDGE_RET1, BM_EDGE); - BMO_slot_from_flag(bm, op, "edgeout2", EDGE_RET2, BM_EDGE); + BMO_slot_buffer_from_flag(bm, op, "edgeout1", EDGE_RET1, BM_EDGE); + BMO_slot_buffer_from_flag(bm, op, "edgeout2", EDGE_RET2, BM_EDGE); BLI_array_free(verts); BLI_array_free(edges_tmp); diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index 8a6c17dabda..ab5287a3d89 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -110,7 +110,7 @@ void bmo_extrude_face_indiv_exec(BMesh *bm, BMOperator *op) BLI_array_free(edges); BMO_op_callf(bm, "del geom=%ff context=%i", EXT_DEL, DEL_ONLYFACES); - BMO_slot_from_flag(bm, op, "faceout", EXT_KEEP, BM_FACE); + BMO_slot_buffer_from_flag(bm, op, "faceout", EXT_KEEP, BM_FACE); } void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op) @@ -162,7 +162,7 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op) BMO_op_finish(bm, &dupeop); - BMO_slot_from_flag(bm, op, "geomout", EXT_KEEP, BM_ALL); + BMO_slot_buffer_from_flag(bm, op, "geomout", EXT_KEEP, BM_ALL); } void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op) @@ -181,8 +181,8 @@ void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op) BMO_elem_flag_enable(bm, dupev, EXT_KEEP); } - BMO_slot_from_flag(bm, op, "vertout", EXT_KEEP, BM_VERT); - BMO_slot_from_flag(bm, op, "edgeout", EXT_KEEP, BM_EDGE); + BMO_slot_buffer_from_flag(bm, op, "vertout", EXT_KEEP, BM_VERT); + BMO_slot_buffer_from_flag(bm, op, "edgeout", EXT_KEEP, BM_EDGE); } void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) @@ -291,11 +291,9 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) BMO_slot_copy(&dupeop, op, "newout", "geomout"); e = BMO_iter_new(&siter, bm, &dupeop, "boundarymap", 0); for ( ; e; e = BMO_iter_step(&siter)) { - if (BMO_slot_map_contains(bm, op, "exclude", e)) { - /* this should always be wire, - * assert if not since we dont want to kill off any faces (next) */ - BLI_assert(BM_edge_is_wire(bm, e) == TRUE); + /* this should always be wire, so this is mainly a speedup to avoid map lookup */ + if (BM_edge_is_wire(bm, e) && BMO_slot_map_contains(bm, op, "exclude", e)) { /* The original edge was excluded, * this would result in a standalone wire edge - see [#30399] */ BM_edge_kill(bm, e); diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c index 7990e991431..30704e16a92 100644 --- a/source/blender/bmesh/operators/bmo_mirror.c +++ b/source/blender/bmesh/operators/bmo_mirror.c @@ -119,7 +119,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op) BMO_op_finish(bm, &weldop); BMO_op_finish(bm, &dupeop); - BMO_slot_from_flag(bm, op, "newout", ELE_NEW, BM_ALL); + BMO_slot_buffer_from_flag(bm, op, "newout", ELE_NEW, BM_ALL); BLI_array_free(vmap); BLI_array_free(emap); diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index 09f815f50d5..54b0805df82 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -283,7 +283,7 @@ void bmo_create_grid_exec(BMesh *bm, BMOperator *op) if (a) BMO_op_finish(bm, &bmop); - BMO_slot_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); + BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); } void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) @@ -372,7 +372,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) } } - BMO_slot_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); + BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); } void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op) @@ -439,7 +439,7 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op) } } - BMO_slot_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); + BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); } void bmo_create_monkey_exec(BMesh *bm, BMOperator *op) @@ -486,7 +486,7 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op) MEM_freeN(tv); - BMO_slot_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); + BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); } @@ -558,7 +558,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) BMO_op_callf(bm, "dissolve_faces faces=%ff", FACE_NEW); } - BMO_slot_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); + BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); } void bmo_create_cone_exec(BMesh *bm, BMOperator *op) @@ -654,7 +654,7 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op) BM_face_create_quad_tri(bm, v1, v2, firstv2, firstv1, NULL, FALSE); BMO_op_callf(bm, "removedoubles verts=%fv dist=%f", VERT_MARK, 0.000001); - BMO_slot_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); + BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); } void bmo_create_cube_exec(BMesh *bm, BMOperator *op) @@ -732,5 +732,5 @@ void bmo_create_cube_exec(BMesh *bm, BMOperator *op) BM_face_create_quad_tri(bm, v1, v2, v3, v4, NULL, FALSE); BM_face_create_quad_tri(bm, v8, v7, v6, v5, NULL, FALSE); - BMO_slot_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); + BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); } diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index 53cd7148005..234749c9786 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -740,8 +740,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) } /* first go through and tag edge */ - BMO_slot_from_flag(bmesh, op, "edges", - SUBD_SPLIT, BM_EDGE); + BMO_slot_buffer_from_flag(bmesh, op, "edges", SUBD_SPLIT, BM_EDGE); params.numcuts = numcuts; params.op = op; @@ -1006,13 +1005,10 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) BLI_array_free(splits); BLI_array_free(loops); - BMO_slot_from_flag(bmesh, op, "outinner", - ELE_INNER, BM_ALL); - BMO_slot_from_flag(bmesh, op, "outsplit", - ELE_SPLIT, BM_ALL); + BMO_slot_buffer_from_flag(bmesh, op, "outinner", ELE_INNER, BM_ALL); + BMO_slot_buffer_from_flag(bmesh, op, "outsplit", ELE_SPLIT, BM_ALL); - BMO_slot_from_flag(bmesh, op, "geomout", - ELE_INNER|ELE_SPLIT|SUBD_SPLIT, BM_ALL); + BMO_slot_buffer_from_flag(bmesh, op, "geomout", ELE_INNER|ELE_SPLIT|SUBD_SPLIT, BM_ALL); } /* editmesh-emulating functio */ @@ -1100,7 +1096,7 @@ void bmo_edgebisect_exec(BMesh *bm, BMOperator *op) bm_subdivide_multicut(bm, e, ¶ms, e->v1, e->v2); } - BMO_slot_from_flag(bm, op, "outsplit", ELE_SPLIT, BM_ALL); + BMO_slot_buffer_from_flag(bm, op, "outsplit", ELE_SPLIT, BM_ALL); BM_data_layer_free_n(bm, &bm->vdata, CD_SHAPEKEY, skey); } diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c index b3f4fefa36e..4b7c7c49cc5 100644 --- a/source/blender/bmesh/operators/bmo_triangulate.c +++ b/source/blender/bmesh/operators/bmo_triangulate.c @@ -71,8 +71,8 @@ void bmo_triangulate_exec(BMesh *bm, BMOperator *op) } } - BMO_slot_from_flag(bm, op, "edgeout", EDGE_NEW, BM_EDGE); - BMO_slot_from_flag(bm, op, "faceout", FACE_NEW, BM_FACE); + BMO_slot_buffer_from_flag(bm, op, "edgeout", EDGE_NEW, BM_EDGE); + BMO_slot_buffer_from_flag(bm, op, "faceout", FACE_NEW, BM_FACE); BLI_array_free(projectverts); BLI_array_free(newfaces); @@ -151,7 +151,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op) } } - BMO_slot_from_flag(bm, op, "geomout", ELE_NEW, BM_EDGE|BM_FACE); + BMO_slot_buffer_from_flag(bm, op, "geomout", ELE_NEW, BM_EDGE|BM_FACE); } void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op) @@ -215,5 +215,5 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op) BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", ELE_NEW, BM_FACE|BM_EDGE); BMO_op_finish(bm, &bmop); - BMO_slot_from_flag(bm, op, "geomout", ELE_NEW, BM_EDGE|BM_FACE); + BMO_slot_buffer_from_flag(bm, op, "geomout", ELE_NEW, BM_EDGE|BM_FACE); } diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c index 278512a29c3..f00fa50f146 100644 --- a/source/blender/bmesh/operators/bmo_utils.c +++ b/source/blender/bmesh/operators/bmo_utils.c @@ -49,7 +49,7 @@ void bmo_makevert_exec(BMesh *bm, BMOperator *op) BMO_slot_vec_get(op, "co", vec); BMO_elem_flag_enable(bm, BM_vert_create(bm, vec, NULL), 1); - BMO_slot_from_flag(bm, op, "newvertout", 1, BM_VERT); + BMO_slot_buffer_from_flag(bm, op, "newvertout", 1, BM_VERT); } void bmo_transform_exec(BMesh *bm, BMOperator *op) @@ -134,7 +134,7 @@ void bmo_edgerotate_exec(BMesh *bm, BMOperator *op) BMO_elem_flag_enable(bm, e2, 1); } - BMO_slot_from_flag(bm, op, "edgeout", 1, BM_EDGE); + BMO_slot_buffer_from_flag(bm, op, "edgeout", 1, BM_EDGE); } #define SEL_FLAG 1 @@ -233,7 +233,7 @@ void bmo_regionextend_exec(BMesh *bm, BMOperator *op) else bmo_regionextend_extend(bm, op, use_faces); - BMO_slot_from_flag(bm, op, "geomout", SEL_FLAG, BM_ALL); + BMO_slot_buffer_from_flag(bm, op, "geomout", SEL_FLAG, BM_ALL); } /********* righthand faces implementation ****** */ @@ -653,7 +653,7 @@ void bmo_similarfaces_exec(BMesh *bm, BMOperator *op) MEM_freeN(indices); /* transfer all marked faces to the output slot */ - BMO_slot_from_flag(bm, op, "faceout", FACE_MARK, BM_FACE); + BMO_slot_buffer_from_flag(bm, op, "faceout", FACE_MARK, BM_FACE); } /****************************************************************************** @@ -850,7 +850,7 @@ void bmo_similaredges_exec(BMesh *bm, BMOperator *op) MEM_freeN(indices); /* transfer all marked edges to the output slot */ - BMO_slot_from_flag(bm, op, "edgeout", EDGE_MARK, BM_EDGE); + BMO_slot_buffer_from_flag(bm, op, "edgeout", EDGE_MARK, BM_EDGE); } /****************************************************************************** @@ -966,7 +966,7 @@ void bmo_similarverts_exec(BMesh *bm, BMOperator *op) MEM_freeN(indices); MEM_freeN(v_ext); - BMO_slot_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); + BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); } /****************************************************************************** @@ -1294,5 +1294,5 @@ void bmo_vertexshortestpath_exec(BMesh *bm, BMOperator *op) BLI_heap_free(h, NULL); MEM_freeN(vert_list); - BMO_slot_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); + BMO_slot_buffer_from_flag(bm, op, "vertout", VERT_MARK, BM_VERT); } diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c index e7a3c3337f0..cf30af4f7e2 100644 --- a/source/blender/editors/mesh/bmesh_tools.c +++ b/source/blender/editors/mesh/bmesh_tools.c @@ -248,8 +248,7 @@ static short EDBM_Extrude_edge(Object *obedit, BMEditMesh *em, const char hflag, BMElem *ele; BMO_op_init(bm, &extop, "extrude_face_region"); - BMO_slot_from_hflag(bm, &extop, "edgefacein", - hflag, BM_VERT|BM_EDGE|BM_FACE); + BMO_slot_buffer_from_hflag(bm, &extop, "edgefacein", hflag, BM_VERT|BM_EDGE|BM_FACE); /* If a mirror modifier with clipping is on, we need to adjust some * of the cases above to handle edges on the line of symmetry. @@ -3143,7 +3142,7 @@ static int knife_cut_exec(bContext *C, wmOperator *op) } } - BMO_slot_from_flag(bm, &bmop, "edges", 1, BM_EDGE); + BMO_slot_buffer_from_flag(bm, &bmop, "edges", 1, BM_EDGE); if (mode == KNIFE_MIDPOINT) numcuts = 1; BMO_slot_int_set(&bmop, "numcuts", numcuts); |