diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-03 04:28:38 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-03 04:28:38 +0400 |
commit | 3f3b88ff426e63f37bc32d3bac05984eafee1062 (patch) | |
tree | a163944fcd20c326613c71dfc1d425485f24cbc3 /source/blender | |
parent | 9fff51e83dc03d38aec9c2a168eb62cf92df9de8 (diff) |
bmesh iterators were passing the BMesh as data argument to BM_iter_new(), harmless but incorrect.
replace these cases with iterator macro.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_construct.c | 54 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_marking.c | 26 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh.c | 14 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_operators.c | 62 |
4 files changed, 83 insertions, 73 deletions
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c index aebad342f7e..974bc814d9b 100644 --- a/source/blender/bmesh/intern/bmesh_construct.c +++ b/source/blender/bmesh/intern/bmesh_construct.c @@ -532,18 +532,19 @@ static void bmo_remove_tagged_context_verts(BMesh *bm, const short oflag) BMEdge *e; BMFace *f; - BMIter verts; - BMIter edges; - BMIter faces; + BMIter iter; + BMIter itersub; - for (v = BM_iter_new(&verts, bm, BM_VERTS_OF_MESH, bm); v; v = BM_iter_step(&verts)) { + BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) { if (BMO_elem_flag_test(bm, v, oflag)) { /* Visit edge */ - for (e = BM_iter_new(&edges, bm, BM_EDGES_OF_VERT, v); e; e = BM_iter_step(&edges)) + BM_ITER(e, &itersub, bm, BM_EDGES_OF_VERT, v) { BMO_elem_flag_enable(bm, e, oflag); + } /* Visit face */ - for (f = BM_iter_new(&faces, bm, BM_FACES_OF_VERT, v); f; f = BM_iter_step(&faces)) + BM_ITER(f, &itersub, bm, BM_FACES_OF_VERT, v) { BMO_elem_flag_enable(bm, f, oflag); + } } } @@ -557,12 +558,12 @@ static void bmo_remove_tagged_context_edges(BMesh *bm, const short oflag) BMEdge *e; BMFace *f; - BMIter edges; - BMIter faces; + BMIter iter; + BMIter itersub; - for (e = BM_iter_new(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BM_iter_step(&edges)) { + BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) { if (BMO_elem_flag_test(bm, e, oflag)) { - for (f = BM_iter_new(&faces, bm, BM_FACES_OF_EDGE, e); f; f = BM_iter_step(&faces)) { + BM_ITER(f, &itersub, bm, BM_FACES_OF_EDGE, e) { BMO_elem_flag_enable(bm, f, oflag); } } @@ -585,9 +586,9 @@ void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type) BMEdge *e; BMFace *f; - BMIter verts; - BMIter edges; - BMIter faces; + BMIter viter; + BMIter eiter; + BMIter fiter; switch (type) { case DEL_VERTS: @@ -599,7 +600,7 @@ void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type) case DEL_EDGES: { /* flush down to vert */ - for (e = BM_iter_new(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BM_iter_step(&edges)) { + BM_ITER(e, &eiter, bm, BM_EDGES_OF_MESH, NULL) { if (BMO_elem_flag_test(bm, e, oflag)) { BMO_elem_flag_enable(bm, e->v1, oflag); BMO_elem_flag_enable(bm, e->v2, oflag); @@ -607,7 +608,7 @@ void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type) } bmo_remove_tagged_context_edges(bm, oflag); /* remove loose vertice */ - for (v = BM_iter_new(&verts, bm, BM_VERTS_OF_MESH, bm); v; v = BM_iter_step(&verts)) { + BM_ITER(v, &viter, bm, BM_VERTS_OF_MESH, NULL) { if (BMO_elem_flag_test(bm, v, oflag) && (!(v->e))) BMO_elem_flag_enable(bm, v, DEL_WIREVERT); } @@ -638,27 +639,27 @@ 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 */ - for (f = BM_iter_new(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BM_iter_step(&faces)) { + BM_ITER(f, &fiter, bm, BM_FACES_OF_MESH, NULL) { if (BMO_elem_flag_test(bm, f, oflag)) { - for (e = BM_iter_new(&edges, bm, BM_EDGES_OF_FACE, f); e; e = BM_iter_step(&edges)) + 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); - for (v = BM_iter_new(&verts, bm, BM_VERTS_OF_FACE, f); v; v = BM_iter_step(&verts)) + for (v = BM_iter_new(&viter, bm, BM_VERTS_OF_FACE, f); v; v = BM_iter_step(&viter)) BMO_elem_flag_enable(bm, v, oflag); } } /* now go through and mark all remaining faces all edges for keeping */ - for (f = BM_iter_new(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BM_iter_step(&faces)) { + BM_ITER(f, &fiter, bm, BM_FACES_OF_MESH, NULL) { if (!BMO_elem_flag_test(bm, f, oflag)) { - for (e = BM_iter_new(&edges, bm, BM_EDGES_OF_FACE, f); e; e = BM_iter_step(&edges)) { + 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); } - for (v = BM_iter_new(&verts, bm, BM_VERTS_OF_FACE, f); v; v = BM_iter_step(&verts)) { + for (v = BM_iter_new(&viter, bm, BM_VERTS_OF_FACE, f); v; v = BM_iter_step(&viter)) { BMO_elem_flag_disable(bm, v, oflag); } } } /* also mark all the vertices of remaining edges for keeping */ - for (e = BM_iter_new(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BM_iter_step(&edges)) { + BM_ITER(e, &eiter, bm, BM_EDGES_OF_MESH, NULL) { if (!BMO_elem_flag_test(bm, e, oflag)) { BMO_elem_flag_disable(bm, e->v1, oflag); BMO_elem_flag_disable(bm, e->v2, oflag); @@ -676,12 +677,15 @@ void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type) case DEL_ALL: { /* does this option even belong in here? */ - for (f = BM_iter_new(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BM_iter_step(&faces)) + BM_ITER(f, &fiter, bm, BM_FACES_OF_MESH, NULL) { BMO_elem_flag_enable(bm, f, oflag); - for (e = BM_iter_new(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BM_iter_step(&edges)) + } + BM_ITER(e, &eiter, bm, BM_EDGES_OF_MESH, NULL) { BMO_elem_flag_enable(bm, e, oflag); - for (v = BM_iter_new(&verts, bm, BM_VERTS_OF_MESH, bm); v; v = BM_iter_step(&verts)) + } + BM_ITER(v, &viter, bm, BM_VERTS_OF_MESH, NULL) { BMO_elem_flag_enable(bm, v, oflag); + } BMO_remove_tagged_faces(bm, oflag); BMO_remove_tagged_edges(bm, oflag); diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index 4ff78faa472..ed826cbf75a 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -78,13 +78,13 @@ void BM_mesh_select_mode_flush(BMesh *bm) BMLoop *l_first; BMFace *f; - BMIter edges; - BMIter faces; + BMIter eiter; + BMIter fiter; int ok; if (bm->selectmode & SCE_SELECT_VERTEX) { - for (e = BM_iter_new(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BM_iter_step(&edges)) { + BM_ITER(e, &eiter, bm, BM_EDGES_OF_MESH, NULL) { 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); } } - for (f = BM_iter_new(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BM_iter_step(&faces)) { + BM_ITER(f, &fiter, bm, BM_FACES_OF_MESH, NULL) { 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) { - for (f = BM_iter_new(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BM_iter_step(&faces)) { + BM_ITER(f, &fiter, bm, BM_FACES_OF_MESH, NULL) { ok = TRUE; if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) { l_iter = l_first = BM_FACE_FIRST_LOOP(f); @@ -149,12 +149,12 @@ void BM_mesh_deselect_flush(BMesh *bm) BMLoop *l_first; BMFace *f; - BMIter edges; - BMIter faces; + BMIter eiter; + BMIter fiter; int ok; - for (e = BM_iter_new(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BM_iter_step(&edges)) { + BM_ITER(e, &eiter, bm, BM_EDGES_OF_MESH, NULL) { 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) } } - for (f = BM_iter_new(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BM_iter_step(&faces)) { + BM_ITER(f, &fiter, bm, BM_FACES_OF_MESH, NULL) { ok = TRUE; if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) { l_iter = l_first = BM_FACE_FIRST_LOOP(f); @@ -200,12 +200,12 @@ void BM_mesh_select_flush(BMesh *bm) BMLoop *l_first; BMFace *f; - BMIter edges; - BMIter faces; + BMIter eiter; + BMIter fiter; int ok; - for (e = BM_iter_new(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BM_iter_step(&edges)) { + BM_ITER(e, &eiter, bm, BM_EDGES_OF_MESH, NULL) { 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) } } - for (f = BM_iter_new(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BM_iter_step(&faces)) { + BM_ITER(f, &fiter, bm, BM_FACES_OF_MESH, NULL) { ok = TRUE; if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) { l_iter = l_first = BM_FACE_FIRST_LOOP(f); diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index f69a46e7d8c..c15937abf1d 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -101,20 +101,18 @@ void BM_mesh_data_free(BMesh *bm) BMFace *f; - BMIter verts; - BMIter edges; - BMIter faces; - BMIter loops; + BMIter iter; + BMIter itersub; - for (v = BM_iter_new(&verts, bm, BM_VERTS_OF_MESH, bm); v; v = BM_iter_step(&verts)) { + BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) { CustomData_bmesh_free_block(&(bm->vdata), &(v->head.data)); } - for (e = BM_iter_new(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BM_iter_step(&edges)) { + BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) { CustomData_bmesh_free_block(&(bm->edata), &(e->head.data)); } - for (f = BM_iter_new(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BM_iter_step(&faces)) { + BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) { CustomData_bmesh_free_block(&(bm->pdata), &(f->head.data)); - for (l = BM_iter_new(&loops, bm, BM_LOOPS_OF_FACE, f); l; l = BM_iter_step(&loops)) { + BM_ITER(l, &itersub, bm, BM_LOOPS_OF_FACE, f) { CustomData_bmesh_free_block(&(bm->ldata), &(l->head.data)); } } diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index 3d410fcd855..44eed679cbe 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -646,8 +646,6 @@ static void *bmo_slot_buffer_alloc(BMOperator *op, const char *slotname, int len */ static void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slotname, const char htype) { - BMIter elements; - BMHeader *e; BMOpSlot *output = BMO_slot_get(op, slotname); int totelement = 0, i = 0; @@ -656,25 +654,30 @@ static void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slot if (htype & BM_FACE) totelement += bm->totface; if (totelement) { + BMIter iter; + BMHeader *ele; + bmo_slot_buffer_alloc(op, slotname, totelement); + /* TODO - collapse these loops into one */ + if (htype & BM_VERT) { - for (e = BM_iter_new(&elements, bm, BM_VERTS_OF_MESH, bm); e; e = BM_iter_step(&elements)) { - ((BMHeader **)output->data.p)[i] = e; + BM_ITER(ele, &iter, bm, BM_VERTS_OF_MESH, NULL) { + ((BMHeader **)output->data.p)[i] = ele; i++; } } if (htype & BM_EDGE) { - for (e = BM_iter_new(&elements, bm, BM_EDGES_OF_MESH, bm); e; e = BM_iter_step(&elements)) { - ((BMHeader **)output->data.p)[i] = e; + BM_ITER(ele, &iter, bm, BM_EDGES_OF_MESH, NULL) { + ((BMHeader **)output->data.p)[i] = ele; i++; } } if (htype & BM_FACE) { - for (e = BM_iter_new(&elements, bm, BM_FACES_OF_MESH, bm); e; e = BM_iter_step(&elements)) { - ((BMHeader **)output->data.p)[i] = e; + BM_ITER(ele, &iter, bm, BM_FACES_OF_MESH, NULL) { + ((BMHeader **)output->data.p)[i] = ele; i++; } } @@ -691,8 +694,6 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl const char htype, const char hflag, int test_for_enabled) { - BMIter elements; - BMElem *ele; BMOpSlot *output = BMO_slot_get(op, slotname); int totelement = 0, i = 0; @@ -702,12 +703,17 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl totelement = BM_mesh_disabled_flag_count(bm, htype, hflag, TRUE); if (totelement) { + BMIter iter; + BMElem *ele; + const char hflag_test = (test_for_enabled ? hflag : 0); bmo_slot_buffer_alloc(op, slotname, totelement); + /* TODO - collapse these loops into one */ + if (htype & BM_VERT) { - for (ele = BM_iter_new(&elements, bm, BM_VERTS_OF_MESH, bm); ele; ele = BM_iter_step(&elements)) { + BM_ITER(ele, &iter, bm, BM_VERTS_OF_MESH, NULL) { if (!BM_elem_flag_test(ele, BM_ELEM_HIDDEN) && BM_elem_flag_test(ele, hflag) == hflag_test) { @@ -718,7 +724,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl } if (htype & BM_EDGE) { - for (ele = BM_iter_new(&elements, bm, BM_EDGES_OF_MESH, bm); ele; ele = BM_iter_step(&elements)) { + BM_ITER(ele, &iter, bm, BM_EDGES_OF_MESH, NULL) { if (!BM_elem_flag_test(ele, BM_ELEM_HIDDEN) && BM_elem_flag_test(ele, hflag) == hflag_test) { @@ -729,7 +735,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl } if (htype & BM_FACE) { - for (ele = BM_iter_new(&elements, bm, BM_FACES_OF_MESH, bm); ele; ele = BM_iter_step(&elements)) { + BM_ITER(ele, &iter, bm, BM_FACES_OF_MESH, NULL) { if (!BM_elem_flag_test(ele, BM_ELEM_HIDDEN) && BM_elem_flag_test(ele, hflag) == hflag_test) { @@ -760,7 +766,7 @@ void BMO_slot_buffer_from_disabled_hflag(BMesh *bm, BMOperator *op, const char * * Copies the values from another slot to the end of the output slot. */ void BMO_slot_buffer_append(BMOperator *output_op, const char *output_slot_name, - BMOperator *other_op, const char *other_slot_name) + BMOperator *other_op, const char *other_slot_name) { BMOpSlot *output_slot = BMO_slot_get(output_op, output_slot_name); BMOpSlot *other_slot = BMO_slot_get(other_op, other_slot_name); @@ -798,7 +804,6 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slo const char htype, const short oflag, int test_for_enabled) { - BMIter elements; BMOpSlot *slot = BMO_slot_get(op, slotname); int totelement, i = 0; @@ -810,6 +815,7 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slo BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF); if (totelement) { + BMIter iter; BMHeader *ele; BMHeader **ele_array; const char hflag_test = (test_for_enabled ? oflag : 0); @@ -818,8 +824,10 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slo ele_array = (BMHeader **)slot->data.p; + /* TODO - collapse these loops into one */ + if (htype & BM_VERT) { - for (ele = BM_iter_new(&elements, bm, BM_VERTS_OF_MESH, bm); ele; ele = BM_iter_step(&elements)) { + BM_ITER(ele, &iter, bm, BM_VERTS_OF_MESH, NULL) { if (BMO_elem_flag_test(bm, (BMElemF *)ele, oflag) == hflag_test) { ele_array[i] = ele; i++; @@ -828,7 +836,7 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slo } if (htype & BM_EDGE) { - for (ele = BM_iter_new(&elements, bm, BM_EDGES_OF_MESH, bm); ele; ele = BM_iter_step(&elements)) { + BM_ITER(ele, &iter, bm, BM_EDGES_OF_MESH, NULL) { if (BMO_elem_flag_test(bm, (BMElemF *)ele, oflag) == hflag_test) { ele_array[i] = ele; i++; @@ -837,7 +845,7 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slo } if (htype & BM_FACE) { - for (ele = BM_iter_new(&elements, bm, BM_FACES_OF_MESH, bm); ele; ele = BM_iter_step(&elements)) { + BM_ITER(ele, &iter, bm, BM_FACES_OF_MESH, NULL) { if (BMO_elem_flag_test(bm, (BMElemF *)ele, oflag) == hflag_test) { ele_array[i] = ele; i++; @@ -1026,19 +1034,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.. */ - for (ele = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, bm), i = 0; ele; ele = BM_iter_step(&iter), i++) { + BM_ITER_INDEX(ele, &iter, bm, BM_VERTS_OF_MESH, NULL, 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 */ } - for (ele = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, bm), i = 0; ele; ele = BM_iter_step(&iter), i++) { + BM_ITER_INDEX(ele, &iter, bm, BM_EDGES_OF_MESH, NULL, 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 */ } - for (ele = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, bm), i = 0; ele; ele = BM_iter_step(&iter), i++) { + BM_ITER_INDEX(ele, &iter, bm, BM_FACES_OF_MESH, NULL, i) { oldflags = ele->oflags; ele->oflags = BLI_mempool_calloc(newpool); memcpy(ele->oflags, oldflags, old_totflags_size); @@ -1071,19 +1079,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 */ - for (ele = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, bm), i = 0; ele; ele = BM_iter_step(&iter), i++) { + BM_ITER_INDEX(ele, &iter, bm, BM_VERTS_OF_MESH, NULL, 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 */ } - for (ele = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, bm), i = 0; ele; ele = BM_iter_step(&iter), i++) { + BM_ITER_INDEX(ele, &iter, bm, BM_EDGES_OF_MESH, NULL, 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 */ } - for (ele = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, bm), i = 0; ele; ele = BM_iter_step(&iter), i++) { + BM_ITER_INDEX(ele, &iter, bm, BM_FACES_OF_MESH, NULL, i) { oldflags = ele->oflags; ele->oflags = BLI_mempool_calloc(newpool); memcpy(ele->oflags, oldflags, new_totflags_size); @@ -1106,15 +1114,15 @@ static void bmo_flag_layer_clear(BMesh *bm) const int totflags_offset = bm->totflags - 1; /* now go through and memcpy all the flag */ - for (ele = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, bm), i = 0; ele; ele = BM_iter_step(&iter), i++) { + BM_ITER_INDEX(ele, &iter, bm, BM_VERTS_OF_MESH, NULL, i) { memset(ele->oflags + totflags_offset, 0, sizeof(BMFlagLayer)); BM_elem_index_set(ele, i); /* set_inline */ } - for (ele = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, bm), i = 0; ele; ele = BM_iter_step(&iter), i++) { + BM_ITER_INDEX(ele, &iter, bm, BM_EDGES_OF_MESH, NULL, i) { memset(ele->oflags + totflags_offset, 0, sizeof(BMFlagLayer)); BM_elem_index_set(ele, i); /* set_inline */ } - for (ele = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, bm), i = 0; ele; ele = BM_iter_step(&iter), i++) { + BM_ITER_INDEX(ele, &iter, bm, BM_FACES_OF_MESH, NULL, i) { memset(ele->oflags + totflags_offset, 0, sizeof(BMFlagLayer)); BM_elem_index_set(ele, i); /* set_inline */ } |