BMesh: make toolflags optional

Saves 8 bytes per vert/edge/face.
Gives overall ~20-25% memory saving for dyntopo sculpting
and modifiers that use BMesh.
This commit is contained in:
2016-07-01 19:07:11 +10:00
parent 4b0aeaf327
commit 0a026033ae
58 changed files with 887 additions and 601 deletions

View File

@@ -32,6 +32,7 @@
*/ */
struct ID; struct ID;
struct BMeshCreateParams;
struct BoundBox; struct BoundBox;
struct EdgeHash; struct EdgeHash;
struct ListBase; struct ListBase;
@@ -69,7 +70,9 @@ extern "C" {
/* *** mesh.c *** */ /* *** mesh.c *** */
struct BMesh *BKE_mesh_to_bmesh(struct Mesh *me, struct Object *ob, const bool add_key_index); struct BMesh *BKE_mesh_to_bmesh(
struct Mesh *me, struct Object *ob,
const bool add_key_index, const struct BMeshCreateParams *params);
int poly_find_loop_from_vert( int poly_find_loop_from_vert(
const struct MPoly *poly, const struct MPoly *poly,

View File

@@ -561,12 +561,14 @@ Mesh *BKE_mesh_copy(Mesh *me)
return BKE_mesh_copy_ex(G.main, me); return BKE_mesh_copy_ex(G.main, me);
} }
BMesh *BKE_mesh_to_bmesh(Mesh *me, Object *ob, const bool add_key_index) BMesh *BKE_mesh_to_bmesh(
Mesh *me, Object *ob,
const bool add_key_index, const struct BMeshCreateParams *params)
{ {
BMesh *bm; BMesh *bm;
const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_ME(me); const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_ME(me);
bm = BM_mesh_create(&allocsize); bm = BM_mesh_create(&allocsize, params);
BM_mesh_bm_from_me( BM_mesh_bm_from_me(
bm, me, (&(struct BMeshFromMeshParams){ bm, me, (&(struct BMeshFromMeshParams){

View File

@@ -211,7 +211,9 @@ BMEditMesh *DM_to_editbmesh(DerivedMesh *dm, BMEditMesh *existing, const bool do
bm = em->bm; bm = em->bm;
} }
else { else {
bm = BM_mesh_create(&bm_mesh_allocsize_default); bm = BM_mesh_create(
&bm_mesh_allocsize_default,
&((struct BMeshCreateParams){.use_toolflags = false,}));
} }
DM_to_bmesh_ex(dm, bm, do_tessellate); DM_to_bmesh_ex(dm, bm, do_tessellate);
@@ -233,7 +235,9 @@ BMesh *DM_to_bmesh(DerivedMesh *dm, const bool calc_face_normal)
BMesh *bm; BMesh *bm;
const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_DM(dm); const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_DM(dm);
bm = BM_mesh_create(&allocsize); bm = BM_mesh_create(
&allocsize,
&((struct BMeshCreateParams){.use_toolflags = false,}));
DM_to_bmesh_ex(dm, bm, calc_face_normal); DM_to_bmesh_ex(dm, bm, calc_face_normal);

View File

@@ -89,7 +89,6 @@ BLI_STATIC_ASSERT((sizeof(BMHeader) <= 16), "BMHeader size has grown!");
typedef struct BMVert { typedef struct BMVert {
BMHeader head; BMHeader head;
struct BMFlagLayer *oflags; /* keep after header, an array of flags, mostly used by the operator stack */
float co[3]; /* vertex coordinates */ float co[3]; /* vertex coordinates */
float no[3]; /* vertex normal */ float no[3]; /* vertex normal */
@@ -102,6 +101,11 @@ typedef struct BMVert {
struct BMEdge *e; struct BMEdge *e;
} BMVert; } BMVert;
typedef struct BMVert_OFlag {
BMVert base;
struct BMFlagLayer *oflags;
} BMVert_OFlag;
/* disk link structure, only used by edges */ /* disk link structure, only used by edges */
typedef struct BMDiskLink { typedef struct BMDiskLink {
struct BMEdge *next, *prev; struct BMEdge *next, *prev;
@@ -109,7 +113,6 @@ typedef struct BMDiskLink {
typedef struct BMEdge { typedef struct BMEdge {
BMHeader head; BMHeader head;
struct BMFlagLayer *oflags; /* keep after header, an array of flags, mostly used by the operator stack */
struct BMVert *v1, *v2; /* vertices (unordered) */ struct BMVert *v1, *v2; /* vertices (unordered) */
@@ -122,6 +125,11 @@ typedef struct BMEdge {
BMDiskLink v1_disk_link, v2_disk_link; BMDiskLink v1_disk_link, v2_disk_link;
} BMEdge; } BMEdge;
typedef struct BMEdge_OFlag {
BMEdge base;
struct BMFlagLayer *oflags;
} BMEdge_OFlag;
typedef struct BMLoop { typedef struct BMLoop {
BMHeader head; BMHeader head;
/* notice no flags layer */ /* notice no flags layer */
@@ -142,10 +150,6 @@ typedef struct BMLoop {
/* can cast BMFace/BMEdge/BMVert, but NOT BMLoop, since these don't have a flag layer */ /* can cast BMFace/BMEdge/BMVert, but NOT BMLoop, since these don't have a flag layer */
typedef struct BMElemF { typedef struct BMElemF {
BMHeader head; BMHeader head;
/* keep directly after header,
* optional array of flags, only used by the operator stack */
struct BMFlagLayer *oflags;
} BMElemF; } BMElemF;
/* can cast anything to this, including BMLoop */ /* can cast anything to this, including BMLoop */
@@ -163,7 +167,6 @@ typedef struct BMLoopList {
typedef struct BMFace { typedef struct BMFace {
BMHeader head; BMHeader head;
struct BMFlagLayer *oflags; /* an array of flags, mostly used by the operator stack */
#ifdef USE_BMESH_HOLES #ifdef USE_BMESH_HOLES
int totbounds; /*total boundaries, is one plus the number of holes in the face*/ int totbounds; /*total boundaries, is one plus the number of holes in the face*/
@@ -177,6 +180,11 @@ typedef struct BMFace {
// short _pad[3]; // short _pad[3];
} BMFace; } BMFace;
typedef struct BMFace_OFlag {
BMFace base;
struct BMFlagLayer *oflags;
} BMFace_OFlag;
typedef struct BMFlagLayer { typedef struct BMFlagLayer {
short f; /* flags */ short f; /* flags */
} BMFlagLayer; } BMFlagLayer;
@@ -217,6 +225,8 @@ typedef struct BMesh {
/* operator api stuff (must be all NULL or all alloc'd) */ /* operator api stuff (must be all NULL or all alloc'd) */
struct BLI_mempool *vtoolflagpool, *etoolflagpool, *ftoolflagpool; struct BLI_mempool *vtoolflagpool, *etoolflagpool, *ftoolflagpool;
unsigned int use_toolflags : 1;
int toolflag_index; int toolflag_index;
struct BMOperator *currentop; struct BMOperator *currentop;
@@ -259,10 +269,12 @@ enum {
/* args for _Generic */ /* args for _Generic */
#define _BM_GENERIC_TYPE_ELEM_NONCONST \ #define _BM_GENERIC_TYPE_ELEM_NONCONST \
void *, BMVert *, BMEdge *, BMLoop *, BMFace *, \ void *, BMVert *, BMEdge *, BMLoop *, BMFace *, \
BMVert_OFlag *, BMEdge_OFlag *, BMFace_OFlag *, \
BMElem *, BMElemF *, BMHeader * BMElem *, BMElemF *, BMHeader *
#define _BM_GENERIC_TYPE_ELEM_CONST \ #define _BM_GENERIC_TYPE_ELEM_CONST \
const void *, const BMVert *, const BMEdge *, const BMLoop *, const BMFace *, \ const void *, const BMVert *, const BMEdge *, const BMLoop *, const BMFace *, \
const BMVert_OFlag *, const BMEdge_OFlag *, const BMFace_OFlag *, \
const BMElem *, const BMElemF *, const BMHeader *, \ const BMElem *, const BMElemF *, const BMHeader *, \
void * const, BMVert * const, BMEdge * const, BMLoop * const, BMFace * const, \ void * const, BMVert * const, BMEdge * const, BMLoop * const, BMFace * const, \
BMElem * const, BMElemF * const, BMHeader * const BMElem * const, BMElemF * const, BMHeader * const
@@ -276,6 +288,27 @@ enum {
#define BM_CHECK_TYPE_ELEM(ele) \ #define BM_CHECK_TYPE_ELEM(ele) \
CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_ELEM_NONCONST, _BM_GENERIC_TYPE_ELEM_CONST) CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_ELEM_NONCONST, _BM_GENERIC_TYPE_ELEM_CONST)
/* vert */
#define _BM_GENERIC_TYPE_VERT_NONCONST BMVert *, BMVert_OFlag *
#define _BM_GENERIC_TYPE_VERT_CONST const BMVert *, const BMVert_OFlag *
#define BM_CHECK_TYPE_VERT_CONST(ele) CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_VERT_CONST)
#define BM_CHECK_TYPE_VERT_NONCONST(ele) CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_ELEM_NONCONST)
#define BM_CHECK_TYPE_VERT(ele) CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_VERT_NONCONST, _BM_GENERIC_TYPE_VERT_CONST)
/* edge */
#define _BM_GENERIC_TYPE_EDGE_NONCONST BMEdge *, BMEdge_OFlag *
#define _BM_GENERIC_TYPE_EDGE_CONST const BMEdge *, const BMEdge_OFlag *
#define BM_CHECK_TYPE_EDGE_CONST(ele) CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_EDGE_CONST)
#define BM_CHECK_TYPE_EDGE_NONCONST(ele) CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_ELEM_NONCONST)
#define BM_CHECK_TYPE_EDGE(ele) CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_EDGE_NONCONST, _BM_GENERIC_TYPE_EDGE_CONST)
/* face */
#define _BM_GENERIC_TYPE_FACE_NONCONST BMFace *, BMFace_OFlag *
#define _BM_GENERIC_TYPE_FACE_CONST const BMFace *, const BMFace_OFlag *
#define BM_CHECK_TYPE_FACE_CONST(ele) CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_FACE_CONST)
#define BM_CHECK_TYPE_FACE_NONCONST(ele) CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_ELEM_NONCONST)
#define BM_CHECK_TYPE_FACE(ele) CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_FACE_NONCONST, _BM_GENERIC_TYPE_FACE_CONST)
/* Assignment from a void* to a typed pointer is not allowed in C++, /* Assignment from a void* to a typed pointer is not allowed in C++,
* casting the LHS to void works fine though. * casting the LHS to void works fine though.
*/ */

View File

@@ -714,7 +714,9 @@ BMesh *BM_mesh_copy(BMesh *bm_old)
const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_BM(bm_old); const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_BM(bm_old);
/* allocate a bmesh */ /* allocate a bmesh */
bm_new = BM_mesh_create(&allocsize); bm_new = BM_mesh_create(
&allocsize,
&((struct BMeshCreateParams){.use_toolflags = bm_old->use_toolflags,}));
BM_mesh_copy_init_customdata(bm_new, bm_old, &allocsize); BM_mesh_copy_init_customdata(bm_new, bm_old, &allocsize);

View File

@@ -81,7 +81,9 @@ BMVert *BM_vert_create(
v->head.api_flag = 0; v->head.api_flag = 0;
/* allocate flags */ /* allocate flags */
v->oflags = bm->vtoolflagpool ? BLI_mempool_calloc(bm->vtoolflagpool) : NULL; if (bm->use_toolflags) {
((BMVert_OFlag *)v)->oflags = bm->vtoolflagpool ? BLI_mempool_calloc(bm->vtoolflagpool) : NULL;
}
/* 'v->no' is handled by BM_elem_attrs_copy */ /* 'v->no' is handled by BM_elem_attrs_copy */
if (co) { if (co) {
@@ -174,7 +176,9 @@ BMEdge *BM_edge_create(
e->head.api_flag = 0; e->head.api_flag = 0;
/* allocate flags */ /* allocate flags */
e->oflags = bm->etoolflagpool ? BLI_mempool_calloc(bm->etoolflagpool) : NULL; if (bm->use_toolflags) {
((BMEdge_OFlag *)e)->oflags = bm->etoolflagpool ? BLI_mempool_calloc(bm->etoolflagpool) : NULL;
}
e->v1 = v1; e->v1 = v1;
e->v2 = v2; e->v2 = v2;
@@ -386,7 +390,9 @@ BLI_INLINE BMFace *bm_face_create__internal(BMesh *bm)
f->head.api_flag = 0; f->head.api_flag = 0;
/* allocate flags */ /* allocate flags */
f->oflags = bm->ftoolflagpool ? BLI_mempool_calloc(bm->ftoolflagpool) : NULL; if (bm->use_toolflags) {
((BMFace_OFlag *)f)->oflags = bm->ftoolflagpool ? BLI_mempool_calloc(bm->ftoolflagpool) : NULL;
}
#ifdef USE_BMESH_HOLES #ifdef USE_BMESH_HOLES
BLI_listbase_clear(&f->loops); BLI_listbase_clear(&f->loops);
@@ -758,7 +764,7 @@ static void bm_kill_only_vert(BMesh *bm, BMVert *v)
CustomData_bmesh_free_block(&bm->vdata, &v->head.data); CustomData_bmesh_free_block(&bm->vdata, &v->head.data);
if (bm->vtoolflagpool) { if (bm->vtoolflagpool) {
BLI_mempool_free(bm->vtoolflagpool, v->oflags); BLI_mempool_free(bm->vtoolflagpool, ((BMVert_OFlag *)v)->oflags);
} }
BLI_mempool_free(bm->vpool, v); BLI_mempool_free(bm->vpool, v);
} }
@@ -779,7 +785,7 @@ static void bm_kill_only_edge(BMesh *bm, BMEdge *e)
CustomData_bmesh_free_block(&bm->edata, &e->head.data); CustomData_bmesh_free_block(&bm->edata, &e->head.data);
if (bm->etoolflagpool) { if (bm->etoolflagpool) {
BLI_mempool_free(bm->etoolflagpool, e->oflags); BLI_mempool_free(bm->etoolflagpool, ((BMEdge_OFlag *)e)->oflags);
} }
BLI_mempool_free(bm->epool, e); BLI_mempool_free(bm->epool, e);
} }
@@ -803,7 +809,7 @@ static void bm_kill_only_face(BMesh *bm, BMFace *f)
CustomData_bmesh_free_block(&bm->pdata, &f->head.data); CustomData_bmesh_free_block(&bm->pdata, &f->head.data);
if (bm->ftoolflagpool) { if (bm->ftoolflagpool) {
BLI_mempool_free(bm->ftoolflagpool, f->oflags); BLI_mempool_free(bm->ftoolflagpool, ((BMFace_OFlag *)f)->oflags);
} }
BLI_mempool_free(bm->fpool, f); BLI_mempool_free(bm->fpool, f);
} }
@@ -2196,7 +2202,7 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
/* deallocate edge and its two loops as well as f2 */ /* deallocate edge and its two loops as well as f2 */
if (bm->etoolflagpool) { if (bm->etoolflagpool) {
BLI_mempool_free(bm->etoolflagpool, l_f1->e->oflags); BLI_mempool_free(bm->etoolflagpool, ((BMEdge_OFlag *)l_f1->e)->oflags);
} }
BLI_mempool_free(bm->epool, l_f1->e); BLI_mempool_free(bm->epool, l_f1->e);
bm->totedge--; bm->totedge--;
@@ -2205,7 +2211,7 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
BLI_mempool_free(bm->lpool, l_f2); BLI_mempool_free(bm->lpool, l_f2);
bm->totloop--; bm->totloop--;
if (bm->ftoolflagpool) { if (bm->ftoolflagpool) {
BLI_mempool_free(bm->ftoolflagpool, f2->oflags); BLI_mempool_free(bm->ftoolflagpool, ((BMFace_OFlag *)f2)->oflags);
} }
BLI_mempool_free(bm->fpool, f2); BLI_mempool_free(bm->fpool, f2);
bm->totface--; bm->totface--;

View File

@@ -54,7 +54,7 @@ static void bmo_remove_tagged_faces(BMesh *bm, const short oflag)
BMIter iter; BMIter iter;
BM_ITER_MESH_MUTABLE (f, f_next, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH_MUTABLE (f, f_next, &iter, bm, BM_FACES_OF_MESH) {
if (BMO_elem_flag_test(bm, f, oflag)) { if (BMO_face_flag_test(bm, f, oflag)) {
BM_face_kill(bm, f); BM_face_kill(bm, f);
} }
} }
@@ -66,7 +66,7 @@ static void bmo_remove_tagged_edges(BMesh *bm, const short oflag)
BMIter iter; BMIter iter;
BM_ITER_MESH_MUTABLE (e, e_next, &iter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH_MUTABLE (e, e_next, &iter, bm, BM_EDGES_OF_MESH) {
if (BMO_elem_flag_test(bm, e, oflag)) { if (BMO_edge_flag_test(bm, e, oflag)) {
BM_edge_kill(bm, e); BM_edge_kill(bm, e);
} }
} }
@@ -78,7 +78,7 @@ static void bmo_remove_tagged_verts(BMesh *bm, const short oflag)
BMIter iter; BMIter iter;
BM_ITER_MESH_MUTABLE (v, v_next, &iter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH_MUTABLE (v, v_next, &iter, bm, BM_VERTS_OF_MESH) {
if (BMO_elem_flag_test(bm, v, oflag)) { if (BMO_vert_flag_test(bm, v, oflag)) {
BM_vert_kill(bm, v); BM_vert_kill(bm, v);
} }
} }
@@ -90,7 +90,7 @@ static void bmo_remove_tagged_verts_loose(BMesh *bm, const short oflag)
BMIter iter; BMIter iter;
BM_ITER_MESH_MUTABLE (v, v_next, &iter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH_MUTABLE (v, v_next, &iter, bm, BM_VERTS_OF_MESH) {
if (BMO_elem_flag_test(bm, v, oflag) && (v->e == NULL)) { if (BMO_vert_flag_test(bm, v, oflag) && (v->e == NULL)) {
BM_vert_kill(bm, v); BM_vert_kill(bm, v);
} }
} }
@@ -132,9 +132,9 @@ void BMO_mesh_delete_oflag_context(BMesh *bm, const short oflag, const int type)
{ {
/* flush down to vert */ /* flush down to vert */
BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
if (BMO_elem_flag_test(bm, e, oflag)) { if (BMO_edge_flag_test(bm, e, oflag)) {
BMO_elem_flag_enable(bm, e->v1, oflag); BMO_vert_flag_enable(bm, e->v1, oflag);
BMO_elem_flag_enable(bm, e->v2, oflag); BMO_vert_flag_enable(bm, e->v2, oflag);
} }
} }
bmo_remove_tagged_edges(bm, oflag); bmo_remove_tagged_edges(bm, oflag);
@@ -165,27 +165,27 @@ void BMO_mesh_delete_oflag_context(BMesh *bm, const short oflag, const int type)
{ {
/* go through and mark all edges and all verts of all faces for delete */ /* go through and mark all edges and all verts of all faces for delete */
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
if (BMO_elem_flag_test(bm, f, oflag)) { if (BMO_face_flag_test(bm, f, oflag)) {
BMLoop *l_first = BM_FACE_FIRST_LOOP(f); BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
BMLoop *l_iter; BMLoop *l_iter;
l_iter = l_first; l_iter = l_first;
do { do {
BMO_elem_flag_enable(bm, l_iter->v, oflag); BMO_vert_flag_enable(bm, l_iter->v, oflag);
BMO_elem_flag_enable(bm, l_iter->e, oflag); BMO_edge_flag_enable(bm, l_iter->e, oflag);
} while ((l_iter = l_iter->next) != l_first); } while ((l_iter = l_iter->next) != l_first);
} }
} }
/* now go through and mark all remaining faces all edges for keeping */ /* now go through and mark all remaining faces all edges for keeping */
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
if (!BMO_elem_flag_test(bm, f, oflag)) { if (!BMO_face_flag_test(bm, f, oflag)) {
BMLoop *l_first = BM_FACE_FIRST_LOOP(f); BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
BMLoop *l_iter; BMLoop *l_iter;
l_iter = l_first; l_iter = l_first;
do { do {
BMO_elem_flag_disable(bm, l_iter->v, oflag); BMO_vert_flag_disable(bm, l_iter->v, oflag);
BMO_elem_flag_disable(bm, l_iter->e, oflag); BMO_edge_flag_disable(bm, l_iter->e, oflag);
} while ((l_iter = l_iter->next) != l_first); } while ((l_iter = l_iter->next) != l_first);
} }
} }
@@ -195,13 +195,13 @@ void BMO_mesh_delete_oflag_context(BMesh *bm, const short oflag, const int type)
/* Only exception to normal 'DEL_FACES' logic. */ /* Only exception to normal 'DEL_FACES' logic. */
if (type == DEL_FACES_KEEP_BOUNDARY) { if (type == DEL_FACES_KEEP_BOUNDARY) {
if (BM_edge_is_boundary(e)) { if (BM_edge_is_boundary(e)) {
BMO_elem_flag_disable(bm, e, oflag); BMO_edge_flag_disable(bm, e, oflag);
} }
} }
if (!BMO_elem_flag_test(bm, e, oflag)) { if (!BMO_edge_flag_test(bm, e, oflag)) {
BMO_elem_flag_disable(bm, e->v1, oflag); BMO_vert_flag_disable(bm, e->v1, oflag);
BMO_elem_flag_disable(bm, e->v2, oflag); BMO_vert_flag_disable(bm, e->v2, oflag);
} }
} }

View File

@@ -339,16 +339,43 @@ int BMO_iter_elem_count_flag(
const short oflag, const bool value) const short oflag, const bool value)
{ {
BMIter iter; BMIter iter;
BMElemF *ele;
int count = 0; int count = 0;
/* loops have no header flags */ /* loops have no header flags */
BLI_assert(bm_iter_itype_htype_map[itype] != BM_LOOP); BLI_assert(bm_iter_itype_htype_map[itype] != BM_LOOP);
BM_ITER_ELEM (ele, &iter, data, itype) { switch (bm_iter_itype_htype_map[itype]) {
if (BMO_elem_flag_test_bool(bm, ele, oflag) == value) { case BM_VERT:
count++; {
BMVert *ele;
BM_ITER_ELEM (ele, &iter, data, itype) {
if (BMO_vert_flag_test_bool(bm, ele, oflag) == value) {
count++;
}
}
break;
} }
case BM_EDGE:
{
BMEdge *ele;
BM_ITER_ELEM (ele, &iter, data, itype) {
if (BMO_edge_flag_test_bool(bm, ele, oflag) == value) {
count++;
}
}
break;
}
case BM_FACE:
{
BMFace *ele;
BM_ITER_ELEM (ele, &iter, data, itype) {
if (BMO_face_flag_test_bool(bm, ele, oflag) == value) {
count++;
}
}
break;
}
} }
return count; return count;
} }

View File

@@ -48,16 +48,35 @@
const BMAllocTemplate bm_mesh_allocsize_default = {512, 1024, 2048, 512}; const BMAllocTemplate bm_mesh_allocsize_default = {512, 1024, 2048, 512};
const BMAllocTemplate bm_mesh_chunksize_default = {512, 1024, 2048, 512}; const BMAllocTemplate bm_mesh_chunksize_default = {512, 1024, 2048, 512};
static void bm_mempool_init(BMesh *bm, const BMAllocTemplate *allocsize) static void bm_mempool_init(BMesh *bm, const BMAllocTemplate *allocsize, const bool use_toolflags)
{ {
bm->vpool = BLI_mempool_create(sizeof(BMVert), allocsize->totvert, size_t vert_size, edge_size, loop_size, face_size;
bm_mesh_chunksize_default.totvert, BLI_MEMPOOL_ALLOW_ITER);
bm->epool = BLI_mempool_create(sizeof(BMEdge), allocsize->totedge, if (use_toolflags == true) {
bm_mesh_chunksize_default.totedge, BLI_MEMPOOL_ALLOW_ITER); vert_size = sizeof(BMVert_OFlag);
bm->lpool = BLI_mempool_create(sizeof(BMLoop), allocsize->totloop, edge_size = sizeof(BMEdge_OFlag);
bm_mesh_chunksize_default.totloop, BLI_MEMPOOL_NOP); loop_size = sizeof(BMLoop);
bm->fpool = BLI_mempool_create(sizeof(BMFace), allocsize->totface, face_size = sizeof(BMFace_OFlag);
bm_mesh_chunksize_default.totface, BLI_MEMPOOL_ALLOW_ITER); }
else {
vert_size = sizeof(BMVert);
edge_size = sizeof(BMEdge);
loop_size = sizeof(BMLoop);
face_size = sizeof(BMFace);
}
bm->vpool = BLI_mempool_create(
vert_size, allocsize->totvert,
bm_mesh_chunksize_default.totvert, BLI_MEMPOOL_ALLOW_ITER);
bm->epool = BLI_mempool_create(
edge_size, allocsize->totedge,
bm_mesh_chunksize_default.totedge, BLI_MEMPOOL_ALLOW_ITER);
bm->lpool = BLI_mempool_create(
loop_size, allocsize->totloop,
bm_mesh_chunksize_default.totloop, BLI_MEMPOOL_NOP);
bm->fpool = BLI_mempool_create(
face_size, allocsize->totface,
bm_mesh_chunksize_default.totface, BLI_MEMPOOL_ALLOW_ITER);
#ifdef USE_BMESH_HOLES #ifdef USE_BMESH_HOLES
bm->looplistpool = BLI_mempool_create(sizeof(BMLoopList), 512, 512, BLI_MEMPOOL_NOP); bm->looplistpool = BLI_mempool_create(sizeof(BMLoopList), 512, 512, BLI_MEMPOOL_NOP);
@@ -66,6 +85,8 @@ static void bm_mempool_init(BMesh *bm, const BMAllocTemplate *allocsize)
void BM_mesh_elem_toolflags_ensure(BMesh *bm) void BM_mesh_elem_toolflags_ensure(BMesh *bm)
{ {
BLI_assert(bm->use_toolflags);
if (bm->vtoolflagpool && bm->etoolflagpool && bm->ftoolflagpool) { if (bm->vtoolflagpool && bm->etoolflagpool && bm->ftoolflagpool) {
return; return;
} }
@@ -80,7 +101,7 @@ void BM_mesh_elem_toolflags_ensure(BMesh *bm)
{ {
BLI_mempool *toolflagpool = bm->vtoolflagpool; BLI_mempool *toolflagpool = bm->vtoolflagpool;
BMIter iter; BMIter iter;
BMElemF *ele; BMVert_OFlag *ele;
BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) {
ele->oflags = BLI_mempool_calloc(toolflagpool); ele->oflags = BLI_mempool_calloc(toolflagpool);
} }
@@ -89,7 +110,7 @@ void BM_mesh_elem_toolflags_ensure(BMesh *bm)
{ {
BLI_mempool *toolflagpool = bm->etoolflagpool; BLI_mempool *toolflagpool = bm->etoolflagpool;
BMIter iter; BMIter iter;
BMElemF *ele; BMEdge_OFlag *ele;
BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
ele->oflags = BLI_mempool_calloc(toolflagpool); ele->oflags = BLI_mempool_calloc(toolflagpool);
} }
@@ -98,7 +119,7 @@ void BM_mesh_elem_toolflags_ensure(BMesh *bm)
{ {
BLI_mempool *toolflagpool = bm->ftoolflagpool; BLI_mempool *toolflagpool = bm->ftoolflagpool;
BMIter iter; BMIter iter;
BMElemF *ele; BMFace_OFlag *ele;
BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) {
ele->oflags = BLI_mempool_calloc(toolflagpool); ele->oflags = BLI_mempool_calloc(toolflagpool);
} }
@@ -134,15 +155,18 @@ void BM_mesh_elem_toolflags_clear(BMesh *bm)
* *
* \note ob is needed by multires * \note ob is needed by multires
*/ */
BMesh *BM_mesh_create(const BMAllocTemplate *allocsize) BMesh *BM_mesh_create(
const BMAllocTemplate *allocsize,
const struct BMeshCreateParams *params)
{ {
/* allocate the structure */ /* allocate the structure */
BMesh *bm = MEM_callocN(sizeof(BMesh), __func__); BMesh *bm = MEM_callocN(sizeof(BMesh), __func__);
/* allocate the memory pools for the mesh elements */ /* allocate the memory pools for the mesh elements */
bm_mempool_init(bm, allocsize); bm_mempool_init(bm, allocsize, params->use_toolflags);
/* allocate one flag pool that we don't get rid of. */ /* allocate one flag pool that we don't get rid of. */
bm->use_toolflags = params->use_toolflags;
bm->toolflag_index = 0; bm->toolflag_index = 0;
bm->totflags = 0; bm->totflags = 0;
@@ -239,13 +263,16 @@ void BM_mesh_data_free(BMesh *bm)
*/ */
void BM_mesh_clear(BMesh *bm) void BM_mesh_clear(BMesh *bm)
{ {
const bool use_toolflags = bm->use_toolflags;
/* free old mesh */ /* free old mesh */
BM_mesh_data_free(bm); BM_mesh_data_free(bm);
memset(bm, 0, sizeof(BMesh)); memset(bm, 0, sizeof(BMesh));
/* allocate the memory pools for the mesh elements */ /* allocate the memory pools for the mesh elements */
bm_mempool_init(bm, &bm_mesh_allocsize_default); bm_mempool_init(bm, &bm_mesh_allocsize_default, use_toolflags);
bm->use_toolflags = use_toolflags;
bm->toolflag_index = 0; bm->toolflag_index = 0;
bm->totflags = 0; bm->totflags = 0;

View File

@@ -32,7 +32,14 @@ struct MLoopNorSpaceArray;
void BM_mesh_elem_toolflags_ensure(BMesh *bm); void BM_mesh_elem_toolflags_ensure(BMesh *bm);
void BM_mesh_elem_toolflags_clear(BMesh *bm); void BM_mesh_elem_toolflags_clear(BMesh *bm);
BMesh *BM_mesh_create(const struct BMAllocTemplate *allocsize);
struct BMeshCreateParams {
unsigned int use_toolflags : 1;
};
BMesh *BM_mesh_create(
const struct BMAllocTemplate *allocsize,
const struct BMeshCreateParams *params);
void BM_mesh_free(BMesh *bm); void BM_mesh_free(BMesh *bm);
void BM_mesh_data_free(BMesh *bm); void BM_mesh_data_free(BMesh *bm);
@@ -113,10 +120,4 @@ extern const BMAllocTemplate bm_mesh_chunksize_default;
#define BMALLOC_TEMPLATE_FROM_DM(...) VA_NARGS_CALL_OVERLOAD(_VA_BMALLOC_TEMPLATE_FROM_DM_, __VA_ARGS__) #define BMALLOC_TEMPLATE_FROM_DM(...) VA_NARGS_CALL_OVERLOAD(_VA_BMALLOC_TEMPLATE_FROM_DM_, __VA_ARGS__)
enum {
BM_MESH_CREATE_USE_TOOLFLAGS = (1 << 0)
};
#endif /* __BMESH_MESH_H__ */ #endif /* __BMESH_MESH_H__ */

View File

@@ -75,15 +75,74 @@ extern "C" {
struct GHashIterator; struct GHashIterator;
#define BMO_elem_flag_test( bm, ele, oflag) _bmo_elem_flag_test (bm, (ele)->oflags, oflag) BLI_INLINE BMFlagLayer *BMO_elem_flag_from_header(BMHeader *ele_head)
#define BMO_elem_flag_test_bool(bm, ele, oflag) _bmo_elem_flag_test_bool(bm, (ele)->oflags, oflag) {
#define BMO_elem_flag_enable( bm, ele, oflag) _bmo_elem_flag_enable (bm, (ele)->oflags, oflag) switch (ele_head->htype) {
#define BMO_elem_flag_disable( bm, ele, oflag) _bmo_elem_flag_disable (bm, (ele)->oflags, oflag) case BM_VERT: return ((BMVert_OFlag *)ele_head)->oflags;
#define BMO_elem_flag_set( bm, ele, oflag, val) _bmo_elem_flag_set (bm, (ele)->oflags, oflag, val) case BM_EDGE: return ((BMEdge_OFlag *)ele_head)->oflags;
#define BMO_elem_flag_toggle( bm, ele, oflag) _bmo_elem_flag_toggle (bm, (ele)->oflags, oflag) default: return ((BMFace_OFlag *)ele_head)->oflags;
}
}
BLI_INLINE short _bmo_elem_flag_test( BMesh *bm, BMFlagLayer *oflags, const short oflag); #define BMO_elem_flag_test(bm, ele, oflag) \
BLI_INLINE bool _bmo_elem_flag_test_bool(BMesh *bm, BMFlagLayer *oflags, const short oflag); _bmo_elem_flag_test(bm, BMO_elem_flag_from_header(&(ele)->head), oflag)
#define BMO_elem_flag_test_bool(bm, ele, oflag) \
_bmo_elem_flag_test_bool(bm, BMO_elem_flag_from_header(&(ele)->head), oflag)
#define BMO_elem_flag_enable(bm, ele, oflag) \
_bmo_elem_flag_enable(bm, (BM_CHECK_TYPE_ELEM_NONCONST(ele), BMO_elem_flag_from_header(&(ele)->head)), oflag)
#define BMO_elem_flag_disable(bm, ele, oflag) \
_bmo_elem_flag_disable(bm, (BM_CHECK_TYPE_ELEM_NONCONST(ele), BMO_elem_flag_from_header(&(ele)->head)), oflag)
#define BMO_elem_flag_set(bm, ele, oflag, val) \
_bmo_elem_flag_set(bm, (BM_CHECK_TYPE_ELEM_NONCONST(ele), BMO_elem_flag_from_header(&(ele)->head)), oflag, val)
#define BMO_elem_flag_toggle(bm, ele, oflag) \
_bmo_elem_flag_toggle(bm, (BM_CHECK_TYPE_ELEM_NONCONST(ele), BMO_elem_flag_from_header(&(ele)->head)), oflag)
/* take care not to instansiate args multiple times */
#ifdef __GNUC___
#define _BMO_CAST_V_CONST(e) ({ typeof(e) _e = e; \
(BM_CHECK_TYPE_VERT(_e), BLI_assert(((const BMHeader *)_e)->htype == BM_VERT), (const BMVert_OFlag *)_e); })
#define _BMO_CAST_E_CONST(e) ({ typeof(e) _e = e; \
(BM_CHECK_TYPE_EDGE(_e), BLI_assert(((const BMHeader *)_e)->htype == BM_EDGE), (const BMEdge_OFlag *)_e); })
#define _BMO_CAST_F_CONST(e) ({ typeof(e) _e = e; \
(BM_CHECK_TYPE_FACE(_e), BLI_assert(((const BMHeader *)_e)->htype == BM_FACE), (const BMFace_OFlag *)_e); })
#define _BMO_CAST_V(e) ({ typeof(e) _e = e; \
(BM_CHECK_TYPE_VERT_NONCONST(_e), BLI_assert(((BMHeader *)_e)->htype == BM_VERT), (BMVert_OFlag *)_e); })
#define _BMO_CAST_E(e) ({ typeof(e) _e = e; \
(BM_CHECK_TYPE_EDGE_NONCONST(_e), BLI_assert(((BMHeader *)_e)->htype == BM_EDGE), (BMEdge_OFlag *)_e); })
#define _BMO_CAST_F(e) ({ typeof(e) _e = e; \
(BM_CHECK_TYPE_FACE_NONCONST(_e), BLI_assert(((BMHeader *)_e)->htype == BM_FACE), (BMFace_OFlag *)_e); })
#else
#define _BMO_CAST_V_CONST(e) (BM_CHECK_TYPE_VERT(e), (const BMVert_OFlag *)e)
#define _BMO_CAST_E_CONST(e) (BM_CHECK_TYPE_EDGE(e), (const BMEdge_OFlag *)e)
#define _BMO_CAST_F_CONST(e) (BM_CHECK_TYPE_FACE(e), (const BMFace_OFlag *)e)
#define _BMO_CAST_V(e) (BM_CHECK_TYPE_VERT_NONCONST(e), (BMVert_OFlag *)e)
#define _BMO_CAST_E(e) (BM_CHECK_TYPE_EDGE_NONCONST(e), (BMEdge_OFlag *)e)
#define _BMO_CAST_F(e) (BM_CHECK_TYPE_FACE_NONCONST(e), (BMFace_OFlag *)e)
#endif
#define BMO_vert_flag_test( bm, e, oflag) _bmo_elem_flag_test (bm, _BMO_CAST_V_CONST(e)->oflags, oflag)
#define BMO_vert_flag_test_bool(bm, e, oflag) _bmo_elem_flag_test_bool(bm, _BMO_CAST_V_CONST(e)->oflags, oflag)
#define BMO_vert_flag_enable( bm, e, oflag) _bmo_elem_flag_enable (bm, _BMO_CAST_V(e)->oflags, oflag)
#define BMO_vert_flag_disable( bm, e, oflag) _bmo_elem_flag_disable (bm, _BMO_CAST_V(e)->oflags, oflag)
#define BMO_vert_flag_set( bm, e, oflag, val) _bmo_elem_flag_set (bm, _BMO_CAST_V(e)->oflags, oflag, val)
#define BMO_vert_flag_toggle( bm, e, oflag) _bmo_elem_flag_toggle (bm, _BMO_CAST_V(e)->oflags, oflag)
#define BMO_edge_flag_test( bm, e, oflag) _bmo_elem_flag_test (bm, _BMO_CAST_E_CONST(e)->oflags, oflag)
#define BMO_edge_flag_test_bool(bm, e, oflag) _bmo_elem_flag_test_bool(bm, _BMO_CAST_E_CONST(e)->oflags, oflag)
#define BMO_edge_flag_enable( bm, e, oflag) _bmo_elem_flag_enable (bm, _BMO_CAST_E(e)->oflags, oflag)
#define BMO_edge_flag_disable( bm, e, oflag) _bmo_elem_flag_disable (bm, _BMO_CAST_E(e)->oflags, oflag)
#define BMO_edge_flag_set( bm, e, oflag, val) _bmo_elem_flag_set (bm, _BMO_CAST_E(e)->oflags, oflag, val)
#define BMO_edge_flag_toggle( bm, e, oflag) _bmo_elem_flag_toggle (bm, _BMO_CAST_E(e)->oflags, oflag)
#define BMO_face_flag_test( bm, e, oflag) _bmo_elem_flag_test (bm, _BMO_CAST_F_CONST(e)->oflags, oflag)
#define BMO_face_flag_test_bool(bm, e, oflag) _bmo_elem_flag_test_bool(bm, _BMO_CAST_F_CONST(e)->oflags, oflag)
#define BMO_face_flag_enable( bm, e, oflag) _bmo_elem_flag_enable (bm, _BMO_CAST_F(e)->oflags, oflag)
#define BMO_face_flag_disable( bm, e, oflag) _bmo_elem_flag_disable (bm, _BMO_CAST_F(e)->oflags, oflag)
#define BMO_face_flag_set( bm, e, oflag, val) _bmo_elem_flag_set (bm, _BMO_CAST_F(e)->oflags, oflag, val)
#define BMO_face_flag_toggle( bm, e, oflag) _bmo_elem_flag_toggle (bm, _BMO_CAST_F(e)->oflags, oflag)
BLI_INLINE short _bmo_elem_flag_test( BMesh *bm, const BMFlagLayer *oflags, const short oflag);
BLI_INLINE bool _bmo_elem_flag_test_bool(BMesh *bm, const BMFlagLayer *oflags, const short oflag);
BLI_INLINE void _bmo_elem_flag_enable( BMesh *bm, BMFlagLayer *oflags, const short oflag); BLI_INLINE void _bmo_elem_flag_enable( BMesh *bm, BMFlagLayer *oflags, const short oflag);
BLI_INLINE void _bmo_elem_flag_disable( BMesh *bm, BMFlagLayer *oflags, const short oflag); BLI_INLINE void _bmo_elem_flag_disable( BMesh *bm, BMFlagLayer *oflags, const short oflag);
BLI_INLINE void _bmo_elem_flag_set( BMesh *bm, BMFlagLayer *oflags, const short oflag, int val); BLI_INLINE void _bmo_elem_flag_set( BMesh *bm, BMFlagLayer *oflags, const short oflag, int val);

View File

@@ -39,32 +39,37 @@
/* flags 15 and 16 (1 << 14 and 1 << 15) are reserved for bmesh api use */ /* flags 15 and 16 (1 << 14 and 1 << 15) are reserved for bmesh api use */
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2)
BLI_INLINE short _bmo_elem_flag_test(BMesh *bm, BMFlagLayer *oflags, const short oflag) BLI_INLINE short _bmo_elem_flag_test(BMesh *bm, const BMFlagLayer *oflags, const short oflag)
{ {
BLI_assert(bm->use_toolflags);
return oflags[bm->toolflag_index].f & oflag; return oflags[bm->toolflag_index].f & oflag;
} }
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2)
BLI_INLINE bool _bmo_elem_flag_test_bool(BMesh *bm, BMFlagLayer *oflags, const short oflag) BLI_INLINE bool _bmo_elem_flag_test_bool(BMesh *bm, const BMFlagLayer *oflags, const short oflag)
{ {
BLI_assert(bm->use_toolflags);
return (oflags[bm->toolflag_index].f & oflag) != 0; return (oflags[bm->toolflag_index].f & oflag) != 0;
} }
ATTR_NONNULL(1, 2) ATTR_NONNULL(1, 2)
BLI_INLINE void _bmo_elem_flag_enable(BMesh *bm, BMFlagLayer *oflags, const short oflag) BLI_INLINE void _bmo_elem_flag_enable(BMesh *bm, BMFlagLayer *oflags, const short oflag)
{ {
BLI_assert(bm->use_toolflags);
oflags[bm->toolflag_index].f |= oflag; oflags[bm->toolflag_index].f |= oflag;
} }
ATTR_NONNULL(1, 2) ATTR_NONNULL(1, 2)
BLI_INLINE void _bmo_elem_flag_disable(BMesh *bm, BMFlagLayer *oflags, const short oflag) BLI_INLINE void _bmo_elem_flag_disable(BMesh *bm, BMFlagLayer *oflags, const short oflag)
{ {
BLI_assert(bm->use_toolflags);
oflags[bm->toolflag_index].f &= (short)~oflag; oflags[bm->toolflag_index].f &= (short)~oflag;
} }
ATTR_NONNULL(1, 2) ATTR_NONNULL(1, 2)
BLI_INLINE void _bmo_elem_flag_set(BMesh *bm, BMFlagLayer *oflags, const short oflag, int val) BLI_INLINE void _bmo_elem_flag_set(BMesh *bm, BMFlagLayer *oflags, const short oflag, int val)
{ {
BLI_assert(bm->use_toolflags);
if (val) oflags[bm->toolflag_index].f |= oflag; if (val) oflags[bm->toolflag_index].f |= oflag;
else oflags[bm->toolflag_index].f &= (short)~oflag; else oflags[bm->toolflag_index].f &= (short)~oflag;
} }
@@ -72,6 +77,7 @@ BLI_INLINE void _bmo_elem_flag_set(BMesh *bm, BMFlagLayer *oflags, const short o
ATTR_NONNULL(1, 2) ATTR_NONNULL(1, 2)
BLI_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, const short oflag) BLI_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, const short oflag)
{ {
BLI_assert(bm->use_toolflags);
oflags[bm->toolflag_index].f ^= oflag; oflags[bm->toolflag_index].f ^= oflag;
} }

View File

@@ -548,27 +548,44 @@ static int bmo_mesh_flag_count(
BMesh *bm, const char htype, const short oflag, BMesh *bm, const char htype, const short oflag,
const bool test_for_enabled) const bool test_for_enabled)
{ {
const char iter_types[3] = {BM_VERTS_OF_MESH, int count_vert = 0, count_edge = 0, count_face = 0;
BM_EDGES_OF_MESH,
BM_FACES_OF_MESH};
const char flag_types[3] = {BM_VERT, BM_EDGE, BM_FACE}; #pragma omp parallel sections if ((bm->totvert + bm->totedge + bm->totface >= BM_OMP_LIMIT) && \
(ELEM(htype, BM_VERT, BM_EDGE, BM_FACE) == 0))
BMIter iter; {
int count = 0; #pragma omp section
BMElemF *ele_f; if (htype & BM_VERT) {
int i; BMIter iter;
BMVert *ele;
for (i = 0; i < 3; i++) { BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) {
if (htype & flag_types[i]) { if (BMO_vert_flag_test_bool(bm, ele, oflag) == test_for_enabled) {
BM_ITER_MESH (ele_f, &iter, bm, iter_types[i]) { count_vert++;
if (BMO_elem_flag_test_bool(bm, ele_f, oflag) == test_for_enabled) }
count++; }
}
#pragma omp section
if (htype & BM_EDGE) {
BMIter iter;
BMEdge *ele;
BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
if (BMO_edge_flag_test_bool(bm, ele, oflag) == test_for_enabled) {
count_edge++;
}
}
}
#pragma omp section
if (htype & BM_FACE) {
BMIter iter;
BMFace *ele;
BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) {
if (BMO_face_flag_test_bool(bm, ele, oflag) == test_for_enabled) {
count_face++;
}
} }
} }
} }
return count; return (count_vert + count_edge + count_face);
} }
@@ -584,21 +601,32 @@ int BMO_mesh_disabled_flag_count(BMesh *bm, const char htype, const short oflag)
void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *UNUSED(op), const char htype, const short oflag) void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *UNUSED(op), const char htype, const short oflag)
{ {
const char iter_types[3] = {BM_VERTS_OF_MESH,
BM_EDGES_OF_MESH,
BM_FACES_OF_MESH};
const char flag_types[3] = {BM_VERT, BM_EDGE, BM_FACE}; #pragma omp parallel sections if ((bm->totvert + bm->totedge + bm->totface >= BM_OMP_LIMIT) && \
(ELEM(htype, BM_VERT, BM_EDGE, BM_FACE) == 0))
BMElemF *ele; {
int i; #pragma omp section
if (htype & BM_VERT) {
#pragma omp parallel for schedule(static) if (bm->totvert + bm->totedge + bm->totface >= BM_OMP_LIMIT)
for (i = 0; i < 3; i++) {
if (htype & flag_types[i]) {
BMIter iter; BMIter iter;
BM_ITER_MESH (ele, &iter, bm, iter_types[i]) { BMVert *ele;
BMO_elem_flag_disable(bm, ele, oflag); BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) {
BMO_vert_flag_disable(bm, ele, oflag);
}
}
#pragma omp section
if (htype & BM_EDGE) {
BMIter iter;
BMEdge *ele;
BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
BMO_edge_flag_disable(bm, ele, oflag);
}
}
#pragma omp section
if (htype & BM_FACE) {
BMIter iter;
BMFace *ele;
BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) {
BMO_face_flag_disable(bm, ele, oflag);
} }
} }
} }
@@ -1007,7 +1035,7 @@ static void bmo_slot_buffer_from_flag(
if (htype & BM_VERT) { if (htype & BM_VERT) {
BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) {
if (BMO_elem_flag_test_bool(bm, (BMElemF *)ele, oflag) == test_for_enabled) { if (BMO_vert_flag_test_bool(bm, (BMVert *)ele, oflag) == test_for_enabled) {
ele_array[i] = ele; ele_array[i] = ele;
i++; i++;
} }
@@ -1016,7 +1044,7 @@ static void bmo_slot_buffer_from_flag(
if (htype & BM_EDGE) { if (htype & BM_EDGE) {
BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
if (BMO_elem_flag_test_bool(bm, (BMElemF *)ele, oflag) == test_for_enabled) { if (BMO_edge_flag_test_bool(bm, (BMEdge *)ele, oflag) == test_for_enabled) {
ele_array[i] = ele; ele_array[i] = ele;
i++; i++;
} }
@@ -1025,7 +1053,7 @@ static void bmo_slot_buffer_from_flag(
if (htype & BM_FACE) { if (htype & BM_FACE) {
BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) {
if (BMO_elem_flag_test_bool(bm, (BMElemF *)ele, oflag) == test_for_enabled) { if (BMO_face_flag_test_bool(bm, (BMFace *)ele, oflag) == test_for_enabled) {
ele_array[i] = ele; ele_array[i] = ele;
i++; i++;
} }
@@ -1213,7 +1241,7 @@ static void bmo_flag_layer_alloc(BMesh *bm)
#pragma omp section #pragma omp section
{ {
BMIter iter; BMIter iter;
BMElemF *ele; BMVert_OFlag *ele;
int i; int i;
BLI_mempool *newpool = bm->vtoolflagpool; BLI_mempool *newpool = bm->vtoolflagpool;
@@ -1223,14 +1251,14 @@ static void bmo_flag_layer_alloc(BMesh *bm)
void *oldflags = ele->oflags; void *oldflags = ele->oflags;
ele->oflags = BLI_mempool_calloc(newpool); ele->oflags = BLI_mempool_calloc(newpool);
memcpy(ele->oflags, oldflags, old_totflags_size); memcpy(ele->oflags, oldflags, old_totflags_size);
BM_elem_index_set(ele, i); /* set_inline */ BM_elem_index_set(&ele->base, i); /* set_inline */
BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele); BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele);
} }
} }
#pragma omp section #pragma omp section
{ {
BMIter iter; BMIter iter;
BMElemF *ele; BMEdge_OFlag *ele;
int i; int i;
BLI_mempool *newpool = bm->etoolflagpool; BLI_mempool *newpool = bm->etoolflagpool;
@@ -1239,14 +1267,14 @@ static void bmo_flag_layer_alloc(BMesh *bm)
void *oldflags = ele->oflags; void *oldflags = ele->oflags;
ele->oflags = BLI_mempool_calloc(newpool); ele->oflags = BLI_mempool_calloc(newpool);
memcpy(ele->oflags, oldflags, old_totflags_size); memcpy(ele->oflags, oldflags, old_totflags_size);
BM_elem_index_set(ele, i); /* set_inline */ BM_elem_index_set(&ele->base, i); /* set_inline */
BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele); BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele);
} }
} }
#pragma omp section #pragma omp section
{ {
BMIter iter; BMIter iter;
BMElemF *ele; BMFace_OFlag *ele;
int i; int i;
BLI_mempool *newpool = bm->ftoolflagpool; BLI_mempool *newpool = bm->ftoolflagpool;
@@ -1255,7 +1283,7 @@ static void bmo_flag_layer_alloc(BMesh *bm)
void *oldflags = ele->oflags; void *oldflags = ele->oflags;
ele->oflags = BLI_mempool_calloc(newpool); ele->oflags = BLI_mempool_calloc(newpool);
memcpy(ele->oflags, oldflags, old_totflags_size); memcpy(ele->oflags, oldflags, old_totflags_size);
BM_elem_index_set(ele, i); /* set_inline */ BM_elem_index_set(&ele->base, i); /* set_inline */
BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele); BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele);
} }
} }
@@ -1292,7 +1320,7 @@ static void bmo_flag_layer_free(BMesh *bm)
#pragma omp section #pragma omp section
{ {
BMIter iter; BMIter iter;
BMElemF *ele; BMVert_OFlag *ele;
int i; int i;
BLI_mempool *newpool = bm->vtoolflagpool; BLI_mempool *newpool = bm->vtoolflagpool;
@@ -1302,14 +1330,14 @@ static void bmo_flag_layer_free(BMesh *bm)
void *oldflags = ele->oflags; void *oldflags = ele->oflags;
ele->oflags = BLI_mempool_alloc(newpool); ele->oflags = BLI_mempool_alloc(newpool);
memcpy(ele->oflags, oldflags, new_totflags_size); memcpy(ele->oflags, oldflags, new_totflags_size);
BM_elem_index_set(ele, i); /* set_inline */ BM_elem_index_set(&ele->base, i); /* set_inline */
BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele); BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele);
} }
} }
#pragma omp section #pragma omp section
{ {
BMIter iter; BMIter iter;
BMElemF *ele; BMEdge_OFlag *ele;
int i; int i;
BLI_mempool *newpool = bm->etoolflagpool; BLI_mempool *newpool = bm->etoolflagpool;
@@ -1318,14 +1346,14 @@ static void bmo_flag_layer_free(BMesh *bm)
void *oldflags = ele->oflags; void *oldflags = ele->oflags;
ele->oflags = BLI_mempool_alloc(newpool); ele->oflags = BLI_mempool_alloc(newpool);
memcpy(ele->oflags, oldflags, new_totflags_size); memcpy(ele->oflags, oldflags, new_totflags_size);
BM_elem_index_set(ele, i); /* set_inline */ BM_elem_index_set(&ele->base, i); /* set_inline */
BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele); BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele);
} }
} }
#pragma omp section #pragma omp section
{ {
BMIter iter; BMIter iter;
BMElemF *ele; BMFace_OFlag *ele;
int i; int i;
BLI_mempool *newpool = bm->ftoolflagpool; BLI_mempool *newpool = bm->ftoolflagpool;
@@ -1334,7 +1362,7 @@ static void bmo_flag_layer_free(BMesh *bm)
void *oldflags = ele->oflags; void *oldflags = ele->oflags;
ele->oflags = BLI_mempool_alloc(newpool); ele->oflags = BLI_mempool_alloc(newpool);
memcpy(ele->oflags, oldflags, new_totflags_size); memcpy(ele->oflags, oldflags, new_totflags_size);
BM_elem_index_set(ele, i); /* set_inline */ BM_elem_index_set(&ele->base, i); /* set_inline */
BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele); BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele);
} }
} }
@@ -1361,31 +1389,31 @@ static void bmo_flag_layer_clear(BMesh *bm)
#pragma omp section #pragma omp section
{ {
BMIter iter; BMIter iter;
BMElemF *ele; BMVert_OFlag *ele;
int i; int i;
BM_ITER_MESH_INDEX (ele, &iter, bm, BM_VERTS_OF_MESH, i) { BM_ITER_MESH_INDEX (ele, &iter, bm, BM_VERTS_OF_MESH, i) {
ele->oflags[totflags_offset] = zero_flag; ele->oflags[totflags_offset] = zero_flag;
BM_elem_index_set(ele, i); /* set_inline */ BM_elem_index_set(&ele->base, i); /* set_inline */
} }
} }
#pragma omp section #pragma omp section
{ {
BMIter iter; BMIter iter;
BMElemF *ele; BMEdge_OFlag *ele;
int i; int i;
BM_ITER_MESH_INDEX (ele, &iter, bm, BM_EDGES_OF_MESH, i) { BM_ITER_MESH_INDEX (ele, &iter, bm, BM_EDGES_OF_MESH, i) {
ele->oflags[totflags_offset] = zero_flag; ele->oflags[totflags_offset] = zero_flag;
BM_elem_index_set(ele, i); /* set_inline */ BM_elem_index_set(&ele->base, i); /* set_inline */
} }
} }
#pragma omp section #pragma omp section
{ {
BMIter iter; BMIter iter;
BMElemF *ele; BMFace_OFlag *ele;
int i; int i;
BM_ITER_MESH_INDEX (ele, &iter, bm, BM_FACES_OF_MESH, i) { BM_ITER_MESH_INDEX (ele, &iter, bm, BM_FACES_OF_MESH, i) {
ele->oflags[totflags_offset] = zero_flag; ele->oflags[totflags_offset] = zero_flag;
BM_elem_index_set(ele, i); /* set_inline */ BM_elem_index_set(&ele->base, i); /* set_inline */
} }
} }
} }

View File

@@ -49,7 +49,7 @@ static bool bmw_mask_check_vert(BMWalker *walker, BMVert *v)
if ((walker->flag & BMW_FLAG_TEST_HIDDEN) && BM_elem_flag_test(v, BM_ELEM_HIDDEN)) { if ((walker->flag & BMW_FLAG_TEST_HIDDEN) && BM_elem_flag_test(v, BM_ELEM_HIDDEN)) {
return false; return false;
} }
else if (walker->mask_vert && !BMO_elem_flag_test(walker->bm, v, walker->mask_vert)) { else if (walker->mask_vert && !BMO_vert_flag_test(walker->bm, v, walker->mask_vert)) {
return false; return false;
} }
else { else {
@@ -62,7 +62,7 @@ static bool bmw_mask_check_edge(BMWalker *walker, BMEdge *e)
if ((walker->flag & BMW_FLAG_TEST_HIDDEN) && BM_elem_flag_test(e, BM_ELEM_HIDDEN)) { if ((walker->flag & BMW_FLAG_TEST_HIDDEN) && BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
return false; return false;
} }
else if (walker->mask_edge && !BMO_elem_flag_test(walker->bm, e, walker->mask_edge)) { else if (walker->mask_edge && !BMO_edge_flag_test(walker->bm, e, walker->mask_edge)) {
return false; return false;
} }
else { else {
@@ -75,7 +75,7 @@ static bool bmw_mask_check_face(BMWalker *walker, BMFace *f)
if ((walker->flag & BMW_FLAG_TEST_HIDDEN) && BM_elem_flag_test(f, BM_ELEM_HIDDEN)) { if ((walker->flag & BMW_FLAG_TEST_HIDDEN) && BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
return false; return false;
} }
else if (walker->mask_face && !BMO_elem_flag_test(walker->bm, f, walker->mask_face)) { else if (walker->mask_face && !BMO_face_flag_test(walker->bm, f, walker->mask_face)) {
return false; return false;
} }
else { else {
@@ -223,7 +223,7 @@ static void *bmw_VertShellWalker_step(BMWalker *walker)
do { do {
if (!BLI_gset_haskey(walker->visit_set, curedge)) { if (!BLI_gset_haskey(walker->visit_set, curedge)) {
if (!walker->restrictflag || if (!walker->restrictflag ||
(walker->restrictflag && BMO_elem_flag_test(walker->bm, curedge, walker->restrictflag))) (walker->restrictflag && BMO_edge_flag_test(walker->bm, curedge, walker->restrictflag)))
{ {
BMwShellWalker *newstate; BMwShellWalker *newstate;
@@ -748,7 +748,7 @@ static void *bmw_IslandboundWalker_step(BMWalker *walker)
iwalk = BMW_state_add(walker); iwalk = BMW_state_add(walker);
iwalk->base = owalk.base; iwalk->base = owalk.base;
//if (!BMO_elem_flag_test(walker->bm, l->f, walker->restrictflag)) //if (!BMO_face_flag_test(walker->bm, l->f, walker->restrictflag))
// iwalk->curloop = l->radial_next; // iwalk->curloop = l->radial_next;
iwalk->curloop = l; //else iwalk->curloop = l; iwalk->curloop = l; //else iwalk->curloop = l;
iwalk->lastv = v; iwalk->lastv = v;

View File

@@ -52,7 +52,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
int edge_array_len = 0; int edge_array_len = 0;
BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) { BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
if (f->len == 3) { if (f->len == 3) {
BMO_elem_flag_enable(bm, f, FACE_MARK); BMO_face_flag_enable(bm, f, FACE_MARK);
} }
} }
@@ -68,8 +68,8 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
/* edge is manifold and can be rotated */ /* edge is manifold and can be rotated */
if (BM_edge_rotate_check(e) && if (BM_edge_rotate_check(e) &&
/* faces are tagged */ /* faces are tagged */
BMO_elem_flag_test(bm, e->l->f, FACE_MARK) && BMO_face_flag_test(bm, e->l->f, FACE_MARK) &&
BMO_elem_flag_test(bm, e->l->radial_next->f, FACE_MARK)) BMO_face_flag_test(bm, e->l->radial_next->f, FACE_MARK))
{ {
edge_array[edge_array_len] = e; edge_array[edge_array_len] = e;
edge_array_len++; edge_array_len++;

View File

@@ -131,13 +131,13 @@ static void bm_face_edges_tag_out(BMesh *bm, BMFace *f)
BMLoop *l_iter, *l_first; BMLoop *l_iter, *l_first;
l_iter = l_first = BM_FACE_FIRST_LOOP(f); l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do { do {
BMO_elem_flag_enable(bm, l_iter->e, EDGE_OUT); BMO_edge_flag_enable(bm, l_iter->e, EDGE_OUT);
} while ((l_iter = l_iter->next) != l_first); } while ((l_iter = l_iter->next) != l_first);
} }
static bool bm_edge_test_cb(BMEdge *e, void *bm_v) static bool bm_edge_test_cb(BMEdge *e, void *bm_v)
{ {
return BMO_elem_flag_test((BMesh *)bm_v, e, EDGE_MARK); return BMO_edge_flag_test((BMesh *)bm_v, e, EDGE_MARK);
} }
static void bridge_loop_pair( static void bridge_loop_pair(
@@ -425,7 +425,7 @@ static void bridge_loop_pair(
if (f_example && (f_example != f)) { if (f_example && (f_example != f)) {
BM_elem_attrs_copy(bm, bm, f_example, f); BM_elem_attrs_copy(bm, bm, f_example, f);
} }
BMO_elem_flag_enable(bm, f, FACE_OUT); BMO_face_flag_enable(bm, f, FACE_OUT);
BM_elem_flag_enable(f, BM_ELEM_TAG); BM_elem_flag_enable(f, BM_ELEM_TAG);
/* tag all edges of the face, untag the loop edges after */ /* tag all edges of the face, untag the loop edges after */
@@ -486,7 +486,7 @@ static void bridge_loop_pair(
BMOIter siter; BMOIter siter;
BMFace *f; BMFace *f;
BMO_ITER (f, &siter, op_sub.slots_in, "faces", BM_FACE) { BMO_ITER (f, &siter, op_sub.slots_in, "faces", BM_FACE) {
BMO_elem_flag_enable(bm, f, FACE_OUT); BMO_face_flag_enable(bm, f, FACE_OUT);
bm_face_edges_tag_out(bm, f); bm_face_edges_tag_out(bm, f);
} }
} }
@@ -498,7 +498,7 @@ static void bridge_loop_pair(
BMOIter siter; BMOIter siter;
BMFace *f; BMFace *f;
BMO_ITER (f, &siter, op_sub.slots_out, "geom.out", BM_FACE) { BMO_ITER (f, &siter, op_sub.slots_out, "geom.out", BM_FACE) {
BMO_elem_flag_enable(bm, f, FACE_OUT); BMO_face_flag_enable(bm, f, FACE_OUT);
bm_face_edges_tag_out(bm, f); bm_face_edges_tag_out(bm, f);
} }
} }
@@ -520,7 +520,7 @@ static void bridge_loop_pair(
if (el_next) { if (el_next) {
if (el->data != el_next->data) { if (el->data != el_next->data) {
BMEdge *e = BM_edge_exists(el->data, el_next->data); BMEdge *e = BM_edge_exists(el->data, el_next->data);
BMO_elem_flag_disable(bm, e, EDGE_OUT); BMO_edge_flag_disable(bm, e, EDGE_OUT);
} }
} }
} }

View File

@@ -62,10 +62,10 @@ static int bm_face_connect_verts(BMesh *bm, BMFace *f, const bool check_degenera
l_iter = l_first = BM_FACE_FIRST_LOOP(f); l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do { do {
if (BMO_elem_flag_test(bm, l_iter->v, VERT_INPUT) && if (BMO_vert_flag_test(bm, l_iter->v, VERT_INPUT) &&
/* ensure this vertex isnt part of a contiguous group */ /* ensure this vertex isnt part of a contiguous group */
((BMO_elem_flag_test(bm, l_iter->prev->v, VERT_INPUT) == 0) || ((BMO_vert_flag_test(bm, l_iter->prev->v, VERT_INPUT) == 0) ||
(BMO_elem_flag_test(bm, l_iter->next->v, VERT_INPUT) == 0))) (BMO_vert_flag_test(bm, l_iter->next->v, VERT_INPUT) == 0)))
{ {
if (!l_tag_prev) { if (!l_tag_prev) {
l_tag_prev = l_tag_first = l_iter; l_tag_prev = l_tag_first = l_iter;
@@ -75,7 +75,7 @@ static int bm_face_connect_verts(BMesh *bm, BMFace *f, const bool check_degenera
if (!BM_loop_is_adjacent(l_tag_prev, l_iter)) { if (!BM_loop_is_adjacent(l_tag_prev, l_iter)) {
BMEdge *e; BMEdge *e;
e = BM_edge_exists(l_tag_prev->v, l_iter->v); e = BM_edge_exists(l_tag_prev->v, l_iter->v);
if (e == NULL || !BMO_elem_flag_test(bm, e, EDGE_OUT)) { if (e == NULL || !BMO_edge_flag_test(bm, e, EDGE_OUT)) {
BMLoop **l_pair = STACK_PUSH_RET(loops_split); BMLoop **l_pair = STACK_PUSH_RET(loops_split);
l_pair[0] = l_tag_prev; l_pair[0] = l_tag_prev;
l_pair[1] = l_iter; l_pair[1] = l_iter;
@@ -138,8 +138,8 @@ static int bm_face_connect_verts(BMesh *bm, BMFace *f, const bool check_degenera
if (!l_new || !f_new) { if (!l_new || !f_new) {
return -1; return -1;
} }
// BMO_elem_flag_enable(bm, f_new, FACE_NEW); // BMO_face_flag_enable(bm, f_new, FACE_NEW);
BMO_elem_flag_enable(bm, l_new->e, EDGE_OUT); BMO_edge_flag_enable(bm, l_new->e, EDGE_OUT);
} }
return 1; return 1;
@@ -164,12 +164,12 @@ void bmo_connect_verts_exec(BMesh *bm, BMOperator *op)
BMIter iter; BMIter iter;
BMLoop *l_iter; BMLoop *l_iter;
BMO_elem_flag_enable(bm, v, VERT_INPUT); BMO_vert_flag_enable(bm, v, VERT_INPUT);
BM_ITER_ELEM (l_iter, &iter, v, BM_LOOPS_OF_VERT) { BM_ITER_ELEM (l_iter, &iter, v, BM_LOOPS_OF_VERT) {
f = l_iter->f; f = l_iter->f;
if (!BMO_elem_flag_test(bm, f, FACE_EXCLUDE)) { if (!BMO_face_flag_test(bm, f, FACE_EXCLUDE)) {
if (!BMO_elem_flag_test(bm, f, FACE_TAG)) { if (!BMO_face_flag_test(bm, f, FACE_TAG)) {
BMO_elem_flag_enable(bm, f, FACE_TAG); BMO_face_flag_enable(bm, f, FACE_TAG);
if (f->len > 3) { if (f->len > 3) {
BLI_LINKSTACK_PUSH(faces, f); BLI_LINKSTACK_PUSH(faces, f);
} }
@@ -179,11 +179,11 @@ void bmo_connect_verts_exec(BMesh *bm, BMOperator *op)
/* flag edges even if these are not newly created /* flag edges even if these are not newly created
* this way cut-pairs that include co-linear edges will get * this way cut-pairs that include co-linear edges will get
* predictable output. */ * predictable output. */
if (BMO_elem_flag_test(bm, l_iter->prev->v, VERT_INPUT)) { if (BMO_vert_flag_test(bm, l_iter->prev->v, VERT_INPUT)) {
BMO_elem_flag_enable(bm, l_iter->prev->e, EDGE_OUT_ADJ); BMO_edge_flag_enable(bm, l_iter->prev->e, EDGE_OUT_ADJ);
} }
if (BMO_elem_flag_test(bm, l_iter->next->v, VERT_INPUT)) { if (BMO_vert_flag_test(bm, l_iter->next->v, VERT_INPUT)) {
BMO_elem_flag_enable(bm, l_iter->e, EDGE_OUT_ADJ); BMO_edge_flag_enable(bm, l_iter->e, EDGE_OUT_ADJ);
} }
} }
} }

View File

@@ -107,10 +107,10 @@ static bool bm_face_split_by_concave(
int i; int i;
for (i = 0; i < faces_array_tot; i++) { for (i = 0; i < faces_array_tot; i++) {
BMFace *f = faces_array[i]; BMFace *f = faces_array[i];
BMO_elem_flag_enable(bm, f, FACE_OUT); BMO_face_flag_enable(bm, f, FACE_OUT);
} }
} }
BMO_elem_flag_enable(bm, f_base, FACE_OUT); BMO_face_flag_enable(bm, f_base, FACE_OUT);
if (edges_array_tot) { if (edges_array_tot) {
int i; int i;
@@ -120,7 +120,7 @@ static bool bm_face_split_by_concave(
for (i = 0; i < edges_array_tot; i++) { for (i = 0; i < edges_array_tot; i++) {
BMLoop *l_pair[2]; BMLoop *l_pair[2];
BMEdge *e = edges_array[i]; BMEdge *e = edges_array[i];
BMO_elem_flag_enable(bm, e, EDGE_OUT); BMO_edge_flag_enable(bm, e, EDGE_OUT);
if (BM_edge_is_contiguous(e) && if (BM_edge_is_contiguous(e) &&
BM_edge_loop_pair(e, &l_pair[0], &l_pair[1])) BM_edge_loop_pair(e, &l_pair[0], &l_pair[1]))
@@ -153,7 +153,7 @@ static bool bm_face_split_by_concave(
BMFace *f_new, *f_pair[2] = {l_pair[0]->f, l_pair[1]->f}; BMFace *f_new, *f_pair[2] = {l_pair[0]->f, l_pair[1]->f};
f_new = BM_faces_join(bm, f_pair, 2, true); f_new = BM_faces_join(bm, f_pair, 2, true);
if (f_new) { if (f_new) {
BMO_elem_flag_enable(bm, f_new, FACE_OUT); BMO_face_flag_enable(bm, f_new, FACE_OUT);
} }
} }
} }

View File

@@ -136,9 +136,9 @@ static bool bm_face_split_by_angle(BMesh *bm, BMFace *f, BMFace *r_f_pair[2], co
r_f_pair[0] = f; r_f_pair[0] = f;
r_f_pair[1] = f_new; r_f_pair[1] = f_new;
BMO_elem_flag_enable(bm, f, FACE_OUT); BMO_face_flag_enable(bm, f, FACE_OUT);
BMO_elem_flag_enable(bm, f_new, FACE_OUT); BMO_face_flag_enable(bm, f_new, FACE_OUT);
BMO_elem_flag_enable(bm, l_new->e, EDGE_OUT); BMO_edge_flag_enable(bm, l_new->e, EDGE_OUT);
return true; return true;
} }
} }

View File

@@ -67,18 +67,29 @@
#define ELE_TOUCHED 4 #define ELE_TOUCHED 4
#define FACE_WALK_TEST(f) (CHECK_TYPE_INLINE(f, BMFace *), \ #define FACE_WALK_TEST(f) (CHECK_TYPE_INLINE(f, BMFace *), \
BMO_elem_flag_test(pc->bm_bmoflag, f, FACE_EXCLUDE) == 0) BMO_face_flag_test(pc->bm_bmoflag, f, FACE_EXCLUDE) == 0)
#define VERT_WALK_TEST(v) (CHECK_TYPE_INLINE(v, BMVert *), \ #define VERT_WALK_TEST(v) (CHECK_TYPE_INLINE(v, BMVert *), \
BMO_elem_flag_test(pc->bm_bmoflag, v, VERT_EXCLUDE) == 0) BMO_vert_flag_test(pc->bm_bmoflag, v, VERT_EXCLUDE) == 0)
#if 0
#define ELE_TOUCH_TEST(e) \ #define ELE_TOUCH_TEST(e) \
(CHECK_TYPE_ANY(e, BMVert *, BMEdge *, BMElem *, BMElemF *), \ (CHECK_TYPE_ANY(e, BMVert *, BMEdge *, BMElem *, BMElemF *), \
BMO_elem_flag_test(pc->bm_bmoflag, (BMElemF *)e, ELE_TOUCHED)) BMO_elem_flag_test(pc->bm_bmoflag, (BMElemF *)e, ELE_TOUCHED))
#endif
#define ELE_TOUCH_MARK(e) \ #define ELE_TOUCH_MARK(e) \
{ CHECK_TYPE_ANY(e, BMVert *, BMEdge *, BMElem *, BMElemF *); \ { CHECK_TYPE_ANY(e, BMVert *, BMEdge *, BMElem *, BMElemF *); \
BMO_elem_flag_enable(pc->bm_bmoflag, (BMElemF *)e, ELE_TOUCHED); } ((void)0) BMO_elem_flag_enable(pc->bm_bmoflag, (BMElemF *)e, ELE_TOUCHED); } ((void)0)
#define ELE_TOUCH_TEST_VERT(v) BMO_vert_flag_test(pc->bm_bmoflag, v, ELE_TOUCHED)
// #define ELE_TOUCH_MARK_VERT(v) BMO_vert_flag_enable(pc->bm_bmoflag, (BMElemF *)e, ELE_TOUCHED)
// #define ELE_TOUCH_TEST_EDGE(v) BMO_edge_flag_test(pc->bm_bmoflag, v, ELE_TOUCHED)
// #define ELE_TOUCH_MARK_EDGE(v) BMO_edge_flag_enable(pc->bm_bmoflag, (BMElemF *)e, ELE_TOUCHED)
// #define ELE_TOUCH_TEST_FACE(v) BMO_face_flag_test(pc->bm_bmoflag, v, ELE_TOUCHED)
// #define ELE_TOUCH_MARK_FACE(v) BMO_face_flag_enable(pc->bm_bmoflag, (BMElemF *)e, ELE_TOUCHED)
// #define DEBUG_PRINT // #define DEBUG_PRINT
typedef struct PathContext { typedef struct PathContext {
@@ -352,7 +363,7 @@ static PathLinkState *state_step__face_edges(
BMElem *ele_next_from = (BMElem *)l_iter->f; BMElem *ele_next_from = (BMElem *)l_iter->f;
if (FACE_WALK_TEST((BMFace *)ele_next_from) && if (FACE_WALK_TEST((BMFace *)ele_next_from) &&
(ELE_TOUCH_TEST(ele_next) == false)) (ELE_TOUCH_TEST_VERT((BMVert *)ele_next) == false))
{ {
min_dist_dir_update(mddir, dist_dir); min_dist_dir_update(mddir, dist_dir);
mddir->dist_min[index] = dist_test; mddir->dist_min[index] = dist_test;
@@ -397,7 +408,7 @@ static PathLinkState *state_step__face_verts(
BMElem *ele_next_from = (BMElem *)l_iter->f; BMElem *ele_next_from = (BMElem *)l_iter->f;
if (FACE_WALK_TEST((BMFace *)ele_next_from) && if (FACE_WALK_TEST((BMFace *)ele_next_from) &&
(ELE_TOUCH_TEST(ele_next) == false)) (ELE_TOUCH_TEST_VERT((BMVert *)ele_next) == false))
{ {
min_dist_dir_update(mddir, dist_dir); min_dist_dir_update(mddir, dist_dir);
mddir->dist_min[index] = dist_test; mddir->dist_min[index] = dist_test;
@@ -480,7 +491,7 @@ static bool state_step(PathContext *pc, PathLinkState *state)
if (state_isect_co_exact(pc, v_other->co)) { if (state_isect_co_exact(pc, v_other->co)) {
BMElem *ele_next = (BMElem *)v_other; BMElem *ele_next = (BMElem *)v_other;
BMElem *ele_next_from = (BMElem *)e; BMElem *ele_next_from = (BMElem *)e;
if (ELE_TOUCH_TEST(ele_next) == false) { if (ELE_TOUCH_TEST_VERT((BMVert *)ele_next) == false) {
state = state_link_add_test(pc, state, &state_orig, ele_next, ele_next_from); state = state_link_add_test(pc, state, &state_orig, ele_next, ele_next_from);
} }
} }
@@ -703,11 +714,11 @@ void bmo_connect_vert_pair_exec(BMesh *bm, BMOperator *op)
BMVert *v_new; BMVert *v_new;
float e_fac = state_calc_co_pair_fac(&pc, e->v1->co, e->v2->co); float e_fac = state_calc_co_pair_fac(&pc, e->v1->co, e->v2->co);
v_new = BM_edge_split(bm, e, e->v1, NULL, e_fac); v_new = BM_edge_split(bm, e, e->v1, NULL, e_fac);
BMO_elem_flag_enable(bm, v_new, VERT_OUT); BMO_vert_flag_enable(bm, v_new, VERT_OUT);
} }
else if (link->ele->head.htype == BM_VERT) { else if (link->ele->head.htype == BM_VERT) {
BMVert *v = (BMVert *)link->ele; BMVert *v = (BMVert *)link->ele;
BMO_elem_flag_enable(bm, v, VERT_OUT); BMO_vert_flag_enable(bm, v, VERT_OUT);
} }
else { else {
BLI_assert(0); BLI_assert(0);
@@ -715,8 +726,8 @@ void bmo_connect_vert_pair_exec(BMesh *bm, BMOperator *op)
} while ((link = link->next)); } while ((link = link->next));
} }
BMO_elem_flag_enable(bm, pc.v_a, VERT_OUT); BMO_vert_flag_enable(bm, pc.v_a, VERT_OUT);
BMO_elem_flag_enable(bm, pc.v_b, VERT_OUT); BMO_vert_flag_enable(bm, pc.v_b, VERT_OUT);
BLI_mempool_destroy(pc.link_pool); BLI_mempool_destroy(pc.link_pool);

View File

@@ -52,12 +52,19 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
/* count number of each element type we were passe */ /* count number of each element type we were passe */
BMO_ITER (h, &oiter, op->slots_in, "geom", BM_VERT | BM_EDGE | BM_FACE) { BMO_ITER (h, &oiter, op->slots_in, "geom", BM_VERT | BM_EDGE | BM_FACE) {
switch (h->htype) { switch (h->htype) {
case BM_VERT: totv++; break; case BM_VERT:
case BM_EDGE: tote++; break; BMO_vert_flag_enable(bm, (BMVert *)h, ELE_NEW);
case BM_FACE: totf++; break; totv++;
break;
case BM_EDGE:
BMO_edge_flag_enable(bm, (BMEdge *)h, ELE_NEW);
tote++;
break;
case BM_FACE:
BMO_face_flag_enable(bm, (BMFace *)h, ELE_NEW);
totf++;
break;
} }
BMO_elem_flag_enable(bm, (BMElemF *)h, ELE_NEW);
} }
/* --- Support Edge Creation --- /* --- Support Edge Creation ---
@@ -71,7 +78,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
/* create edge */ /* create edge */
e = BM_edge_create(bm, verts[0], verts[1], NULL, BM_CREATE_NO_DOUBLE); e = BM_edge_create(bm, verts[0], verts[1], NULL, BM_CREATE_NO_DOUBLE);
BMO_elem_flag_enable(bm, e, ELE_OUT); BMO_edge_flag_enable(bm, e, ELE_OUT);
tote += 1; tote += 1;
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, ELE_OUT); BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, ELE_OUT);
return; return;
@@ -131,10 +138,10 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
BMEdge *e; BMEdge *e;
e = BM_edge_create(bm, v_free, v_a, NULL, BM_CREATE_NO_DOUBLE); e = BM_edge_create(bm, v_free, v_a, NULL, BM_CREATE_NO_DOUBLE);
BMO_elem_flag_enable(bm, e, ELE_NEW); BMO_edge_flag_enable(bm, e, ELE_NEW);
e = BM_edge_create(bm, v_free, v_b, NULL, BM_CREATE_NO_DOUBLE); e = BM_edge_create(bm, v_free, v_b, NULL, BM_CREATE_NO_DOUBLE);
BMO_elem_flag_enable(bm, e, ELE_NEW); BMO_edge_flag_enable(bm, e, ELE_NEW);
tote += 2; tote += 2;
} }
} }
@@ -236,7 +243,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
for (ese = bm->selected.first; ese; ese = ese->next) { for (ese = bm->selected.first; ese; ese = ese->next) {
if (ese->htype == BM_VERT) { if (ese->htype == BM_VERT) {
if (BMO_elem_flag_test(bm, (BMElemF *)ese->ele, ELE_NEW)) { if (BMO_vert_flag_test(bm, (BMVert *)ese->ele, ELE_NEW)) {
tot_ese_v++; tot_ese_v++;
} }
else { else {
@@ -256,7 +263,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
BMVert *v = (BMVert *)ese->ele; BMVert *v = (BMVert *)ese->ele;
if (v_prev) { if (v_prev) {
BMEdge *e = BM_edge_create(bm, v, v_prev, NULL, BM_CREATE_NO_DOUBLE); BMEdge *e = BM_edge_create(bm, v, v_prev, NULL, BM_CREATE_NO_DOUBLE);
BMO_elem_flag_enable(bm, e, ELE_OUT); BMO_edge_flag_enable(bm, e, ELE_OUT);
} }
v_prev = v; v_prev = v;
} }
@@ -286,7 +293,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
f = BM_face_create_ngon_vcloud(bm, vert_arr, totv, NULL, BM_CREATE_NO_DOUBLE); f = BM_face_create_ngon_vcloud(bm, vert_arr, totv, NULL, BM_CREATE_NO_DOUBLE);
if (f) { if (f) {
BMO_elem_flag_enable(bm, f, ELE_OUT); BMO_face_flag_enable(bm, f, ELE_OUT);
f->mat_nr = mat_nr; f->mat_nr = mat_nr;
if (use_smooth) { if (use_smooth) {
BM_elem_flag_enable(f, BM_ELEM_SMOOTH); BM_elem_flag_enable(f, BM_ELEM_SMOOTH);

View File

@@ -74,10 +74,10 @@ static bool UNUSED_FUNCTION(check_hole_in_region) (BMesh *bm, BMFace *f)
for (f2 = BMW_begin(&regwalker, f); f2; f2 = BMW_step(&regwalker)) { for (f2 = BMW_begin(&regwalker, f); f2; f2 = BMW_step(&regwalker)) {
BM_ITER_ELEM (l2, &liter2, f2, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l2, &liter2, f2, BM_LOOPS_OF_FACE) {
l3 = l2->radial_next; l3 = l2->radial_next;
if (BMO_elem_flag_test(bm, l3->f, FACE_MARK) != if (BMO_face_flag_test(bm, l3->f, FACE_MARK) !=
BMO_elem_flag_test(bm, l2->f, FACE_MARK)) BMO_face_flag_test(bm, l2->f, FACE_MARK))
{ {
if (!BMO_elem_flag_test(bm, l2->e, EDGE_MARK)) { if (!BMO_edge_flag_test(bm, l2->e, EDGE_MARK)) {
return false; return false;
} }
} }
@@ -99,14 +99,14 @@ static void bm_face_split(BMesh *bm, const short oflag, bool use_edge_delete)
} }
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BMO_elem_flag_test(bm, v, oflag)) { if (BMO_vert_flag_test(bm, v, oflag)) {
if (BM_vert_is_edge_pair(v) == false) { if (BM_vert_is_edge_pair(v) == false) {
BMIter liter; BMIter liter;
BMLoop *l; BMLoop *l;
BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) { BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) {
if (l->f->len > 3) { if (l->f->len > 3) {
if (BMO_elem_flag_test(bm, l->next->v, oflag) == 0 && if (BMO_vert_flag_test(bm, l->next->v, oflag) == 0 &&
BMO_elem_flag_test(bm, l->prev->v, oflag) == 0) BMO_vert_flag_test(bm, l->prev->v, oflag) == 0)
{ {
BM_face_split(bm, l->f, l->next, l->prev, NULL, NULL, true); BM_face_split(bm, l->f, l->next, l->prev, NULL, NULL, true);
} }
@@ -153,7 +153,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
BMVert *v; BMVert *v;
BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
BMO_elem_flag_set(bm, v, VERT_MARK, !BM_vert_is_edge_pair(v)); BMO_vert_flag_set(bm, v, VERT_MARK, !BM_vert_is_edge_pair(v));
} }
} }
@@ -162,7 +162,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
/* collect region */ /* collect region */
BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) { BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) {
BMFace *f_iter; BMFace *f_iter;
if (!BMO_elem_flag_test(bm, f, FACE_TAG)) { if (!BMO_face_flag_test(bm, f, FACE_TAG)) {
continue; continue;
} }
@@ -181,8 +181,8 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
for (i = 0; i < BLI_array_count(faces); i++) { for (i = 0; i < BLI_array_count(faces); i++) {
f_iter = faces[i]; f_iter = faces[i];
BMO_elem_flag_disable(bm, f_iter, FACE_TAG); BMO_face_flag_disable(bm, f_iter, FACE_TAG);
BMO_elem_flag_enable(bm, f_iter, FACE_ORIG); BMO_face_flag_enable(bm, f_iter, FACE_ORIG);
} }
if (BMO_error_occurred(bm)) { if (BMO_error_occurred(bm)) {
@@ -229,8 +229,8 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
/* if making the new face failed (e.g. overlapping test) /* if making the new face failed (e.g. overlapping test)
* unmark the original faces for deletion */ * unmark the original faces for deletion */
BMO_elem_flag_disable(bm, f_new, FACE_ORIG); BMO_face_flag_disable(bm, f_new, FACE_ORIG);
BMO_elem_flag_enable(bm, f_new, FACE_NEW); BMO_face_flag_enable(bm, f_new, FACE_NEW);
} }
/* Typically no faces need to be deleted */ /* Typically no faces need to be deleted */
@@ -243,7 +243,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
BMVert *v, *v_next; BMVert *v, *v_next;
BM_ITER_MESH_MUTABLE (v, v_next, &viter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH_MUTABLE (v, v_next, &viter, bm, BM_VERTS_OF_MESH) {
if (BMO_elem_flag_test(bm, v, VERT_MARK)) { if (BMO_vert_flag_test(bm, v, VERT_MARK)) {
if (BM_vert_is_edge_pair(v)) { if (BM_vert_is_edge_pair(v)) {
BM_vert_collapse_edge(bm, v->e, v, true, true); BM_vert_collapse_edge(bm, v->e, v, true, true);
} }
@@ -285,14 +285,14 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
BMIter itersub; BMIter itersub;
int untag_count = 0; int untag_count = 0;
BM_ITER_ELEM (e, &itersub, v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &itersub, v, BM_EDGES_OF_VERT) {
if (!BMO_elem_flag_test(bm, e, EDGE_TAG)) { if (!BMO_edge_flag_test(bm, e, EDGE_TAG)) {
untag_count++; untag_count++;
} }
} }
/* check that we have 2 edges remaining after dissolve */ /* check that we have 2 edges remaining after dissolve */
if (untag_count <= 2) { if (untag_count <= 2) {
BMO_elem_flag_enable(bm, v, VERT_TAG); BMO_vert_flag_enable(bm, v, VERT_TAG);
} }
} }
@@ -301,7 +301,7 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
if (use_verts) { if (use_verts) {
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
BMO_elem_flag_set(bm, v, VERT_MARK, !BM_vert_is_edge_pair(v)); BMO_vert_flag_set(bm, v, VERT_MARK, !BM_vert_is_edge_pair(v));
} }
} }
@@ -314,8 +314,8 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
BMLoop *l_first, *l_iter; BMLoop *l_first, *l_iter;
l_iter = l_first = BM_FACE_FIRST_LOOP(f_pair[j]); l_iter = l_first = BM_FACE_FIRST_LOOP(f_pair[j]);
do { do {
BMO_elem_flag_enable(bm, l_iter->v, VERT_ISGC); BMO_vert_flag_enable(bm, l_iter->v, VERT_ISGC);
BMO_elem_flag_enable(bm, l_iter->e, EDGE_ISGC); BMO_edge_flag_enable(bm, l_iter->e, EDGE_ISGC);
} while ((l_iter = l_iter->next) != l_first); } while ((l_iter = l_iter->next) != l_first);
} }
} }
@@ -341,12 +341,12 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
/* Cleanup geometry (#BM_faces_join_pair, but it removes geometry we're looping on) /* Cleanup geometry (#BM_faces_join_pair, but it removes geometry we're looping on)
* so do this in a separate pass instead. */ * so do this in a separate pass instead. */
BM_ITER_MESH_MUTABLE (e, e_next, &iter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH_MUTABLE (e, e_next, &iter, bm, BM_EDGES_OF_MESH) {
if ((e->l == NULL) && BMO_elem_flag_test(bm, e, EDGE_ISGC)) { if ((e->l == NULL) && BMO_edge_flag_test(bm, e, EDGE_ISGC)) {
BM_edge_kill(bm, e); BM_edge_kill(bm, e);
} }
} }
BM_ITER_MESH_MUTABLE (v, v_next, &iter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH_MUTABLE (v, v_next, &iter, bm, BM_VERTS_OF_MESH) {
if ((v->e == NULL) && BMO_elem_flag_test(bm, v, VERT_ISGC)) { if ((v->e == NULL) && BMO_vert_flag_test(bm, v, VERT_ISGC)) {
BM_vert_kill(bm, v); BM_vert_kill(bm, v);
} }
} }
@@ -355,7 +355,7 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
if (use_verts) { if (use_verts) {
BM_ITER_MESH_MUTABLE (v, v_next, &iter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH_MUTABLE (v, v_next, &iter, bm, BM_VERTS_OF_MESH) {
if (BMO_elem_flag_test(bm, v, VERT_MARK)) { if (BMO_vert_flag_test(bm, v, VERT_MARK)) {
if (BM_vert_is_edge_pair(v)) { if (BM_vert_is_edge_pair(v)) {
BM_vert_collapse_edge(bm, v->e, v, true, true); BM_vert_collapse_edge(bm, v->e, v, true, true);
} }
@@ -376,7 +376,7 @@ void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
const bool use_boundary_tear = BMO_slot_bool_get(op->slots_in, "use_boundary_tear"); const bool use_boundary_tear = BMO_slot_bool_get(op->slots_in, "use_boundary_tear");
BMO_ITER (v, &oiter, op->slots_in, "verts", BM_VERT) { BMO_ITER (v, &oiter, op->slots_in, "verts", BM_VERT) {
BMO_elem_flag_enable(bm, v, VERT_MARK | VERT_ISGC); BMO_vert_flag_enable(bm, v, VERT_MARK | VERT_ISGC);
} }
if (use_face_split) { if (use_face_split) {
@@ -388,7 +388,7 @@ void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
if (!BM_vert_is_edge_pair(v)) { if (!BM_vert_is_edge_pair(v)) {
BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
if (BM_edge_is_boundary(e)) { if (BM_edge_is_boundary(e)) {
BMO_elem_flag_enable(bm, v, VERT_MARK_TEAR); BMO_vert_flag_enable(bm, v, VERT_MARK_TEAR);
break; break;
} }
} }
@@ -406,8 +406,8 @@ void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
BMLoop *l_iter; BMLoop *l_iter;
l_iter = l_first; l_iter = l_first;
do { do {
BMO_elem_flag_enable(bm, l_iter->v, VERT_ISGC); BMO_vert_flag_enable(bm, l_iter->v, VERT_ISGC);
BMO_elem_flag_enable(bm, l_iter->e, EDGE_ISGC); BMO_edge_flag_enable(bm, l_iter->e, EDGE_ISGC);
} while ((l_iter = l_iter->next) != l_first); } while ((l_iter = l_iter->next) != l_first);
e_first = l_first->e; e_first = l_first->e;
@@ -428,14 +428,14 @@ void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
BMO_ITER (v, &oiter, op->slots_in, "verts", BM_VERT) { BMO_ITER (v, &oiter, op->slots_in, "verts", BM_VERT) {
/* tag here so we avoid feedback loop (checking topology as we edit) */ /* tag here so we avoid feedback loop (checking topology as we edit) */
if (BM_vert_is_edge_pair(v)) { if (BM_vert_is_edge_pair(v)) {
BMO_elem_flag_enable(bm, v, VERT_MARK_PAIR); BMO_vert_flag_enable(bm, v, VERT_MARK_PAIR);
} }
} }
BMO_ITER (v, &oiter, op->slots_in, "verts", BM_VERT) { BMO_ITER (v, &oiter, op->slots_in, "verts", BM_VERT) {
BMIter itersub; BMIter itersub;
if (!BMO_elem_flag_test(bm, v, VERT_MARK_PAIR)) { if (!BMO_vert_flag_test(bm, v, VERT_MARK_PAIR)) {
BM_ITER_ELEM (e, &itersub, v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &itersub, v, BM_EDGES_OF_VERT) {
BMFace *fa, *fb; BMFace *fa, *fb;
if (BM_edge_face_pair(e, &fa, &fb)) { if (BM_edge_face_pair(e, &fa, &fb)) {
@@ -456,7 +456,7 @@ void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
/* Cleanup geometry (#BM_faces_join_pair, but it removes geometry we're looping on) /* Cleanup geometry (#BM_faces_join_pair, but it removes geometry we're looping on)
* so do this in a separate pass instead. */ * so do this in a separate pass instead. */
BM_ITER_MESH_MUTABLE (e, e_next, &iter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH_MUTABLE (e, e_next, &iter, bm, BM_EDGES_OF_MESH) {
if ((e->l == NULL) && BMO_elem_flag_test(bm, e, EDGE_ISGC)) { if ((e->l == NULL) && BMO_edge_flag_test(bm, e, EDGE_ISGC)) {
BM_edge_kill(bm, e); BM_edge_kill(bm, e);
} }
} }
@@ -469,7 +469,7 @@ void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
} }
BM_ITER_MESH_MUTABLE (v, v_next, &iter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH_MUTABLE (v, v_next, &iter, bm, BM_VERTS_OF_MESH) {
if ((v->e == NULL) && BMO_elem_flag_test(bm, v, VERT_ISGC)) { if ((v->e == NULL) && BMO_vert_flag_test(bm, v, VERT_ISGC)) {
BM_vert_kill(bm, v); BM_vert_kill(bm, v);
} }
} }
@@ -518,9 +518,9 @@ void bmo_dissolve_degenerate_exec(BMesh *bm, BMOperator *op)
/* collapse zero length edges, this accounts for zero area faces too */ /* collapse zero length edges, this accounts for zero area faces too */
found = false; found = false;
BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
if (BMO_elem_flag_test(bm, e, EDGE_MARK)) { if (BMO_edge_flag_test(bm, e, EDGE_MARK)) {
if (BM_edge_calc_length_squared(e) < dist_sq) { if (BM_edge_calc_length_squared(e) < dist_sq) {
BMO_elem_flag_enable(bm, e, EDGE_COLLAPSE); BMO_edge_flag_enable(bm, e, EDGE_COLLAPSE);
found = true; found = true;
} }
} }
@@ -543,7 +543,7 @@ void bmo_dissolve_degenerate_exec(BMesh *bm, BMOperator *op)
/* clip degenerate ears from the face */ /* clip degenerate ears from the face */
found = false; found = false;
BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
if (e->l && BMO_elem_flag_test(bm, e, EDGE_MARK)) { if (e->l && BMO_edge_flag_test(bm, e, EDGE_MARK)) {
BMLoop *l_iter, *l_first; BMLoop *l_iter, *l_first;
l_iter = l_first = e->l; l_iter = l_first = e->l;
do { do {
@@ -553,11 +553,11 @@ void bmo_dissolve_degenerate_exec(BMesh *bm, BMOperator *op)
((void)BM_elem_flag_enable(l_iter, BM_ELEM_TAG), ((void)BM_elem_flag_enable(l_iter, BM_ELEM_TAG),
/* check we're marked to tested (radial edge already tested) */ /* check we're marked to tested (radial edge already tested) */
BMO_elem_flag_test(bm, l_iter->prev->e, EDGE_MARK) && BMO_edge_flag_test(bm, l_iter->prev->e, EDGE_MARK) &&
/* check edges are not already going to be collapsed */ /* check edges are not already going to be collapsed */
!BMO_elem_flag_test(bm, l_iter->e, EDGE_COLLAPSE) && !BMO_edge_flag_test(bm, l_iter->e, EDGE_COLLAPSE) &&
!BMO_elem_flag_test(bm, l_iter->prev->e, EDGE_COLLAPSE))) !BMO_edge_flag_test(bm, l_iter->prev->e, EDGE_COLLAPSE)))
{ {
/* test if the faces loop (ear) is degenerate */ /* test if the faces loop (ear) is degenerate */
float dir_prev[3], len_prev; float dir_prev[3], len_prev;
@@ -577,14 +577,14 @@ void bmo_dissolve_degenerate_exec(BMesh *bm, BMOperator *op)
/* both edges the same length */ /* both edges the same length */
if (l_iter->f->len == 3) { if (l_iter->f->len == 3) {
/* ideally this would have been discovered with short edge test above */ /* ideally this would have been discovered with short edge test above */
BMO_elem_flag_enable(bm, l_iter->next->e, EDGE_COLLAPSE); BMO_edge_flag_enable(bm, l_iter->next->e, EDGE_COLLAPSE);
found = true; found = true;
} }
else { else {
/* add a joining edge and tag for removal */ /* add a joining edge and tag for removal */
BMLoop *l_split; BMLoop *l_split;
if (BM_face_split(bm, l_iter->f, l_iter->prev, l_iter->next, &l_split, NULL, true)) { if (BM_face_split(bm, l_iter->f, l_iter->prev, l_iter->next, &l_split, NULL, true)) {
BMO_elem_flag_enable(bm, l_split->e, EDGE_COLLAPSE); BMO_edge_flag_enable(bm, l_split->e, EDGE_COLLAPSE);
found = true; found = true;
reset = true; reset = true;
} }
@@ -599,7 +599,7 @@ void bmo_dissolve_degenerate_exec(BMesh *bm, BMOperator *op)
BLI_assert(v_new == l_iter->next->v); BLI_assert(v_new == l_iter->next->v);
(void)v_new; (void)v_new;
if (BM_face_split(bm, l_iter->f, l_iter->prev, l_iter->next, &l_split, NULL, true)) { if (BM_face_split(bm, l_iter->f, l_iter->prev, l_iter->next, &l_split, NULL, true)) {
BMO_elem_flag_enable(bm, l_split->e, EDGE_COLLAPSE); BMO_edge_flag_enable(bm, l_split->e, EDGE_COLLAPSE);
found = true; found = true;
} }
reset = true; reset = true;
@@ -613,7 +613,7 @@ void bmo_dissolve_degenerate_exec(BMesh *bm, BMOperator *op)
BLI_assert(v_new == l_iter->prev->v); BLI_assert(v_new == l_iter->prev->v);
(void)v_new; (void)v_new;
if (BM_face_split(bm, l_iter->f, l_iter->prev, l_iter->next, &l_split, NULL, true)) { if (BM_face_split(bm, l_iter->f, l_iter->prev, l_iter->next, &l_split, NULL, true)) {
BMO_elem_flag_enable(bm, l_split->e, EDGE_COLLAPSE); BMO_edge_flag_enable(bm, l_split->e, EDGE_COLLAPSE);
found = true; found = true;
} }
reset = true; reset = true;

View File

@@ -63,7 +63,7 @@ static BMVert *bmo_vert_copy(
BM_elem_attrs_copy(bm_src, bm_dst, v_src, v_dst); BM_elem_attrs_copy(bm_src, bm_dst, v_src, v_dst);
/* Mark the vert for output */ /* Mark the vert for output */
BMO_elem_flag_enable(bm_dst, v_dst, DUPE_NEW); BMO_vert_flag_enable(bm_dst, v_dst, DUPE_NEW);
return v_dst; return v_dst;
} }
@@ -94,7 +94,7 @@ static BMEdge *bmo_edge_copy(
BMLoop *l_iter_src, *l_first_src; BMLoop *l_iter_src, *l_first_src;
l_iter_src = l_first_src = e_src->l; l_iter_src = l_first_src = e_src->l;
do { do {
if (BMO_elem_flag_test(bm_src, l_iter_src->f, DUPE_INPUT)) { if (BMO_face_flag_test(bm_src, l_iter_src->f, DUPE_INPUT)) {
rlen++; rlen++;
} }
} while ((l_iter_src = l_iter_src->radial_next) != l_first_src); } while ((l_iter_src = l_iter_src->radial_next) != l_first_src);
@@ -123,7 +123,7 @@ static BMEdge *bmo_edge_copy(
BM_elem_attrs_copy(bm_src, bm_dst, e_src, e_dst); BM_elem_attrs_copy(bm_src, bm_dst, e_src, e_dst);
/* Mark the edge for output */ /* Mark the edge for output */
BMO_elem_flag_enable(bm_dst, e_dst, DUPE_NEW); BMO_edge_flag_enable(bm_dst, e_dst, DUPE_NEW);
return e_dst; return e_dst;
} }
@@ -175,7 +175,7 @@ static BMFace *bmo_face_copy(
(l_iter_src = l_iter_src->next) != l_first_src); (l_iter_src = l_iter_src->next) != l_first_src);
/* Mark the face for output */ /* Mark the face for output */
BMO_elem_flag_enable(bm_dst, f_dst, DUPE_NEW); BMO_face_flag_enable(bm_dst, f_dst, DUPE_NEW);
return f_dst; return f_dst;
} }
@@ -209,8 +209,8 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *bm_dst, BMesh *bm_src)
/* duplicate flagged vertices */ /* duplicate flagged vertices */
BM_ITER_MESH (v, &viter, bm_src, BM_VERTS_OF_MESH) { BM_ITER_MESH (v, &viter, bm_src, BM_VERTS_OF_MESH) {
if (BMO_elem_flag_test(bm_src, v, DUPE_INPUT) && if (BMO_vert_flag_test(bm_src, v, DUPE_INPUT) &&
!BMO_elem_flag_test(bm_src, v, DUPE_DONE)) BMO_vert_flag_test(bm_src, v, DUPE_DONE) == false)
{ {
BMIter iter; BMIter iter;
bool isolated = true; bool isolated = true;
@@ -218,7 +218,7 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *bm_dst, BMesh *bm_src)
v2 = bmo_vert_copy(op, slot_vert_map_out, bm_dst, bm_src, v, vhash); v2 = bmo_vert_copy(op, slot_vert_map_out, bm_dst, bm_src, v, vhash);
BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) { BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) {
if (BMO_elem_flag_test(bm_src, f, DUPE_INPUT)) { if (BMO_face_flag_test(bm_src, f, DUPE_INPUT)) {
isolated = false; isolated = false;
break; break;
} }
@@ -226,7 +226,7 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *bm_dst, BMesh *bm_src)
if (isolated) { if (isolated) {
BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
if (BMO_elem_flag_test(bm_src, e, DUPE_INPUT)) { if (BMO_edge_flag_test(bm_src, e, DUPE_INPUT)) {
isolated = false; isolated = false;
break; break;
} }
@@ -237,53 +237,53 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *bm_dst, BMesh *bm_src)
BMO_slot_map_elem_insert(op, slot_isovert_map_out, v, v2); BMO_slot_map_elem_insert(op, slot_isovert_map_out, v, v2);
} }
BMO_elem_flag_enable(bm_src, v, DUPE_DONE); BMO_vert_flag_enable(bm_src, v, DUPE_DONE);
} }
} }
/* now we dupe all the edges */ /* now we dupe all the edges */
BM_ITER_MESH (e, &eiter, bm_src, BM_EDGES_OF_MESH) { BM_ITER_MESH (e, &eiter, bm_src, BM_EDGES_OF_MESH) {
if (BMO_elem_flag_test(bm_src, e, DUPE_INPUT) && if (BMO_edge_flag_test(bm_src, e, DUPE_INPUT) &&
!BMO_elem_flag_test(bm_src, e, DUPE_DONE)) BMO_edge_flag_test(bm_src, e, DUPE_DONE) == false)
{ {
/* make sure that verts are copied */ /* make sure that verts are copied */
if (!BMO_elem_flag_test(bm_src, e->v1, DUPE_DONE)) { if (!BMO_vert_flag_test(bm_src, e->v1, DUPE_DONE)) {
bmo_vert_copy(op, slot_vert_map_out, bm_dst, bm_src, e->v1, vhash); bmo_vert_copy(op, slot_vert_map_out, bm_dst, bm_src, e->v1, vhash);
BMO_elem_flag_enable(bm_src, e->v1, DUPE_DONE); BMO_vert_flag_enable(bm_src, e->v1, DUPE_DONE);
} }
if (!BMO_elem_flag_test(bm_src, e->v2, DUPE_DONE)) { if (!BMO_vert_flag_test(bm_src, e->v2, DUPE_DONE)) {
bmo_vert_copy(op, slot_vert_map_out, bm_dst, bm_src, e->v2, vhash); bmo_vert_copy(op, slot_vert_map_out, bm_dst, bm_src, e->v2, vhash);
BMO_elem_flag_enable(bm_src, e->v2, DUPE_DONE); BMO_vert_flag_enable(bm_src, e->v2, DUPE_DONE);
} }
/* now copy the actual edge */ /* now copy the actual edge */
bmo_edge_copy(op, slot_edge_map_out, slot_boundary_map_out, bmo_edge_copy(op, slot_edge_map_out, slot_boundary_map_out,
bm_dst, bm_src, e, vhash, ehash); bm_dst, bm_src, e, vhash, ehash);
BMO_elem_flag_enable(bm_src, e, DUPE_DONE); BMO_edge_flag_enable(bm_src, e, DUPE_DONE);
} }
} }
/* first we dupe all flagged faces and their elements from source */ /* first we dupe all flagged faces and their elements from source */
BM_ITER_MESH (f, &fiter, bm_src, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &fiter, bm_src, BM_FACES_OF_MESH) {
if (BMO_elem_flag_test(bm_src, f, DUPE_INPUT)) { if (BMO_face_flag_test(bm_src, f, DUPE_INPUT)) {
/* vertex pass */ /* vertex pass */
BM_ITER_ELEM (v, &viter, f, BM_VERTS_OF_FACE) { BM_ITER_ELEM (v, &viter, f, BM_VERTS_OF_FACE) {
if (!BMO_elem_flag_test(bm_src, v, DUPE_DONE)) { if (!BMO_vert_flag_test(bm_src, v, DUPE_DONE)) {
bmo_vert_copy(op, slot_vert_map_out, bm_dst, bm_src, v, vhash); bmo_vert_copy(op, slot_vert_map_out, bm_dst, bm_src, v, vhash);
BMO_elem_flag_enable(bm_src, v, DUPE_DONE); BMO_vert_flag_enable(bm_src, v, DUPE_DONE);
} }
} }
/* edge pass */ /* edge pass */
BM_ITER_ELEM (e, &eiter, f, BM_EDGES_OF_FACE) { BM_ITER_ELEM (e, &eiter, f, BM_EDGES_OF_FACE) {
if (!BMO_elem_flag_test(bm_src, e, DUPE_DONE)) { if (!BMO_edge_flag_test(bm_src, e, DUPE_DONE)) {
bmo_edge_copy(op, slot_edge_map_out, slot_boundary_map_out, bmo_edge_copy(op, slot_edge_map_out, slot_boundary_map_out,
bm_dst, bm_src, e, vhash, ehash); bm_dst, bm_src, e, vhash, ehash);
BMO_elem_flag_enable(bm_src, e, DUPE_DONE); BMO_edge_flag_enable(bm_src, e, DUPE_DONE);
} }
} }
bmo_face_copy(op, slot_face_map_out, bm_dst, bm_src, f, vhash, ehash); bmo_face_copy(op, slot_face_map_out, bm_dst, bm_src, f, vhash, ehash);
BMO_elem_flag_enable(bm_src, f, DUPE_DONE); BMO_face_flag_enable(bm_src, f, DUPE_DONE);
} }
} }
@@ -408,26 +408,26 @@ void bmo_split_exec(BMesh *bm, BMOperator *op)
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
bool found = false; bool found = false;
BM_ITER_ELEM (f, &iter2, e, BM_FACES_OF_EDGE) { BM_ITER_ELEM (f, &iter2, e, BM_FACES_OF_EDGE) {
if (!BMO_elem_flag_test(bm, f, SPLIT_INPUT)) { if (!BMO_face_flag_test(bm, f, SPLIT_INPUT)) {
found = true; found = true;
break; break;
} }
} }
if (found == false) { if (found == false) {
BMO_elem_flag_enable(bm, e, SPLIT_INPUT); BMO_edge_flag_enable(bm, e, SPLIT_INPUT);
} }
} }
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
bool found = false; bool found = false;
BM_ITER_ELEM (e, &iter2, v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &iter2, v, BM_EDGES_OF_VERT) {
if (!BMO_elem_flag_test(bm, e, SPLIT_INPUT)) { if (!BMO_edge_flag_test(bm, e, SPLIT_INPUT)) {
found = true; found = true;
break; break;
} }
} }
if (found == false) { if (found == false) {
BMO_elem_flag_enable(bm, v, SPLIT_INPUT); BMO_vert_flag_enable(bm, v, SPLIT_INPUT);
} }
} }
} }

View File

@@ -94,8 +94,8 @@ static BMEdge *edge_next(BMesh *bm, BMEdge *e)
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
BM_ITER_ELEM (e2, &iter, i ? e->v2 : e->v1, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e2, &iter, i ? e->v2 : e->v1, BM_EDGES_OF_VERT) {
if ((BMO_elem_flag_test(bm, e2, EDGE_MARK)) && if ((BMO_edge_flag_test(bm, e2, EDGE_MARK)) &&
(!BMO_elem_flag_test(bm, e2, EDGE_VIS)) && (BMO_edge_flag_test(bm, e2, EDGE_VIS) == false) &&
(e2 != e)) (e2 != e))
{ {
return e2; return e2;
@@ -144,7 +144,7 @@ void bmo_edgenet_prepare_exec(BMesh *bm, BMOperator *op)
count = 0; count = 0;
while (1) { while (1) {
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) { BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
if (!BMO_elem_flag_test(bm, e, EDGE_VIS)) { if (!BMO_edge_flag_test(bm, e, EDGE_VIS)) {
if (BMO_iter_elem_count_flag(bm, BM_EDGES_OF_VERT, e->v1, EDGE_MARK, true) == 1 || if (BMO_iter_elem_count_flag(bm, BM_EDGES_OF_VERT, e->v1, EDGE_MARK, true) == 1 ||
BMO_iter_elem_count_flag(bm, BM_EDGES_OF_VERT, e->v2, EDGE_MARK, true) == 1) BMO_iter_elem_count_flag(bm, BM_EDGES_OF_VERT, e->v2, EDGE_MARK, true) == 1)
{ {
@@ -169,7 +169,7 @@ void bmo_edgenet_prepare_exec(BMesh *bm, BMOperator *op)
i = 0; i = 0;
while (e) { while (e) {
BMO_elem_flag_enable(bm, e, EDGE_VIS); BMO_edge_flag_enable(bm, e, EDGE_VIS);
BLI_array_grow_one(edges); BLI_array_grow_one(edges);
edges[i] = e; edges[i] = e;
@@ -258,9 +258,9 @@ void bmo_edgenet_prepare_exec(BMesh *bm, BMOperator *op)
} }
e = BM_edge_create(bm, v1, v3, NULL, BM_CREATE_NO_DOUBLE); e = BM_edge_create(bm, v1, v3, NULL, BM_CREATE_NO_DOUBLE);
BMO_elem_flag_enable(bm, e, ELE_NEW); BMO_edge_flag_enable(bm, e, ELE_NEW);
e = BM_edge_create(bm, v2, v4, NULL, BM_CREATE_NO_DOUBLE); e = BM_edge_create(bm, v2, v4, NULL, BM_CREATE_NO_DOUBLE);
BMO_elem_flag_enable(bm, e, ELE_NEW); BMO_edge_flag_enable(bm, e, ELE_NEW);
} }
else if (edges1) { else if (edges1) {
BMVert *v1, *v2; BMVert *v1, *v2;
@@ -270,7 +270,7 @@ void bmo_edgenet_prepare_exec(BMesh *bm, BMOperator *op)
i = BLI_array_count(edges1) - 1; i = BLI_array_count(edges1) - 1;
v2 = BM_vert_in_edge(edges1[i - 1], edges1[i]->v1) ? edges1[i]->v2 : edges1[i]->v1; v2 = BM_vert_in_edge(edges1[i - 1], edges1[i]->v1) ? edges1[i]->v2 : edges1[i]->v1;
e = BM_edge_create(bm, v1, v2, NULL, BM_CREATE_NO_DOUBLE); e = BM_edge_create(bm, v1, v2, NULL, BM_CREATE_NO_DOUBLE);
BMO_elem_flag_enable(bm, e, ELE_NEW); BMO_edge_flag_enable(bm, e, ELE_NEW);
} }
} }

View File

@@ -70,10 +70,10 @@ void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op)
BMLoop *l_org, *l_org_first; BMLoop *l_org, *l_org_first;
BMLoop *l_new; BMLoop *l_new;
BMO_elem_flag_enable(bm, f_org, EXT_DEL); BMO_face_flag_enable(bm, f_org, EXT_DEL);
f_new = BM_face_copy(bm, bm, f_org, true, true); f_new = BM_face_copy(bm, bm, f_org, true, true);
BMO_elem_flag_enable(bm, f_new, EXT_KEEP); BMO_face_flag_enable(bm, f_new, EXT_KEEP);
if (select_history_map) { if (select_history_map) {
BMEditSelection *ese; BMEditSelection *ese;
@@ -188,9 +188,9 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
BMEdge *e, *e_new; BMEdge *e, *e_new;
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) { BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
BMO_elem_flag_enable(bm, e, EXT_INPUT); BMO_edge_flag_enable(bm, e, EXT_INPUT);
BMO_elem_flag_enable(bm, e->v1, EXT_INPUT); BMO_vert_flag_enable(bm, e->v1, EXT_INPUT);
BMO_elem_flag_enable(bm, e->v2, EXT_INPUT); BMO_vert_flag_enable(bm, e->v2, EXT_INPUT);
} }
BMO_op_initf( BMO_op_initf(
@@ -228,13 +228,14 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
f = BM_face_create_verts(bm, f_verts, 4, NULL, BM_CREATE_NOP, true); f = BM_face_create_verts(bm, f_verts, 4, NULL, BM_CREATE_NOP, true);
bm_extrude_copy_face_loop_attributes(bm, f); bm_extrude_copy_face_loop_attributes(bm, f);
if (BMO_elem_flag_test(bm, e, EXT_INPUT)) if (BMO_edge_flag_test(bm, e, EXT_INPUT)) {
e = e_new; e = e_new;
}
BMO_elem_flag_enable(bm, f, EXT_KEEP); BMO_face_flag_enable(bm, f, EXT_KEEP);
BMO_elem_flag_enable(bm, e, EXT_KEEP); BMO_edge_flag_enable(bm, e, EXT_KEEP);
BMO_elem_flag_enable(bm, e->v1, EXT_KEEP); BMO_vert_flag_enable(bm, e->v1, EXT_KEEP);
BMO_elem_flag_enable(bm, e->v2, EXT_KEEP); BMO_vert_flag_enable(bm, e->v2, EXT_KEEP);
} }
@@ -258,7 +259,7 @@ void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
for (v = BMO_iter_new(&siter, op->slots_in, "verts", BM_VERT); v; v = BMO_iter_step(&siter)) { for (v = BMO_iter_new(&siter, op->slots_in, "verts", BM_VERT); v; v = BMO_iter_step(&siter)) {
dupev = BM_vert_create(bm, v->co, v, BM_CREATE_NOP); dupev = BM_vert_create(bm, v->co, v, BM_CREATE_NOP);
BMO_elem_flag_enable(bm, dupev, EXT_KEEP); BMO_vert_flag_enable(bm, dupev, EXT_KEEP);
if (has_vskin) if (has_vskin)
bm_extrude_disable_skin_root(bm, v); bm_extrude_disable_skin_root(bm, v);
@@ -279,7 +280,7 @@ void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
} }
e = BM_edge_create(bm, v, dupev, NULL, BM_CREATE_NOP); e = BM_edge_create(bm, v, dupev, NULL, BM_CREATE_NOP);
BMO_elem_flag_enable(bm, e, EXT_KEEP); BMO_edge_flag_enable(bm, e, EXT_KEEP);
} }
if (select_history_map) { if (select_history_map) {
@@ -350,7 +351,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
int edge_face_tot; int edge_face_tot;
if (!BMO_elem_flag_test(bm, e, EXT_INPUT)) { if (!BMO_edge_flag_test(bm, e, EXT_INPUT)) {
continue; continue;
} }
@@ -358,7 +359,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
edge_face_tot = 0; /* edge/face count */ edge_face_tot = 0; /* edge/face count */
BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) { BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) {
if (!BMO_elem_flag_test(bm, f, EXT_INPUT)) { if (!BMO_face_flag_test(bm, f, EXT_INPUT)) {
found = true; found = true;
delorig = true; delorig = true;
break; break;
@@ -369,7 +370,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
if ((edge_face_tot > 1) && (found == false)) { if ((edge_face_tot > 1) && (found == false)) {
/* edge has a face user, that face isn't extrude input */ /* edge has a face user, that face isn't extrude input */
BMO_elem_flag_enable(bm, e, EXT_DEL); BMO_edge_flag_enable(bm, e, EXT_DEL);
} }
} }
} }
@@ -380,7 +381,9 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
found = false; found = false;
BM_ITER_ELEM (e, &viter, v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &viter, v, BM_EDGES_OF_VERT) {
if (!BMO_elem_flag_test(bm, e, EXT_INPUT) || !BMO_elem_flag_test(bm, e, EXT_DEL)) { if (!BMO_edge_flag_test(bm, e, EXT_INPUT) ||
!BMO_edge_flag_test(bm, e, EXT_DEL))
{
found = true; found = true;
break; break;
} }
@@ -389,7 +392,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
/* avoid an extra loop */ /* avoid an extra loop */
if (found == true) { if (found == true) {
BM_ITER_ELEM (f, &viter, v, BM_FACES_OF_VERT) { BM_ITER_ELEM (f, &viter, v, BM_FACES_OF_VERT) {
if (!BMO_elem_flag_test(bm, f, EXT_INPUT)) { if (!BMO_face_flag_test(bm, f, EXT_INPUT)) {
found = true; found = true;
break; break;
} }
@@ -397,14 +400,14 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
} }
if (found == false) { if (found == false) {
BMO_elem_flag_enable(bm, v, EXT_DEL); BMO_vert_flag_enable(bm, v, EXT_DEL);
} }
} }
} }
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
if (BMO_elem_flag_test(bm, f, EXT_INPUT)) { if (BMO_face_flag_test(bm, f, EXT_INPUT)) {
BMO_elem_flag_enable(bm, f, EXT_DEL); BMO_face_flag_enable(bm, f, EXT_DEL);
} }
} }
@@ -426,7 +429,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
} }
slot_facemap_out = BMO_slot_get(dupeop.slots_out, "face_map.out"); slot_facemap_out = BMO_slot_get(dupeop.slots_out, "face_map.out");
if (bm->act_face && BMO_elem_flag_test(bm, bm->act_face, EXT_INPUT)) { if (bm->act_face && BMO_face_flag_test(bm, bm->act_face, EXT_INPUT)) {
bm->act_face = BMO_slot_map_elem_get(slot_facemap_out, bm->act_face); bm->act_face = BMO_slot_map_elem_get(slot_facemap_out, bm->act_face);
} }
@@ -437,7 +440,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
/* if not delorig, reverse loops of original face */ /* if not delorig, reverse loops of original face */
if (!delorig) { if (!delorig) {
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
if (BMO_elem_flag_test(bm, f, EXT_INPUT)) { if (BMO_face_flag_test(bm, f, EXT_INPUT)) {
BM_face_normal_flip(bm, f); BM_face_normal_flip(bm, f);
} }
} }
@@ -583,7 +586,7 @@ static void calc_solidify_normals(BMesh *bm)
BM_mesh_elem_index_ensure(bm, BM_EDGE); BM_mesh_elem_index_ensure(bm, BM_EDGE);
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
if (!BMO_elem_flag_test(bm, f, FACE_MARK)) { if (!BMO_face_flag_test(bm, f, FACE_MARK)) {
continue; continue;
} }
@@ -591,15 +594,15 @@ static void calc_solidify_normals(BMesh *bm)
/* And mark all edges and vertices on the /* And mark all edges and vertices on the
* marked faces */ * marked faces */
BMO_elem_flag_enable(bm, e, EDGE_MARK); BMO_edge_flag_enable(bm, e, EDGE_MARK);
BMO_elem_flag_enable(bm, e->v1, VERT_MARK); BMO_vert_flag_enable(bm, e->v1, VERT_MARK);
BMO_elem_flag_enable(bm, e->v2, VERT_MARK); BMO_vert_flag_enable(bm, e->v2, VERT_MARK);
edge_face_count[BM_elem_index_get(e)]++; edge_face_count[BM_elem_index_get(e)]++;
} }
} }
BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
if (!BMO_elem_flag_test(bm, e, EDGE_MARK)) { if (!BMO_edge_flag_test(bm, e, EDGE_MARK)) {
continue; continue;
} }
@@ -608,9 +611,9 @@ static void calc_solidify_normals(BMesh *bm)
if (i == 0 || i > 2) { if (i == 0 || i > 2) {
/* Edge & vertices are non-manifold even when considering /* Edge & vertices are non-manifold even when considering
* only marked faces */ * only marked faces */
BMO_elem_flag_enable(bm, e, EDGE_NONMAN); BMO_edge_flag_enable(bm, e, EDGE_NONMAN);
BMO_elem_flag_enable(bm, e->v1, VERT_NONMAN); BMO_vert_flag_enable(bm, e->v1, VERT_NONMAN);
BMO_elem_flag_enable(bm, e->v2, VERT_NONMAN); BMO_vert_flag_enable(bm, e->v2, VERT_NONMAN);
} }
} }
MEM_freeN(edge_face_count); MEM_freeN(edge_face_count);
@@ -618,11 +621,11 @@ static void calc_solidify_normals(BMesh *bm)
BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
if (!BM_vert_is_manifold(v)) { if (!BM_vert_is_manifold(v)) {
BMO_elem_flag_enable(bm, v, VERT_NONMAN); BMO_vert_flag_enable(bm, v, VERT_NONMAN);
continue; continue;
} }
if (BMO_elem_flag_test(bm, v, VERT_MARK)) { if (BMO_vert_flag_test(bm, v, VERT_MARK)) {
zero_v3(v->no); zero_v3(v->no);
} }
} }
@@ -631,20 +634,20 @@ static void calc_solidify_normals(BMesh *bm)
/* If the edge is not part of a the solidify region /* If the edge is not part of a the solidify region
* its normal should not be considered */ * its normal should not be considered */
if (!BMO_elem_flag_test(bm, e, EDGE_MARK)) { if (!BMO_edge_flag_test(bm, e, EDGE_MARK)) {
continue; continue;
} }
/* If the edge joins more than two marked faces high /* If the edge joins more than two marked faces high
* quality normal computation won't work */ * quality normal computation won't work */
if (BMO_elem_flag_test(bm, e, EDGE_NONMAN)) { if (BMO_edge_flag_test(bm, e, EDGE_NONMAN)) {
continue; continue;
} }
f1 = f2 = NULL; f1 = f2 = NULL;
BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) { BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) {
if (BMO_elem_flag_test(bm, f, FACE_MARK)) { if (BMO_face_flag_test(bm, f, FACE_MARK)) {
if (f1 == NULL) { if (f1 == NULL) {
f1 = f; f1 = f;
} }
@@ -689,11 +692,11 @@ static void calc_solidify_normals(BMesh *bm)
/* normalize accumulated vertex normal */ /* normalize accumulated vertex normal */
BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
if (!BMO_elem_flag_test(bm, v, VERT_MARK)) { if (!BMO_vert_flag_test(bm, v, VERT_MARK)) {
continue; continue;
} }
if (BMO_elem_flag_test(bm, v, VERT_NONMAN)) { if (BMO_vert_flag_test(bm, v, VERT_NONMAN)) {
/* use standard normals for vertices connected to non-manifold edges */ /* use standard normals for vertices connected to non-manifold edges */
BM_vert_normal_update(v); BM_vert_normal_update(v);
} }
@@ -701,7 +704,7 @@ static void calc_solidify_normals(BMesh *bm)
/* exceptional case, totally flat. use the normal /* exceptional case, totally flat. use the normal
* of any marked face around the vertex */ * of any marked face around the vertex */
BM_ITER_ELEM (f, &fiter, v, BM_FACES_OF_VERT) { BM_ITER_ELEM (f, &fiter, v, BM_FACES_OF_VERT) {
if (BMO_elem_flag_test(bm, f, FACE_MARK)) { if (BMO_face_flag_test(bm, f, FACE_MARK)) {
break; break;
} }
} }
@@ -726,7 +729,7 @@ static void solidify_add_thickness(BMesh *bm, const float dist)
BM_mesh_elem_index_ensure(bm, BM_VERT); BM_mesh_elem_index_ensure(bm, BM_VERT);
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
if (BMO_elem_flag_test(bm, f, FACE_MARK)) { if (BMO_face_flag_test(bm, f, FACE_MARK)) {
/* array for passing verts to angle_poly_v3 */ /* array for passing verts to angle_poly_v3 */
float *face_angles = BLI_buffer_reinit_data(&face_angles_buf, float, f->len); float *face_angles = BLI_buffer_reinit_data(&face_angles_buf, float, f->len);

View File

@@ -59,14 +59,14 @@ void bmo_edgeloop_fill_exec(BMesh *bm, BMOperator *op)
i = 0; i = 0;
BMO_ITER (e, &oiter, op->slots_in, "edges", BM_EDGE) { BMO_ITER (e, &oiter, op->slots_in, "edges", BM_EDGE) {
BMIter viter; BMIter viter;
BMO_elem_flag_enable(bm, e, EDGE_MARK); BMO_edge_flag_enable(bm, e, EDGE_MARK);
BM_ITER_ELEM (v, &viter, e, BM_VERTS_OF_EDGE) { BM_ITER_ELEM (v, &viter, e, BM_VERTS_OF_EDGE) {
if (BMO_elem_flag_test(bm, v, VERT_USED) == false) { if (BMO_vert_flag_test(bm, v, VERT_USED) == false) {
if (i == tote) { if (i == tote) {
goto cleanup; goto cleanup;
} }
BMO_elem_flag_enable(bm, v, VERT_USED); BMO_vert_flag_enable(bm, v, VERT_USED);
verts[i++] = v; verts[i++] = v;
} }
} }
@@ -103,21 +103,21 @@ void bmo_edgeloop_fill_exec(BMesh *bm, BMOperator *op)
while (totv_used < totv) { while (totv_used < totv) {
for (i = 0; i < totv; i++) { for (i = 0; i < totv; i++) {
v = verts[i]; v = verts[i];
if (BMO_elem_flag_test(bm, v, VERT_USED)) { if (BMO_vert_flag_test(bm, v, VERT_USED)) {
break; break;
} }
} }
/* this should never fail, as long as (totv_used < totv) /* this should never fail, as long as (totv_used < totv)
* we should have marked verts available */ * we should have marked verts available */
BLI_assert(BMO_elem_flag_test(bm, v, VERT_USED)); BLI_assert(BMO_vert_flag_test(bm, v, VERT_USED));
/* watch it, 'i' is used for final face length */ /* watch it, 'i' is used for final face length */
i = 0; i = 0;
do { do {
/* we know that there are 2 edges per vertex so no need to check */ /* we know that there are 2 edges per vertex so no need to check */
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
if (BMO_elem_flag_test(bm, e, EDGE_MARK)) { if (BMO_edge_flag_test(bm, e, EDGE_MARK)) {
if (e != e_prev) { if (e != e_prev) {
e_next = e; e_next = e;
break; break;
@@ -127,7 +127,7 @@ void bmo_edgeloop_fill_exec(BMesh *bm, BMOperator *op)
/* fill in the array */ /* fill in the array */
f_verts[i] = v; f_verts[i] = v;
BMO_elem_flag_disable(bm, v, VERT_USED); BMO_vert_flag_disable(bm, v, VERT_USED);
totv_used++; totv_used++;
/* step over the edges */ /* step over the edges */
@@ -141,7 +141,7 @@ void bmo_edgeloop_fill_exec(BMesh *bm, BMOperator *op)
/* don't use calc_edges option because we already have the edges */ /* don't use calc_edges option because we already have the edges */
f = BM_face_create_ngon_verts(bm, f_verts, i, NULL, BM_CREATE_NOP, true, false); f = BM_face_create_ngon_verts(bm, f_verts, i, NULL, BM_CREATE_NOP, true, false);
BMO_elem_flag_enable(bm, f, ELE_OUT); BMO_face_flag_enable(bm, f, ELE_OUT);
f->mat_nr = mat_nr; f->mat_nr = mat_nr;
if (use_smooth) { if (use_smooth) {
BM_elem_flag_enable(f, BM_ELEM_SMOOTH); BM_elem_flag_enable(f, BM_ELEM_SMOOTH);

View File

@@ -466,7 +466,7 @@ static void bm_grid_fill_array(
/* end interp */ /* end interp */
BMO_elem_flag_enable(bm, f, FACE_OUT); BMO_face_flag_enable(bm, f, FACE_OUT);
f->mat_nr = mat_nr; f->mat_nr = mat_nr;
if (use_smooth) { if (use_smooth) {
BM_elem_flag_enable(f, BM_ELEM_SMOOTH); BM_elem_flag_enable(f, BM_ELEM_SMOOTH);
@@ -585,7 +585,7 @@ static void bm_edgeloop_flag_set(struct BMEdgeLoopStore *estore, char hflag, boo
static bool bm_edge_test_cb(BMEdge *e, void *bm_v) static bool bm_edge_test_cb(BMEdge *e, void *bm_v)
{ {
return BMO_elem_flag_test_bool((BMesh *)bm_v, e, EDGE_MARK); return BMO_edge_flag_test_bool((BMesh *)bm_v, e, EDGE_MARK);
} }
static bool bm_edge_test_rail_cb(BMEdge *e, void *UNUSED(bm_v)) static bool bm_edge_test_rail_cb(BMEdge *e, void *UNUSED(bm_v))

View File

@@ -81,7 +81,7 @@ static void hull_add_triangle(
/* Mark triangles vertices as not interior */ /* Mark triangles vertices as not interior */
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
BMO_elem_flag_disable(bm, t->v[i], HULL_FLAG_INTERIOR_ELE); BMO_vert_flag_disable(bm, t->v[i], HULL_FLAG_INTERIOR_ELE);
BLI_gset_insert(hull_triangles, t); BLI_gset_insert(hull_triangles, t);
normal_tri_v3(t->no, v1->co, v2->co, v3->co); normal_tri_v3(t->no, v1->co, v2->co, v3->co);
@@ -93,8 +93,8 @@ static BMFace *hull_find_example_face(BMesh *bm, BMEdge *e)
BMFace *f; BMFace *f;
BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) { BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
if (BMO_elem_flag_test(bm, f, HULL_FLAG_INPUT) || if (BMO_face_flag_test(bm, f, HULL_FLAG_INPUT) ||
!BMO_elem_flag_test(bm, f, HULL_FLAG_OUTPUT_GEOM)) BMO_face_flag_test(bm, f, HULL_FLAG_OUTPUT_GEOM) == false)
{ {
return f; return f;
} }
@@ -124,9 +124,9 @@ static void hull_output_triangles(BMesh *bm, GSet *hull_triangles)
* disabled, but an output face in the hull is the * disabled, but an output face in the hull is the
* same as a face in the existing mesh, it should not * same as a face in the existing mesh, it should not
* be marked as unused or interior. */ * be marked as unused or interior. */
BMO_elem_flag_enable(bm, f, HULL_FLAG_OUTPUT_GEOM); BMO_face_flag_enable(bm, f, HULL_FLAG_OUTPUT_GEOM);
BMO_elem_flag_disable(bm, f, HULL_FLAG_HOLE); BMO_face_flag_disable(bm, f, HULL_FLAG_HOLE);
BMO_elem_flag_disable(bm, f, HULL_FLAG_INTERIOR_ELE); BMO_face_flag_disable(bm, f, HULL_FLAG_INTERIOR_ELE);
} }
else { else {
/* Look for an adjacent face that existed before the hull */ /* Look for an adjacent face that existed before the hull */
@@ -140,12 +140,12 @@ static void hull_output_triangles(BMesh *bm, GSet *hull_triangles)
BM_face_copy_shared(bm, f, NULL, NULL); BM_face_copy_shared(bm, f, NULL, NULL);
} }
/* Mark face for 'geom.out' slot and select */ /* Mark face for 'geom.out' slot and select */
BMO_elem_flag_enable(bm, f, HULL_FLAG_OUTPUT_GEOM); BMO_face_flag_enable(bm, f, HULL_FLAG_OUTPUT_GEOM);
BM_face_select_set(bm, f, true); BM_face_select_set(bm, f, true);
/* Mark edges for 'geom.out' slot */ /* Mark edges for 'geom.out' slot */
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
BMO_elem_flag_enable(bm, edges[i], HULL_FLAG_OUTPUT_GEOM); BMO_edge_flag_enable(bm, edges[i], HULL_FLAG_OUTPUT_GEOM);
} }
} }
else { else {
@@ -154,17 +154,17 @@ static void hull_output_triangles(BMesh *bm, GSet *hull_triangles)
const int next = (i == 2 ? 0 : i + 1); const int next = (i == 2 ? 0 : i + 1);
BMEdge *e = BM_edge_exists(t->v[i], t->v[next]); BMEdge *e = BM_edge_exists(t->v[i], t->v[next]);
if (e && if (e &&
BMO_elem_flag_test(bm, e, HULL_FLAG_INPUT) && BMO_edge_flag_test(bm, e, HULL_FLAG_INPUT) &&
!BMO_elem_flag_test(bm, e, HULL_FLAG_HOLE)) !BMO_edge_flag_test(bm, e, HULL_FLAG_HOLE))
{ {
BMO_elem_flag_enable(bm, e, HULL_FLAG_OUTPUT_GEOM); BMO_edge_flag_enable(bm, e, HULL_FLAG_OUTPUT_GEOM);
} }
} }
} }
/* Mark verts for 'geom.out' slot */ /* Mark verts for 'geom.out' slot */
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
BMO_elem_flag_enable(bm, t->v[i], HULL_FLAG_OUTPUT_GEOM); BMO_vert_flag_enable(bm, t->v[i], HULL_FLAG_OUTPUT_GEOM);
} }
} }
} }
@@ -292,8 +292,8 @@ static void hull_remove_overlapping(
BM_vert_in_face(t->v[2], f) && f_on_hull) BM_vert_in_face(t->v[2], f) && f_on_hull)
{ {
t->skip = true; t->skip = true;
BMO_elem_flag_disable(bm, f, HULL_FLAG_INTERIOR_ELE); BMO_face_flag_disable(bm, f, HULL_FLAG_INTERIOR_ELE);
BMO_elem_flag_enable(bm, f, HULL_FLAG_HOLE); BMO_face_flag_enable(bm, f, HULL_FLAG_HOLE);
} }
} }
} }
@@ -310,13 +310,13 @@ static void hull_mark_interior_elements(
/* Check for interior edges too */ /* Check for interior edges too */
BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) { BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) {
if (!hull_final_edges_lookup(final_edges, e->v1, e->v2)) if (!hull_final_edges_lookup(final_edges, e->v1, e->v2))
BMO_elem_flag_enable(bm, e, HULL_FLAG_INTERIOR_ELE); BMO_edge_flag_enable(bm, e, HULL_FLAG_INTERIOR_ELE);
} }
/* Mark all input faces as interior, some may be unmarked in /* Mark all input faces as interior, some may be unmarked in
* hull_remove_overlapping() */ * hull_remove_overlapping() */
BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) { BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) {
BMO_elem_flag_enable(bm, f, HULL_FLAG_INTERIOR_ELE); BMO_face_flag_enable(bm, f, HULL_FLAG_INTERIOR_ELE);
} }
} }
@@ -333,47 +333,50 @@ static void hull_tag_unused(BMesh *bm, BMOperator *op)
* the hull), but that aren't also used by elements outside the * the hull), but that aren't also used by elements outside the
* input set */ * input set */
BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) { BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
if (BMO_elem_flag_test(bm, v, HULL_FLAG_INTERIOR_ELE)) { if (BMO_vert_flag_test(bm, v, HULL_FLAG_INTERIOR_ELE)) {
bool del = true; bool del = true;
BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
if (!BMO_elem_flag_test(bm, e, HULL_FLAG_INPUT)) { if (!BMO_edge_flag_test(bm, e, HULL_FLAG_INPUT)) {
del = false; del = false;
break; break;
} }
} }
BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) { BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) {
if (!BMO_elem_flag_test(bm, f, HULL_FLAG_INPUT)) { if (!BMO_face_flag_test(bm, f, HULL_FLAG_INPUT)) {
del = false; del = false;
break; break;
} }
} }
if (del) if (del) {
BMO_elem_flag_enable(bm, v, HULL_FLAG_DEL); BMO_vert_flag_enable(bm, v, HULL_FLAG_DEL);
}
} }
} }
BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) { BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) {
if (BMO_elem_flag_test(bm, e, HULL_FLAG_INTERIOR_ELE)) { if (BMO_edge_flag_test(bm, e, HULL_FLAG_INTERIOR_ELE)) {
bool del = true; bool del = true;
BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) { BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
if (!BMO_elem_flag_test(bm, f, HULL_FLAG_INPUT)) { if (!BMO_face_flag_test(bm, f, HULL_FLAG_INPUT)) {
del = false; del = false;
break; break;
} }
} }
if (del) if (del) {
BMO_elem_flag_enable(bm, e, HULL_FLAG_DEL); BMO_edge_flag_enable(bm, e, HULL_FLAG_DEL);
}
} }
} }
BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) { BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) {
if (BMO_elem_flag_test(bm, f, HULL_FLAG_INTERIOR_ELE)) if (BMO_face_flag_test(bm, f, HULL_FLAG_INTERIOR_ELE)) {
BMO_elem_flag_enable(bm, f, HULL_FLAG_DEL); BMO_face_flag_enable(bm, f, HULL_FLAG_DEL);
}
} }
} }
@@ -387,10 +390,10 @@ static void hull_tag_holes(BMesh *bm, BMOperator *op)
/* Unmark any hole faces if they are isolated or part of a /* Unmark any hole faces if they are isolated or part of a
* border */ * border */
BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) { BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) {
if (BMO_elem_flag_test(bm, f, HULL_FLAG_HOLE)) { if (BMO_face_flag_test(bm, f, HULL_FLAG_HOLE)) {
BM_ITER_ELEM (e, &iter, f, BM_EDGES_OF_FACE) { BM_ITER_ELEM (e, &iter, f, BM_EDGES_OF_FACE) {
if (BM_edge_is_boundary(e)) { if (BM_edge_is_boundary(e)) {
BMO_elem_flag_disable(bm, f, HULL_FLAG_HOLE); BMO_face_flag_disable(bm, f, HULL_FLAG_HOLE);
break; break;
} }
} }
@@ -405,14 +408,14 @@ static void hull_tag_holes(BMesh *bm, BMOperator *op)
BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) { BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
any_faces = true; any_faces = true;
if (!BMO_elem_flag_test(bm, f, HULL_FLAG_HOLE)) { if (!BMO_face_flag_test(bm, f, HULL_FLAG_HOLE)) {
hole = false; hole = false;
break; break;
} }
} }
if (hole && any_faces) if (hole && any_faces)
BMO_elem_flag_enable(bm, e, HULL_FLAG_HOLE); BMO_edge_flag_enable(bm, e, HULL_FLAG_HOLE);
} }
} }
@@ -578,11 +581,17 @@ void bmo_convex_hull_exec(BMesh *bm, BMOperator *op)
/* Tag input elements */ /* Tag input elements */
BMO_ITER (ele, &oiter, op->slots_in, "input", BM_ALL) { BMO_ITER (ele, &oiter, op->slots_in, "input", BM_ALL) {
BMO_elem_flag_enable(bm, ele, HULL_FLAG_INPUT);
/* Mark all vertices as interior to begin with */ /* Mark all vertices as interior to begin with */
if (ele->head.htype == BM_VERT) if (ele->head.htype == BM_VERT) {
BMO_elem_flag_enable(bm, ele, HULL_FLAG_INTERIOR_ELE); BMO_vert_flag_enable(bm, (BMVert *)ele, HULL_FLAG_INPUT | HULL_FLAG_INTERIOR_ELE);
}
else if (ele->head.htype == BM_EDGE) {
BMO_edge_flag_enable(bm, (BMEdge *)ele, HULL_FLAG_INPUT);
}
else {
BMO_face_flag_enable(bm, (BMFace *)ele, HULL_FLAG_INPUT);
}
} }
hull_pool = BLI_mempool_create(sizeof(HullTriangle), 0, 128, BLI_MEMPOOL_NOP); hull_pool = BLI_mempool_create(sizeof(HullTriangle), 0, 128, BLI_MEMPOOL_NOP);

View File

@@ -313,7 +313,7 @@ static void bmo_face_inset_individual(
l_iter->next->v, l_iter->next->v,
l_iter->v, l_iter->v,
f, BM_CREATE_NOP); f, BM_CREATE_NOP);
BMO_elem_flag_enable(bm, f_new_outer, ELE_NEW); BMO_face_flag_enable(bm, f_new_outer, ELE_NEW);
/* copy loop data */ /* copy loop data */
l_other = l_iter->radial_next; l_other = l_iter->radial_next;
@@ -1037,7 +1037,7 @@ void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
/* no need to check doubles, we KNOW there won't be any */ /* no need to check doubles, we KNOW there won't be any */
/* yes - reverse face is correct in this case */ /* yes - reverse face is correct in this case */
f = BM_face_create_verts(bm, varr, j, es->l->f, BM_CREATE_NOP, true); f = BM_face_create_verts(bm, varr, j, es->l->f, BM_CREATE_NOP, true);
BMO_elem_flag_enable(bm, f, ELE_NEW); BMO_face_flag_enable(bm, f, ELE_NEW);
/* copy for loop data, otherwise UV's and vcols are no good. /* copy for loop data, otherwise UV's and vcols are no good.
* tiny speedup here we could be more clever and copy from known adjacent data * tiny speedup here we could be more clever and copy from known adjacent data

View File

@@ -315,7 +315,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op)
/* flag all edges of all input face */ /* flag all edges of all input face */
BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) { BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
if (f->len == 3) { if (f->len == 3) {
BMO_elem_flag_enable(bm, f, FACE_INPUT); BMO_face_flag_enable(bm, f, FACE_INPUT);
} }
} }
@@ -323,11 +323,11 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op)
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
BMFace *f_a, *f_b; BMFace *f_a, *f_b;
if (BM_edge_face_pair(e, &f_a, &f_b) && if (BM_edge_face_pair(e, &f_a, &f_b) &&
(BMO_elem_flag_test(bm, f_a, FACE_INPUT) && (BMO_face_flag_test(bm, f_a, FACE_INPUT) &&
BMO_elem_flag_test(bm, f_b, FACE_INPUT))) BMO_face_flag_test(bm, f_b, FACE_INPUT)))
{ {
if (!bm_edge_is_delimit(e, &delimit_data)) { if (!bm_edge_is_delimit(e, &delimit_data)) {
BMO_elem_flag_enable(bm, e, EDGE_MARK); BMO_edge_flag_enable(bm, e, EDGE_MARK);
totedge_tag++; totedge_tag++;
} }
} }
@@ -345,7 +345,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op)
const BMVert *verts[4]; const BMVert *verts[4];
float error; float error;
if (!BMO_elem_flag_test(bm, e, EDGE_MARK)) if (!BMO_edge_flag_test(bm, e, EDGE_MARK))
continue; continue;
bm_edge_to_quad_verts(e, verts); bm_edge_to_quad_verts(e, verts);
@@ -372,7 +372,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op)
BMFace *f_new; BMFace *f_new;
f_new = BM_faces_join_pair(bm, f_a, f_b, e, true); f_new = BM_faces_join_pair(bm, f_a, f_b, e, true);
if (f_new) { if (f_new) {
BMO_elem_flag_enable(bm, f_new, FACE_OUT); BMO_face_flag_enable(bm, f_new, FACE_OUT);
} }
} }
} }

View File

@@ -111,7 +111,7 @@ static int recalc_face_normals_find_index(BMesh *bm, BMFace **faces, const int f
madd_v3_v3fl(cent, f_cent, cent_fac * f_area); madd_v3_v3fl(cent, f_cent, cent_fac * f_area);
cent_area_accum += f_area; cent_area_accum += f_area;
BLI_assert(BMO_elem_flag_test(bm, faces[i], FACE_TEMP) == 0); BLI_assert(BMO_face_flag_test(bm, faces[i], FACE_TEMP) == 0);
BLI_assert(BM_face_is_normal_valid(faces[i])); BLI_assert(BM_face_is_normal_valid(faces[i]));
} }
@@ -209,7 +209,7 @@ static void bmo_recalc_face_normals_array(BMesh *bm, BMFace **faces, const int f
f_start_index = recalc_face_normals_find_index(bm, faces, faces_len, &is_flip); f_start_index = recalc_face_normals_find_index(bm, faces, faces_len, &is_flip);
if (is_flip) { if (is_flip) {
BMO_elem_flag_enable(bm, faces[f_start_index], FACE_FLIP); BMO_face_flag_enable(bm, faces[f_start_index], FACE_FLIP);
} }
/* now that we've found our starting face, make all connected faces /* now that we've found our starting face, make all connected faces
@@ -219,10 +219,10 @@ static void bmo_recalc_face_normals_array(BMesh *bm, BMFace **faces, const int f
BLI_LINKSTACK_INIT(fstack); BLI_LINKSTACK_INIT(fstack);
BLI_LINKSTACK_PUSH(fstack, faces[f_start_index]); BLI_LINKSTACK_PUSH(fstack, faces[f_start_index]);
BMO_elem_flag_enable(bm, faces[f_start_index], FACE_TEMP); BMO_face_flag_enable(bm, faces[f_start_index], FACE_TEMP);
while ((f = BLI_LINKSTACK_POP(fstack))) { while ((f = BLI_LINKSTACK_POP(fstack))) {
const bool flip_state = BMO_elem_flag_test_bool(bm, f, FACE_FLIP); const bool flip_state = BMO_face_flag_test_bool(bm, f, FACE_FLIP);
BMLoop *l_iter, *l_first; BMLoop *l_iter, *l_first;
l_iter = l_first = BM_FACE_FIRST_LOOP(f); l_iter = l_first = BM_FACE_FIRST_LOOP(f);
@@ -230,9 +230,9 @@ static void bmo_recalc_face_normals_array(BMesh *bm, BMFace **faces, const int f
BMLoop *l_other = l_iter->radial_next; BMLoop *l_other = l_iter->radial_next;
if ((l_other != l_iter) && bmo_recalc_normal_loop_filter_cb(l_iter, NULL)) { if ((l_other != l_iter) && bmo_recalc_normal_loop_filter_cb(l_iter, NULL)) {
if (!BMO_elem_flag_test(bm, l_other->f, FACE_TEMP)) { if (!BMO_face_flag_test(bm, l_other->f, FACE_TEMP)) {
BMO_elem_flag_enable(bm, l_other->f, FACE_TEMP); BMO_face_flag_enable(bm, l_other->f, FACE_TEMP);
BMO_elem_flag_set(bm, l_other->f, FACE_FLIP, (l_other->v == l_iter->v) != flip_state); BMO_face_flag_set(bm, l_other->f, FACE_FLIP, (l_other->v == l_iter->v) != flip_state);
BLI_LINKSTACK_PUSH(fstack, l_other->f); BLI_LINKSTACK_PUSH(fstack, l_other->f);
} }
} }
@@ -243,10 +243,10 @@ static void bmo_recalc_face_normals_array(BMesh *bm, BMFace **faces, const int f
/* apply flipping to oflag'd faces */ /* apply flipping to oflag'd faces */
for (i = 0; i < faces_len; i++) { for (i = 0; i < faces_len; i++) {
if (BMO_elem_flag_test(bm, faces[i], oflag_flip) == oflag_flip) { if (BMO_face_flag_test(bm, faces[i], oflag_flip) == oflag_flip) {
BM_face_normal_flip(bm, faces[i]); BM_face_normal_flip(bm, faces[i]);
} }
BMO_elem_flag_disable(bm, faces[i], FACE_TEMP); BMO_face_flag_disable(bm, faces[i], FACE_TEMP);
} }
} }
@@ -284,7 +284,7 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
faces_grp[j] = BM_face_at_index(bm, groups_array[fg_sta + j]); faces_grp[j] = BM_face_at_index(bm, groups_array[fg_sta + j]);
if (is_calc == false) { if (is_calc == false) {
is_calc = BMO_elem_flag_test_bool(bm, faces_grp[j], FACE_FLAG); is_calc = BMO_face_flag_test_bool(bm, faces_grp[j], FACE_FLAG);
} }
} }

View File

@@ -178,7 +178,7 @@ void bmo_offset_edgeloops_exec(BMesh *bm, BMOperator *op)
#ifdef USE_CAP_OPTION #ifdef USE_CAP_OPTION
if (v_edges_num_untag == 1) { if (v_edges_num_untag == 1) {
BMO_elem_flag_enable(bm, v, ELE_VERT_ENDPOINT); BMO_vert_flag_enable(bm, v, ELE_VERT_ENDPOINT);
} }
CLAMP_MIN(v_edges_max, v_edges_num); CLAMP_MIN(v_edges_max, v_edges_num);
@@ -201,7 +201,7 @@ void bmo_offset_edgeloops_exec(BMesh *bm, BMOperator *op)
(BM_elem_index_get(l->prev->v) == -1)) (BM_elem_index_get(l->prev->v) == -1))
{ {
#ifdef USE_CAP_OPTION #ifdef USE_CAP_OPTION
if (use_cap_endpoint || (BMO_elem_flag_test(bm, v, ELE_VERT_ENDPOINT) == 0)) if (use_cap_endpoint || (BMO_vert_flag_test(bm, v, ELE_VERT_ENDPOINT) == 0))
#endif #endif
{ {
BMLoop *l_new; BMLoop *l_new;
@@ -209,7 +209,7 @@ void bmo_offset_edgeloops_exec(BMesh *bm, BMOperator *op)
BLI_assert(f_cmp == l->f); BLI_assert(f_cmp == l->f);
BLI_assert(f_cmp != l_new->f); BLI_assert(f_cmp != l_new->f);
UNUSED_VARS_NDEBUG(f_cmp); UNUSED_VARS_NDEBUG(f_cmp);
BMO_elem_flag_enable(bm, l_new->e, ELE_NEW); BMO_edge_flag_enable(bm, l_new->e, ELE_NEW);
} }
} }
else if (l->f->len > 4) { else if (l->f->len > 4) {
@@ -222,7 +222,7 @@ void bmo_offset_edgeloops_exec(BMesh *bm, BMOperator *op)
BM_face_split(bm, l->f, l->prev->prev, l->next, &l_new, NULL, true); BM_face_split(bm, l->f, l->prev->prev, l->next, &l_new, NULL, true);
BLI_assert(f_cmp == l->f); BLI_assert(f_cmp == l->f);
BLI_assert(f_cmp != l_new->f); BLI_assert(f_cmp != l_new->f);
BMO_elem_flag_enable(bm, l_new->e, ELE_NEW); BMO_edge_flag_enable(bm, l_new->e, ELE_NEW);
BM_elem_flag_disable(l->f, BM_ELEM_TAG); BM_elem_flag_disable(l->f, BM_ELEM_TAG);
} }
else { else {
@@ -230,7 +230,7 @@ void bmo_offset_edgeloops_exec(BMesh *bm, BMOperator *op)
BMLoop *l_new; BMLoop *l_new;
bm_face_split_walk_back(bm, l, &l_new); bm_face_split_walk_back(bm, l, &l_new);
do { do {
BMO_elem_flag_enable(bm, l_new->e, ELE_NEW); BMO_edge_flag_enable(bm, l_new->e, ELE_NEW);
l_new = l_new->next; l_new = l_new->next;
} while (BM_vert_is_edge_pair(l_new->v)); } while (BM_vert_is_edge_pair(l_new->v));
BM_elem_flag_disable(l->f, BM_ELEM_TAG); BM_elem_flag_disable(l->f, BM_ELEM_TAG);

View File

@@ -71,13 +71,13 @@ void bmo_planar_faces_exec(BMesh *bm, BMOperator *op)
l_iter = l_first = BM_FACE_FIRST_LOOP(f); l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do { do {
if (!BMO_elem_flag_test(bm, l_iter->v, ELE_VERT_ADJUST)) { if (!BMO_vert_flag_test(bm, l_iter->v, ELE_VERT_ADJUST)) {
BMO_elem_flag_enable(bm, l_iter->v, ELE_VERT_ADJUST); BMO_vert_flag_enable(bm, l_iter->v, ELE_VERT_ADJUST);
shared_vert_num += 1; shared_vert_num += 1;
} }
} while ((l_iter = l_iter->next) != l_first); } while ((l_iter = l_iter->next) != l_first);
BMO_elem_flag_enable(bm, f, ELE_FACE_ADJUST); BMO_face_flag_enable(bm, f, ELE_FACE_ADJUST);
} }
vert_accum_pool = BLI_mempool_create(sizeof(struct VertAccum), 0, 512, BLI_MEMPOOL_NOP); vert_accum_pool = BLI_mempool_create(sizeof(struct VertAccum), 0, 512, BLI_MEMPOOL_NOP);
@@ -91,10 +91,10 @@ void bmo_planar_faces_exec(BMesh *bm, BMOperator *op)
BMLoop *l_iter, *l_first; BMLoop *l_iter, *l_first;
float plane[4]; float plane[4];
if (!BMO_elem_flag_test(bm, f, ELE_FACE_ADJUST)) { if (!BMO_face_flag_test(bm, f, ELE_FACE_ADJUST)) {
continue; continue;
} }
BMO_elem_flag_disable(bm, f, ELE_FACE_ADJUST); BMO_face_flag_disable(bm, f, ELE_FACE_ADJUST);
BLI_assert(f->len != 3); BLI_assert(f->len != 3);
@@ -130,7 +130,7 @@ void bmo_planar_faces_exec(BMesh *bm, BMOperator *op)
BMIter iter; BMIter iter;
if (len_squared_v3v3(v->co, va->co) > eps_sq) { if (len_squared_v3v3(v->co, va->co) > eps_sq) {
BMO_elem_flag_enable(bm, v, ELE_VERT_ADJUST); BMO_vert_flag_enable(bm, v, ELE_VERT_ADJUST);
interp_v3_v3v3(v->co, v->co, va->co, fac); interp_v3_v3v3(v->co, v->co, va->co, fac);
changed = true; changed = true;
} }
@@ -138,7 +138,7 @@ void bmo_planar_faces_exec(BMesh *bm, BMOperator *op)
/* tag for re-calculation */ /* tag for re-calculation */
BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) { BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) {
if (f->len != 3) { if (f->len != 3) {
BMO_elem_flag_enable(bm, f, ELE_FACE_ADJUST); BMO_face_flag_enable(bm, f, ELE_FACE_ADJUST);
} }
} }
} }

View File

@@ -87,7 +87,7 @@ void bmo_poke_exec(BMesh *bm, BMOperator *op)
bm_face_calc_center_fn(f, f_center); bm_face_calc_center_fn(f, f_center);
v_center = BM_vert_create(bm, f_center, NULL, BM_CREATE_NOP); v_center = BM_vert_create(bm, f_center, NULL, BM_CREATE_NOP);
BMO_elem_flag_enable(bm, v_center, ELE_NEW); BMO_vert_flag_enable(bm, v_center, ELE_NEW);
if (cd_loop_mdisp_offset != -1) { if (cd_loop_mdisp_offset != -1) {
if (center_mode == BMOP_POKE_MEAN) { if (center_mode == BMOP_POKE_MEAN) {
@@ -128,7 +128,7 @@ void bmo_poke_exec(BMesh *bm, BMOperator *op)
BM_elem_attrs_copy(bm, bm, l_iter, l_new); BM_elem_attrs_copy(bm, bm, l_iter, l_new);
BM_elem_attrs_copy(bm, bm, l_iter->next, l_new->next); BM_elem_attrs_copy(bm, bm, l_iter->next, l_new->next);
BMO_elem_flag_enable(bm, f_new, ELE_NEW); BMO_face_flag_enable(bm, f_new, ELE_NEW);
if (cd_loop_mdisp_offset != -1) { if (cd_loop_mdisp_offset != -1) {
float f_new_center[3]; float f_new_center[3];

View File

@@ -259,7 +259,7 @@ void bmo_create_grid_exec(BMesh *bm, BMOperator *op)
vec[0] = ((x * xtot_inv2) - 1.0f) * dia; vec[0] = ((x * xtot_inv2) - 1.0f) * dia;
mul_v3_m4v3(tvec, mat, vec); mul_v3_m4v3(tvec, mat, vec);
varr[i] = BM_vert_create(bm, tvec, NULL, BM_CREATE_NOP); varr[i] = BM_vert_create(bm, tvec, NULL, BM_CREATE_NOP);
BMO_elem_flag_enable(bm, varr[i], VERT_MARK); BMO_vert_flag_enable(bm, varr[i], VERT_MARK);
i++; i++;
} }
} }
@@ -277,7 +277,7 @@ void bmo_create_grid_exec(BMesh *bm, BMOperator *op)
f = BM_face_create_verts(bm, vquad, 4, NULL, BM_CREATE_NOP, true); f = BM_face_create_verts(bm, vquad, 4, NULL, BM_CREATE_NOP, true);
if (calc_uvs) { if (calc_uvs) {
BMO_elem_flag_enable(bm, f, FACE_MARK); BMO_face_flag_enable(bm, f, FACE_MARK);
} }
} }
} }
@@ -315,7 +315,7 @@ void BM_mesh_calc_uvs_grid(BMesh *bm, const unsigned int x_segments, const unsig
BLI_assert(cd_loop_uv_offset != -1); BLI_assert(cd_loop_uv_offset != -1);
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
if (!BMO_elem_flag_test(bm, f, oflag)) if (!BMO_face_flag_test(bm, f, oflag))
continue; continue;
BM_ITER_ELEM_INDEX (l, &liter, f, BM_LOOPS_OF_FACE, loop_index) { BM_ITER_ELEM_INDEX (l, &liter, f, BM_LOOPS_OF_FACE, loop_index) {
@@ -380,11 +380,11 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
vec[1] = dia * sinf(phi); vec[1] = dia * sinf(phi);
vec[2] = dia * cosf(phi); vec[2] = dia * cosf(phi);
eve = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); eve = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
BMO_elem_flag_enable(bm, eve, VERT_MARK); BMO_vert_flag_enable(bm, eve, VERT_MARK);
if (a != 0) { if (a != 0) {
e = BM_edge_create(bm, preveve, eve, NULL, BM_CREATE_NOP); e = BM_edge_create(bm, preveve, eve, NULL, BM_CREATE_NOP);
BMO_elem_flag_enable(bm, e, EDGE_ORIG); BMO_edge_flag_enable(bm, e, EDGE_ORIG);
} }
phi += phid; phi += phid;
@@ -442,14 +442,14 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
bool valid = true; bool valid = true;
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
if (!BMO_elem_flag_test(bm, l->v, VERT_MARK)) { if (!BMO_vert_flag_test(bm, l->v, VERT_MARK)) {
valid = false; valid = false;
break; break;
} }
} }
if (valid) { if (valid) {
BMO_elem_flag_enable(bm, f, FACE_MARK); BMO_face_flag_enable(bm, f, FACE_MARK);
} }
} }
@@ -458,7 +458,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
/* and now do imat */ /* and now do imat */
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
if (BMO_elem_flag_test(bm, eve, VERT_MARK)) { if (BMO_vert_flag_test(bm, eve, VERT_MARK)) {
mul_m4_v3(mat, eve->co); mul_m4_v3(mat, eve->co);
} }
} }
@@ -493,7 +493,7 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
vec[2] = dia_div * icovert[a][2]; vec[2] = dia_div * icovert[a][2];
eva[a] = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); eva[a] = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
BMO_elem_flag_enable(bm, eva[a], VERT_MARK); BMO_vert_flag_enable(bm, eva[a], VERT_MARK);
} }
for (a = 0; a < 20; a++) { for (a = 0; a < 20; a++) {
@@ -507,10 +507,10 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
eftemp = BM_face_create_quad_tri(bm, v1, v2, v3, NULL, NULL, BM_CREATE_NOP); eftemp = BM_face_create_quad_tri(bm, v1, v2, v3, NULL, NULL, BM_CREATE_NOP);
BM_ITER_ELEM (l, &liter, eftemp, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l, &liter, eftemp, BM_LOOPS_OF_FACE) {
BMO_elem_flag_enable(bm, l->e, EDGE_MARK); BMO_edge_flag_enable(bm, l->e, EDGE_MARK);
} }
BMO_elem_flag_enable(bm, eftemp, FACE_MARK); BMO_face_flag_enable(bm, eftemp, FACE_MARK);
} }
if (subdiv > 1) { if (subdiv > 1) {
@@ -540,14 +540,14 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
bool valid = true; bool valid = true;
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
if (!BMO_elem_flag_test(bm, l->v, VERT_MARK)) { if (!BMO_vert_flag_test(bm, l->v, VERT_MARK)) {
valid = false; valid = false;
break; break;
} }
} }
if (valid) { if (valid) {
BMO_elem_flag_enable(bm, f, FACE_MARK); BMO_face_flag_enable(bm, f, FACE_MARK);
} }
} }
@@ -556,7 +556,7 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
/* must transform after because of sphere subdivision */ /* must transform after because of sphere subdivision */
BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
if (BMO_elem_flag_test(bm, v, VERT_MARK)) { if (BMO_vert_flag_test(bm, v, VERT_MARK)) {
mul_m4_v3(mat, v->co); mul_m4_v3(mat, v->co);
} }
} }
@@ -626,7 +626,7 @@ void BM_mesh_calc_uvs_sphere(BMesh *bm, const short oflag)
BLI_assert(cd_loop_uv_offset != -1); /* caller is responsible for giving us UVs */ BLI_assert(cd_loop_uv_offset != -1); /* caller is responsible for giving us UVs */
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
if (!BMO_elem_flag_test(bm, f, oflag)) if (!BMO_face_flag_test(bm, f, oflag))
continue; continue;
bm_mesh_calc_uvs_sphere_face(f, mat_rot, cd_loop_uv_offset); bm_mesh_calc_uvs_sphere_face(f, mat_rot, cd_loop_uv_offset);
@@ -650,7 +650,7 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
v[1] = monkeyv[i][2] / -128.0; v[1] = monkeyv[i][2] / -128.0;
tv[i] = BM_vert_create(bm, v, NULL, BM_CREATE_NOP); tv[i] = BM_vert_create(bm, v, NULL, BM_CREATE_NOP);
BMO_elem_flag_enable(bm, tv[i], VERT_MARK); BMO_vert_flag_enable(bm, tv[i], VERT_MARK);
if (fabsf(v[0] = -v[0]) < 0.001f) { if (fabsf(v[0] = -v[0]) < 0.001f) {
tv[monkeynv + i] = tv[i]; tv[monkeynv + i] = tv[i];
@@ -661,7 +661,7 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
tv[monkeynv + i] = eve; tv[monkeynv + i] = eve;
} }
BMO_elem_flag_enable(bm, tv[monkeynv + i], VERT_MARK); BMO_vert_flag_enable(bm, tv[monkeynv + i], VERT_MARK);
mul_m4_v3(mat, tv[i]->co); mul_m4_v3(mat, tv[i]->co);
} }
@@ -713,7 +713,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
mul_m4_v3(mat, vec); mul_m4_v3(mat, vec);
cent1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); cent1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
BMO_elem_flag_enable(bm, cent1, VERT_MARK); BMO_vert_flag_enable(bm, cent1, VERT_MARK);
} }
for (a = 0; a < segs; a++, phi += phid) { for (a = 0; a < segs; a++, phi += phid) {
@@ -724,7 +724,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
mul_m4_v3(mat, vec); mul_m4_v3(mat, vec);
v1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); v1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
BMO_elem_flag_enable(bm, v1, VERT_MARK); BMO_vert_flag_enable(bm, v1, VERT_MARK);
if (lastv1) if (lastv1)
BM_edge_create(bm, v1, lastv1, NULL, BM_CREATE_NOP); BM_edge_create(bm, v1, lastv1, NULL, BM_CREATE_NOP);
@@ -733,7 +733,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
BMFace *f; BMFace *f;
f = BM_face_create_quad_tri(bm, cent1, lastv1, v1, NULL, NULL, BM_CREATE_NOP); f = BM_face_create_quad_tri(bm, cent1, lastv1, v1, NULL, NULL, BM_CREATE_NOP);
BMO_elem_flag_enable(bm, f, FACE_NEW); BMO_face_flag_enable(bm, f, FACE_NEW);
} }
if (!firstv1) if (!firstv1)
@@ -751,7 +751,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
BMFace *f; BMFace *f;
f = BM_face_create_quad_tri(bm, cent1, v1, firstv1, NULL, NULL, BM_CREATE_NOP); f = BM_face_create_quad_tri(bm, cent1, v1, firstv1, NULL, NULL, BM_CREATE_NOP);
BMO_elem_flag_enable(bm, f, FACE_NEW); BMO_face_flag_enable(bm, f, FACE_NEW);
if (calc_uvs) { if (calc_uvs) {
BM_mesh_calc_uvs_circle(bm, mat, dia, FACE_NEW); BM_mesh_calc_uvs_circle(bm, mat, dia, FACE_NEW);
@@ -791,7 +791,7 @@ void BM_mesh_calc_uvs_circle(BMesh *bm, float mat[4][4], const float radius, con
invert_m4_m4(inv_mat, mat); invert_m4_m4(inv_mat, mat);
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
if (!BMO_elem_flag_test(bm, f, oflag)) if (!BMO_face_flag_test(bm, f, oflag))
continue; continue;
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
@@ -845,8 +845,8 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
cent2 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); cent2 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
BMO_elem_flag_enable(bm, cent1, VERT_MARK); BMO_vert_flag_enable(bm, cent1, VERT_MARK);
BMO_elem_flag_enable(bm, cent2, VERT_MARK); BMO_vert_flag_enable(bm, cent2, VERT_MARK);
} }
for (a = 0; a < segs; a++, phi += phid) { for (a = 0; a < segs; a++, phi += phid) {
@@ -862,27 +862,27 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
mul_m4_v3(mat, vec); mul_m4_v3(mat, vec);
v2 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); v2 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
BMO_elem_flag_enable(bm, v1, VERT_MARK); BMO_vert_flag_enable(bm, v1, VERT_MARK);
BMO_elem_flag_enable(bm, v2, VERT_MARK); BMO_vert_flag_enable(bm, v2, VERT_MARK);
if (a) { if (a) {
if (cap_ends) { if (cap_ends) {
f = BM_face_create_quad_tri(bm, cent1, lastv1, v1, NULL, NULL, BM_CREATE_NOP); f = BM_face_create_quad_tri(bm, cent1, lastv1, v1, NULL, NULL, BM_CREATE_NOP);
if (calc_uvs) { if (calc_uvs) {
BMO_elem_flag_enable(bm, f, FACE_MARK); BMO_face_flag_enable(bm, f, FACE_MARK);
} }
BMO_elem_flag_enable(bm, f, FACE_NEW); BMO_face_flag_enable(bm, f, FACE_NEW);
f = BM_face_create_quad_tri(bm, cent2, v2, lastv2, NULL, NULL, BM_CREATE_NOP); f = BM_face_create_quad_tri(bm, cent2, v2, lastv2, NULL, NULL, BM_CREATE_NOP);
if (calc_uvs) { if (calc_uvs) {
BMO_elem_flag_enable(bm, f, FACE_MARK); BMO_face_flag_enable(bm, f, FACE_MARK);
} }
BMO_elem_flag_enable(bm, f, FACE_NEW); BMO_face_flag_enable(bm, f, FACE_NEW);
} }
f = BM_face_create_quad_tri(bm, lastv1, lastv2, v2, v1, NULL, BM_CREATE_NOP); f = BM_face_create_quad_tri(bm, lastv1, lastv2, v2, v1, NULL, BM_CREATE_NOP);
if (calc_uvs) { if (calc_uvs) {
BMO_elem_flag_enable(bm, f, FACE_MARK); BMO_face_flag_enable(bm, f, FACE_MARK);
} }
} }
else { else {
@@ -900,20 +900,20 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
if (cap_ends) { if (cap_ends) {
f = BM_face_create_quad_tri(bm, cent1, v1, firstv1, NULL, NULL, BM_CREATE_NOP); f = BM_face_create_quad_tri(bm, cent1, v1, firstv1, NULL, NULL, BM_CREATE_NOP);
if (calc_uvs) { if (calc_uvs) {
BMO_elem_flag_enable(bm, f, FACE_MARK); BMO_face_flag_enable(bm, f, FACE_MARK);
} }
BMO_elem_flag_enable(bm, f, FACE_NEW); BMO_face_flag_enable(bm, f, FACE_NEW);
f = BM_face_create_quad_tri(bm, cent2, firstv2, v2, NULL, NULL, BM_CREATE_NOP); f = BM_face_create_quad_tri(bm, cent2, firstv2, v2, NULL, NULL, BM_CREATE_NOP);
if (calc_uvs) { if (calc_uvs) {
BMO_elem_flag_enable(bm, f, FACE_MARK); BMO_face_flag_enable(bm, f, FACE_MARK);
} }
BMO_elem_flag_enable(bm, f, FACE_NEW); BMO_face_flag_enable(bm, f, FACE_NEW);
} }
f = BM_face_create_quad_tri(bm, v1, v2, firstv2, firstv1, NULL, BM_CREATE_NOP); f = BM_face_create_quad_tri(bm, v1, v2, firstv2, firstv1, NULL, BM_CREATE_NOP);
if (calc_uvs) { if (calc_uvs) {
BMO_elem_flag_enable(bm, f, FACE_MARK); BMO_face_flag_enable(bm, f, FACE_MARK);
} }
if (calc_uvs) { if (calc_uvs) {
@@ -981,7 +981,7 @@ void BM_mesh_calc_uvs_cone(
y = 1.0f - uv_height; y = 1.0f - uv_height;
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
if (!BMO_elem_flag_test(bm, f, oflag)) if (!BMO_face_flag_test(bm, f, oflag))
continue; continue;
if (f->len == 4 && radius_top && radius_bottom) { if (f->len == 4 && radius_top && radius_bottom) {
@@ -1063,7 +1063,7 @@ void bmo_create_cube_exec(BMesh *bm, BMOperator *op)
float vec[3] = {(float)x * off, (float)y * off, (float)z * off}; float vec[3] = {(float)x * off, (float)y * off, (float)z * off};
mul_m4_v3(mat, vec); mul_m4_v3(mat, vec);
verts[i] = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); verts[i] = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
BMO_elem_flag_enable(bm, verts[i], VERT_MARK); BMO_vert_flag_enable(bm, verts[i], VERT_MARK);
i++; i++;
} }
} }
@@ -1080,7 +1080,7 @@ void bmo_create_cube_exec(BMesh *bm, BMOperator *op)
f = BM_face_create_verts(bm, quad, 4, NULL, BM_CREATE_NOP, true); f = BM_face_create_verts(bm, quad, 4, NULL, BM_CREATE_NOP, true);
if (calc_uvs) { if (calc_uvs) {
BMO_elem_flag_enable(bm, f, FACE_MARK); BMO_face_flag_enable(bm, f, FACE_MARK);
} }
} }
@@ -1117,7 +1117,7 @@ void BM_mesh_calc_uvs_cube(BMesh *bm, const short oflag)
BLI_assert(cd_loop_uv_offset != -1); /* the caller can ensure that we have UVs */ BLI_assert(cd_loop_uv_offset != -1); /* the caller can ensure that we have UVs */
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
if (!BMO_elem_flag_test(bm, f, oflag)) { if (!BMO_face_flag_test(bm, f, oflag)) {
continue; continue;
} }

View File

@@ -98,7 +98,7 @@ static BMFace *remdoubles_createface(BMesh *bm, BMFace *f, BMOpSlot *slot_target
{ {
#define LOOP_MAP_VERT_INIT(l_init, v_map, is_del) \ #define LOOP_MAP_VERT_INIT(l_init, v_map, is_del) \
v_map = l_init->v; \ v_map = l_init->v; \
is_del = BMO_elem_flag_test_bool(bm, v_map, ELE_DEL); \ is_del = BMO_vert_flag_test_bool(bm, v_map, ELE_DEL); \
if (is_del) { \ if (is_del) { \
v_map = BMO_slot_map_elem_get(slot_targetmap, v_map); \ v_map = BMO_slot_map_elem_get(slot_targetmap, v_map); \
} ((void)0) } ((void)0)
@@ -131,12 +131,12 @@ static BMFace *remdoubles_createface(BMesh *bm, BMFace *f, BMOpSlot *slot_target
} }
if (e_new) { if (e_new) {
if (UNLIKELY(BMO_elem_flag_test(bm, v_curr, VERT_IN_FACE))) { if (UNLIKELY(BMO_vert_flag_test(bm, v_curr, VERT_IN_FACE))) {
/* we can't make the face, bail out */ /* we can't make the face, bail out */
STACK_CLEAR(edges); STACK_CLEAR(edges);
goto finally; goto finally;
} }
BMO_elem_flag_enable(bm, v_curr, VERT_IN_FACE); BMO_vert_flag_enable(bm, v_curr, VERT_IN_FACE);
STACK_PUSH(edges, e_new); STACK_PUSH(edges, e_new);
STACK_PUSH(loops, l_curr); STACK_PUSH(loops, l_curr);
@@ -155,7 +155,7 @@ finally:
{ {
unsigned int i; unsigned int i;
for (i = 0; i < STACK_SIZE(verts); i++) { for (i = 0; i < STACK_SIZE(verts); i++) {
BMO_elem_flag_disable(bm, verts[i], VERT_IN_FACE); BMO_vert_flag_disable(bm, verts[i], VERT_IN_FACE);
} }
} }
@@ -198,7 +198,7 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
/* mark merge verts for deletion */ /* mark merge verts for deletion */
BM_ITER_MESH (v1, &iter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (v1, &iter, bm, BM_VERTS_OF_MESH) {
if ((v2 = BMO_slot_map_elem_get(slot_targetmap, v1))) { if ((v2 = BMO_slot_map_elem_get(slot_targetmap, v1))) {
BMO_elem_flag_enable(bm, v1, ELE_DEL); BMO_vert_flag_enable(bm, v1, ELE_DEL);
/* merge the vertex flags, else we get randomly selected/unselected verts */ /* merge the vertex flags, else we get randomly selected/unselected verts */
BM_elem_flag_merge(v1, v2); BM_elem_flag_merge(v1, v2);
@@ -212,8 +212,8 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
} }
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
const bool is_del_v1 = BMO_elem_flag_test_bool(bm, (v1 = e->v1), ELE_DEL); const bool is_del_v1 = BMO_vert_flag_test_bool(bm, (v1 = e->v1), ELE_DEL);
const bool is_del_v2 = BMO_elem_flag_test_bool(bm, (v2 = e->v2), ELE_DEL); const bool is_del_v2 = BMO_vert_flag_test_bool(bm, (v2 = e->v2), ELE_DEL);
if (is_del_v1 || is_del_v2) { if (is_del_v1 || is_del_v2) {
if (is_del_v1) if (is_del_v1)
@@ -222,7 +222,7 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
v2 = BMO_slot_map_elem_get(slot_targetmap, v2); v2 = BMO_slot_map_elem_get(slot_targetmap, v2);
if (v1 == v2) { if (v1 == v2) {
BMO_elem_flag_enable(bm, e, EDGE_COL); BMO_edge_flag_enable(bm, e, EDGE_COL);
} }
else { else {
/* always merge flags, even for edges we already created */ /* always merge flags, even for edges we already created */
@@ -233,7 +233,7 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
BM_elem_flag_merge(e_new, e); BM_elem_flag_merge(e_new, e);
} }
BMO_elem_flag_enable(bm, e, ELE_DEL); BMO_edge_flag_enable(bm, e, ELE_DEL);
} }
} }
@@ -244,16 +244,16 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
int edge_collapse = 0; int edge_collapse = 0;
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
if (BMO_elem_flag_test(bm, l->v, ELE_DEL)) { if (BMO_vert_flag_test(bm, l->v, ELE_DEL)) {
vert_delete = true; vert_delete = true;
} }
if (BMO_elem_flag_test(bm, l->e, EDGE_COL)) { if (BMO_edge_flag_test(bm, l->e, EDGE_COL)) {
edge_collapse++; edge_collapse++;
} }
} }
if (vert_delete) { if (vert_delete) {
BMO_elem_flag_enable(bm, f, ELE_DEL); BMO_face_flag_enable(bm, f, ELE_DEL);
if (f->len - edge_collapse >= 3) { if (f->len - edge_collapse >= 3) {
BMFace *f_new = remdoubles_createface(bm, f, slot_targetmap); BMFace *f_new = remdoubles_createface(bm, f, slot_targetmap);
@@ -261,8 +261,12 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
/* do this so we don't need to return a list of created faces */ /* do this so we don't need to return a list of created faces */
if (f_new) { if (f_new) {
bmesh_face_swap_data(f_new, f); bmesh_face_swap_data(f_new, f);
SWAP(BMFlagLayer *, f->oflags, f_new->oflags);
BMO_elem_flag_disable(bm, f, ELE_DEL); if (bm->use_toolflags) {
SWAP(BMFlagLayer *, ((BMFace_OFlag *)f)->oflags, ((BMFace_OFlag *)f_new)->oflags);
}
BMO_face_flag_disable(bm, f, ELE_DEL);
BM_face_kill(bm, f_new); BM_face_kill(bm, f_new);
} }
@@ -439,7 +443,7 @@ void bmo_collapse_exec(BMesh *bm, BMOperator *op)
float min[3], max[3], center[3]; float min[3], max[3], center[3];
BMVert *v_tar; BMVert *v_tar;
if (!BMO_elem_flag_test(bm, e, EDGE_MARK)) if (!BMO_edge_flag_test(bm, e, EDGE_MARK))
continue; continue;
BLI_assert(BLI_stack_is_empty(edge_stack)); BLI_assert(BLI_stack_is_empty(edge_stack));
@@ -510,7 +514,7 @@ static void bmo_collapsecon_do_layer(BMesh *bm, const int layer, const short ofl
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
if (BMO_elem_flag_test(bm, l->e, oflag)) { if (BMO_edge_flag_test(bm, l->e, oflag)) {
/* walk */ /* walk */
BLI_assert(BLI_stack_is_empty(block_stack)); BLI_assert(BLI_stack_is_empty(block_stack));
@@ -606,7 +610,7 @@ static void bmesh_find_doubles_common(
for (i = 0; i < verts_len; i++) { for (i = 0; i < verts_len; i++) {
BMVert *v_check = verts[i]; BMVert *v_check = verts[i];
if (BMO_elem_flag_test(bm, v_check, VERT_DOUBLE | VERT_TARGET)) { if (BMO_vert_flag_test(bm, v_check, VERT_DOUBLE | VERT_TARGET)) {
continue; continue;
} }
@@ -614,7 +618,7 @@ static void bmesh_find_doubles_common(
BMVert *v_other = verts[j]; BMVert *v_other = verts[j];
/* a match has already been found, (we could check which is best, for now don't) */ /* a match has already been found, (we could check which is best, for now don't) */
if (BMO_elem_flag_test(bm, v_other, VERT_DOUBLE | VERT_TARGET)) { if (BMO_vert_flag_test(bm, v_other, VERT_DOUBLE | VERT_TARGET)) {
continue; continue;
} }
@@ -628,19 +632,19 @@ static void bmesh_find_doubles_common(
} }
if (keepvert) { if (keepvert) {
if (BMO_elem_flag_test(bm, v_other, VERT_KEEP) == BMO_elem_flag_test(bm, v_check, VERT_KEEP)) if (BMO_vert_flag_test(bm, v_other, VERT_KEEP) == BMO_vert_flag_test(bm, v_check, VERT_KEEP))
continue; continue;
} }
if (compare_len_squared_v3v3(v_check->co, v_other->co, dist_sq)) { if (compare_len_squared_v3v3(v_check->co, v_other->co, dist_sq)) {
/* If one vert is marked as keep, make sure it will be the target */ /* If one vert is marked as keep, make sure it will be the target */
if (BMO_elem_flag_test(bm, v_other, VERT_KEEP)) { if (BMO_vert_flag_test(bm, v_other, VERT_KEEP)) {
SWAP(BMVert *, v_check, v_other); SWAP(BMVert *, v_check, v_other);
} }
BMO_elem_flag_enable(bm, v_other, VERT_DOUBLE); BMO_vert_flag_enable(bm, v_other, VERT_DOUBLE);
BMO_elem_flag_enable(bm, v_check, VERT_TARGET); BMO_vert_flag_enable(bm, v_check, VERT_TARGET);
BMO_slot_map_elem_insert(optarget, optarget_slot, v_other, v_check); BMO_slot_map_elem_insert(optarget, optarget_slot, v_other, v_check);
} }
@@ -683,8 +687,8 @@ void bmo_automerge_exec(BMesh *bm, BMOperator *op)
* as VERT_KEEP. */ * as VERT_KEEP. */
BMO_slot_buffer_flag_enable(bm, op->slots_in, "verts", BM_VERT, VERT_IN); BMO_slot_buffer_flag_enable(bm, op->slots_in, "verts", BM_VERT, VERT_IN);
BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
if (!BMO_elem_flag_test(bm, v, VERT_IN)) { if (!BMO_vert_flag_test(bm, v, VERT_IN)) {
BMO_elem_flag_enable(bm, v, VERT_KEEP); BMO_vert_flag_enable(bm, v, VERT_KEEP);
} }
} }

View File

@@ -121,8 +121,8 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
* and n is the total number of faces * and n is the total number of faces
*/ */
BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) { BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
if (!BMO_elem_flag_test(bm, fs, FACE_MARK)) { /* is this really needed ? */ if (!BMO_face_flag_test(bm, fs, FACE_MARK)) { /* is this really needed ? */
BMO_elem_flag_enable(bm, fs, FACE_MARK); BMO_face_flag_enable(bm, fs, FACE_MARK);
num_sels++; num_sels++;
} }
} }
@@ -134,7 +134,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
/* loop through all the faces and fill the faces/indices structure */ /* loop through all the faces and fill the faces/indices structure */
BM_ITER_MESH (fm, &fm_iter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (fm, &fm_iter, bm, BM_FACES_OF_MESH) {
f_ext[i].f = fm; f_ext[i].f = fm;
if (BMO_elem_flag_test(bm, fm, FACE_MARK)) { if (BMO_face_flag_test(bm, fm, FACE_MARK)) {
indices[idx] = i; indices[idx] = i;
idx++; idx++;
} }
@@ -179,21 +179,21 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
/* now select the rest (if any) */ /* now select the rest (if any) */
for (i = 0; i < num_total; i++) { for (i = 0; i < num_total; i++) {
fm = f_ext[i].f; fm = f_ext[i].f;
if (!BMO_elem_flag_test(bm, fm, FACE_MARK) && !BM_elem_flag_test(fm, BM_ELEM_HIDDEN)) { if (!BMO_face_flag_test(bm, fm, FACE_MARK) && !BM_elem_flag_test(fm, BM_ELEM_HIDDEN)) {
bool cont = true; bool cont = true;
for (idx = 0; idx < num_sels && cont == true; idx++) { for (idx = 0; idx < num_sels && cont == true; idx++) {
fs = f_ext[indices[idx]].f; fs = f_ext[indices[idx]].f;
switch (type) { switch (type) {
case SIMFACE_MATERIAL: case SIMFACE_MATERIAL:
if (fm->mat_nr == fs->mat_nr) { if (fm->mat_nr == fs->mat_nr) {
BMO_elem_flag_enable(bm, fm, FACE_MARK); BMO_face_flag_enable(bm, fm, FACE_MARK);
cont = false; cont = false;
} }
break; break;
case SIMFACE_IMAGE: case SIMFACE_IMAGE:
if (f_ext[i].t == f_ext[indices[idx]].t) { if (f_ext[i].t == f_ext[indices[idx]].t) {
BMO_elem_flag_enable(bm, fm, FACE_MARK); BMO_face_flag_enable(bm, fm, FACE_MARK);
cont = false; cont = false;
} }
break; break;
@@ -201,7 +201,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
case SIMFACE_NORMAL: case SIMFACE_NORMAL:
angle = angle_normalized_v3v3(fs->no, fm->no); /* if the angle between the normals -> 0 */ angle = angle_normalized_v3v3(fs->no, fm->no); /* if the angle between the normals -> 0 */
if (angle <= thresh_radians) { if (angle <= thresh_radians) {
BMO_elem_flag_enable(bm, fm, FACE_MARK); BMO_face_flag_enable(bm, fm, FACE_MARK);
cont = false; cont = false;
} }
break; break;
@@ -218,7 +218,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
if (angle <= thresh_radians) { /* and dot product difference -> 0 */ if (angle <= thresh_radians) { /* and dot product difference -> 0 */
delta_fl = f_ext[i].d - (f_ext[indices[idx]].d * sign); delta_fl = f_ext[i].d - (f_ext[indices[idx]].d * sign);
if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) { if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
BMO_elem_flag_enable(bm, fm, FACE_MARK); BMO_face_flag_enable(bm, fm, FACE_MARK);
cont = false; cont = false;
} }
} }
@@ -227,7 +227,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
case SIMFACE_AREA: case SIMFACE_AREA:
delta_fl = f_ext[i].area - f_ext[indices[idx]].area; delta_fl = f_ext[i].area - f_ext[indices[idx]].area;
if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) { if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
BMO_elem_flag_enable(bm, fm, FACE_MARK); BMO_face_flag_enable(bm, fm, FACE_MARK);
cont = false; cont = false;
} }
break; break;
@@ -235,7 +235,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
case SIMFACE_SIDES: case SIMFACE_SIDES:
delta_i = fm->len - fs->len; delta_i = fm->len - fs->len;
if (bm_sel_similar_cmp_i(delta_i, compare)) { if (bm_sel_similar_cmp_i(delta_i, compare)) {
BMO_elem_flag_enable(bm, fm, FACE_MARK); BMO_face_flag_enable(bm, fm, FACE_MARK);
cont = false; cont = false;
} }
break; break;
@@ -243,14 +243,14 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
case SIMFACE_PERIMETER: case SIMFACE_PERIMETER:
delta_fl = f_ext[i].perim - f_ext[indices[idx]].perim; delta_fl = f_ext[i].perim - f_ext[indices[idx]].perim;
if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) { if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
BMO_elem_flag_enable(bm, fm, FACE_MARK); BMO_face_flag_enable(bm, fm, FACE_MARK);
cont = false; cont = false;
} }
break; break;
case SIMFACE_SMOOTH: case SIMFACE_SMOOTH:
if (BM_elem_flag_test(fm, BM_ELEM_SMOOTH) == BM_elem_flag_test(fs, BM_ELEM_SMOOTH)) { if (BM_elem_flag_test(fm, BM_ELEM_SMOOTH) == BM_elem_flag_test(fs, BM_ELEM_SMOOTH)) {
BMO_elem_flag_enable(bm, fm, FACE_MARK); BMO_face_flag_enable(bm, fm, FACE_MARK);
cont = false; cont = false;
} }
break; break;
@@ -263,7 +263,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
ffa2 = CustomData_bmesh_get(&bm->pdata, fm->head.data, CD_FREESTYLE_FACE); ffa2 = CustomData_bmesh_get(&bm->pdata, fm->head.data, CD_FREESTYLE_FACE);
if (ffa1 && ffa2 && (ffa1->flag & FREESTYLE_FACE_MARK) == (ffa2->flag & FREESTYLE_FACE_MARK)) { if (ffa1 && ffa2 && (ffa1->flag & FREESTYLE_FACE_MARK) == (ffa2->flag & FREESTYLE_FACE_MARK)) {
BMO_elem_flag_enable(bm, fm, FACE_MARK); BMO_face_flag_enable(bm, fm, FACE_MARK);
cont = false; cont = false;
} }
} }
@@ -350,7 +350,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
/* iterate through all selected edges and mark them */ /* iterate through all selected edges and mark them */
BMO_ITER (es, &es_iter, op->slots_in, "edges", BM_EDGE) { BMO_ITER (es, &es_iter, op->slots_in, "edges", BM_EDGE) {
BMO_elem_flag_enable(bm, es, EDGE_MARK); BMO_edge_flag_enable(bm, es, EDGE_MARK);
num_sels++; num_sels++;
} }
@@ -361,7 +361,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
/* loop through all the edges and fill the edges/indices structure */ /* loop through all the edges and fill the edges/indices structure */
BM_ITER_MESH (e, &e_iter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (e, &e_iter, bm, BM_EDGES_OF_MESH) {
e_ext[i].e = e; e_ext[i].e = e;
if (BMO_elem_flag_test(bm, e, EDGE_MARK)) { if (BMO_edge_flag_test(bm, e, EDGE_MARK)) {
indices[idx] = i; indices[idx] = i;
idx++; idx++;
} }
@@ -397,7 +397,9 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
/* select the edges if any */ /* select the edges if any */
for (i = 0; i < num_total; i++) { for (i = 0; i < num_total; i++) {
e = e_ext[i].e; e = e_ext[i].e;
if (!BMO_elem_flag_test(bm, e, EDGE_MARK) && !BM_elem_flag_test(e, BM_ELEM_HIDDEN)) { if (!BMO_edge_flag_test(bm, e, EDGE_MARK) &&
!BM_elem_flag_test(e, BM_ELEM_HIDDEN))
{
bool cont = true; bool cont = true;
for (idx = 0; idx < num_sels && cont == true; idx++) { for (idx = 0; idx < num_sels && cont == true; idx++) {
es = e_ext[indices[idx]].e; es = e_ext[indices[idx]].e;
@@ -405,7 +407,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
case SIMEDGE_LENGTH: case SIMEDGE_LENGTH:
delta_fl = e_ext[i].length - e_ext[indices[idx]].length; delta_fl = e_ext[i].length - e_ext[indices[idx]].length;
if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) { if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
BMO_elem_flag_enable(bm, e, EDGE_MARK); BMO_edge_flag_enable(bm, e, EDGE_MARK);
cont = false; cont = false;
} }
break; break;
@@ -418,7 +420,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
angle = fabsf(angle - (float)M_PI); angle = fabsf(angle - (float)M_PI);
if (angle / (float)M_PI_2 <= thresh) { if (angle / (float)M_PI_2 <= thresh) {
BMO_elem_flag_enable(bm, e, EDGE_MARK); BMO_edge_flag_enable(bm, e, EDGE_MARK);
cont = false; cont = false;
} }
break; break;
@@ -426,7 +428,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
case SIMEDGE_FACE: case SIMEDGE_FACE:
delta_i = e_ext[i].faces - e_ext[indices[idx]].faces; delta_i = e_ext[i].faces - e_ext[indices[idx]].faces;
if (bm_sel_similar_cmp_i(delta_i, compare)) { if (bm_sel_similar_cmp_i(delta_i, compare)) {
BMO_elem_flag_enable(bm, e, EDGE_MARK); BMO_edge_flag_enable(bm, e, EDGE_MARK);
cont = false; cont = false;
} }
break; break;
@@ -435,7 +437,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
if (e_ext[i].faces == 2) { if (e_ext[i].faces == 2) {
if (e_ext[indices[idx]].faces == 2) { if (e_ext[indices[idx]].faces == 2) {
if (fabsf(e_ext[i].angle - e_ext[indices[idx]].angle) <= thresh) { if (fabsf(e_ext[i].angle - e_ext[indices[idx]].angle) <= thresh) {
BMO_elem_flag_enable(bm, e, EDGE_MARK); BMO_edge_flag_enable(bm, e, EDGE_MARK);
cont = false; cont = false;
} }
} }
@@ -454,7 +456,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
delta_fl = *c1 - *c2; delta_fl = *c1 - *c2;
if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) { if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
BMO_elem_flag_enable(bm, e, EDGE_MARK); BMO_edge_flag_enable(bm, e, EDGE_MARK);
cont = false; cont = false;
} }
} }
@@ -469,7 +471,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
delta_fl = *c1 - *c2; delta_fl = *c1 - *c2;
if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) { if (bm_sel_similar_cmp_fl(delta_fl, thresh, compare)) {
BMO_elem_flag_enable(bm, e, EDGE_MARK); BMO_edge_flag_enable(bm, e, EDGE_MARK);
cont = false; cont = false;
} }
} }
@@ -477,14 +479,14 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
case SIMEDGE_SEAM: case SIMEDGE_SEAM:
if (BM_elem_flag_test(e, BM_ELEM_SEAM) == BM_elem_flag_test(es, BM_ELEM_SEAM)) { if (BM_elem_flag_test(e, BM_ELEM_SEAM) == BM_elem_flag_test(es, BM_ELEM_SEAM)) {
BMO_elem_flag_enable(bm, e, EDGE_MARK); BMO_edge_flag_enable(bm, e, EDGE_MARK);
cont = false; cont = false;
} }
break; break;
case SIMEDGE_SHARP: case SIMEDGE_SHARP:
if (BM_elem_flag_test(e, BM_ELEM_SMOOTH) == BM_elem_flag_test(es, BM_ELEM_SMOOTH)) { if (BM_elem_flag_test(e, BM_ELEM_SMOOTH) == BM_elem_flag_test(es, BM_ELEM_SMOOTH)) {
BMO_elem_flag_enable(bm, e, EDGE_MARK); BMO_edge_flag_enable(bm, e, EDGE_MARK);
cont = false; cont = false;
} }
break; break;
@@ -497,7 +499,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
fed2 = CustomData_bmesh_get(&bm->edata, es->head.data, CD_FREESTYLE_EDGE); fed2 = CustomData_bmesh_get(&bm->edata, es->head.data, CD_FREESTYLE_EDGE);
if (fed1 && fed2 && (fed1->flag & FREESTYLE_EDGE_MARK) == (fed2->flag & FREESTYLE_EDGE_MARK)) { if (fed1 && fed2 && (fed1->flag & FREESTYLE_EDGE_MARK) == (fed2->flag & FREESTYLE_EDGE_MARK)) {
BMO_elem_flag_enable(bm, e, EDGE_MARK); BMO_edge_flag_enable(bm, e, EDGE_MARK);
cont = false; cont = false;
} }
} }
@@ -562,7 +564,7 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
/* iterate through all selected edges and mark them */ /* iterate through all selected edges and mark them */
BMO_ITER (vs, &vs_iter, op->slots_in, "verts", BM_VERT) { BMO_ITER (vs, &vs_iter, op->slots_in, "verts", BM_VERT) {
BMO_elem_flag_enable(bm, vs, VERT_MARK); BMO_vert_flag_enable(bm, vs, VERT_MARK);
num_sels++; num_sels++;
} }
@@ -573,7 +575,7 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
/* loop through all the vertices and fill the vertices/indices structure */ /* loop through all the vertices and fill the vertices/indices structure */
BM_ITER_MESH (v, &v_iter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (v, &v_iter, bm, BM_VERTS_OF_MESH) {
v_ext[i].v = v; v_ext[i].v = v;
if (BMO_elem_flag_test(bm, v, VERT_MARK)) { if (BMO_vert_flag_test(bm, v, VERT_MARK)) {
indices[idx] = i; indices[idx] = i;
idx++; idx++;
} }
@@ -599,7 +601,9 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
/* select the vertices if any */ /* select the vertices if any */
for (i = 0; i < num_total; i++) { for (i = 0; i < num_total; i++) {
v = v_ext[i].v; v = v_ext[i].v;
if (!BMO_elem_flag_test(bm, v, VERT_MARK) && !BM_elem_flag_test(v, BM_ELEM_HIDDEN)) { if (!BMO_vert_flag_test(bm, v, VERT_MARK) &&
!BM_elem_flag_test(v, BM_ELEM_HIDDEN))
{
bool cont = true; bool cont = true;
for (idx = 0; idx < num_sels && cont == true; idx++) { for (idx = 0; idx < num_sels && cont == true; idx++) {
vs = v_ext[indices[idx]].v; vs = v_ext[indices[idx]].v;
@@ -607,7 +611,7 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
case SIMVERT_NORMAL: case SIMVERT_NORMAL:
/* compare the angle between the normals */ /* compare the angle between the normals */
if (angle_normalized_v3v3(v->no, vs->no) <= thresh_radians) { if (angle_normalized_v3v3(v->no, vs->no) <= thresh_radians) {
BMO_elem_flag_enable(bm, v, VERT_MARK); BMO_vert_flag_enable(bm, v, VERT_MARK);
cont = false; cont = false;
} }
break; break;
@@ -615,7 +619,7 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
/* number of adjacent faces */ /* number of adjacent faces */
delta_i = v_ext[i].num_faces - v_ext[indices[idx]].num_faces; delta_i = v_ext[i].num_faces - v_ext[indices[idx]].num_faces;
if (bm_sel_similar_cmp_i(delta_i, compare)) { if (bm_sel_similar_cmp_i(delta_i, compare)) {
BMO_elem_flag_enable(bm, v, VERT_MARK); BMO_vert_flag_enable(bm, v, VERT_MARK);
cont = false; cont = false;
} }
break; break;
@@ -623,7 +627,7 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
case SIMVERT_VGROUP: case SIMVERT_VGROUP:
if (v_ext[i].dvert != NULL && v_ext[indices[idx]].dvert != NULL) { if (v_ext[i].dvert != NULL && v_ext[indices[idx]].dvert != NULL) {
if (defvert_find_shared(v_ext[i].dvert, v_ext[indices[idx]].dvert) != -1) { if (defvert_find_shared(v_ext[i].dvert, v_ext[indices[idx]].dvert) != -1) {
BMO_elem_flag_enable(bm, v, VERT_MARK); BMO_vert_flag_enable(bm, v, VERT_MARK);
cont = false; cont = false;
} }
} }
@@ -632,7 +636,7 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
/* number of adjacent edges */ /* number of adjacent edges */
delta_i = v_ext[i].num_edges - v_ext[indices[idx]].num_edges; delta_i = v_ext[i].num_edges - v_ext[indices[idx]].num_edges;
if (bm_sel_similar_cmp_i(delta_i, compare)) { if (bm_sel_similar_cmp_i(delta_i, compare)) {
BMO_elem_flag_enable(bm, v, VERT_MARK); BMO_vert_flag_enable(bm, v, VERT_MARK);
cont = false; cont = false;
} }
break; break;

View File

@@ -384,7 +384,7 @@ static BMVert *bm_subdivide_edge_addvert(
v_new = BM_edge_split(bm, edge, edge->v1, r_edge, factor_edge_split); v_new = BM_edge_split(bm, edge, edge->v1, r_edge, factor_edge_split);
BMO_elem_flag_enable(bm, v_new, ELE_INNER); BMO_vert_flag_enable(bm, v_new, ELE_INNER);
/* offset for smooth or sphere or fractal */ /* offset for smooth or sphere or fractal */
alter_co(v_new, e_orig, params, factor_subd, v_a, v_b); alter_co(v_new, e_orig, params, factor_subd, v_a, v_b);
@@ -419,7 +419,7 @@ static BMVert *subdivide_edge_num(
BMVert *v_new; BMVert *v_new;
float factor_edge_split, factor_subd; float factor_edge_split, factor_subd;
if (BMO_elem_flag_test(bm, edge, EDGE_PERCENT) && totpoint == 1) { if (BMO_edge_flag_test(bm, edge, EDGE_PERCENT) && totpoint == 1) {
factor_edge_split = BMO_slot_map_float_get(params->slot_edge_percents, edge); factor_edge_split = BMO_slot_map_float_get(params->slot_edge_percents, edge);
factor_subd = 0.0f; factor_subd = 0.0f;
} }
@@ -449,9 +449,9 @@ static void bm_subdivide_multicut(
for (i = 0; i < numcuts; i++) { for (i = 0; i < numcuts; i++) {
v = subdivide_edge_num(bm, eed, &e_tmp, i, params->numcuts, params, v_a, v_b, &e_new); v = subdivide_edge_num(bm, eed, &e_tmp, i, params->numcuts, params, v_a, v_b, &e_new);
BMO_elem_flag_enable(bm, v, SUBD_SPLIT | ELE_SPLIT); BMO_vert_flag_enable(bm, v, SUBD_SPLIT | ELE_SPLIT);
BMO_elem_flag_enable(bm, eed, SUBD_SPLIT | ELE_SPLIT); BMO_edge_flag_enable(bm, eed, SUBD_SPLIT | ELE_SPLIT);
BMO_elem_flag_enable(bm, e_new, SUBD_SPLIT | ELE_SPLIT); BMO_edge_flag_enable(bm, e_new, SUBD_SPLIT | ELE_SPLIT);
BM_CHECK_ELEMENT(v); BM_CHECK_ELEMENT(v);
if (v->e) BM_CHECK_ELEMENT(v->e); if (v->e) BM_CHECK_ELEMENT(v->e);
@@ -698,8 +698,8 @@ static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts
if (!e) if (!e)
continue; continue;
BMO_elem_flag_enable(bm, e, ELE_INNER); BMO_edge_flag_enable(bm, e, ELE_INNER);
BMO_elem_flag_enable(bm, f_new, ELE_INNER); BMO_face_flag_enable(bm, f_new, ELE_INNER);
v1 = lines[(i + 1) * s] = verts[a]; v1 = lines[(i + 1) * s] = verts[a];
@@ -711,7 +711,7 @@ static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts
BMESH_ASSERT(v != NULL); BMESH_ASSERT(v != NULL);
BMO_elem_flag_enable(bm, e_new, ELE_INNER); BMO_edge_flag_enable(bm, e_new, ELE_INNER);
lines[(i + 1) * s + a + 1] = v; lines[(i + 1) * s + a + 1] = v;
} }
} }
@@ -724,8 +724,8 @@ static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts
if (!e) if (!e)
continue; continue;
BMO_elem_flag_enable(bm, e, ELE_INNER); BMO_edge_flag_enable(bm, e, ELE_INNER);
BMO_elem_flag_enable(bm, f_new, ELE_INNER); BMO_face_flag_enable(bm, f_new, ELE_INNER);
} }
} }
@@ -802,8 +802,8 @@ static void tri_3edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
e = connect_smallest_face(bm, verts[a], verts[b], &f_new); e = connect_smallest_face(bm, verts[a], verts[b], &f_new);
if (!e) goto cleanup; if (!e) goto cleanup;
BMO_elem_flag_enable(bm, e, ELE_INNER); BMO_edge_flag_enable(bm, e, ELE_INNER);
BMO_elem_flag_enable(bm, f_new, ELE_INNER); BMO_face_flag_enable(bm, f_new, ELE_INNER);
lines[i + 1][0] = verts[a]; lines[i + 1][0] = verts[a];
lines[i + 1][i + 1] = verts[b]; lines[i + 1][i + 1] = verts[b];
@@ -817,7 +817,7 @@ static void tri_3edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
v = subdivide_edge_num(bm, e, &e_tmp, j, i, params, verts[a], verts[b], &e_new); v = subdivide_edge_num(bm, e, &e_tmp, j, i, params, verts[a], verts[b], &e_new);
lines[i + 1][j + 1] = v; lines[i + 1][j + 1] = v;
BMO_elem_flag_enable(bm, e_new, ELE_INNER); BMO_edge_flag_enable(bm, e_new, ELE_INNER);
} }
} }
@@ -837,13 +837,13 @@ static void tri_3edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
e = connect_smallest_face(bm, lines[i][j], lines[i + 1][j + 1], &f_new); e = connect_smallest_face(bm, lines[i][j], lines[i + 1][j + 1], &f_new);
BMO_elem_flag_enable(bm, e, ELE_INNER); BMO_edge_flag_enable(bm, e, ELE_INNER);
BMO_elem_flag_enable(bm, f_new, ELE_INNER); BMO_face_flag_enable(bm, f_new, ELE_INNER);
e = connect_smallest_face(bm, lines[i][j + 1], lines[i + 1][j + 1], &f_new); e = connect_smallest_face(bm, lines[i][j + 1], lines[i + 1][j + 1], &f_new);
BMO_elem_flag_enable(bm, e, ELE_INNER); BMO_edge_flag_enable(bm, e, ELE_INNER);
BMO_elem_flag_enable(bm, f_new, ELE_INNER); BMO_face_flag_enable(bm, f_new, ELE_INNER);
} }
} }
@@ -1023,7 +1023,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
edges[i] = l_new->e; edges[i] = l_new->e;
verts[i] = l_new->v; verts[i] = l_new->v;
if (BMO_elem_flag_test(bm, edges[i], SUBD_SPLIT)) { if (BMO_edge_flag_test(bm, edges[i], SUBD_SPLIT)) {
if (!e1) e1 = edges[i]; if (!e1) e1 = edges[i];
else e2 = edges[i]; else e2 = edges[i];
@@ -1043,13 +1043,13 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
} }
} }
if (BMO_elem_flag_test(bm, face, FACE_CUSTOMFILL)) { if (BMO_face_flag_test(bm, face, FACE_CUSTOMFILL)) {
pat = *BMO_slot_map_data_get(params.slot_custom_patterns, face); pat = *BMO_slot_map_data_get(params.slot_custom_patterns, face);
for (i = 0; i < pat->len; i++) { for (i = 0; i < pat->len; i++) {
matched = 1; matched = 1;
for (j = 0; j < pat->len; j++) { for (j = 0; j < pat->len; j++) {
a = (j + i) % pat->len; a = (j + i) % pat->len;
if ((!!BMO_elem_flag_test(bm, edges[a], SUBD_SPLIT)) != (!!pat->seledges[j])) { if ((!!BMO_edge_flag_test(bm, edges[a], SUBD_SPLIT)) != (!!pat->seledges[j])) {
matched = 0; matched = 0;
break; break;
} }
@@ -1062,7 +1062,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
fd->start = verts[i]; fd->start = verts[i];
fd->face = face; fd->face = face;
fd->totedgesel = totesel; fd->totedgesel = totesel;
BMO_elem_flag_enable(bm, face, SUBD_SPLIT); BMO_face_flag_enable(bm, face, SUBD_SPLIT);
break; break;
} }
} }
@@ -1082,7 +1082,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
matched = 1; matched = 1;
for (b = 0; b < pat->len; b++) { for (b = 0; b < pat->len; b++) {
j = (b + a) % pat->len; j = (b + a) % pat->len;
if ((!!BMO_elem_flag_test(bm, edges[j], SUBD_SPLIT)) != (!!pat->seledges[b])) { if ((!!BMO_edge_flag_test(bm, edges[j], SUBD_SPLIT)) != (!!pat->seledges[b])) {
matched = 0; matched = 0;
break; break;
} }
@@ -1094,7 +1094,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
if (matched) { if (matched) {
SubDFaceData *fd; SubDFaceData *fd;
BMO_elem_flag_enable(bm, face, SUBD_SPLIT); BMO_face_flag_enable(bm, face, SUBD_SPLIT);
fd = BLI_stack_push_r(facedata); fd = BLI_stack_push_r(facedata);
fd->pat = pat; fd->pat = pat;
@@ -1110,7 +1110,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
if (!matched && totesel) { if (!matched && totesel) {
SubDFaceData *fd; SubDFaceData *fd;
BMO_elem_flag_enable(bm, face, SUBD_SPLIT); BMO_face_flag_enable(bm, face, SUBD_SPLIT);
/* must initialize all members here */ /* must initialize all members here */
fd = BLI_stack_push_r(facedata); fd = BLI_stack_push_r(facedata);
@@ -1162,22 +1162,22 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
/* find the boundary of one of the split edges */ /* find the boundary of one of the split edges */
for (a = 1; a < vlen; a++) { for (a = 1; a < vlen; a++) {
if (!BMO_elem_flag_test(bm, loops[a - 1]->v, ELE_INNER) && if (!BMO_vert_flag_test(bm, loops[a - 1]->v, ELE_INNER) &&
BMO_elem_flag_test(bm, loops[a]->v, ELE_INNER)) BMO_vert_flag_test(bm, loops[a]->v, ELE_INNER))
{ {
break; break;
} }
} }
if (BMO_elem_flag_test(bm, loops[(a + numcuts + 1) % vlen]->v, ELE_INNER)) { if (BMO_vert_flag_test(bm, loops[(a + numcuts + 1) % vlen]->v, ELE_INNER)) {
b = (a + numcuts + 1) % vlen; b = (a + numcuts + 1) % vlen;
} }
else { else {
/* find the boundary of the other edge. */ /* find the boundary of the other edge. */
for (j = 0; j < vlen; j++) { for (j = 0; j < vlen; j++) {
b = (j + a + numcuts + 1) % vlen; b = (j + a + numcuts + 1) % vlen;
if (!BMO_elem_flag_test(bm, loops[b == 0 ? vlen - 1 : b - 1]->v, ELE_INNER) && if (!BMO_vert_flag_test(bm, loops[b == 0 ? vlen - 1 : b - 1]->v, ELE_INNER) &&
BMO_elem_flag_test(bm, loops[b]->v, ELE_INNER)) BMO_vert_flag_test(bm, loops[b]->v, ELE_INNER))
{ {
break; break;
} }
@@ -1245,7 +1245,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
BLI_assert(BM_edge_exists(loops_split[j][0]->v, loops_split[j][1]->v) == NULL); BLI_assert(BM_edge_exists(loops_split[j][0]->v, loops_split[j][1]->v) == NULL);
f_new = BM_face_split(bm, face, loops_split[j][0], loops_split[j][1], &l_new, NULL, false); f_new = BM_face_split(bm, face, loops_split[j][0], loops_split[j][1], &l_new, NULL, false);
if (f_new) { if (f_new) {
BMO_elem_flag_enable(bm, l_new->e, ELE_INNER); BMO_edge_flag_enable(bm, l_new->e, ELE_INNER);
} }
} }
} }

View File

@@ -128,7 +128,7 @@ static void bmo_edgeloop_vert_tag(BMesh *bm, struct BMEdgeLoopStore *el_store, c
{ {
LinkData *node = BM_edgeloop_verts_get(el_store)->first; LinkData *node = BM_edgeloop_verts_get(el_store)->first;
do { do {
BMO_elem_flag_set(bm, (BMVert *)node->data, oflag, tag); BMO_vert_flag_set(bm, (BMVert *)node->data, oflag, tag);
} while ((node = node->next)); } while ((node = node->next));
} }
@@ -137,7 +137,7 @@ static bool bmo_face_is_vert_tag_all(BMesh *bm, BMFace *f, short oflag)
BMLoop *l_iter, *l_first; BMLoop *l_iter, *l_first;
l_iter = l_first = BM_FACE_FIRST_LOOP(f); l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do { do {
if (!BMO_elem_flag_test(bm, l_iter->v, oflag)) { if (!BMO_vert_flag_test(bm, l_iter->v, oflag)) {
return false; return false;
} }
} while ((l_iter = l_iter->next) != l_first); } while ((l_iter = l_iter->next) != l_first);
@@ -150,7 +150,7 @@ static bool bm_vert_is_tag_edge_connect(BMesh *bm, BMVert *v)
BMEdge *e; BMEdge *e;
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
if (BMO_elem_flag_test(bm, e, EDGE_RING)) { if (BMO_edge_flag_test(bm, e, EDGE_RING)) {
BMVert *v_other = BM_edge_other_vert(e, v); BMVert *v_other = BM_edge_other_vert(e, v);
if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) { if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) {
return true; return true;
@@ -243,7 +243,7 @@ static GSet *bm_edgering_pair_calc(BMesh *bm, ListBase *eloops_rim)
BMVert *v = ((LinkData *)BM_edgeloop_verts_get(el_store)->first)->data; BMVert *v = ((LinkData *)BM_edgeloop_verts_get(el_store)->first)->data;
BM_ITER_ELEM (e, &eiter, (BMVert *)v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &eiter, (BMVert *)v, BM_EDGES_OF_VERT) {
if (BMO_elem_flag_test(bm, e, EDGE_RING)) { if (BMO_edge_flag_test(bm, e, EDGE_RING)) {
struct BMEdgeLoopStore *el_store_other; struct BMEdgeLoopStore *el_store_other;
BMVert *v_other = BM_edge_other_vert(e, v); BMVert *v_other = BM_edge_other_vert(e, v);
GHashPair pair_test; GHashPair pair_test;
@@ -339,7 +339,7 @@ static void bm_vert_calc_surface_tangent(BMesh *bm, BMVert *v, float r_no[3])
if (UNLIKELY(BM_edge_is_wire(e))) { if (UNLIKELY(BM_edge_is_wire(e))) {
/* pass - this may confuse things */ /* pass - this may confuse things */
} }
else if (BMO_elem_flag_test(bm, e, EDGE_RIM)) { else if (BMO_edge_flag_test(bm, e, EDGE_RIM)) {
BMIter liter; BMIter liter;
BMLoop *l; BMLoop *l;
BM_ITER_ELEM (l, &liter, e, BM_LOOPS_OF_EDGE) { BM_ITER_ELEM (l, &liter, e, BM_LOOPS_OF_EDGE) {
@@ -347,7 +347,7 @@ static void bm_vert_calc_surface_tangent(BMesh *bm, BMVert *v, float r_no[3])
float no[3]; float no[3];
// BM_face_normal_update(l->f); // BM_face_normal_update(l->f);
BM_edge_calc_face_tangent(e, l, no); BM_edge_calc_face_tangent(e, l, no);
if (BMO_elem_flag_test(bm, l->f, FACE_SHARED)) { if (BMO_face_flag_test(bm, l->f, FACE_SHARED)) {
add_v3_v3(no_inner, no); add_v3_v3(no_inner, no);
found_inner = true; found_inner = true;
} }
@@ -356,7 +356,7 @@ static void bm_vert_calc_surface_tangent(BMesh *bm, BMVert *v, float r_no[3])
found_outer = true; found_outer = true;
/* other side is used too, blend midway */ /* other side is used too, blend midway */
if (BMO_elem_flag_test(bm, l->f, FACE_OUT)) { if (BMO_face_flag_test(bm, l->f, FACE_OUT)) {
found_outer_tag = true; found_outer_tag = true;
} }
} }
@@ -400,9 +400,9 @@ static void bm_faces_share_tag_flush(BMesh *bm, BMEdge **e_arr, const unsigned i
l_iter = l_first = e->l; l_iter = l_first = e->l;
do { do {
if (!BMO_elem_flag_test(bm, l_iter->f, FACE_SHARED)) { if (!BMO_face_flag_test(bm, l_iter->f, FACE_SHARED)) {
if (bmo_face_is_vert_tag_all(bm, l_iter->f, VERT_SHARED)) { if (bmo_face_is_vert_tag_all(bm, l_iter->f, VERT_SHARED)) {
BMO_elem_flag_enable(bm, l_iter->f, FACE_SHARED); BMO_face_flag_enable(bm, l_iter->f, FACE_SHARED);
} }
} }
} while ((l_iter = l_iter->radial_next) != l_first); } while ((l_iter = l_iter->radial_next) != l_first);
@@ -422,7 +422,7 @@ static void bm_faces_share_tag_clear(BMesh *bm, BMEdge **e_arr_iter, const unsig
l_iter = l_first = e->l; l_iter = l_first = e->l;
do { do {
BMO_elem_flag_disable(bm, l_iter->f, FACE_SHARED); BMO_face_flag_disable(bm, l_iter->f, FACE_SHARED);
} while ((l_iter = l_iter->radial_next) != l_first); } while ((l_iter = l_iter->radial_next) != l_first);
} }
} }
@@ -834,8 +834,8 @@ static void bm_face_slice(BMesh *bm, BMLoop *l, const int cuts)
if (l_new->f->len < l_new->radial_next->f->len) { if (l_new->f->len < l_new->radial_next->f->len) {
l_new = l_new->radial_next; l_new = l_new->radial_next;
} }
BMO_elem_flag_enable(bm, l_new->f, FACE_OUT); BMO_face_flag_enable(bm, l_new->f, FACE_OUT);
BMO_elem_flag_enable(bm, l_new->radial_next->f, FACE_OUT); BMO_face_flag_enable(bm, l_new->radial_next->f, FACE_OUT);
} }
} }
@@ -903,7 +903,7 @@ static void bm_edgering_pair_order(
node = lb_a->first; node = lb_a->first;
BM_ITER_ELEM (e, &eiter, (BMVert *)node->data, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &eiter, (BMVert *)node->data, BM_EDGES_OF_VERT) {
if (BMO_elem_flag_test(bm, e, EDGE_RING)) { if (BMO_edge_flag_test(bm, e, EDGE_RING)) {
v_other = BM_edge_other_vert(e, (BMVert *)node->data); v_other = BM_edge_other_vert(e, (BMVert *)node->data);
if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) { if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) {
break; break;
@@ -938,7 +938,7 @@ static void bm_edgering_pair_order(
/* if we dont share and edge - flip */ /* if we dont share and edge - flip */
BMEdge *e = BM_edge_exists(((LinkData *)lb_a->first)->data, BMEdge *e = BM_edge_exists(((LinkData *)lb_a->first)->data,
((LinkData *)lb_b->first)->data); ((LinkData *)lb_b->first)->data);
if (e == NULL || !BMO_elem_flag_test(bm, e, EDGE_RING)) { if (e == NULL || !BMO_edge_flag_test(bm, e, EDGE_RING)) {
BM_edgeloop_flip(bm, el_store_b); BM_edgeloop_flip(bm, el_store_b);
} }
} }
@@ -983,19 +983,19 @@ static void bm_edgering_pair_subdiv(
BMIter eiter; BMIter eiter;
BM_ITER_ELEM (e, &eiter, (BMVert *)node->data, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &eiter, (BMVert *)node->data, BM_EDGES_OF_VERT) {
if (!BMO_elem_flag_test(bm, e, EDGE_IN_STACK)) { if (!BMO_edge_flag_test(bm, e, EDGE_IN_STACK)) {
BMVert *v_other = BM_edge_other_vert(e, (BMVert *)node->data); BMVert *v_other = BM_edge_other_vert(e, (BMVert *)node->data);
if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) { if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) {
BMIter fiter; BMIter fiter;
BMO_elem_flag_enable(bm, e, EDGE_IN_STACK); BMO_edge_flag_enable(bm, e, EDGE_IN_STACK);
STACK_PUSH(edges_ring_arr, e); STACK_PUSH(edges_ring_arr, e);
/* add faces to the stack */ /* add faces to the stack */
BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) { BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) {
if (BMO_elem_flag_test(bm, f, FACE_OUT)) { if (BMO_face_flag_test(bm, f, FACE_OUT)) {
if (!BMO_elem_flag_test(bm, f, FACE_IN_STACK)) { if (!BMO_face_flag_test(bm, f, FACE_IN_STACK)) {
BMO_elem_flag_enable(bm, f, FACE_IN_STACK); BMO_face_flag_enable(bm, f, FACE_IN_STACK);
STACK_PUSH(faces_ring_arr, f); STACK_PUSH(faces_ring_arr, f);
} }
} }
@@ -1009,10 +1009,10 @@ static void bm_edgering_pair_subdiv(
/* found opposite edge */ /* found opposite edge */
BMVert *v_other; BMVert *v_other;
BMO_elem_flag_disable(bm, e, EDGE_IN_STACK); BMO_edge_flag_disable(bm, e, EDGE_IN_STACK);
/* unrelated to subdiv, but if we _don't_ clear flag, multiple rings fail */ /* unrelated to subdiv, but if we _don't_ clear flag, multiple rings fail */
BMO_elem_flag_disable(bm, e, EDGE_RING); BMO_edge_flag_disable(bm, e, EDGE_RING);
v_other = BM_elem_flag_test(e->v1, BM_ELEM_TAG) ? e->v1 : e->v2; v_other = BM_elem_flag_test(e->v1, BM_ELEM_TAG) ? e->v1 : e->v2;
bm_edge_subdiv_as_loop(bm, eloops_ring, e, v_other, cuts); bm_edge_subdiv_as_loop(bm, eloops_ring, e, v_other, cuts);
@@ -1021,12 +1021,12 @@ static void bm_edgering_pair_subdiv(
while ((f = STACK_POP(faces_ring_arr))) { while ((f = STACK_POP(faces_ring_arr))) {
BMLoop *l_iter, *l_first; BMLoop *l_iter, *l_first;
BMO_elem_flag_disable(bm, f, FACE_IN_STACK); BMO_face_flag_disable(bm, f, FACE_IN_STACK);
/* Check each edge of the face */ /* Check each edge of the face */
l_iter = l_first = BM_FACE_FIRST_LOOP(f); l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do { do {
if (BMO_elem_flag_test(bm, l_iter->e, EDGE_RIM)) { if (BMO_edge_flag_test(bm, l_iter->e, EDGE_RIM)) {
bm_face_slice(bm, l_iter, cuts); bm_face_slice(bm, l_iter, cuts);
break; break;
} }
@@ -1064,7 +1064,7 @@ static void bm_edgering_pair_ringsubd(
static bool bm_edge_rim_test_cb(BMEdge *e, void *bm_v) static bool bm_edge_rim_test_cb(BMEdge *e, void *bm_v)
{ {
BMesh *bm = bm_v; BMesh *bm = bm_v;
return BMO_elem_flag_test_bool(bm, e, EDGE_RIM); return BMO_edge_flag_test_bool(bm, e, EDGE_RIM);
} }
@@ -1099,25 +1099,25 @@ void bmo_subdivide_edgering_exec(BMesh *bm, BMOperator *op)
BMFace *f; BMFace *f;
BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) { BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) {
if (!BMO_elem_flag_test(bm, f, FACE_OUT)) { if (!BMO_face_flag_test(bm, f, FACE_OUT)) {
BMIter liter; BMIter liter;
BMLoop *l; BMLoop *l;
bool ok = false; bool ok = false;
/* check at least 2 edges in the face are rings */ /* check at least 2 edges in the face are rings */
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
if (BMO_elem_flag_test(bm, l->e, EDGE_RING) && e != l->e) { if (BMO_edge_flag_test(bm, l->e, EDGE_RING) && e != l->e) {
ok = true; ok = true;
break; break;
} }
} }
if (ok) { if (ok) {
BMO_elem_flag_enable(bm, f, FACE_OUT); BMO_face_flag_enable(bm, f, FACE_OUT);
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
if (!BMO_elem_flag_test(bm, l->e, EDGE_RING)) { if (!BMO_edge_flag_test(bm, l->e, EDGE_RING)) {
BMO_elem_flag_enable(bm, l->e, EDGE_RIM); BMO_edge_flag_enable(bm, l->e, EDGE_RIM);
} }
} }
} }

View File

@@ -91,7 +91,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
BMVert **e_verts = &e->v1; BMVert **e_verts = &e->v1;
unsigned int i; unsigned int i;
BMO_elem_flag_enable(bm, e, EDGE_MARK); BMO_edge_flag_enable(bm, e, EDGE_MARK);
calc_winding = (calc_winding || BM_edge_is_boundary(e)); calc_winding = (calc_winding || BM_edge_is_boundary(e));
@@ -132,7 +132,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
add_v3_v3(normal, v->no); add_v3_v3(normal, v->no);
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
if (BMO_elem_flag_test(bm, e, EDGE_MARK)) { if (BMO_edge_flag_test(bm, e, EDGE_MARK)) {
if (e_index == 2) { if (e_index == 2) {
e_index = 0; e_index = 0;
break; break;
@@ -203,7 +203,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
for (i = 0, i_prev = 2; i < 3; i_prev = i++) { for (i = 0, i_prev = 2; i < 3; i_prev = i++) {
e = BM_edge_exists(v_tri[i], v_tri[i_prev]); e = BM_edge_exists(v_tri[i], v_tri[i_prev]);
if (e && BM_edge_is_boundary(e) && BMO_elem_flag_test(bm, e, EDGE_MARK)) { if (e && BM_edge_is_boundary(e) && BMO_edge_flag_test(bm, e, EDGE_MARK)) {
winding_votes += (e->l->v == v_tri[i]) ? 1 : -1; winding_votes += (e->l->v == v_tri[i]) ? 1 : -1;
} }
} }
@@ -226,10 +226,10 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
sf_tri->v1->tmp.p, sf_tri->v2->tmp.p, sf_tri->v3->tmp.p, NULL, sf_tri->v1->tmp.p, sf_tri->v2->tmp.p, sf_tri->v3->tmp.p, NULL,
NULL, BM_CREATE_NO_DOUBLE); NULL, BM_CREATE_NO_DOUBLE);
BMO_elem_flag_enable(bm, f, ELE_NEW); BMO_face_flag_enable(bm, f, ELE_NEW);
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
if (!BMO_elem_flag_test(bm, l->e, EDGE_MARK)) { if (!BMO_edge_flag_test(bm, l->e, EDGE_MARK)) {
BMO_elem_flag_enable(bm, l->e, ELE_NEW); BMO_edge_flag_enable(bm, l->e, ELE_NEW);
} }
} }
} }
@@ -250,7 +250,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
BMIter iter; BMIter iter;
BM_ITER_MESH_MUTABLE (e, e_next, &iter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH_MUTABLE (e, e_next, &iter, bm, BM_EDGES_OF_MESH) {
if (BMO_elem_flag_test(bm, e, ELE_NEW)) { if (BMO_edge_flag_test(bm, e, ELE_NEW)) {
/* in rare cases the edges face will have already been removed from the edge */ /* in rare cases the edges face will have already been removed from the edge */
if (LIKELY(e->l)) { if (LIKELY(e->l)) {
BMFace *f_new = BM_faces_join_pair( BMFace *f_new = BM_faces_join_pair(
@@ -258,7 +258,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
e->l->radial_next->f, e, e->l->radial_next->f, e,
false); /* join faces */ false); /* join faces */
if (f_new) { if (f_new) {
BMO_elem_flag_enable(bm, f_new, ELE_NEW); BMO_face_flag_enable(bm, f_new, ELE_NEW);
BM_edge_kill(bm, e); BM_edge_kill(bm, e);
} }
else { else {

View File

@@ -48,7 +48,7 @@ void bmo_create_vert_exec(BMesh *bm, BMOperator *op)
BMO_slot_vec_get(op->slots_in, "co", vec); BMO_slot_vec_get(op->slots_in, "co", vec);
BMO_elem_flag_enable(bm, BM_vert_create(bm, vec, NULL, BM_CREATE_NOP), ELE_NEW); BMO_vert_flag_enable(bm, BM_vert_create(bm, vec, NULL, BM_CREATE_NOP), ELE_NEW);
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "vert.out", BM_VERT, ELE_NEW); BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "vert.out", BM_VERT, ELE_NEW);
} }
@@ -74,7 +74,7 @@ void bmo_transform_exec(BMesh *UNUSED(bm), BMOperator *op)
void bmo_translate_exec(BMesh *bm, BMOperator *op) void bmo_translate_exec(BMesh *bm, BMOperator *op)
{ {
float mat[4][4], vec[3]; float mat[4][4], vec[3];
BMO_slot_vec_get(op->slots_in, "vec", vec); BMO_slot_vec_get(op->slots_in, "vec", vec);
unit_m4(mat); unit_m4(mat);
@@ -86,7 +86,7 @@ void bmo_translate_exec(BMesh *bm, BMOperator *op)
void bmo_scale_exec(BMesh *bm, BMOperator *op) void bmo_scale_exec(BMesh *bm, BMOperator *op)
{ {
float mat[3][3], vec[3]; float mat[3][3], vec[3];
BMO_slot_vec_get(op->slots_in, "vec", vec); BMO_slot_vec_get(op->slots_in, "vec", vec);
unit_m3(mat); unit_m3(mat);
@@ -143,18 +143,18 @@ void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
if (BM_edge_face_pair(e, &fa, &fb)) { if (BM_edge_face_pair(e, &fa, &fb)) {
/* check we're untouched */ /* check we're untouched */
if (BMO_elem_flag_test(bm, fa, FACE_TAINT) == false && if (BMO_face_flag_test(bm, fa, FACE_TAINT) == false &&
BMO_elem_flag_test(bm, fb, FACE_TAINT) == false) BMO_face_flag_test(bm, fb, FACE_TAINT) == false)
{ {
/* don't touch again (faces will be freed so run before rotating the edge) */ /* don't touch again (faces will be freed so run before rotating the edge) */
BMO_elem_flag_enable(bm, fa, FACE_TAINT); BMO_face_flag_enable(bm, fa, FACE_TAINT);
BMO_elem_flag_enable(bm, fb, FACE_TAINT); BMO_face_flag_enable(bm, fb, FACE_TAINT);
if (!(e2 = BM_edge_rotate(bm, e, use_ccw, check_flag))) { if (!(e2 = BM_edge_rotate(bm, e, use_ccw, check_flag))) {
BMO_elem_flag_disable(bm, fa, FACE_TAINT); BMO_face_flag_disable(bm, fa, FACE_TAINT);
BMO_elem_flag_disable(bm, fb, FACE_TAINT); BMO_face_flag_disable(bm, fb, FACE_TAINT);
#if 0 #if 0
BMO_error_raise(bm, op, BMERR_INVALID_SELECTION, "Could not rotate edge"); BMO_error_raise(bm, op, BMERR_INVALID_SELECTION, "Could not rotate edge");
return; return;
@@ -163,7 +163,7 @@ void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
continue; continue;
} }
BMO_elem_flag_enable(bm, e2, EDGE_OUT); BMO_edge_flag_enable(bm, e2, EDGE_OUT);
} }
} }
} }
@@ -184,11 +184,11 @@ static void bmo_face_flag_set_flush(BMesh *bm, BMFace *f, const short oflag, con
BMLoop *l_iter; BMLoop *l_iter;
BMLoop *l_first; BMLoop *l_first;
BMO_elem_flag_set(bm, f, oflag, value); BMO_face_flag_set(bm, f, oflag, value);
l_iter = l_first = BM_FACE_FIRST_LOOP(f); l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do { do {
BMO_elem_flag_set(bm, l_iter->e, oflag, value); BMO_edge_flag_set(bm, l_iter->e, oflag, value);
BMO_elem_flag_set(bm, l_iter->v, oflag, value); BMO_vert_flag_set(bm, l_iter->v, oflag, value);
} while ((l_iter = l_iter->next) != l_first); } while ((l_iter = l_iter->next) != l_first);
} }
@@ -210,7 +210,9 @@ static void bmo_region_extend_expand(
BMEdge *e; BMEdge *e;
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
if (!BMO_elem_flag_test(bm, e, SEL_ORIG) && !BM_elem_flag_test(e, BM_ELEM_HIDDEN)) { if (!BMO_edge_flag_test(bm, e, SEL_ORIG) &&
!BM_elem_flag_test(e, BM_ELEM_HIDDEN))
{
found = true; found = true;
break; break;
} }
@@ -223,9 +225,11 @@ static void bmo_region_extend_expand(
BMEdge *e; BMEdge *e;
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
if (!BMO_elem_flag_test(bm, e, SEL_FLAG) && !BM_elem_flag_test(e, BM_ELEM_HIDDEN)) { if (!BMO_edge_flag_test(bm, e, SEL_FLAG) &&
BMO_elem_flag_enable(bm, e, SEL_FLAG); !BM_elem_flag_test(e, BM_ELEM_HIDDEN))
BMO_elem_flag_enable(bm, BM_edge_other_vert(e, v), SEL_FLAG); {
BMO_edge_flag_enable(bm, e, SEL_FLAG);
BMO_vert_flag_enable(bm, BM_edge_other_vert(e, v), SEL_FLAG);
} }
} }
} }
@@ -234,7 +238,9 @@ static void bmo_region_extend_expand(
BMFace *f; BMFace *f;
BM_ITER_ELEM (f, &fiter, v, BM_FACES_OF_VERT) { BM_ITER_ELEM (f, &fiter, v, BM_FACES_OF_VERT) {
if (!BMO_elem_flag_test(bm, f, SEL_FLAG) && !BM_elem_flag_test(f, BM_ELEM_HIDDEN)) { if (!BMO_face_flag_test(bm, f, SEL_FLAG) &&
!BM_elem_flag_test(f, BM_ELEM_HIDDEN))
{
bmo_face_flag_set_flush(bm, f, SEL_FLAG, true); bmo_face_flag_set_flush(bm, f, SEL_FLAG, true);
} }
} }
@@ -245,9 +251,11 @@ static void bmo_region_extend_expand(
BMEdge *e; BMEdge *e;
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
if (BM_edge_is_wire(e)) { if (BM_edge_is_wire(e)) {
if (!BMO_elem_flag_test(bm, e, SEL_FLAG) && !BM_elem_flag_test(e, BM_ELEM_HIDDEN)) { if (!BMO_edge_flag_test(bm, e, SEL_FLAG) &&
BMO_elem_flag_enable(bm, e, SEL_FLAG); !BM_elem_flag_test(e, BM_ELEM_HIDDEN))
BMO_elem_flag_enable(bm, BM_edge_other_vert(e, v), SEL_FLAG); {
BMO_edge_flag_enable(bm, e, SEL_FLAG);
BMO_vert_flag_enable(bm, BM_edge_other_vert(e, v), SEL_FLAG);
} }
} }
} }
@@ -269,10 +277,10 @@ static void bmo_region_extend_expand(
BMFace *f_other; BMFace *f_other;
BM_ITER_ELEM (f_other, &fiter, l->e, BM_FACES_OF_EDGE) { BM_ITER_ELEM (f_other, &fiter, l->e, BM_FACES_OF_EDGE) {
if (!BMO_elem_flag_test(bm, f_other, SEL_ORIG | SEL_FLAG) && if (!BMO_face_flag_test(bm, f_other, SEL_ORIG | SEL_FLAG) &&
!BM_elem_flag_test(f_other, BM_ELEM_HIDDEN)) !BM_elem_flag_test(f_other, BM_ELEM_HIDDEN))
{ {
BMO_elem_flag_enable(bm, f_other, SEL_FLAG); BMO_face_flag_enable(bm, f_other, SEL_FLAG);
} }
} }
} }
@@ -281,10 +289,10 @@ static void bmo_region_extend_expand(
BMFace *f_other; BMFace *f_other;
BM_ITER_ELEM (f_other, &fiter, l->v, BM_FACES_OF_VERT) { BM_ITER_ELEM (f_other, &fiter, l->v, BM_FACES_OF_VERT) {
if (!BMO_elem_flag_test(bm, f_other, SEL_ORIG | SEL_FLAG) && if (!BMO_face_flag_test(bm, f_other, SEL_ORIG | SEL_FLAG) &&
!BM_elem_flag_test(f_other, BM_ELEM_HIDDEN)) !BM_elem_flag_test(f_other, BM_ELEM_HIDDEN))
{ {
BMO_elem_flag_enable(bm, f_other, SEL_FLAG); BMO_face_flag_enable(bm, f_other, SEL_FLAG);
} }
} }
} }
@@ -310,7 +318,7 @@ static void bmo_region_extend_contract(
BMEdge *e; BMEdge *e;
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
if (!BMO_elem_flag_test(bm, e, SEL_ORIG)) { if (!BMO_edge_flag_test(bm, e, SEL_ORIG)) {
found = true; found = true;
break; break;
} }
@@ -321,7 +329,7 @@ static void bmo_region_extend_contract(
BMFace *f; BMFace *f;
BM_ITER_ELEM (f, &fiter, v, BM_FACES_OF_VERT) { BM_ITER_ELEM (f, &fiter, v, BM_FACES_OF_VERT) {
if (!BMO_elem_flag_test(bm, f, SEL_ORIG)) { if (!BMO_face_flag_test(bm, f, SEL_ORIG)) {
found = true; found = true;
break; break;
} }
@@ -334,7 +342,7 @@ static void bmo_region_extend_contract(
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
if (BM_edge_is_wire(e)) { if (BM_edge_is_wire(e)) {
if (!BMO_elem_flag_test(bm, e, SEL_ORIG)) { if (!BMO_edge_flag_test(bm, e, SEL_ORIG)) {
found = true; found = true;
break; break;
} }
@@ -347,10 +355,10 @@ static void bmo_region_extend_contract(
BMIter eiter; BMIter eiter;
BMEdge *e; BMEdge *e;
BMO_elem_flag_enable(bm, v, SEL_FLAG); BMO_vert_flag_enable(bm, v, SEL_FLAG);
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
BMO_elem_flag_enable(bm, e, SEL_FLAG); BMO_edge_flag_enable(bm, e, SEL_FLAG);
} }
} }
} }
@@ -369,8 +377,8 @@ static void bmo_region_extend_contract(
BMFace *f_other; BMFace *f_other;
BM_ITER_ELEM (f_other, &fiter, l->e, BM_FACES_OF_EDGE) { BM_ITER_ELEM (f_other, &fiter, l->e, BM_FACES_OF_EDGE) {
if (!BMO_elem_flag_test(bm, f_other, SEL_ORIG)) { if (!BMO_face_flag_test(bm, f_other, SEL_ORIG)) {
BMO_elem_flag_enable(bm, f, SEL_FLAG); BMO_face_flag_enable(bm, f, SEL_FLAG);
break; break;
} }
} }
@@ -380,8 +388,8 @@ static void bmo_region_extend_contract(
BMFace *f_other; BMFace *f_other;
BM_ITER_ELEM (f_other, &fiter, l->v, BM_FACES_OF_VERT) { BM_ITER_ELEM (f_other, &fiter, l->v, BM_FACES_OF_VERT) {
if (!BMO_elem_flag_test(bm, f_other, SEL_ORIG)) { if (!BMO_face_flag_test(bm, f_other, SEL_ORIG)) {
BMO_elem_flag_enable(bm, f, SEL_FLAG); BMO_face_flag_enable(bm, f, SEL_FLAG);
break; break;
} }
} }
@@ -420,7 +428,7 @@ void bmo_smooth_vert_exec(BMesh *UNUSED(bm), BMOperator *op)
const float fac = BMO_slot_float_get(op->slots_in, "factor"); const float fac = BMO_slot_float_get(op->slots_in, "factor");
int i, j, clipx, clipy, clipz; int i, j, clipx, clipy, clipz;
int xaxis, yaxis, zaxis; int xaxis, yaxis, zaxis;
clipx = BMO_slot_bool_get(op->slots_in, "mirror_clip_x"); clipx = BMO_slot_bool_get(op->slots_in, "mirror_clip_x");
clipy = BMO_slot_bool_get(op->slots_in, "mirror_clip_y"); clipy = BMO_slot_bool_get(op->slots_in, "mirror_clip_y");
clipz = BMO_slot_bool_get(op->slots_in, "mirror_clip_z"); clipz = BMO_slot_bool_get(op->slots_in, "mirror_clip_z");
@@ -441,7 +449,7 @@ void bmo_smooth_vert_exec(BMesh *UNUSED(bm), BMOperator *op)
add_v3_v3v3(co, co, co2); add_v3_v3v3(co, co, co2);
j += 1; j += 1;
} }
if (!j) { if (!j) {
copy_v3_v3(co, v->co); copy_v3_v3(co, v->co);
i++; i++;

View File

@@ -424,11 +424,13 @@ void BM_mesh_beautify_fill(
flag, method); flag, method);
/* update flags */ /* update flags */
if (oflag_edge) if (oflag_edge) {
BMO_elem_flag_enable(bm, e, oflag_edge); BMO_edge_flag_enable(bm, e, oflag_edge);
}
if (oflag_face) { if (oflag_face) {
BMO_elem_flag_enable(bm, e->l->f, oflag_face); BMO_face_flag_enable(bm, e->l->f, oflag_face);
BMO_elem_flag_enable(bm, e->l->radial_next->f, oflag_face); BMO_face_flag_enable(bm, e->l->radial_next->f, oflag_face);
} }
} }
} }

View File

@@ -155,9 +155,9 @@ static void bm_face_bisect_verts(BMesh *bm, BMFace *f, const float plane[4], con
BM_face_split(bm, f, l_a, l_b, &l_new, NULL, true); BM_face_split(bm, f, l_a, l_b, &l_new, NULL, true);
if (l_new) { if (l_new) {
if (oflag_center) { if (oflag_center) {
BMO_elem_flag_enable(bm, l_new->e, oflag_center); BMO_edge_flag_enable(bm, l_new->e, oflag_center);
BMO_elem_flag_enable(bm, l_new->f, oflag_center); BMO_face_flag_enable(bm, l_new->f, oflag_center);
BMO_elem_flag_enable(bm, f, oflag_center); BMO_face_flag_enable(bm, f, oflag_center);
} }
} }
} }
@@ -270,9 +270,9 @@ static void bm_face_bisect_verts(BMesh *bm, BMFace *f, const float plane[4], con
if (l_new) { if (l_new) {
if (oflag_center) { if (oflag_center) {
BMO_elem_flag_enable(bm, l_new->e, oflag_center); BMO_edge_flag_enable(bm, l_new->e, oflag_center);
BMO_elem_flag_enable(bm, l_new->f, oflag_center); BMO_face_flag_enable(bm, l_new->f, oflag_center);
BMO_elem_flag_enable(bm, face_split_arr[j], oflag_center); BMO_face_flag_enable(bm, face_split_arr[j], oflag_center);
} }
} }
@@ -372,7 +372,7 @@ void BM_mesh_bisect_plane(
if (BM_VERT_DIR(v) == 0) { if (BM_VERT_DIR(v) == 0) {
if (oflag_center) { if (oflag_center) {
BMO_elem_flag_enable(bm, v, oflag_center); BMO_vert_flag_enable(bm, v, oflag_center);
} }
if (use_snap_center) { if (use_snap_center) {
closest_to_plane_v3(v->co, plane, v->co); closest_to_plane_v3(v->co, plane, v->co);
@@ -407,7 +407,7 @@ void BM_mesh_bisect_plane(
v_new = BM_edge_split(bm, e, e->v1, NULL, e_fac); v_new = BM_edge_split(bm, e, e->v1, NULL, e_fac);
vert_is_center_enable(v_new); vert_is_center_enable(v_new);
if (oflag_center) { if (oflag_center) {
BMO_elem_flag_enable(bm, v_new, oflag_center); BMO_vert_flag_enable(bm, v_new, oflag_center);
} }
BM_VERT_DIR(v_new) = 0; BM_VERT_DIR(v_new) = 0;
@@ -439,7 +439,7 @@ void BM_mesh_bisect_plane(
/* if both verts are on the center - tag it */ /* if both verts are on the center - tag it */
if (oflag_center) { if (oflag_center) {
if (side[0] == 0 && side[1] == 0) { if (side[0] == 0 && side[1] == 0) {
BMO_elem_flag_enable(bm, e, oflag_center); BMO_edge_flag_enable(bm, e, oflag_center);
} }
} }
} }

View File

@@ -335,7 +335,7 @@ void BM_mesh_decimate_dissolve_ex(
/* update normal */ /* update normal */
BM_face_normal_update(f_new); BM_face_normal_update(f_new);
if (oflag_out) { if (oflag_out) {
BMO_elem_flag_enable(bm, f_new, oflag_out); BMO_face_flag_enable(bm, f_new, oflag_out);
} }
/* re-calculate costs */ /* re-calculate costs */

View File

@@ -213,7 +213,7 @@ void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const bool
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG) && bm_vert_dissolve_fan_test(v)) { if (BM_elem_flag_test(v, BM_ELEM_TAG) && bm_vert_dissolve_fan_test(v)) {
#ifdef USE_WALKER #ifdef USE_WALKER
BMO_elem_flag_enable(bm, v, ELE_VERT_TAG); BMO_vert_flag_enable(bm, v, ELE_VERT_TAG);
#endif #endif
BM_elem_index_set(v, VERT_INDEX_INIT); /* set_dirty! */ BM_elem_index_set(v, VERT_INDEX_INIT); /* set_dirty! */
} }
@@ -238,7 +238,7 @@ void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const bool
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (v->e && (BM_elem_index_get(v) == VERT_INDEX_INIT)) { if (v->e && (BM_elem_index_get(v) == VERT_INDEX_INIT)) {
#ifdef USE_WALKER #ifdef USE_WALKER
if (BMO_elem_flag_test(bm, v, ELE_VERT_TAG)) if (BMO_vert_flag_test(bm, v, ELE_VERT_TAG))
#endif #endif
{ {
/* check again incase the topology changed */ /* check again incase the topology changed */

View File

@@ -358,7 +358,9 @@ void bc_triangulate_mesh(Mesh *me)
bool tag_only = false; bool tag_only = false;
int quad_method = MOD_TRIANGULATE_QUAD_SHORTEDGE; /* XXX: The triangulation method selection could be offered in the UI */ int quad_method = MOD_TRIANGULATE_QUAD_SHORTEDGE; /* XXX: The triangulation method selection could be offered in the UI */
BMesh *bm = BM_mesh_create(&bm_mesh_allocsize_default); BMesh *bm = BM_mesh_create(
&bm_mesh_allocsize_default,
&((struct BMeshCreateParams){.use_toolflags = false,}));
BMeshFromMeshParams bm_from_me_params = {0}; BMeshFromMeshParams bm_from_me_params = {0};
bm_from_me_params.calc_face_normal = true; bm_from_me_params.calc_face_normal = true;
BM_mesh_bm_from_me(bm, me, &bm_from_me_params); BM_mesh_bm_from_me(bm, me, &bm_from_me_params);

View File

@@ -2453,7 +2453,7 @@ static void select_linked_delimit_begin(BMesh *bm, int delimit)
const bool is_walk_ok = ( const bool is_walk_ok = (
(select_linked_delimit_test(e, delimit, &delimit_data) == false)); (select_linked_delimit_test(e, delimit, &delimit_data) == false));
BMO_elem_flag_set(bm, e, BMO_ELE_TAG, is_walk_ok); BMO_edge_flag_set(bm, e, BMO_ELE_TAG, is_walk_ok);
} }
} }
} }
@@ -2496,7 +2496,7 @@ static int edbm_select_linked_exec(bContext *C, wmOperator *op)
if (delimit) { if (delimit) {
BMEdge *e; BMEdge *e;
BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
if (!BMO_elem_flag_test(bm, e, BMO_ELE_TAG)) { if (!BMO_edge_flag_test(bm, e, BMO_ELE_TAG)) {
BM_elem_flag_disable(e->v1, BM_ELEM_TAG); BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
BM_elem_flag_disable(e->v2, BM_ELEM_TAG); BM_elem_flag_disable(e->v2, BM_ELEM_TAG);
} }
@@ -2552,7 +2552,7 @@ static int edbm_select_linked_exec(bContext *C, wmOperator *op)
BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
BM_elem_flag_set( BM_elem_flag_set(
e, BM_ELEM_TAG, e, BM_ELEM_TAG,
(BM_elem_flag_test(e, BM_ELEM_SELECT) && BMO_elem_flag_test(bm, e, BMO_ELE_TAG))); (BM_elem_flag_test(e, BM_ELEM_SELECT) && BMO_edge_flag_test(bm, e, BMO_ELE_TAG)));
} }
} }
else { else {

View File

@@ -2910,7 +2910,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
} }
} }
BMO_elem_flag_set(bm, be, ELE_EDGE_CUT, is_cut); BMO_edge_flag_set(bm, be, ELE_EDGE_CUT, is_cut);
} }
@@ -2982,7 +2982,9 @@ static Base *mesh_separate_tagged(Main *bmain, Scene *scene, Base *base_old, BMe
Object *obedit = base_old->object; Object *obedit = base_old->object;
BMesh *bm_new; BMesh *bm_new;
bm_new = BM_mesh_create(&bm_mesh_allocsize_default); bm_new = BM_mesh_create(
&bm_mesh_allocsize_default,
&((struct BMeshCreateParams){.use_toolflags = true,}));
BM_mesh_elem_toolflags_ensure(bm_new); /* needed for 'duplicate' bmo */ BM_mesh_elem_toolflags_ensure(bm_new); /* needed for 'duplicate' bmo */
CustomData_copy(&bm_old->vdata, &bm_new->vdata, CD_MASK_BMESH, CD_CALLOC, 0); CustomData_copy(&bm_old->vdata, &bm_new->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
@@ -3294,7 +3296,9 @@ static int edbm_separate_exec(bContext *C, wmOperator *op)
BMesh *bm_old = NULL; BMesh *bm_old = NULL;
int retval_iter = 0; int retval_iter = 0;
bm_old = BM_mesh_create(&bm_mesh_allocsize_default); bm_old = BM_mesh_create(
&bm_mesh_allocsize_default,
&((struct BMeshCreateParams){.use_toolflags = true,}));
BM_mesh_bm_from_me(bm_old, me, (&(struct BMeshFromMeshParams){0})); BM_mesh_bm_from_me(bm_old, me, (&(struct BMeshFromMeshParams){0}));

View File

@@ -563,7 +563,9 @@ static void undoMesh_to_editbtMesh(void *um_v, void *em_v, void *obdata)
EDBM_mesh_free(em); EDBM_mesh_free(em);
bm = BM_mesh_create(&allocsize); bm = BM_mesh_create(
&allocsize,
&((struct BMeshCreateParams){.use_toolflags = true,}));
BM_mesh_bm_from_me( BM_mesh_bm_from_me(
bm, &um->me, (&(struct BMeshFromMeshParams){ bm, &um->me, (&(struct BMeshFromMeshParams){

View File

@@ -354,7 +354,9 @@ void EDBM_mesh_make(ToolSettings *ts, Object *ob, const bool add_key_index)
BKE_mesh_convert_mfaces_to_mpolys(me); BKE_mesh_convert_mfaces_to_mpolys(me);
} }
bm = BKE_mesh_to_bmesh(me, ob, add_key_index); bm = BKE_mesh_to_bmesh(
me, ob, add_key_index,
&((struct BMeshCreateParams){.use_toolflags = true,}));
if (me->edit_btmesh) { if (me->edit_btmesh) {
/* this happens when switching shape keys */ /* this happens when switching shape keys */

View File

@@ -5858,7 +5858,9 @@ static int add_simple_uvs_exec(bContext *C, wmOperator *UNUSED(op))
Mesh *me = ob->data; Mesh *me = ob->data;
bool synch_selection = (scene->toolsettings->uv_flag & UV_SYNC_SELECTION) != 0; bool synch_selection = (scene->toolsettings->uv_flag & UV_SYNC_SELECTION) != 0;
BMesh *bm = BM_mesh_create(&bm_mesh_allocsize_default); BMesh *bm = BM_mesh_create(
&bm_mesh_allocsize_default,
&((struct BMeshCreateParams){.use_toolflags = false,}));
/* turn synch selection off, since we are not in edit mode we need to ensure only the uv flags are tested */ /* turn synch selection off, since we are not in edit mode we need to ensure only the uv flags are tested */
scene->toolsettings->uv_flag &= ~UV_SYNC_SELECTION; scene->toolsettings->uv_flag &= ~UV_SYNC_SELECTION;

View File

@@ -5001,7 +5001,9 @@ void sculpt_dynamic_topology_enable(bContext *C)
BKE_mesh_mselect_clear(me); BKE_mesh_mselect_clear(me);
/* Create triangles-only BMesh */ /* Create triangles-only BMesh */
ss->bm = BM_mesh_create(&allocsize); ss->bm = BM_mesh_create(
&allocsize,
&((struct BMeshCreateParams){.use_toolflags = false,}));
BM_mesh_bm_from_me( BM_mesh_bm_from_me(
ss->bm, me, (&(struct BMeshFromMeshParams){ ss->bm, me, (&(struct BMeshFromMeshParams){

View File

@@ -366,7 +366,9 @@ static void sculpt_undo_bmesh_enable(Object *ob,
sculpt_pbvh_clear(ob); sculpt_pbvh_clear(ob);
/* Create empty BMesh and enable logging */ /* Create empty BMesh and enable logging */
ss->bm = BM_mesh_create(&bm_mesh_allocsize_default); ss->bm = BM_mesh_create(
&bm_mesh_allocsize_default,
&((struct BMeshCreateParams){.use_toolflags = false,}));
BM_data_layer_add(ss->bm, &ss->bm->vdata, CD_PAINT_MASK); BM_data_layer_add(ss->bm, &ss->bm->vdata, CD_PAINT_MASK);
sculpt_dyntopo_node_layers_add(ss); sculpt_dyntopo_node_layers_add(ss);
me->flag |= ME_SCULPT_DYNAMIC_TOPOLOGY; me->flag |= ME_SCULPT_DYNAMIC_TOPOLOGY;

View File

@@ -5375,7 +5375,9 @@ static void slide_origdata_init_data(
BMesh *bm = em->bm; BMesh *bm = em->bm;
sod->origfaces = BLI_ghash_ptr_new(__func__); sod->origfaces = BLI_ghash_ptr_new(__func__);
sod->bm_origfaces = BM_mesh_create(&bm_mesh_allocsize_default); sod->bm_origfaces = BM_mesh_create(
&bm_mesh_allocsize_default,
&((struct BMeshCreateParams){.use_toolflags = false,}));
/* we need to have matching customdata */ /* we need to have matching customdata */
BM_mesh_copy_init_customdata(sod->bm_origfaces, bm, NULL); BM_mesh_copy_init_customdata(sod->bm_origfaces, bm, NULL);
} }

View File

@@ -222,7 +222,7 @@ static DerivedMesh *applyModifier_bmesh(
#ifdef DEBUG_TIME #ifdef DEBUG_TIME
TIMEIT_START(boolean_bmesh); TIMEIT_START(boolean_bmesh);
#endif #endif
bm = BM_mesh_create(&allocsize); bm = BM_mesh_create_ex(&allocsize, );
DM_to_bmesh_ex(dm_other, bm, true); DM_to_bmesh_ex(dm_other, bm, true);
DM_to_bmesh_ex(dm, bm, true); DM_to_bmesh_ex(dm, bm, true);

View File

@@ -1745,7 +1745,9 @@ static BMesh *build_skin(SkinNode *skin_nodes,
int v; int v;
so.smd = smd; so.smd = smd;
so.bm = BM_mesh_create(&bm_mesh_allocsize_default); so.bm = BM_mesh_create(
&bm_mesh_allocsize_default,
&((struct BMeshCreateParams){.use_toolflags = true,}));
so.mat_nr = 0; so.mat_nr = 0;
/* BMESH_TODO: bumping up the stack level (see MOD_array.c) */ /* BMESH_TODO: bumping up the stack level (see MOD_array.c) */

View File

@@ -53,17 +53,31 @@
#include "bmesh_py_api.h" /* own include */ #include "bmesh_py_api.h" /* own include */
PyDoc_STRVAR(bpy_bm_new_doc, PyDoc_STRVAR(bpy_bm_new_doc,
".. method:: new()\n" ".. method:: new(use_operators=True)\n"
"\n" "\n"
" :arg use_operators: Support calling operators in :mod:`bmesh.ops` (uses some extra memory per vert/edge/face).\n"
" :type use_operators: bool\n"
" :return: Return a new, empty BMesh.\n" " :return: Return a new, empty BMesh.\n"
" :rtype: :class:`bmesh.types.BMesh`\n" " :rtype: :class:`bmesh.types.BMesh`\n"
); );
static PyObject *bpy_bm_new(PyObject *UNUSED(self)) static PyObject *bpy_bm_new(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{ {
static const char *kwlist[] = {"use_operators", NULL};
BMesh *bm; BMesh *bm;
bm = BM_mesh_create(&bm_mesh_allocsize_default); bool use_operators = true;
if (!PyArg_ParseTupleAndKeywords(
args, kw, "|$O&:new", (char **)kwlist,
PyC_ParseBool, &use_operators))
{
return NULL;
}
bm = BM_mesh_create(
&bm_mesh_allocsize_default,
&((struct BMeshCreateParams){.use_toolflags = use_operators,}));
return BPy_BMesh_CreatePyObject(bm, BPY_BMFLAG_NOP); return BPy_BMesh_CreatePyObject(bm, BPY_BMFLAG_NOP);
} }
@@ -155,7 +169,7 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args,
} }
static struct PyMethodDef BPy_BM_methods[] = { static struct PyMethodDef BPy_BM_methods[] = {
{"new", (PyCFunction)bpy_bm_new, METH_NOARGS, bpy_bm_new_doc}, {"new", (PyCFunction)bpy_bm_new, METH_VARARGS | METH_KEYWORDS, bpy_bm_new_doc},
{"from_edit_mesh", (PyCFunction)bpy_bm_from_edit_mesh, METH_O, bpy_bm_from_edit_mesh_doc}, {"from_edit_mesh", (PyCFunction)bpy_bm_from_edit_mesh, METH_O, bpy_bm_from_edit_mesh_doc},
{"update_edit_mesh", (PyCFunction)bpy_bm_update_edit_mesh, METH_VARARGS | METH_KEYWORDS, bpy_bm_update_edit_mesh_doc}, {"update_edit_mesh", (PyCFunction)bpy_bm_update_edit_mesh, METH_VARARGS | METH_KEYWORDS, bpy_bm_update_edit_mesh_doc},
{NULL, NULL, 0, NULL} {NULL, NULL, 0, NULL}

View File

@@ -698,6 +698,12 @@ PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw)
BPY_BM_CHECK_OBJ(py_bm); BPY_BM_CHECK_OBJ(py_bm);
bm = py_bm->bm; bm = py_bm->bm;
if (bm->use_toolflags == false) {
PyErr_SetString(PyExc_ValueError,
"bmesh created with 'use_operators=False'");
return NULL;
}
/* could complain about entering with exceptions... */ /* could complain about entering with exceptions... */
BMO_error_clear(bm); BMO_error_clear(bm);
} }