diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-19 17:47:58 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-19 17:47:58 +0400 |
commit | 475ecbb0ce11d48ef41774ce1f982f992547beca (patch) | |
tree | 316c679f1c9e3d581078a2aa0a269caf304a8c2c /source/blender/bmesh | |
parent | 9276d7aeb2679a4eecbdd97f0ed699712920e4fb (diff) |
remove BM_ITER, BM_ITER_INDEX macros, use ELEM or MESH variants only (the maceros had unused args in both cases).
Diffstat (limited to 'source/blender/bmesh')
30 files changed, 299 insertions, 307 deletions
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c index 179feeccb18..dee18e62930 100644 --- a/source/blender/bmesh/intern/bmesh_construct.c +++ b/source/blender/bmesh/intern/bmesh_construct.c @@ -495,7 +495,7 @@ void BMO_remove_tagged_faces(BMesh *bm, const short oflag) BMFace *f; BMIter iter; - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { if (BMO_elem_flag_test(bm, f, oflag)) { BM_face_kill(bm, f); } @@ -507,7 +507,7 @@ void BMO_remove_tagged_edges(BMesh *bm, const short oflag) BMEdge *e; BMIter iter; - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (BMO_elem_flag_test(bm, e, oflag)) { BM_edge_kill(bm, e); } @@ -519,7 +519,7 @@ void BMO_remove_tagged_verts(BMesh *bm, const short oflag) BMVert *v; BMIter iter; - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { if (BMO_elem_flag_test(bm, v, oflag)) { BM_vert_kill(bm, v); } @@ -545,14 +545,14 @@ static void bmo_remove_tagged_context_verts(BMesh *bm, const short oflag) BMIter iter; BMIter itersub; - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { if (BMO_elem_flag_test(bm, v, oflag)) { /* Visit edge */ - BM_ITER (e, &itersub, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &itersub, v, BM_EDGES_OF_VERT) { BMO_elem_flag_enable(bm, e, oflag); } /* Visit face */ - BM_ITER (f, &itersub, bm, BM_FACES_OF_VERT, v) { + BM_ITER_ELEM (f, &itersub, v, BM_FACES_OF_VERT) { BMO_elem_flag_enable(bm, f, oflag); } } @@ -571,9 +571,9 @@ static void bmo_remove_tagged_context_edges(BMesh *bm, const short oflag) BMIter iter; BMIter itersub; - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (BMO_elem_flag_test(bm, e, oflag)) { - BM_ITER (f, &itersub, bm, BM_FACES_OF_EDGE, e) { + BM_ITER_ELEM (f, &itersub, e, BM_FACES_OF_EDGE) { BMO_elem_flag_enable(bm, f, oflag); } } @@ -610,7 +610,7 @@ void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type) case DEL_EDGES: { /* flush down to vert */ - BM_ITER (e, &eiter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) { if (BMO_elem_flag_test(bm, e, oflag)) { BMO_elem_flag_enable(bm, e->v1, oflag); BMO_elem_flag_enable(bm, e->v2, oflag); @@ -618,7 +618,7 @@ void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type) } bmo_remove_tagged_context_edges(bm, oflag); /* remove loose vertice */ - BM_ITER (v, &viter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { if (BMO_elem_flag_test(bm, v, oflag) && (!(v->e))) BMO_elem_flag_enable(bm, v, DEL_WIREVERT); } @@ -649,7 +649,7 @@ void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type) case DEL_FACES: { /* go through and mark all edges and all verts of all faces for delet */ - BM_ITER (f, &fiter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { if (BMO_elem_flag_test(bm, f, oflag)) { for (e = BM_iter_new(&eiter, bm, BM_EDGES_OF_FACE, f); e; e = BM_iter_step(&eiter)) BMO_elem_flag_enable(bm, e, oflag); @@ -658,7 +658,7 @@ void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type) } } /* now go through and mark all remaining faces all edges for keeping */ - BM_ITER (f, &fiter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { if (!BMO_elem_flag_test(bm, f, oflag)) { for (e = BM_iter_new(&eiter, bm, BM_EDGES_OF_FACE, f); e; e = BM_iter_step(&eiter)) { BMO_elem_flag_disable(bm, e, oflag); @@ -669,7 +669,7 @@ void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type) } } /* also mark all the vertices of remaining edges for keeping */ - BM_ITER (e, &eiter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) { if (!BMO_elem_flag_test(bm, e, oflag)) { BMO_elem_flag_disable(bm, e->v1, oflag); BMO_elem_flag_disable(bm, e->v2, oflag); @@ -687,13 +687,13 @@ void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type) case DEL_ALL: { /* does this option even belong in here? */ - BM_ITER (f, &fiter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { BMO_elem_flag_enable(bm, f, oflag); } - BM_ITER (e, &eiter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) { BMO_elem_flag_enable(bm, e, oflag); } - BM_ITER (v, &viter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { BMO_elem_flag_enable(bm, v, oflag); } diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index ce1474e37af..01fe1c83bc0 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -1746,7 +1746,7 @@ int BM_vert_splice(BMesh *bm, BMVert *v, BMVert *vtarget) } /* retarget all the loops of v to vtarget */ - BM_ITER (l, &liter, bm, BM_LOOPS_OF_VERT, v) { + BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) { l->v = vtarget; } @@ -1792,7 +1792,7 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len) visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, __func__); maxindex = 0; - BM_ITER (e, &eiter, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { if (BLI_ghash_haskey(visithash, e)) { continue; } @@ -1805,7 +1805,7 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len) while ((e = BLI_array_pop(stack))) { BLI_ghash_insert(visithash, e, SET_INT_IN_POINTER(maxindex)); - BM_ITER (l, &liter, bm, BM_LOOPS_OF_EDGE, e) { + BM_ITER_ELEM (l, &liter, e, BM_LOOPS_OF_EDGE) { nl = (l->v == v) ? l->prev : l->next; if (!BLI_ghash_haskey(visithash, nl->e)) { BLI_array_append(stack, nl->e); @@ -1825,7 +1825,7 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len) /* Replace v with the new verts in each group */ #if 0 - BM_ITER (l, &liter, bm, BM_LOOPS_OF_VERT, v) { + BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) { /* call first since its faster then a hash lookup */ if (l->v != v) { continue; @@ -1851,7 +1851,7 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len) * bad practice but save alloc'ing a new array - note, the comment above is useful, keep it * if you are tidying up code - campbell */ BLI_array_empty(stack); - BM_ITER (l, &liter, bm, BM_LOOPS_OF_VERT, v) { + BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) { if (l->v == v) { BLI_array_append(stack, (BMEdge *)l); } @@ -1865,7 +1865,7 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len) BLI_array_free(stack); - BM_ITER (e, &eiter, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { i = GET_INT_FROM_POINTER(BLI_ghash_lookup(visithash, e)); if (i == 0) { continue; diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index d8a977c5431..c56d2c622a4 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -489,7 +489,7 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f) if (!CustomData_has_layer(&bm->ldata, CD_MDISPS)) return; - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { MDisps *mdp = CustomData_bmesh_get(&bm->ldata, l->prev->head.data, CD_MDISPS); MDisps *mdl = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MDISPS); MDisps *mdn = CustomData_bmesh_get(&bm->ldata, l->next->head.data, CD_MDISPS); @@ -521,7 +521,7 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f) } } - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { MDisps *mdl1 = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MDISPS); MDisps *mdl2; float co1[3], co2[3], co[3]; @@ -726,7 +726,7 @@ static void update_data_blocks(BMesh *bm, CustomData *olddata, CustomData *data) CustomData_bmesh_init_pool(data, bm->totvert, BM_VERT); - BM_ITER (eve, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { block = NULL; CustomData_bmesh_set_default(data, &block); CustomData_bmesh_copy_data(olddata, data, eve->head.data, &block); @@ -739,7 +739,7 @@ static void update_data_blocks(BMesh *bm, CustomData *olddata, CustomData *data) CustomData_bmesh_init_pool(data, bm->totedge, BM_EDGE); - BM_ITER (eed, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) { block = NULL; CustomData_bmesh_set_default(data, &block); CustomData_bmesh_copy_data(olddata, data, eed->head.data, &block); @@ -753,8 +753,8 @@ static void update_data_blocks(BMesh *bm, CustomData *olddata, CustomData *data) BMLoop *l; CustomData_bmesh_init_pool(data, bm->totloop, BM_LOOP); - BM_ITER (efa, &iter, bm, BM_FACES_OF_MESH, NULL) { - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, efa) { + BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { + BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { block = NULL; CustomData_bmesh_set_default(data, &block); CustomData_bmesh_copy_data(olddata, data, l->head.data, &block); @@ -768,7 +768,7 @@ static void update_data_blocks(BMesh *bm, CustomData *olddata, CustomData *data) CustomData_bmesh_init_pool(data, bm->totface, BM_FACE); - BM_ITER (efa, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { block = NULL; CustomData_bmesh_set_default(data, &block); CustomData_bmesh_copy_data(olddata, data, efa->head.data, &block); diff --git a/source/blender/bmesh/intern/bmesh_iterators.h b/source/blender/bmesh/intern/bmesh_iterators.h index 65da25015ee..c687e4b4e7a 100644 --- a/source/blender/bmesh/intern/bmesh_iterators.h +++ b/source/blender/bmesh/intern/bmesh_iterators.h @@ -82,10 +82,6 @@ typedef enum BMIterType { /* the iterator htype for each iterator */ extern const char bm_iter_itype_htype_map[BM_ITYPE_MAX]; - -#define BM_ITER(ele, iter, bm, itype, data) \ - for (ele = BM_iter_new(iter, bm, itype, data); ele; ele = BM_iter_step(iter)) - #define BM_ITER_MESH(ele, iter, bm, itype) \ for (ele = BM_iter_new(iter, bm, itype, NULL); ele; ele = BM_iter_step(iter)) @@ -95,13 +91,9 @@ extern const char bm_iter_itype_htype_map[BM_ITYPE_MAX]; #define BM_ITER_ELEM(ele, iter, data, itype) \ for (ele = BM_iter_new(iter, NULL, itype, data); ele; ele = BM_iter_step(iter)) -#define BM_ITER_ELEM_INDEX(ele, iter, data, itype) \ +#define BM_ITER_ELEM_INDEX(ele, iter, data, itype, indexvar) \ for (ele = BM_iter_new(iter, NULL, itype, data), indexvar = 0; ele; ele = BM_iter_step(iter), (indexvar)++) -#define BM_ITER_INDEX(ele, iter, bm, itype, data, indexvar) \ - for (ele = BM_iter_new(iter, bm, itype, data), indexvar = 0; ele; ele = BM_iter_step(iter), (indexvar)++) - - /* Iterator Structure */ typedef struct BMIter { BLI_mempool_iter pooliter; diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index faf2d79046a..2e61592c172 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -84,7 +84,7 @@ void BM_mesh_select_mode_flush(BMesh *bm) int ok; if (bm->selectmode & SCE_SELECT_VERTEX) { - BM_ITER (e, &eiter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) { if (BM_elem_flag_test(e->v1, BM_ELEM_SELECT) && BM_elem_flag_test(e->v2, BM_ELEM_SELECT) && !BM_elem_flag_test(e, BM_ELEM_HIDDEN)) @@ -95,7 +95,7 @@ void BM_mesh_select_mode_flush(BMesh *bm) BM_elem_flag_disable(e, BM_ELEM_SELECT); } } - BM_ITER (f, &fiter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { ok = TRUE; if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) { l_iter = l_first = BM_FACE_FIRST_LOOP(f); @@ -114,7 +114,7 @@ void BM_mesh_select_mode_flush(BMesh *bm) } } else if (bm->selectmode & SCE_SELECT_EDGE) { - BM_ITER (f, &fiter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { ok = TRUE; if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) { l_iter = l_first = BM_FACE_FIRST_LOOP(f); @@ -154,7 +154,7 @@ void BM_mesh_deselect_flush(BMesh *bm) int ok; - BM_ITER (e, &eiter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) { if (!(BM_elem_flag_test(e->v1, BM_ELEM_SELECT) && BM_elem_flag_test(e->v2, BM_ELEM_SELECT) && !BM_elem_flag_test(e, BM_ELEM_HIDDEN))) @@ -163,7 +163,7 @@ void BM_mesh_deselect_flush(BMesh *bm) } } - BM_ITER (f, &fiter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { ok = TRUE; if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) { l_iter = l_first = BM_FACE_FIRST_LOOP(f); @@ -205,7 +205,7 @@ void BM_mesh_select_flush(BMesh *bm) int ok; - BM_ITER (e, &eiter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) { if (BM_elem_flag_test(e->v1, BM_ELEM_SELECT) && BM_elem_flag_test(e->v2, BM_ELEM_SELECT) && !BM_elem_flag_test(e, BM_ELEM_HIDDEN)) @@ -214,7 +214,7 @@ void BM_mesh_select_flush(BMesh *bm) } } - BM_ITER (f, &fiter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { ok = TRUE; if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) { l_iter = l_first = BM_FACE_FIRST_LOOP(f); @@ -360,10 +360,10 @@ void BM_face_select_set(BMesh *bm, BMFace *f, int select) BM_elem_flag_disable(f, BM_ELEM_SELECT); /* flush down to edges */ - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BMIter fiter; BMFace *f2; - BM_ITER (f2, &fiter, bm, BM_FACES_OF_EDGE, l->e) { + BM_ITER_ELEM (f2, &fiter, l->e, BM_FACES_OF_EDGE) { if (BM_elem_flag_test(f2, BM_ELEM_SELECT)) break; } @@ -374,10 +374,10 @@ void BM_face_select_set(BMesh *bm, BMFace *f, int select) } /* flush down to verts */ - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BMIter eiter; BMEdge *e; - BM_ITER (e, &eiter, bm, BM_EDGES_OF_VERT, l->v) { + BM_ITER_ELEM (e, &eiter, l->v, BM_EDGES_OF_VERT) { if (BM_elem_flag_test(e, BM_ELEM_SELECT)) break; } @@ -405,10 +405,10 @@ void BM_mesh_select_mode_set(BMesh *bm, int selectmode) if (bm->selectmode & SCE_SELECT_VERTEX) { /* disabled because selection flushing handles these */ #if 0 - BM_ITER (ele, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) { BM_elem_flag_disable(ele, BM_ELEM_SELECT); } - BM_ITER (ele, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) { BM_elem_flag_disable(ele, BM_ELEM_SELECT); } #endif @@ -417,12 +417,12 @@ void BM_mesh_select_mode_set(BMesh *bm, int selectmode) else if (bm->selectmode & SCE_SELECT_EDGE) { /* disabled because selection flushing handles these */ #if 0 - BM_ITER (ele, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) { BM_elem_flag_disable(ele, BM_ELEM_SELECT); } #endif - BM_ITER (ele, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) { if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) { BM_edge_select_set(bm, (BMEdge *)ele, TRUE); } @@ -432,11 +432,11 @@ void BM_mesh_select_mode_set(BMesh *bm, int selectmode) else if (bm->selectmode & SCE_SELECT_FACE) { /* disabled because selection flushing handles these */ #if 0 - BM_ITER (ele, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) { BM_elem_flag_disable(ele, BM_ELEM_SELECT); } #endif - BM_ITER (ele, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) { if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) { BM_face_select_set(bm, (BMFace *)ele, TRUE); } @@ -543,7 +543,7 @@ BMFace *BM_active_face_get(BMesh *bm, int sloppy) } /* Last attempt: try to find any selected face */ if (f == NULL) { - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { if (BM_elem_flag_test(f, BM_ELEM_SELECT)) { break; } @@ -896,7 +896,7 @@ static void vert_flush_hide_set(BMesh *bm, BMVert *v) BMEdge *e; int hide = TRUE; - BM_ITER (e, &iter, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) { hide = hide && BM_elem_flag_test(e, BM_ELEM_HIDDEN); } @@ -909,7 +909,7 @@ static void edge_flush_hide(BMesh *bm, BMEdge *e) BMFace *f; int hide = TRUE; - BM_ITER (f, &iter, bm, BM_FACES_OF_EDGE, e) { + BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) { hide = hide && BM_elem_flag_test(f, BM_ELEM_HIDDEN); } @@ -925,10 +925,10 @@ void BM_vert_hide_set(BMesh *bm, BMVert *v, int hide) BM_elem_flag_set(v, BM_ELEM_HIDDEN, hide); - BM_ITER (e, &iter, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) { BM_elem_flag_set(e, BM_ELEM_HIDDEN, hide); - BM_ITER (f, &fiter, bm, BM_FACES_OF_EDGE, e) { + BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) { BM_elem_flag_set(f, BM_ELEM_HIDDEN, hide); } } @@ -941,7 +941,7 @@ void BM_edge_hide_set(BMesh *bm, BMEdge *e, int hide) /* BMVert *v; */ /* edge hiding: faces around the edge */ - BM_ITER (f, &iter, bm, BM_FACES_OF_EDGE, e) { + BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) { BM_elem_flag_set(f, BM_ELEM_HIDDEN, hide); } @@ -959,11 +959,11 @@ void BM_face_hide_set(BMesh *bm, BMFace *f, int hide) BM_elem_flag_set(f, BM_ELEM_HIDDEN, hide); - BM_ITER (l, &iter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) { edge_flush_hide(bm, l->e); } - BM_ITER (l, &iter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) { vert_flush_hide_set(bm, l->v); } } diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index d3c0404e73e..e2b9732e87a 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -104,15 +104,15 @@ void BM_mesh_data_free(BMesh *bm) BMIter iter; BMIter itersub; - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { CustomData_bmesh_free_block(&(bm->vdata), &(v->head.data)); } - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { CustomData_bmesh_free_block(&(bm->edata), &(e->head.data)); } - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { CustomData_bmesh_free_block(&(bm->pdata), &(f->head.data)); - BM_ITER (l, &itersub, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &itersub, f, BM_LOOPS_OF_FACE) { CustomData_bmesh_free_block(&(bm->ldata), &(l->head.data)); } } @@ -211,7 +211,7 @@ void BM_mesh_normals_update(BMesh *bm, const short skip_hidden) float (*edgevec)[3]; /* calculate all face normals */ - BM_ITER (f, &faces, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &faces, bm, BM_FACES_OF_MESH) { if (skip_hidden && BM_elem_flag_test(f, BM_ELEM_HIDDEN)) continue; #if 0 /* UNUSED */ @@ -223,7 +223,7 @@ void BM_mesh_normals_update(BMesh *bm, const short skip_hidden) } /* Zero out vertex normals */ - BM_ITER (v, &verts, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &verts, bm, BM_VERTS_OF_MESH) { if (skip_hidden && BM_elem_flag_test(v, BM_ELEM_HIDDEN)) continue; @@ -235,7 +235,7 @@ void BM_mesh_normals_update(BMesh *bm, const short skip_hidden) * normals */ index = 0; edgevec = MEM_callocN(sizeof(float) * 3 * bm->totedge, "BM normal computation array"); - BM_ITER (e, &edges, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &edges, bm, BM_EDGES_OF_MESH) { BM_elem_index_set(e, index); /* set_inline */ if (e->l) { @@ -251,12 +251,12 @@ void BM_mesh_normals_update(BMesh *bm, const short skip_hidden) bm->elem_index_dirty &= ~BM_EDGE; /* add weighted face normals to vertices */ - BM_ITER (f, &faces, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &faces, bm, BM_FACES_OF_MESH) { if (skip_hidden && BM_elem_flag_test(f, BM_ELEM_HIDDEN)) continue; - BM_ITER (l, &loops, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &loops, f, BM_LOOPS_OF_FACE) { float *e1diff, *e2diff; float dotprod; float fac; @@ -282,7 +282,7 @@ void BM_mesh_normals_update(BMesh *bm, const short skip_hidden) } /* normalize the accumulated vertex normals */ - BM_ITER (v, &verts, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &verts, bm, BM_VERTS_OF_MESH) { if (skip_hidden && BM_elem_flag_test(v, BM_ELEM_HIDDEN)) continue; @@ -312,7 +312,7 @@ static void bm_rationalize_normals(BMesh *bm, int undo) BMIter iter; if (undo) { - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { if (BM_elem_flag_test(f, BM_ELEM_TAG)) { BM_face_normal_flip(bm, f); } @@ -327,7 +327,7 @@ static void bm_rationalize_normals(BMesh *bm, int undo) BMO_push(bm, &bmop); bmo_righthandfaces_exec(bm, &bmop); - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BM_elem_flag_set(f, BM_ELEM_TAG, BMO_elem_flag_test(bm, f, FACE_FLIP)); } @@ -350,10 +350,10 @@ static void UNUSED_FUNCTION(bm_mdisps_space_set)(Object *ob, BMesh *bm, int from mdisps = CustomData_get_layer(&dm->loopData, CD_MDISPS); - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BMLoop *l; BMIter liter; - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { MDisps *lmd = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MDISPS); if (!lmd->disps) { @@ -463,7 +463,7 @@ void BM_mesh_elem_index_ensure(BMesh *bm, const char hflag) if (hflag & BM_VERT) { if (bm->elem_index_dirty & BM_VERT) { int index = 0; - BM_ITER (ele, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) { BM_elem_index_set(ele, index); /* set_ok */ index++; } @@ -478,7 +478,7 @@ void BM_mesh_elem_index_ensure(BMesh *bm, const char hflag) if (hflag & BM_EDGE) { if (bm->elem_index_dirty & BM_EDGE) { int index = 0; - BM_ITER (ele, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) { BM_elem_index_set(ele, index); /* set_ok */ index++; } @@ -493,7 +493,7 @@ void BM_mesh_elem_index_ensure(BMesh *bm, const char hflag) if (hflag & BM_FACE) { if (bm->elem_index_dirty & BM_FACE) { int index = 0; - BM_ITER (ele, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) { BM_elem_index_set(ele, index); /* set_ok */ index++; } @@ -712,7 +712,7 @@ void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx) /* And now, fix all vertices/edges/faces/loops pointers! */ /* Verts' pointers, only edge pointers... */ if (eptr_map) { - BM_ITER (ve, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (ve, &iter, bm, BM_VERTS_OF_MESH) { /* printf("Vert e: %p -> %p\n", ve->e, BLI_ghash_lookup(eptr_map, (const void*)ve->e));*/ ve->e = BLI_ghash_lookup(eptr_map, (const void *)ve->e); } @@ -720,7 +720,7 @@ void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx) /* Edges' pointers, only vert pointers (as we don’t mess with loops!)... */ if (vptr_map) { - BM_ITER (ed, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (ed, &iter, bm, BM_EDGES_OF_MESH) { /* printf("Edge v1: %p -> %p\n", ed->v1, BLI_ghash_lookup(vptr_map, (const void*)ed->v1));*/ /* printf("Edge v2: %p -> %p\n", ed->v2, BLI_ghash_lookup(vptr_map, (const void*)ed->v2));*/ ed->v1 = BLI_ghash_lookup(vptr_map, (const void *)ed->v1); @@ -729,8 +729,8 @@ void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx) } /* Faces' pointers (loops, in fact), always needed... */ - BM_ITER (fa, &iter, bm, BM_FACES_OF_MESH, NULL) { - BM_ITER (lo, &iterl, bm, BM_LOOPS_OF_FACE, fa) { + BM_ITER_MESH (fa, &iter, bm, BM_FACES_OF_MESH) { + BM_ITER_ELEM (lo, &iterl, fa, BM_LOOPS_OF_FACE) { if (vptr_map) { /* printf("Loop v: %p -> %p\n", lo->v, BLI_ghash_lookup(vptr_map, (const void*)lo->v));*/ lo->v = BLI_ghash_lookup(vptr_map, (const void *)lo->v); diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c index cc96cfbef6d..d15e3d36523 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_conv.c +++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c @@ -336,7 +336,7 @@ void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, int set_key, int act_key_nr) if (i == me->act_face) bm->act_face = f; j = 0; - BM_ITER_INDEX (l, &iter, bm, BM_LOOPS_OF_FACE, f, j) { + BM_ITER_ELEM_INDEX (l, &iter, f, BM_LOOPS_OF_FACE, j) { /* Save index of correspsonding MLoop */ BM_elem_index_set(l, mpoly->loopstart + j); /* set_loop */ } @@ -355,8 +355,8 @@ void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, int set_key, int act_key_nr) * but is an optimization, to avoid copying a bunch of interpolated customdata * for each BMLoop (from previous BMLoops using the same edge), always followed * by freeing the interpolated data and overwriting it with data from the Mesh. */ - BM_ITER (f, &fiter, bm, BM_FACES_OF_MESH, NULL) { - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { int li = BM_elem_index_get(l); CustomData_to_bmesh_block(&me->ldata, &bm->ldata, li, &l->head.data); BM_elem_index_set(l, 0); /* set_loop */ @@ -379,9 +379,9 @@ void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, int set_key, int act_key_nr) BMFace *face; MSelect *msel; - BM_ITER_INDEX (vert, &iter, bm, BM_VERTS_OF_MESH, NULL, i) { vert_array[i] = vert; } - BM_ITER_INDEX (edge, &iter, bm, BM_EDGES_OF_MESH, NULL, i) { edge_array[i] = edge; } - BM_ITER_INDEX (face, &iter, bm, BM_FACES_OF_MESH, NULL, i) { face_array[i] = face; } + BM_ITER_MESH_INDEX (vert, &iter, bm, BM_VERTS_OF_MESH, i) { vert_array[i] = vert; } + BM_ITER_MESH_INDEX (edge, &iter, bm, BM_EDGES_OF_MESH, i) { edge_array[i] = edge; } + BM_ITER_MESH_INDEX (face, &iter, bm, BM_FACES_OF_MESH, i) { face_array[i] = face; } for (i = 0, msel = me->mselect; i < me->totselect; i++, msel++) { switch (msel->type) { @@ -432,7 +432,7 @@ static BMVert **bm_to_mesh_vertex_map(BMesh *bm, int ototvert) vertMap = MEM_callocN(sizeof(*vertMap) * ototvert, "vertMap"); if (CustomData_has_layer(&bm->vdata, CD_SHAPE_KEYINDEX)) { int *keyi; - BM_ITER (eve, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { keyi = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX); if (keyi) { if (((index = *keyi) != ORIGINDEX_NONE) && (index < ototvert)) { @@ -448,7 +448,7 @@ static BMVert **bm_to_mesh_vertex_map(BMesh *bm, int ototvert) } } else { - BM_ITER (eve, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { if (i < ototvert) { vertMap[i] = eve; } @@ -564,7 +564,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess) mesh_update_customdata_pointers(me, 0); i = 0; - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { float *bweight = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_BWEIGHT); mvert->bweight = bweight ? (char)((*bweight) * 255) : 0; @@ -588,7 +588,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess) med = medge; i = 0; - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { float *crease = CustomData_bmesh_get(&bm->edata, e->head.data, CD_CREASE); float *bweight = CustomData_bmesh_get(&bm->edata, e->head.data, CD_BWEIGHT); @@ -614,7 +614,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess) i = 0; j = 0; - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { mpoly->loopstart = j; mpoly->totloop = f->len; mpoly->mat_nr = f->mat_nr; @@ -783,7 +783,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess) ofs = MEM_callocN(sizeof(float) * 3 * bm->totvert, "currkey->data"); mvert = me->mvert; - BM_ITER_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, NULL, i) { + BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) { keyi = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX); if (keyi && *keyi != ORIGINDEX_NONE) { sub_v3_v3v3(ofs[i], mvert->co, fp[*keyi]); @@ -806,7 +806,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess) oldkey = currkey->data; mvert = me->mvert; - BM_ITER (eve, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { if (currkey == actkey) { copy_v3_v3(fp, eve->co); diff --git a/source/blender/bmesh/intern/bmesh_mesh_validate.c b/source/blender/bmesh/intern/bmesh_mesh_validate.c index 6f30134f66c..3ec3b84c120 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_validate.c +++ b/source/blender/bmesh/intern/bmesh_mesh_validate.c @@ -70,7 +70,7 @@ int BM_mesh_validate(BMesh *bm) bm->elem_index_dirty |= BM_ALL; BM_mesh_elem_index_ensure(bm, BM_ALL); - BM_ITER_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, NULL, i) { + BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) { if (BM_elem_flag_test(v, BM_ELEM_SELECT | BM_ELEM_HIDDEN) == (BM_ELEM_SELECT | BM_ELEM_HIDDEN)) { ERRMSG("vert %d: is hidden and selected", i); } @@ -83,13 +83,13 @@ int BM_mesh_validate(BMesh *bm) } /* check edges */ - BM_ITER_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, NULL, i) { + BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, i) { if (e->v1 == e->v2) ERRMSG("edge %d: duplicate index: %d", i, BM_elem_index_get(e->v1)); } /* edge radial structure */ - BM_ITER_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, NULL, i) { + BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, i) { if (BM_elem_flag_test(e, BM_ELEM_SELECT | BM_ELEM_HIDDEN) == (BM_ELEM_SELECT | BM_ELEM_HIDDEN)) { ERRMSG("edge %d: is hidden and selected", i); } @@ -117,7 +117,7 @@ int BM_mesh_validate(BMesh *bm) } /* face structure */ - BM_ITER_INDEX (f, &iter, bm, BM_FACES_OF_MESH, NULL, i) { + BM_ITER_MESH_INDEX (f, &iter, bm, BM_FACES_OF_MESH, i) { BMLoop *l_iter; BMLoop *l_first; diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index f4aa1133d27..a29b657d76e 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -286,8 +286,8 @@ BMEdge *BM_verts_connect(BMesh *bm, BMVert *v1, BMVert *v2, BMFace **r_f) BMFace *f_iter; /* be warned: this can do weird things in some ngon situation, see BM_face_legal_splits */ - BM_ITER (f_iter, &fiter, bm, BM_FACES_OF_VERT, v1) { - BM_ITER (v_iter, &viter, bm, BM_FACES_OF_VERT, f_iter) { + BM_ITER_ELEM (f_iter, &fiter, v1, BM_FACES_OF_VERT) { + BM_ITER_ELEM (v_iter, &viter, f_iter, BM_FACES_OF_VERT) { if (v_iter == v2) { BMLoop *nl; @@ -521,7 +521,7 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac, BMFace *f; BLI_array_staticdeclare(faces, 8); - BM_ITER (f, &iter, bm, BM_FACES_OF_VERT, kv) { + BM_ITER_ELEM (f, &iter, kv, BM_FACES_OF_VERT) { BLI_array_append(faces, f); } @@ -556,7 +556,7 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac, for (i = 0; i < 2; i++) { /* cant kill data we loop on, build a list and remove those */ BLI_array_empty(bad_faces); - BM_ITER (f, &fiter, bm, BM_FACES_OF_VERT, verts[i]) { + BM_ITER_ELEM (f, &fiter, verts[i], BM_FACES_OF_VERT) { if (f->len < 3) { BLI_array_append(bad_faces, f); } diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index e16554eb637..dce491efe72 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -663,21 +663,21 @@ static void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slot /* TODO - collapse these loops into one */ if (htype & BM_VERT) { - BM_ITER (ele, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) { ((BMHeader **)output->data.p)[i] = ele; i++; } } if (htype & BM_EDGE) { - BM_ITER (ele, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) { ((BMHeader **)output->data.p)[i] = ele; i++; } } if (htype & BM_FACE) { - BM_ITER (ele, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) { ((BMHeader **)output->data.p)[i] = ele; i++; } @@ -714,7 +714,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl /* TODO - collapse these loops into one */ if (htype & BM_VERT) { - BM_ITER (ele, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) { if (!BM_elem_flag_test(ele, BM_ELEM_HIDDEN) && BM_elem_flag_test_bool(ele, hflag) == test_for_enabled) { @@ -725,7 +725,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl } if (htype & BM_EDGE) { - BM_ITER (ele, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) { if (!BM_elem_flag_test(ele, BM_ELEM_HIDDEN) && BM_elem_flag_test_bool(ele, hflag) == test_for_enabled) { @@ -736,7 +736,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl } if (htype & BM_FACE) { - BM_ITER (ele, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(ele, BM_ELEM_HIDDEN) && BM_elem_flag_test_bool(ele, hflag) == test_for_enabled) { @@ -828,7 +828,7 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slo /* TODO - collapse these loops into one */ if (htype & BM_VERT) { - BM_ITER (ele, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) { if (BMO_elem_flag_test_bool(bm, (BMElemF *)ele, oflag) == test_for_enabled) { ele_array[i] = ele; i++; @@ -837,7 +837,7 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slo } if (htype & BM_EDGE) { - BM_ITER (ele, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) { if (BMO_elem_flag_test_bool(bm, (BMElemF *)ele, oflag) == test_for_enabled) { ele_array[i] = ele; i++; @@ -846,7 +846,7 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slo } if (htype & BM_FACE) { - BM_ITER (ele, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) { if (BMO_elem_flag_test_bool(bm, (BMElemF *)ele, oflag) == test_for_enabled) { ele_array[i] = ele; i++; @@ -1035,19 +1035,19 @@ static void bmo_flag_layer_alloc(BMesh *bm) bm->toolflagpool = newpool = BLI_mempool_create(sizeof(BMFlagLayer) * bm->totflags, 512, 512, 0); /* now go through and memcpy all the flags. Loops don't get a flag layer at this time.. */ - BM_ITER_INDEX (ele, &iter, bm, BM_VERTS_OF_MESH, NULL, i) { + BM_ITER_MESH_INDEX (ele, &iter, bm, BM_VERTS_OF_MESH, i) { oldflags = ele->oflags; ele->oflags = BLI_mempool_calloc(newpool); memcpy(ele->oflags, oldflags, old_totflags_size); BM_elem_index_set(ele, i); /* set_inline */ } - BM_ITER_INDEX (ele, &iter, bm, BM_EDGES_OF_MESH, NULL, i) { + BM_ITER_MESH_INDEX (ele, &iter, bm, BM_EDGES_OF_MESH, i) { oldflags = ele->oflags; ele->oflags = BLI_mempool_calloc(newpool); memcpy(ele->oflags, oldflags, old_totflags_size); BM_elem_index_set(ele, i); /* set_inline */ } - BM_ITER_INDEX (ele, &iter, bm, BM_FACES_OF_MESH, NULL, i) { + BM_ITER_MESH_INDEX (ele, &iter, bm, BM_FACES_OF_MESH, i) { oldflags = ele->oflags; ele->oflags = BLI_mempool_calloc(newpool); memcpy(ele->oflags, oldflags, old_totflags_size); @@ -1080,19 +1080,19 @@ static void bmo_flag_layer_free(BMesh *bm) bm->toolflagpool = newpool = BLI_mempool_create(new_totflags_size, 512, 512, BLI_MEMPOOL_SYSMALLOC); /* now go through and memcpy all the flag */ - BM_ITER_INDEX (ele, &iter, bm, BM_VERTS_OF_MESH, NULL, i) { + BM_ITER_MESH_INDEX (ele, &iter, bm, BM_VERTS_OF_MESH, i) { oldflags = ele->oflags; ele->oflags = BLI_mempool_calloc(newpool); memcpy(ele->oflags, oldflags, new_totflags_size); BM_elem_index_set(ele, i); /* set_inline */ } - BM_ITER_INDEX (ele, &iter, bm, BM_EDGES_OF_MESH, NULL, i) { + BM_ITER_MESH_INDEX (ele, &iter, bm, BM_EDGES_OF_MESH, i) { oldflags = ele->oflags; ele->oflags = BLI_mempool_calloc(newpool); memcpy(ele->oflags, oldflags, new_totflags_size); BM_elem_index_set(ele, i); /* set_inline */ } - BM_ITER_INDEX (ele, &iter, bm, BM_FACES_OF_MESH, NULL, i) { + BM_ITER_MESH_INDEX (ele, &iter, bm, BM_FACES_OF_MESH, i) { oldflags = ele->oflags; ele->oflags = BLI_mempool_calloc(newpool); memcpy(ele->oflags, oldflags, new_totflags_size); @@ -1115,15 +1115,15 @@ static void bmo_flag_layer_clear(BMesh *bm) const int totflags_offset = bm->totflags - 1; /* now go through and memcpy all the flag */ - BM_ITER_INDEX (ele, &iter, bm, BM_VERTS_OF_MESH, NULL, i) { + BM_ITER_MESH_INDEX (ele, &iter, bm, BM_VERTS_OF_MESH, i) { memset(ele->oflags + totflags_offset, 0, sizeof(BMFlagLayer)); BM_elem_index_set(ele, i); /* set_inline */ } - BM_ITER_INDEX (ele, &iter, bm, BM_EDGES_OF_MESH, NULL, i) { + BM_ITER_MESH_INDEX (ele, &iter, bm, BM_EDGES_OF_MESH, i) { memset(ele->oflags + totflags_offset, 0, sizeof(BMFlagLayer)); BM_elem_index_set(ele, i); /* set_inline */ } - BM_ITER_INDEX (ele, &iter, bm, BM_FACES_OF_MESH, NULL, i) { + BM_ITER_MESH_INDEX (ele, &iter, bm, BM_FACES_OF_MESH, i) { memset(ele->oflags + totflags_offset, 0, sizeof(BMFlagLayer)); BM_elem_index_set(ele, i); /* set_inline */ } diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 869ab4f74e4..971ad96c24a 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -164,7 +164,7 @@ float BM_face_area_calc(BMesh *bm, BMFace *f) BLI_array_fixedstack_declare(verts, BM_NGON_STACK_SIZE, f->len, __func__); - BM_ITER_INDEX (l, &iter, bm, BM_LOOPS_OF_FACE, f, i) { + BM_ITER_ELEM_INDEX (l, &iter, f, BM_LOOPS_OF_FACE, i) { copy_v3_v3(verts[i], l->v->co); } @@ -360,7 +360,7 @@ void BM_vert_normal_update(BMesh *bm, BMVert *v) zero_v3(v->no); - BM_ITER (l, &liter, bm, BM_LOOPS_OF_VERT, v) { + BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) { /* Same calculation used in BM_mesh_normals_update */ sub_v3_v3v3(vec1, l->v->co, l->prev->v->co); sub_v3_v3v3(vec2, l->next->v->co, l->v->co); @@ -384,7 +384,7 @@ void BM_vert_normal_update_all(BMesh *bm, BMVert *v) BMIter iter; BMFace *f; - BM_ITER (f, &iter, bm, BM_FACES_OF_VERT, v) { + BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) { BM_face_normal_update(bm, f); } diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index c615f81f3f8..1238038c67c 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -125,7 +125,7 @@ BMLoop *BM_face_other_vert_loop(BMFace *f, BMVert *v_prev, BMVert *v) BLI_assert(BM_edge_exists(v_prev, v) != NULL); - BM_ITER (l_iter, &liter, NULL, BM_LOOPS_OF_VERT, v) { + BM_ITER_ELEM (l_iter, &liter, v, BM_LOOPS_OF_VERT) { if (l_iter->f == f) { break; } @@ -379,7 +379,7 @@ int BM_vert_edge_count_nonwire(BMVert *v) int count = 0; BMIter eiter; BMEdge *edge; - BM_ITER (edge, &eiter, NULL, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (edge, &eiter, v, BM_EDGES_OF_VERT) { if (edge->l) { count++; } @@ -416,7 +416,7 @@ int BM_vert_face_count(BMVert *v) BMLoop *l; BMIter iter; - BM_ITER (l, &iter, NULL, BM_LOOPS_OF_VERT, v) { + BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { count++; } @@ -877,7 +877,7 @@ BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2) BMIter iter; BMEdge *e; - BM_ITER (e, &iter, NULL, BM_EDGES_OF_VERT, v1) { + BM_ITER_ELEM (e, &iter, v1, BM_EDGES_OF_VERT) { if (e->v1 == v2 || e->v2 == v2) return e; } @@ -902,7 +902,7 @@ int BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_overlap int i, amount; for (i = 0; i < len; i++) { - BM_ITER (f, &viter, bm, BM_FACES_OF_VERT, varr[i]) { + BM_ITER_ELEM (f, &viter, varr[i], BM_FACES_OF_VERT) { amount = BM_verts_in_face(bm, f, varr, len); if (amount >= len) { if (r_overlapface) { @@ -932,7 +932,7 @@ int BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface) int i, amount; for (i = 0; i < len; i++) { - BM_ITER (f, &viter, bm, BM_FACES_OF_VERT, varr[i]) { + BM_ITER_ELEM (f, &viter, varr[i], BM_FACES_OF_VERT) { amount = BM_verts_in_face(bm, f, varr, len); if (amount == len && amount == f->len) { if (r_existface) { @@ -978,15 +978,15 @@ int BM_face_exists_multi(BMesh *bm, BMVert **varr, BMEdge **earr, int len) for (i = 0; i < len; i++) { /* save some time by looping over edge faces rather then vert faces * will still loop over some faces twice but not as many */ - BM_ITER (f, &fiter, bm, BM_FACES_OF_EDGE, earr[i]) { + BM_ITER_ELEM (f, &fiter, earr[i], BM_FACES_OF_EDGE) { BM_elem_flag_disable(f, BM_ELEM_INTERNAL_TAG); - BM_ITER (v, &viter, bm, BM_VERTS_OF_FACE, f) { + BM_ITER_ELEM (v, &viter, f, BM_VERTS_OF_FACE) { BM_elem_flag_disable(v, BM_ELEM_INTERNAL_TAG); } } /* clear all edge tags */ - BM_ITER (e, &fiter, bm, BM_EDGES_OF_VERT, varr[i]) { + BM_ITER_ELEM (e, &fiter, varr[i], BM_EDGES_OF_VERT) { BM_elem_flag_disable(e, BM_ELEM_INTERNAL_TAG); } } @@ -1005,10 +1005,10 @@ int BM_face_exists_multi(BMesh *bm, BMVert **varr, BMEdge **earr, int len) /* 1) tag all faces connected to edges - if all their verts are boundary */ tot_tag = 0; for (i = 0; i < len; i++) { - BM_ITER (f, &fiter, bm, BM_FACES_OF_EDGE, earr[i]) { + BM_ITER_ELEM (f, &fiter, earr[i], BM_FACES_OF_EDGE) { if (!BM_elem_flag_test(f, BM_ELEM_INTERNAL_TAG)) { ok = TRUE; - BM_ITER (v, &viter, bm, BM_VERTS_OF_FACE, f) { + BM_ITER_ELEM (v, &viter, f, BM_VERTS_OF_FACE) { if (!BM_elem_flag_test(v, BM_ELEM_INTERNAL_TAG)) { ok = FALSE; break; @@ -1036,7 +1036,7 @@ int BM_face_exists_multi(BMesh *bm, BMVert **varr, BMEdge **earr, int len) * check each have 2 tagges faces connected (faces that only use 'varr' verts) */ ok = TRUE; for (i = 0; i < len; i++) { - BM_ITER (e, &fiter, bm, BM_EDGES_OF_VERT, varr[i]) { + BM_ITER_ELEM (e, &fiter, varr[i], BM_EDGES_OF_VERT) { if (/* non-boundary edge */ BM_elem_flag_test(e, BM_ELEM_INTERNAL_TAG) == FALSE && @@ -1045,7 +1045,7 @@ int BM_face_exists_multi(BMesh *bm, BMVert **varr, BMEdge **earr, int len) BM_elem_flag_test(e->v2, BM_ELEM_INTERNAL_TAG) == TRUE) { int tot_face_tag = 0; - BM_ITER (f, &fiter, bm, BM_FACES_OF_EDGE, e) { + BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) { if (BM_elem_flag_test(f, BM_ELEM_INTERNAL_TAG)) { tot_face_tag++; } diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c index 6f283116236..113e1ddc164 100644 --- a/source/blender/bmesh/intern/bmesh_walkers_impl.c +++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c @@ -115,7 +115,7 @@ static void bmw_ShellWalker_begin(BMWalker *walker, void *data) /* starting the walk at a vert, add all the edges * to the worklist */ v = (BMVert *)h; - BM_ITER (e, &eiter, walker->bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { bmw_ShellWalker_visitEdge(walker, e); } break; @@ -151,7 +151,7 @@ static void *bmw_ShellWalker_step(BMWalker *walker) for (i = 0; i < 2; i++) { v = i ? e->v2 : e->v1; - BM_ITER (e2, &iter, walker->bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e2, &iter, v, BM_EDGES_OF_VERT) { bmw_ShellWalker_visitEdge(walker, e2); } } @@ -249,7 +249,7 @@ static void *bmw_ConnectedVertexWalker_step(BMWalker *walker) BMW_state_remove(walker); - BM_ITER (e, &iter, walker->bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) { v2 = BM_edge_other_vert(e, v); if (!BLI_ghash_haskey(walker->visithash, v2)) { bmw_ConnectedVertexWalker_visitVertex(walker, v2); @@ -450,7 +450,7 @@ static void bmw_LoopWalker_begin(BMWalker *walker, void *data) BMFace *f_iter; BMFace *f_best = NULL; - BM_ITER (f_iter, &iter, walker->bm, BM_FACES_OF_EDGE, e) { + BM_ITER_ELEM (f_iter, &iter, e, BM_FACES_OF_EDGE) { if (f_best == NULL || f_best->len < f_iter->len) { f_best = f_iter; } @@ -606,7 +606,7 @@ static void *bmw_LoopWalker_step(BMWalker *walker) for (i = 0; i < 2; i++) { v = i ? e->v2 : e->v1; - BM_ITER (nexte, &eiter, walker->bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (nexte, &eiter, v, BM_EDGES_OF_VERT) { if ((nexte->l == NULL) && bmw_mask_check_edge(walker, nexte) && !BLI_ghash_haskey(walker->visithash, nexte)) @@ -953,7 +953,7 @@ static void *bmw_UVEdgeWalker_step(BMWalker *walker) * mloopuv's coordinates. in addition, push on l->next if necessary */ for (i = 0; i < 2; i++) { cl = i ? nl : l; - BM_ITER (l2, &liter, walker->bm, BM_LOOPS_OF_VERT, cl->v) { + BM_ITER_ELEM (l2, &liter, cl->v, BM_LOOPS_OF_VERT) { d1 = CustomData_bmesh_get_layer_n(&walker->bm->ldata, cl->head.data, walker->layer); diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c index dd94e14ba1c..99c70cc7c13 100644 --- a/source/blender/bmesh/operators/bmo_bevel.c +++ b/source/blender/bmesh/operators/bmo_bevel.c @@ -80,7 +80,7 @@ static void calc_corner_co(BMesh *bm, BMLoop *l, const float fac, float r_co[3], copy_v3_v3(l_co_prev, l->prev->v->co); copy_v3_v3(l_co, l->v->co); - BM_ITER (l2, &iter, bm, BM_LOOPS_OF_VERT, l->v) { + BM_ITER_ELEM (l2, &iter, l->v, BM_LOOPS_OF_VERT) { if (l2->f != l->f) { copy_v3_v3(l_co_next, BM_edge_other_vert(l2->e, l2->next->v)->co); break; @@ -228,14 +228,14 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) #endif } - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { BMO_elem_flag_enable(bm, v, VERT_OLD); } #if 0 //a bit of cleaner code that, alas, doens't work. /* build edge tag */ - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (BMO_elem_flag_test(bm, e->v1, BEVEL_FLAG) || BMO_elem_flag_test(bm, e->v2, BEVEL_FLAG)) { BMIter liter; BMLoop *l; @@ -247,14 +247,14 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) BMO_elem_flag_enable(bm, e, EDGE_OLD); } - BM_ITER (l, &liter, bm, BM_LOOPS_OF_EDGE, e) { + BM_ITER_ELEM (l, &liter, e, BM_LOOPS_OF_EDGE) { BMLoop *l2; BMIter liter2; if (BMO_elem_flag_test(bm, l->f, BEVEL_FLAG)) continue; - BM_ITER (l2, &liter2, bm, BM_LOOPS_OF_FACE, l->f) { + BM_ITER_ELEM (l2, &liter2, l->f, BM_LOOPS_OF_FACE) { BM_elem_index_set(l2, BLI_array_count(tags)); /* set_loop */ BLI_array_growone(tags); @@ -299,7 +299,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) /* find all faces surrounding e->v1 and, e->v2 */ for (i = 0; i < 2; i++) { - BM_ITER (l, &liter, bm, BM_LOOPS_OF_VERT, i ? e->v2:e->v1) { + BM_ITER_ELEM (l, &liter, i ? e->v2:e->v1, BM_LOOPS_OF_VERT) { BMLoop *l2; BMIter liter2; @@ -308,7 +308,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) continue; /* create tags for all loops in l-> */ - BM_ITER (l2, &liter2, bm, BM_LOOPS_OF_FACE, l->f) { + BM_ITER_ELEM (l2, &liter2, l->f, BM_LOOPS_OF_FACE) { BLI_array_growone(tags); BM_elem_index_set(l2, BLI_array_count(tags) - 1); /* set_loop */ @@ -329,13 +329,13 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) bm->elem_index_dirty |= BM_EDGE; - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { BMIter eiter; if (!BMO_elem_flag_test(bm, v, BEVEL_FLAG)) continue; - BM_ITER (e, &eiter, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { if (!BMO_elem_flag_test(bm, e, BEVEL_FLAG) && !ETAG_GET(e, v)) { BMVert *v2; float co[3]; @@ -364,7 +364,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) BMO_elem_flag_enable(bm, faces[i], FACE_OLD); - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, faces[i]) { + BM_ITER_ELEM (l, &liter, faces[i], BM_LOOPS_OF_FACE) { float co[3]; if (BMO_elem_flag_test(bm, l->e, BEVEL_FLAG)) { @@ -438,7 +438,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) BLI_array_empty(verts); BLI_array_empty(edges); - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, faces[i]) { + BM_ITER_ELEM (l, &liter, faces[i], BM_LOOPS_OF_FACE) { BMVert *v2; tag = tags + BM_elem_index_get(l); @@ -489,7 +489,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) int j; /* create quad spans between split edge */ - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, faces[i]) { + BM_ITER_ELEM (l, &liter, faces[i], BM_LOOPS_OF_FACE) { BMVert *v1 = NULL, *v2 = NULL, *v3 = NULL, *v4 = NULL; if (!BMO_elem_flag_test(bm, l->e, BEVEL_FLAG)) @@ -516,7 +516,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) BMIter eiter; BMVert *v = j ? v4 : v3; - BM_ITER (e, &eiter, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { if (!BM_vert_in_edge(e, v3) || !BM_vert_in_edge(e, v4)) continue; @@ -600,7 +600,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) BMO_elem_flag_enable(bm, f, FACE_NEW|FACE_SPAN); /* un-tag edges in f for deletio */ - BM_ITER (l2, &liter2, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l2, &liter2, f, BM_LOOPS_OF_FACE) { BMO_elem_flag_disable(bm, l2->e, BEVEL_DEL); } } @@ -611,7 +611,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) } /* fill in holes at vertices */ - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { BMIter eiter; BMVert *vv, *vstart = NULL, *lastv = NULL; SmallHash tmphash; @@ -625,7 +625,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) BLI_array_empty(verts); BLI_array_empty(edges); - BM_ITER (e, &eiter, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { BMIter liter; BMVert *v1 = NULL, *v2 = NULL; BMLoop *l; @@ -637,7 +637,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) continue; rad = 0; - BM_ITER (l, &liter, bm, BM_LOOPS_OF_EDGE, e) { + BM_ITER_ELEM (l, &liter, e, BM_LOOPS_OF_EDGE) { if (!BMO_elem_flag_test(bm, l->f, FACE_OLD)) continue; @@ -685,7 +685,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) vstart = vstart ? vstart : verts[0]; vv = vstart; do { - BM_ITER (e, &eiter, bm, BM_EDGES_OF_VERT, vv) { + BM_ITER_ELEM (e, &eiter, vv, BM_EDGES_OF_VERT) { BMVert *vv2 = BM_edge_other_vert(e, vv); if (vv2 != lastv && BLI_smallhash_haskey(&tmphash, (intptr_t)vv2)) { @@ -730,7 +730,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) lastv = NULL; BLI_array_empty(edges); do { - BM_ITER (e, &eiter, bm, BM_EDGES_OF_VERT, vv) { + BM_ITER_ELEM (e, &eiter, vv, BM_EDGES_OF_VERT) { BMVert *vv2 = BM_edge_other_vert(e, vv); if (vv2 != lastv && BLI_smallhash_haskey(&tmphash, (intptr_t)vv2)) { @@ -787,7 +787,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) BMIter liter; BMFace *f = faces[i]; - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BMLoop *l2; BMIter liter2; @@ -795,7 +795,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) if (!tag->newv) continue; - BM_ITER (l2, &liter2, bm, BM_LOOPS_OF_VERT, tag->newv) { + BM_ITER_ELEM (l2, &liter2, tag->newv, BM_LOOPS_OF_VERT) { if (!BMO_elem_flag_test(bm, l2->f, FACE_NEW) || (l2->v != tag->newv && l2->v != l->v)) continue; @@ -812,7 +812,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) BMLoop *l3; BMIter liter3; - BM_ITER (l3, &liter3, bm, BM_LOOPS_OF_FACE, l2->f) { + BM_ITER_ELEM (l3, &liter3, l2->f, BM_LOOPS_OF_FACE) { BM_loop_interp_multires(bm, l3, l->f); } } @@ -821,7 +821,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) } /* handle vertices along boundary edge */ - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { if (BMO_elem_flag_test(bm, v, VERT_OLD) && BMO_elem_flag_test(bm, v, BEVEL_FLAG) && !BMO_elem_flag_test(bm, v, BEVEL_DEL)) @@ -830,7 +830,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) BMLoop *lorig = NULL; BMIter liter; - BM_ITER (l, &liter, bm, BM_LOOPS_OF_VERT, v) { + BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) { // BMIter liter2; // BMLoop *l2 = l->v == v ? l : l->next, *l3; @@ -843,7 +843,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) if (!lorig) continue; - BM_ITER (l, &liter, bm, BM_LOOPS_OF_VERT, v) { + BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) { BMLoop *l2 = l->v == v ? l : l->next; BM_elem_attrs_copy(bm, bm, lorig->f, l2->f); @@ -853,7 +853,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) } #if 0 /* clean up any remaining 2-edged face */ - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { if (f->len == 2) { BMFace *faces[2] = {f, BM_FACE_FIRST_LOOP(f)->radial_next->f}; @@ -868,7 +868,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) BMO_op_callf(bm, "del geom=%fv context=%i", BEVEL_DEL, DEL_VERTS); /* clean up any edges that might not get properly delete */ - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (BMO_elem_flag_test(bm, e, EDGE_OLD) && !e->l) BMO_elem_flag_enable(bm, e, BEVEL_DEL); } diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c index 98bf22fb833..3c1f10be4c4 100644 --- a/source/blender/bmesh/operators/bmo_connect.c +++ b/source/blender/bmesh/operators/bmo_connect.c @@ -135,7 +135,7 @@ static BMVert *get_outer_vert(BMesh *bm, BMEdge *e) int i; i = 0; - BM_ITER (e2, &iter, bm, BM_EDGES_OF_VERT, e->v1) { + BM_ITER_ELEM (e2, &iter, e->v1, BM_EDGES_OF_VERT) { if (BMO_elem_flag_test(bm, e2, EDGE_MARK)) { i++; } @@ -191,7 +191,7 @@ static void bm_vert_loop_pair(BMesh *bm, BMVert *v1, BMVert *v2, BMLoop **l1, BM if ((v1->e && v1->e->l) && (v2->e && v2->e->l)) { - BM_ITER (l, &liter, bm, BM_LOOPS_OF_VERT, v1) { + BM_ITER_ELEM (l, &liter, v1, BM_LOOPS_OF_VERT) { if (l->prev->v == v2) { *l1 = l; *l2 = l->prev; @@ -241,7 +241,7 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op) do { v = BM_edge_other_vert(e2, v); nexte = NULL; - BM_ITER (e3, &iter, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e3, &iter, v, BM_EDGES_OF_VERT) { if (e3 != e2 && BMO_elem_flag_test(bm, e3, EDGE_MARK)) { if (nexte == NULL) { nexte = e3; @@ -278,7 +278,7 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op) BMO_elem_flag_enable(bm, e2, EDGE_DONE); v = BM_edge_other_vert(e2, v); - BM_ITER (e3, &iter, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e3, &iter, v, BM_EDGES_OF_VERT) { if (e3 != e2 && BMO_elem_flag_test(bm, e3, EDGE_MARK) && !BMO_elem_flag_test(bm, e3, EDGE_DONE)) { break; } diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index a090536fbe0..9e09f71d123 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -225,7 +225,7 @@ static int UNUSED_FUNCTION(rotsys_fill_faces)(BMesh *bm, EdgeData *edata, VertDa SmallHash visithash, *hash = &visithash; int i; - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { BMEdge *e2, *starte; BMVert *startv; int rad, ok; @@ -366,7 +366,7 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata) #define SIGN(n) ((n)<0.0f) - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { BMIter eiter; float no[3], cent[3]; int j, k = 0, totedge = 0; @@ -376,7 +376,7 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata) BLI_array_empty(edges); - BM_ITER (e, &eiter, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { if (BMO_elem_flag_test(bm, e, EDGE_MARK)) { BLI_array_append(edges, e); totedge++; @@ -581,7 +581,7 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata) #if 0 /* create visualizing geometr */ BMVert *lastv; - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { BMVert *v2; BMFace *f; int totedge = BM_vert_edge_count(v); @@ -915,12 +915,12 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op) BM_mesh_elem_index_ensure(bm, BM_VERT); - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BMO_elem_flag_enable(bm, f, ELE_ORIG); } i = 0; - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { BM_elem_index_set(e, i); /* set_inline */ if (!BMO_elem_flag_test(bm, e, EDGE_MARK)) { @@ -1076,7 +1076,7 @@ static BMEdge *edge_next(BMesh *bm, BMEdge *e) int i; for (i = 0; i < 2; i++) { - BM_ITER (e2, &iter, bm, BM_EDGES_OF_VERT, i ? e->v2 : e->v1) { + BM_ITER_ELEM (e2, &iter, i ? e->v2 : e->v1, BM_EDGES_OF_VERT) { if ((BMO_elem_flag_test(bm, e2, EDGE_MARK)) && (!BMO_elem_flag_test(bm, e2, EDGE_VIS)) && (e2 != e)) @@ -1317,7 +1317,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) BMO_ITER (v, &oiter, bm, op, "geom", BM_VERT) { /* count how many flagged edges this vertex uses */ int tot_edges = 0; - BM_ITER (e, &iter, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) { if (BMO_elem_flag_test(bm, e, ELE_NEW)) { tot_edges++; if (tot_edges > 2) { @@ -1392,7 +1392,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) /* now, count how many verts we have */ amount = 0; - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { if (BMO_elem_flag_test(bm, v, ELE_NEW)) { verts[amount] = v; amount++; diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index b69408480d0..3e3dae11ab9 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -93,7 +93,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op) BMIter viter; BMVert *v; - BM_ITER (v, &viter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { BMO_elem_flag_set(bm, v, VERT_MARK, (BM_vert_edge_count(v) != 2)); } } @@ -171,7 +171,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op) BMIter viter; BMVert *v; - BM_ITER (v, &viter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { if (BMO_elem_flag_test(bm, v, VERT_MARK)) { if (BM_vert_edge_count(v) == 2) { BM_vert_collapse_edge(bm, v->e, v, TRUE); @@ -219,7 +219,7 @@ void bmo_dissolve_edgeloop_exec(BMesh *bm, BMOperator *op) } } - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { if (BMO_elem_flag_test(bm, v, VERT_MARK) && BM_vert_edge_count(v) == 2) { BLI_array_append(verts, v); } @@ -257,7 +257,7 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op) int use_verts = BMO_slot_bool_get(op, "use_verts"); if (use_verts) { - BM_ITER (v, &viter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { BMO_elem_flag_set(bm, v, VERT_MARK, (BM_vert_edge_count(v) != 2)); } } @@ -276,7 +276,7 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op) } if (use_verts) { - BM_ITER (v, &viter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { if (BMO_elem_flag_test(bm, v, VERT_MARK)) { if (BM_vert_edge_count(v) == 2) { BM_vert_collapse_edge(bm, v->e, v, TRUE); diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c index 1a067430239..36d446a0a8c 100644 --- a/source/blender/bmesh/operators/bmo_dupe.c +++ b/source/blender/bmesh/operators/bmo_dupe.c @@ -163,8 +163,8 @@ static BMFace *copy_face(BMOperator *op, BMesh *source_mesh, BMO_elem_flag_enable(target_mesh, target_face, DUPE_NEW); /* copy per-loop custom data */ - BM_ITER (source_loop, &iter, source_mesh, BM_LOOPS_OF_FACE, source_face) { - BM_ITER (target_loop, &iter2, target_mesh, BM_LOOPS_OF_FACE, target_face) { + BM_ITER_ELEM (source_loop, &iter, source_face, BM_LOOPS_OF_FACE) { + BM_ITER_ELEM (target_loop, &iter2, target_face, BM_LOOPS_OF_FACE) { if (BLI_ghash_lookup(vhash, source_loop->v) == target_loop->v) { BM_elem_attrs_copy(source_mesh, target_mesh, source_loop, target_loop); break; @@ -201,7 +201,7 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target) ehash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh dupeops e"); /* duplicate flagged vertices */ - BM_ITER (v, &viter, source, BM_VERTS_OF_MESH, source) { + BM_ITER_MESH (v, &viter, source, BM_VERTS_OF_MESH) { if (BMO_elem_flag_test(source, v, DUPE_INPUT) && !BMO_elem_flag_test(source, v, DUPE_DONE)) { @@ -210,7 +210,7 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target) v2 = copy_vertex(source, v, target, vhash); - BM_ITER (f, &iter, source, BM_FACES_OF_VERT, v) { + BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) { if (BMO_elem_flag_test(source, f, DUPE_INPUT)) { isolated = 0; break; @@ -218,7 +218,7 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target) } if (isolated) { - BM_ITER (e, &iter, source, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) { if (BMO_elem_flag_test(source, e, DUPE_INPUT)) { isolated = 0; break; @@ -235,7 +235,7 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target) } /* now we dupe all the edges */ - BM_ITER (e, &eiter, source, BM_EDGES_OF_MESH, source) { + BM_ITER_MESH (e, &eiter, source, BM_EDGES_OF_MESH) { if (BMO_elem_flag_test(source, e, DUPE_INPUT) && !BMO_elem_flag_test(source, e, DUPE_DONE)) { @@ -255,10 +255,10 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target) } /* first we dupe all flagged faces and their elements from source */ - BM_ITER (f, &fiter, source, BM_FACES_OF_MESH, source) { + BM_ITER_MESH (f, &fiter, source, BM_FACES_OF_MESH) { if (BMO_elem_flag_test(source, f, DUPE_INPUT)) { /* vertex pass */ - BM_ITER (v, &viter, source, BM_VERTS_OF_FACE, f) { + BM_ITER_ELEM (v, &viter, f, BM_VERTS_OF_FACE) { if (!BMO_elem_flag_test(source, v, DUPE_DONE)) { copy_vertex(source, v, target, vhash); BMO_elem_flag_enable(source, v, DUPE_DONE); @@ -266,7 +266,7 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target) } /* edge pass */ - BM_ITER (e, &eiter, source, BM_EDGES_OF_FACE, f) { + BM_ITER_ELEM (e, &eiter, f, BM_EDGES_OF_FACE) { if (!BMO_elem_flag_test(source, e, DUPE_DONE)) { copy_edge(op, source, e, target, vhash, ehash); BMO_elem_flag_enable(source, e, DUPE_DONE); diff --git a/source/blender/bmesh/operators/bmo_edgesplit.c b/source/blender/bmesh/operators/bmo_edgesplit.c index 05703ce1933..ccbcb293915 100644 --- a/source/blender/bmesh/operators/bmo_edgesplit.c +++ b/source/blender/bmesh/operators/bmo_edgesplit.c @@ -60,7 +60,7 @@ static void bm_edgesplit_validate_seams(BMesh *bm, BMOperator *op) vtouch = MEM_callocN(sizeof(char) * bm->totvert, __func__); /* tag all boundary verts so as not to untag an edge which is inbetween only 2 faces [] */ - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { /* unrelated to flag assignment in this function - since this is the * only place we loop over all edges, disable tag */ diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index af62abaeec9..4124eafda74 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -62,7 +62,7 @@ void bmo_extrude_face_indiv_exec(BMesh *bm, BMOperator *op) i = 0; firstv = lastv = NULL; - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { v = BM_vert_create(bm, l->v->co, l->v); /* skip on the first iteration */ @@ -93,7 +93,7 @@ void bmo_extrude_face_indiv_exec(BMesh *bm, BMOperator *op) BM_elem_attrs_copy(bm, bm, f, f2); l2 = BM_iter_new(&liter2, bm, BM_LOOPS_OF_FACE, f2); - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BM_elem_attrs_copy(bm, bm, l, l2); l3 = l->next; @@ -258,7 +258,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) /* if one flagged face is bordered by an un-flagged face, then we delete * original geometry unless caller explicitly asked to keep it. */ if (!BMO_slot_bool_get(op, "alwayskeeporig")) { - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { int edge_face_tot; @@ -269,7 +269,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) found = FALSE; /* found a face that isn't input? */ edge_face_tot = 0; /* edge/face count */ - BM_ITER (f, &fiter, bm, BM_FACES_OF_EDGE, e) { + BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) { if (!BMO_elem_flag_test(bm, f, EXT_INPUT)) { found = TRUE; delorig = TRUE; @@ -287,10 +287,10 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) } /* calculate verts to delete */ - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { found = FALSE; - BM_ITER (e, &viter, bm, BM_EDGES_OF_VERT, v) { + 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)) { found = TRUE; break; @@ -299,7 +299,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) /* avoid an extra loop */ if (found == TRUE) { - BM_ITER (f, &viter, bm, BM_FACES_OF_VERT, v) { + BM_ITER_ELEM (f, &viter, v, BM_FACES_OF_VERT) { if (!BMO_elem_flag_test(bm, f, EXT_INPUT)) { found = TRUE; break; @@ -312,7 +312,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) } } - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { if (BMO_elem_flag_test(bm, f, EXT_INPUT)) { BMO_elem_flag_enable(bm, f, EXT_DEL); } @@ -335,7 +335,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) /* if not delorig, reverse loops of original face */ if (!delorig) { - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { if (BMO_elem_flag_test(bm, f, EXT_INPUT)) { BM_face_normal_flip(bm, f); } @@ -418,18 +418,18 @@ static void calc_solidify_normals(BMesh *bm) /* can't use BM_edge_face_count because we need to count only marked faces */ int *edge_face_count = MEM_callocN(sizeof(int) * bm->totedge, __func__); - BM_ITER (v, &viter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { BM_elem_flag_enable(v, BM_ELEM_TAG); } BM_mesh_elem_index_ensure(bm, BM_EDGE); - BM_ITER (f, &fiter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { if (!BMO_elem_flag_test(bm, f, FACE_MARK)) { continue; } - BM_ITER (e, &eiter, bm, BM_EDGES_OF_FACE, f) { + BM_ITER_ELEM (e, &eiter, f, BM_EDGES_OF_FACE) { /* And mark all edges and vertices on the * marked faces */ @@ -440,7 +440,7 @@ static void calc_solidify_normals(BMesh *bm) } } - BM_ITER (e, &eiter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) { if (!BMO_elem_flag_test(bm, e, EDGE_MARK)) { continue; } @@ -458,7 +458,7 @@ static void calc_solidify_normals(BMesh *bm) MEM_freeN(edge_face_count); edge_face_count = NULL; /* don't re-use */ - BM_ITER (v, &viter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { if (!BM_vert_is_manifold(v)) { BMO_elem_flag_enable(bm, v, VERT_NONMAN); continue; @@ -469,7 +469,7 @@ static void calc_solidify_normals(BMesh *bm) } } - BM_ITER (e, &eiter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) { /* If the edge is not part of a the solidify region * its normal should not be considered */ @@ -485,7 +485,7 @@ static void calc_solidify_normals(BMesh *bm) f1 = f2 = NULL; - BM_ITER (f, &fiter, bm, BM_FACES_OF_EDGE, e) { + BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) { if (BMO_elem_flag_test(bm, f, FACE_MARK)) { if (f1 == NULL) { f1 = f; @@ -530,7 +530,7 @@ static void calc_solidify_normals(BMesh *bm) } /* normalize accumulated vertex normal */ - BM_ITER (v, &viter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { if (!BMO_elem_flag_test(bm, v, VERT_MARK)) { continue; } @@ -542,7 +542,7 @@ static void calc_solidify_normals(BMesh *bm) else if (normalize_v3(v->no) == 0.0f && !BM_elem_flag_test(v, BM_ELEM_TAG)) { /* exceptional case, totally flat. use the normal * of any marked face around the vertex */ - BM_ITER (f, &fiter, bm, BM_FACES_OF_VERT, v) { + BM_ITER_ELEM (f, &fiter, v, BM_FACES_OF_VERT) { if (BMO_elem_flag_test(bm, f, FACE_MARK)) { break; } @@ -571,13 +571,13 @@ static void solidify_add_thickness(BMesh *bm, const float dist) BM_mesh_elem_index_ensure(bm, BM_VERT); - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { if (!BMO_elem_flag_test(bm, f, FACE_MARK)) { continue; } BLI_array_growitems(verts, f->len); - BM_ITER_INDEX (l, &loopIter, bm, BM_LOOPS_OF_FACE, f, i) { + BM_ITER_ELEM_INDEX (l, &loopIter, f, BM_LOOPS_OF_FACE, i) { verts[i] = l->v->co; } @@ -585,7 +585,7 @@ static void solidify_add_thickness(BMesh *bm, const float dist) angle_poly_v3(face_angles, (const float **)verts, f->len); i = 0; - BM_ITER (l, &loopIter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &loopIter, f, BM_LOOPS_OF_FACE) { v = l->v; index = BM_elem_index_get(v); vert_accum[index] += face_angles[i]; @@ -597,7 +597,7 @@ static void solidify_add_thickness(BMesh *bm, const float dist) BLI_array_empty(face_angles); } - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { index = BM_elem_index_get(v); if (vert_accum[index]) { /* zero if unselected */ madd_v3_v3fl(v->co, v->no, dist * (vert_angles[index] / vert_accum[index])); diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c index 38fa7237e9c..4e4ea655414 100644 --- a/source/blender/bmesh/operators/bmo_inset.c +++ b/source/blender/bmesh/operators/bmo_inset.c @@ -122,7 +122,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op) /* first count all inset edges we will split */ /* fill in array and initialize tagging */ - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if ( /* tag if boundary is enabled */ (use_boundary && BM_edge_is_boundary(e) && BM_elem_flag_test(e->l->f, BM_ELEM_TAG)) || @@ -152,7 +152,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op) /* fill in array and initialize tagging */ es = edge_info; - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { i = BM_elem_index_get(e); if (i != -1) { /* calc edge-split info */ @@ -246,7 +246,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op) int vecpair[2]; /* find adjacent */ - BM_ITER (e, &iter, bm, BM_EDGES_OF_VERT, v_split) { + BM_ITER_ELEM (e, &iter, v_split, BM_EDGES_OF_VERT) { if (BM_elem_flag_test(e, BM_ELEM_TAG) && e->l && BM_elem_flag_test(e->l->f, BM_ELEM_TAG)) { @@ -411,7 +411,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op) if (r_vout_len > 2) { int ok = TRUE; /* last step, NULL this vertex if has a tagged face */ - BM_ITER (f, &iter, bm, BM_FACES_OF_VERT, v_split) { + BM_ITER_ELEM (f, &iter, v_split, BM_FACES_OF_VERT) { if (BM_elem_flag_test(f, BM_ELEM_TAG)) { ok = FALSE; break; diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c index a31b635021b..c8c36f94c0c 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.c +++ b/source/blender/bmesh/operators/bmo_join_triangles.c @@ -239,13 +239,13 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) /* flag all edges of all input face */ BMO_ITER (f1, &siter, bm, op, "faces", BM_FACE) { BMO_elem_flag_enable(bm, f1, FACE_INPUT); - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f1) { + BM_ITER_ELEM (l, &liter, f1, BM_LOOPS_OF_FACE) { BMO_elem_flag_enable(bm, l->e, EDGE_MARK); } } /* unflag edges that are invalid; e.g. aren't surrounded by triangle */ - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (!BMO_elem_flag_test(bm, e, EDGE_MARK)) continue; @@ -266,7 +266,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) } i = 0; - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { BMVert *v1, *v2, *v3, *v4; BMFace *f1, *f2; float measure; @@ -323,7 +323,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) BMO_elem_flag_enable(bm, e, EDGE_CHOSEN); } - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (!BMO_elem_flag_test(bm, e, EDGE_CHOSEN)) continue; @@ -332,7 +332,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) BM_faces_join_pair(bm, f1, f2, e, TRUE); } - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (BMO_elem_flag_test(bm, e, EDGE_MARK)) { /* ok, this edge wasn't merged, check if it's * in a 2-tri-pair island, and if so merg */ @@ -344,7 +344,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) continue; for (i = 0; i < 2; i++) { - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, i ? f2 : f1) { + BM_ITER_ELEM (l, &liter, i ? f2 : f1, BM_LOOPS_OF_FACE) { if (l->e != e && BMO_elem_flag_test(bm, l->e, EDGE_MARK)) { break; } diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c index 003cb49164f..cf1669d441e 100644 --- a/source/blender/bmesh/operators/bmo_mirror.c +++ b/source/blender/bmesh/operators/bmo_mirror.c @@ -102,7 +102,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op) BMIter liter; BMO_ITER (f, &siter, bm, &dupeop, "newout", BM_FACE) { - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { totlayer = CustomData_number_of_layers(&bm->ldata, CD_MLOOPUV); for (i = 0; i < totlayer; i++) { luv = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPUV, i); diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index ec2504c3976..e526e2eaca0 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -370,7 +370,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) } /* and now do imat */ - BM_ITER (eve, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { if (BMO_elem_flag_test(bm, eve, VERT_MARK)) { mul_m4_v3(mat, eve->co); } @@ -415,7 +415,7 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op) eftemp = BM_face_create_quad_tri(bm, v1, v2, v3, NULL, NULL, FALSE); - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, eftemp) { + BM_ITER_ELEM (l, &liter, eftemp, BM_LOOPS_OF_FACE) { BMO_elem_flag_enable(bm, l->e, EDGE_MARK); } @@ -437,7 +437,7 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op) } /* must transform after because of sphere subdivision */ - BM_ITER (v, &viter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { if (BMO_elem_flag_test(bm, v, VERT_MARK)) { mul_m4_v3(mat, v->co); } diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c index 3eec9437299..8cdb3b9b373 100644 --- a/source/blender/bmesh/operators/bmo_removedoubles.c +++ b/source/blender/bmesh/operators/bmo_removedoubles.c @@ -43,7 +43,7 @@ static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op) BMVert *v2, *doub; int split = FALSE; - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", l->v); /* ok: if v2 is NULL (e.g. not in the map) then it's * a target vert, otherwise it's a double */ @@ -108,7 +108,7 @@ void bmo_weldverts_exec(BMesh *bm, BMOperator *op) int a, b; /* mark merge verts for deletion */ - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { if ((v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", v))) { BMO_elem_flag_enable(bm, v, ELE_DEL); @@ -119,11 +119,11 @@ void bmo_weldverts_exec(BMesh *bm, BMOperator *op) /* check if any faces are getting their own corners merged together, split face if so */ - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { remdoubles_splitface(f, bm, op); } - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (BMO_elem_flag_test(bm, e->v1, ELE_DEL) || BMO_elem_flag_test(bm, e->v2, ELE_DEL)) { v = BMO_slot_map_ptr_get(bm, op, "targetmap", e->v1); v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", e->v2); @@ -143,9 +143,9 @@ void bmo_weldverts_exec(BMesh *bm, BMOperator *op) } /* BMESH_TODO, stop abusing face index here */ - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BM_elem_index_set(f, 0); /* set_dirty! */ - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { if (BMO_elem_flag_test(bm, l->v, ELE_DEL)) { BMO_elem_flag_enable(bm, f, FACE_MARK|ELE_DEL); } @@ -158,7 +158,7 @@ void bmo_weldverts_exec(BMesh *bm, BMOperator *op) /* faces get "modified" by creating new faces here, then at the end the old faces are deleted */ - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { if (!BMO_elem_flag_test(bm, f, FACE_MARK)) continue; @@ -170,7 +170,7 @@ void bmo_weldverts_exec(BMesh *bm, BMOperator *op) BLI_array_empty(edges); BLI_array_empty(loops); a = 0; - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { v = l->v; v2 = l->next->v; if (BMO_elem_flag_test(bm, v, ELE_DEL)) { @@ -218,7 +218,7 @@ void bmo_weldverts_exec(BMesh *bm, BMOperator *op) BM_elem_attrs_copy(bm, bm, f, f2); a = 0; - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f2) { + BM_ITER_ELEM (l, &liter, f2, BM_LOOPS_OF_FACE) { l2 = loops[a]; BM_elem_attrs_copy(bm, bm, l2, l); @@ -269,7 +269,7 @@ void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op) return; fac = 1.0f / tot; - BM_ITER (l, &iter, bm, BM_LOOPS_OF_VERT, snapv) { + BM_ITER_ELEM (l, &iter, snapv, BM_LOOPS_OF_VERT) { if (!firstl) { firstl = l; } @@ -291,7 +291,7 @@ void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op) } BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) { - BM_ITER (l, &iter, bm, BM_LOOPS_OF_VERT, v) { + BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { if (l == firstl) { continue; } @@ -319,7 +319,7 @@ void bmo_vert_average_facedata_exec(BMesh *bm, BMOperator *op) CustomData_data_initminmax(type, &min, &max); BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) { - BM_ITER (l, &iter, bm, BM_LOOPS_OF_VERT, v) { + BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { block = CustomData_bmesh_get_layer_n(&bm->ldata, l->head.data, i); CustomData_data_dominmax(type, block, &min, &max); } @@ -330,7 +330,7 @@ void bmo_vert_average_facedata_exec(BMesh *bm, BMOperator *op) CustomData_data_add(type, &min, &max); BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) { - BM_ITER (l, &iter, bm, BM_LOOPS_OF_VERT, v) { + BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { block = CustomData_bmesh_get_layer_n(&bm->ldata, l->head.data, i); CustomData_data_copy_value(type, &min, block); } @@ -384,7 +384,7 @@ void bmo_collapse_exec(BMesh *bm, BMOperator *op) BMW_FLAG_NOP, /* no need to use BMW_FLAG_TEST_HIDDEN, already marked data */ BMW_NIL_LAY); - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (!BMO_elem_flag_test(bm, e, EDGE_MARK)) continue; @@ -444,8 +444,8 @@ static void bmo_collapsecon_do_layer(BMesh *bm, BMOperator *op, int layer) BMW_FLAG_NOP, /* no need to use BMW_FLAG_TEST_HIDDEN, already marked data */ layer); - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { if (BMO_elem_flag_test(bm, l->e, EDGE_MARK)) { /* walk */ BLI_array_empty(blocks); @@ -583,7 +583,7 @@ void bmo_automerge_exec(BMesh *bm, BMOperator *op) * can be merged away into any other verts. Mark all other verts * as VERT_KEEP. */ BMO_slot_buffer_flag_enable(bm, op, "verts", BM_VERT, VERT_IN); - BM_ITER (v, &viter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { if (!BMO_elem_flag_test(bm, v, VERT_IN)) { BMO_elem_flag_enable(bm, v, VERT_KEEP); } diff --git a/source/blender/bmesh/operators/bmo_slide.c b/source/blender/bmesh/operators/bmo_slide.c index 4b1c2b56f05..57bda579603 100644 --- a/source/blender/bmesh/operators/bmo_slide.c +++ b/source/blender/bmesh/operators/bmo_slide.c @@ -88,7 +88,7 @@ void bmo_vertex_slide_exec(BMesh *bm, BMOperator *op) } /* Make sure we get the correct edge. */ - BM_ITER (edge, &iter, bm, BM_EDGES_OF_VERT, vertex) { + BM_ITER_ELEM (edge, &iter, vertex, BM_EDGES_OF_VERT) { if (BMO_elem_flag_test(bm, edge, EDGE_MARK) && BM_vert_in_edge(edge, vertex)) { slide_edge = edge; break; diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index 3d148d6268f..b5ca85ebe81 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -742,7 +742,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) BM_data_layer_add(bmesh, &bmesh->vdata, CD_SHAPEKEY); skey = CustomData_number_of_layers(&bmesh->vdata, CD_SHAPEKEY) - 1; - BM_ITER (v, &viter, bmesh, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &viter, bmesh, BM_VERTS_OF_MESH) { float *co = CustomData_bmesh_get_n(&bmesh->vdata, v->head.data, CD_SHAPEKEY, skey); copy_v3_v3(co, v->co); } @@ -768,7 +768,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) BM_EDGE, EDGE_PERCENT); - BM_ITER (face, &fiter, bmesh, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (face, &fiter, bmesh, BM_FACES_OF_MESH) { BMEdge *e1 = NULL, *e2 = NULL; float vec1[3], vec2[3]; @@ -783,7 +783,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) matched = 0; totesel = 0; - BM_ITER_INDEX (nl, &liter, bmesh, BM_LOOPS_OF_FACE, face, i) { + BM_ITER_ELEM_INDEX (nl, &liter, face, BM_LOOPS_OF_FACE, i) { edges[i] = nl->e; verts[i] = nl->v; @@ -894,7 +894,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) } /* copy original-geometry displacements to current coordinates */ - BM_ITER (v, &viter, bmesh, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &viter, bmesh, BM_VERTS_OF_MESH) { float *co = CustomData_bmesh_get_n(&bmesh->vdata, v->head.data, CD_SHAPEKEY, skey); copy_v3_v3(v->co, co); } @@ -916,7 +916,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) BLI_array_empty(splits); /* for case of two edges, connecting them shouldn't be too hard */ - BM_ITER (l, &liter, bmesh, BM_LOOPS_OF_FACE, face) { + BM_ITER_ELEM (l, &liter, face, BM_LOOPS_OF_FACE) { BLI_array_growone(loops); loops[BLI_array_count(loops) - 1] = l; } @@ -1003,7 +1003,7 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op) } /* copy original-geometry displacements to current coordinates */ - BM_ITER (v, &viter, bmesh, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &viter, bmesh, BM_VERTS_OF_MESH) { float *co = CustomData_bmesh_get_n(&bmesh->vdata, v->head.data, CD_SHAPEKEY, skey); copy_v3_v3(v->co, co); } @@ -1064,7 +1064,7 @@ void BM_mesh_esubdivideflag(Object *UNUSED(obedit), BMesh *bm, int flag, float s BMEdge *e; BMIter eiter; - BM_ITER (e, &eiter, bm, BM_EDGES_OF_VERT, ele) { + BM_ITER_ELEM (e, &eiter, ele, BM_EDGES_OF_VERT) { if (!BM_elem_flag_test(e, BM_ELEM_SELECT) && BM_elem_flag_test(e->v1, BM_ELEM_SELECT) && BM_elem_flag_test(e->v2, BM_ELEM_SELECT)) diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c index 33c4cfc45e8..916b10d707e 100644 --- a/source/blender/bmesh/operators/bmo_triangulate.c +++ b/source/blender/bmesh/operators/bmo_triangulate.c @@ -103,7 +103,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op) while (!stop) { stop = 1; - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { BMVert *v1, *v2, *v3, *v4; if (!BM_edge_is_manifold(e) || BMO_elem_flag_test(bm, e, EDGE_MARK)) { @@ -206,7 +206,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op) BMIter liter; BMO_elem_flag_enable(bm, f, ELE_NEW); - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { if (!BMO_elem_flag_test(bm, l->e, EDGE_MARK)) { BMO_elem_flag_enable(bm, l->e, ELE_NEW); } diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c index b35bcc8eaec..30bb1d2913d 100644 --- a/source/blender/bmesh/operators/bmo_utils.c +++ b/source/blender/bmesh/operators/bmo_utils.c @@ -181,13 +181,13 @@ static void bmo_regionextend_extend(BMesh *bm, BMOperator *op, int usefaces) if (!usefaces) { BMO_ITER (v, &siter, bm, op, "geom", BM_VERT) { - BM_ITER (e, &eiter, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { if (!BMO_elem_flag_test(bm, e, SEL_ORIG)) break; } if (e) { - BM_ITER (e, &eiter, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { BMO_elem_flag_enable(bm, e, SEL_FLAG); BMO_elem_flag_enable(bm, BM_edge_other_vert(e, v), SEL_FLAG); } @@ -200,8 +200,8 @@ static void bmo_regionextend_extend(BMesh *bm, BMOperator *op, int usefaces) BMLoop *l; BMO_ITER (f, &siter, bm, op, "geom", BM_FACE) { - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { - BM_ITER (f2, &fiter, bm, BM_FACES_OF_EDGE, l->e) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { + BM_ITER_ELEM (f2, &fiter, l->e, BM_FACES_OF_EDGE) { if (!BMO_elem_flag_test(bm, f2, SEL_ORIG)) { BMO_elem_flag_enable(bm, f2, SEL_FLAG); } @@ -220,7 +220,7 @@ static void bmo_regionextend_constrict(BMesh *bm, BMOperator *op, int usefaces) if (!usefaces) { BMO_ITER (v, &siter, bm, op, "geom", BM_VERT) { - BM_ITER (e, &eiter, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { if (!BMO_elem_flag_test(bm, e, SEL_ORIG)) break; } @@ -228,7 +228,7 @@ static void bmo_regionextend_constrict(BMesh *bm, BMOperator *op, int usefaces) if (e) { BMO_elem_flag_enable(bm, v, SEL_FLAG); - BM_ITER (e, &eiter, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { BMO_elem_flag_enable(bm, e, SEL_FLAG); } @@ -241,8 +241,8 @@ static void bmo_regionextend_constrict(BMesh *bm, BMOperator *op, int usefaces) BMLoop *l; BMO_ITER (f, &siter, bm, op, "geom", BM_FACE) { - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { - BM_ITER (f2, &fiter, bm, BM_FACES_OF_EDGE, l->e) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { + BM_ITER_ELEM (f2, &fiter, l->e, BM_FACES_OF_EDGE) { if (!BMO_elem_flag_test(bm, f2, SEL_ORIG)) { BMO_elem_flag_enable(bm, f, SEL_FLAG); break; @@ -358,8 +358,8 @@ void bmo_righthandfaces_exec(BMesh *bm, BMOperator *op) f = fstack[i]; i--; - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { - BM_ITER (l2, &liter2, bm, BM_LOOPS_OF_LOOP, l) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { + BM_ITER_ELEM (l2, &liter2, l, BM_LOOPS_OF_LOOP) { if (!BMO_elem_flag_test(bm, l2->f, FACE_FLAG) || l2 == l) continue; @@ -424,7 +424,7 @@ void bmo_vertexsmooth_exec(BMesh *bm, BMOperator *op) co = cos[i]; j = 0; - BM_ITER (e, &iter, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) { co2 = BM_edge_other_vert(e, v)->co; add_v3_v3v3(co, co, co2); j += 1; @@ -475,7 +475,7 @@ static float ngon_fake_area(BMesh *bm, BMFace *f) BM_face_center_mean_calc(bm, f, c); - BM_ITER (l, &liter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { if (num_verts == 0) { copy_v3_v3(v, l->v->co); copy_v3_v3(sv, l->v->co); @@ -545,7 +545,7 @@ void bmo_similarfaces_exec(BMesh *bm, BMOperator *op) f_ext = (SimSel_FaceExt *)MEM_callocN(sizeof(SimSel_FaceExt) * num_total, "f_ext util.c"); /* loop through all the faces and fill the faces/indices structure */ - BM_ITER (fm, &fm_iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (fm, &fm_iter, bm, BM_FACES_OF_MESH) { f_ext[i].f = fm; if (BMO_elem_flag_test(bm, fm, FACE_MARK)) { indices[idx] = i; @@ -673,7 +673,7 @@ static float edge_angle(BMesh *bm, BMEdge *e) /* first edge faces, don't account for 3+ */ - BM_ITER (f, &fiter, bm, BM_FACES_OF_EDGE, e) { + BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) { if (f_prev == NULL) { f_prev = f; } @@ -733,7 +733,7 @@ void bmo_similaredges_exec(BMesh *bm, BMOperator *op) e_ext = (SimSel_EdgeExt *)MEM_callocN(sizeof(SimSel_EdgeExt) * num_total, "e_ext util.c"); /* loop through all the edges and fill the edges/indices structure */ - BM_ITER (e, &e_iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &e_iter, bm, BM_EDGES_OF_MESH) { e_ext[i].e = e; if (BMO_elem_flag_test(bm, e, EDGE_MARK)) { indices[idx] = i; @@ -897,7 +897,7 @@ void bmo_similarverts_exec(BMesh *bm, BMOperator *op) v_ext = (SimSel_VertExt *)MEM_mallocN(sizeof(SimSel_VertExt) * num_total, "vertex extra"); /* loop through all the vertices and fill the vertices/indices structure */ - BM_ITER (v, &v_iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &v_iter, bm, BM_VERTS_OF_MESH) { v_ext[i].v = v; if (BMO_elem_flag_test(bm, v, VERT_MARK)) { indices[idx] = i; @@ -993,7 +993,7 @@ void bmo_face_rotateuvs_exec(BMesh *bm, BMOperator *op) float t_uv[2]; /* tmp uvs */ int n = 0; - BM_ITER (lf, &l_iter, bm, BM_LOOPS_OF_FACE, fs) { + BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) { /* current loop uv is the previous loop uv */ MLoopUV *luv = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPUV); if (n == 0) { @@ -1017,7 +1017,7 @@ void bmo_face_rotateuvs_exec(BMesh *bm, BMOperator *op) float t_uv[2]; /* current uvs */ int n = 0; - BM_ITER (lf, &l_iter, bm, BM_LOOPS_OF_FACE, fs) { + BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) { /* previous loop uv is the current loop uv */ luv = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPUV); if (n == 0) { @@ -1058,7 +1058,7 @@ void bmo_face_reverseuvs_exec(BMesh *bm, BMOperator *op) BLI_array_empty(uvs); BLI_array_growitems(uvs, fs->len); - BM_ITER_INDEX (lf, &l_iter, bm, BM_LOOPS_OF_FACE, fs, i) { + BM_ITER_ELEM_INDEX (lf, &l_iter, fs, BM_LOOPS_OF_FACE, i) { MLoopUV *luv = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPUV); /* current loop uv is the previous loop uv */ @@ -1067,7 +1067,7 @@ void bmo_face_reverseuvs_exec(BMesh *bm, BMOperator *op) /* now that we have the uvs in the array, reverse! */ i = 0; - BM_ITER (lf, &l_iter, bm, BM_LOOPS_OF_FACE, fs) { + BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) { /* current loop uv is the previous loop uv */ MLoopUV *luv = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPUV); luv->uv[0] = uvs[(fs->len - i - 1)][0]; @@ -1102,7 +1102,7 @@ void bmo_rotatecolors_exec(BMesh *bm, BMOperator *op) MLoopCol t_col; /* tmp color */ int n = 0; - BM_ITER (lf, &l_iter, bm, BM_LOOPS_OF_FACE, fs) { + BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) { /* current loop color is the previous loop color */ MLoopCol *luv = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPCOL); if (n == 0) { @@ -1126,7 +1126,7 @@ void bmo_rotatecolors_exec(BMesh *bm, BMOperator *op) MLoopCol t_col; /* current color */ int n = 0; - BM_ITER (lf, &l_iter, bm, BM_LOOPS_OF_FACE, fs) { + BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) { /* previous loop color is the current loop color */ lcol = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPCOL); if (n == 0) { @@ -1164,7 +1164,7 @@ void bmo_face_reversecolors_exec(BMesh *bm, BMOperator *op) int i = 0; BLI_array_empty(cols); - BM_ITER (lf, &l_iter, bm, BM_LOOPS_OF_FACE, fs) { + BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) { MLoopCol *lcol = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPCOL); /* current loop uv is the previous loop color */ @@ -1175,7 +1175,7 @@ void bmo_face_reversecolors_exec(BMesh *bm, BMOperator *op) /* now that we have the uvs in the array, reverse! */ i = 0; - BM_ITER (lf, &l_iter, bm, BM_LOOPS_OF_FACE, fs) { + BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) { /* current loop uv is the previous loop color */ MLoopCol *lcol = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPCOL); *lcol = cols[(fs->len - i - 1)]; @@ -1227,7 +1227,7 @@ void bmo_vertexshortestpath_exec(BMesh *bm, BMOperator *op) /* iterate through all the mesh vertices */ /* loop through all the vertices and fill the vertices/indices structure */ i = 0; - BM_ITER (v, &v_iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &v_iter, bm, BM_VERTS_OF_MESH) { vert_list[i].v = v; vert_list[i].parent = NULL; vert_list[i].weight = FLT_MAX; @@ -1262,7 +1262,7 @@ void bmo_vertexshortestpath_exec(BMesh *bm, BMOperator *op) v_weight = vert_list[BM_elem_index_get(v)].weight; - BM_ITER (e, &e_i, bm, BM_EDGES_OF_VERT, v) { + BM_ITER_ELEM (e, &e_i, v, BM_EDGES_OF_VERT) { BMVert *u; float e_weight = v_weight; diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c index 307136c504c..02ae75c5d9a 100644 --- a/source/blender/bmesh/tools/BME_bevel.c +++ b/source/blender/bmesh/tools/BME_bevel.c @@ -661,7 +661,7 @@ static BMFace *BME_bevel_poly(BMesh *bm, BMFace *f, float value, int options, BM zero_v3(up_vec); /* find a good normal for this face (there's better ways, I'm sure) */ - BM_ITER (l, &iter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) { BME_bevel_get_vec(vec1, l->v, l->next->v, td); BME_bevel_get_vec(vec2, l->prev->v, l->v, td); cross_v3_v3v3(vec3, vec2, vec1); @@ -690,7 +690,7 @@ static BMFace *BME_bevel_poly(BMesh *bm, BMFace *f, float value, int options, BM /* max pass */ if (value > 0.5f && max > 0) { max = -1; - BM_ITER (l, &iter, bm, BM_LOOPS_OF_FACE, f) { + BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) { if (BMO_elem_flag_test(bm, l->e, BME_BEVEL_BEVEL) || BMO_elem_flag_test(bm, l->e, BME_BEVEL_ORIG)) { BME_bevel_get_vec(vec1, l->v, l->next->v, td); vtd1 = BME_get_transdata(td, l->v); @@ -788,13 +788,13 @@ static float UNUSED_FUNCTION(BME_bevel_get_angle_vert)(BMesh *bm, BMVert *v) float angle_diff = 0.0f; - BM_ITER (l, &iter, bm, BM_LOOPS_OF_VERT, v) { + BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { BM_loop_face_normal(l, n_tmp); madd_v3_v3fl(n, n_tmp, BM_loop_face_angle(l)); } normalize_v3(n); - BM_ITER (l, &iter, bm, BM_LOOPS_OF_VERT, v) { + BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { /* could cache from before */ BM_loop_face_normal(l, n_tmp); angle_diff += angle_normalized_v3v3(n, n_tmp) * (BM_loop_face_angle(l) * (float)(M_PI * 0.5)); @@ -848,7 +848,7 @@ static void bevel_init_verts(BMesh *bm, int options, float angle, BME_TransData_ // const float threshold = (options & BME_BEVEL_ANGLE) ? cosf(angle + 0.001) : 0.0f; (void)angle; - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { weight = 0.0f; if (!BMO_elem_flag_test(bm, v, BME_BEVEL_NONMAN)) { /* modifiers should not use selection */ @@ -889,7 +889,7 @@ static void bevel_init_edges(BMesh *bm, int options, float angle, BME_TransData_ BMIter iter; const float threshold = (options & BME_BEVEL_ANGLE) ? cosf(angle + 0.001) : 0.0f; - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { weight = 0.0; if (!BMO_elem_flag_test(bm, e, BME_BEVEL_NONMAN)) { if (options & BME_BEVEL_SELECT) { @@ -930,7 +930,7 @@ static void bevel_init_edges(BMesh *bm, int options, float angle, BME_TransData_ } /* clean up edges with 2 faces that share more than one edg */ - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (BMO_elem_flag_test(bm, e, BME_BEVEL_BEVEL)) { count = BM_face_share_edge_count(e->l->f, e->l->radial_next->f); if (count > 1) BMO_elem_flag_disable(bm, e, BME_BEVEL_BEVEL); @@ -947,7 +947,7 @@ static BMesh *BME_bevel_initialize(BMesh *bm, int options, int UNUSED(defgrp_ind int /* wire, */ len; /* tag non-manifold geometr */ - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { BMO_elem_flag_enable(bm, v, BME_BEVEL_ORIG); if (v->e) { BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 0, -1, -1, NULL); @@ -965,7 +965,7 @@ static BMesh *BME_bevel_initialize(BMesh *bm, int options, int UNUSED(defgrp_ind } } - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { BMO_elem_flag_enable(bm, e, BME_BEVEL_ORIG); if (!(BM_edge_is_boundary(e) || BM_edge_is_manifold(e))) { BMO_elem_flag_enable(bm, e->v1, BME_BEVEL_NONMAN); @@ -977,7 +977,7 @@ static BMesh *BME_bevel_initialize(BMesh *bm, int options, int UNUSED(defgrp_ind } } - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BMO_elem_flag_enable(bm, f, BME_BEVEL_ORIG); } @@ -1001,13 +1001,13 @@ static BMesh *BME_bevel_reinitialize(BMesh *bm) BMFace *f; BMIter iter; - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { BMO_elem_flag_enable(bm, v, BME_BEVEL_ORIG); } - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { BMO_elem_flag_enable(bm, e, BME_BEVEL_ORIG); } - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BMO_elem_flag_enable(bm, f, BME_BEVEL_ORIG); } return bm; @@ -1041,21 +1041,21 @@ static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int option /* unsigned int i, len; */ /* bevel poly */ - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { if (BMO_elem_flag_test(bm, f, BME_BEVEL_ORIG)) { BME_bevel_poly(bm, f, value, options, td); } } /* get rid of beveled edge */ - BM_ITER (e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (BMO_elem_flag_test(bm, e, BME_BEVEL_BEVEL) && BMO_elem_flag_test(bm, e, BME_BEVEL_ORIG)) { BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e, TRUE); } } /* link up corners and cli */ - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { if (BMO_elem_flag_test(bm, v, BME_BEVEL_ORIG) && BMO_elem_flag_test(bm, v, BME_BEVEL_BEVEL)) { curedge = v->e; do { @@ -1075,7 +1075,7 @@ static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int option #ifdef DEBUG /* Debug print, remov */ - BM_ITER (f, &iter, bm, BM_FACES_OF_MESH, NULL) { + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { if (f->len == 2) { printf("%s: warning, 2 edge face\n", __func__); } @@ -1128,7 +1128,7 @@ BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_i } /* otherwise apply transforms */ - BM_ITER (v, &iter, bm, BM_VERTS_OF_MESH, NULL) { + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { if ((vtd = BME_get_transdata(td, v))) { if (vtd->max && (*vtd->max > 0 && value > *vtd->max)) { d = *vtd->max; |