diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-23 06:17:57 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-23 06:17:57 +0400 |
commit | 792f536b368067fd27d0eefbe1bf6c91123220f4 (patch) | |
tree | 125ac2b55c19bc3ea0ec49b684810cb983ffff4d /source/blender/bmesh/intern | |
parent | 16ff7e40e66f93484695445b89090547de78d086 (diff) |
code cleanup: better use of BLI_array_* (grow in larger steps where possible), include BMO_iter_new in for loops.
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mods.c | 13 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mods.h | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_operator_api.h | 3 |
3 files changed, 8 insertions, 10 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 3474d4b3194..a5e761af783 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -758,7 +758,7 @@ BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts) /** * Checks if a face is valid in the data structure */ -int BM_face_validate(BMesh *bm, BMFace *face, FILE *err) +int BM_face_validate(BMFace *face, FILE *err) { BMIter iter; BLI_array_declare(verts); @@ -771,10 +771,9 @@ int BM_face_validate(BMesh *bm, BMFace *face, FILE *err) fflush(err); } - for (l = BM_iter_new(&iter, bm, BM_LOOPS_OF_FACE, face); l; l = BM_iter_step(&iter)) { - BLI_array_growone(verts); - verts[BLI_array_count(verts) - 1] = l->v; - + BLI_array_growitems(verts, face->len); + BM_ITER_ELEM_INDEX (l, &iter, face, BM_LOOPS_OF_FACE, i) { + verts[i] = l->v; if (l->e->v1 == l->e->v2) { fprintf(err, "Found bmesh edge with identical verts!\n"); fprintf(err, " edge ptr: %p, vert: %p\n", l->e, l->e->v1); @@ -783,8 +782,8 @@ int BM_face_validate(BMesh *bm, BMFace *face, FILE *err) } } - for (i = 0; i < BLI_array_count(verts); i++) { - for (j = 0; j < BLI_array_count(verts); j++) { + for (i = 0; i < face->len; i++) { + for (j = 0; j < face->len; j++) { if (j == i) { continue; } diff --git a/source/blender/bmesh/intern/bmesh_mods.h b/source/blender/bmesh/intern/bmesh_mods.h index 2cb599f75d3..802c6cca05d 100644 --- a/source/blender/bmesh/intern/bmesh_mods.h +++ b/source/blender/bmesh/intern/bmesh_mods.h @@ -57,7 +57,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float perce BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts); -int BM_face_validate(BMesh *bm, BMFace *face, FILE *err); +int BM_face_validate(BMFace *face, FILE *err); void BM_edge_calc_rotate(BMEdge *e, int ccw, BMLoop **r_l1, BMLoop **r_l2); diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h index b01b80f1ef4..bf66388fb9e 100644 --- a/source/blender/bmesh/intern/bmesh_operator_api.h +++ b/source/blender/bmesh/intern/bmesh_operator_api.h @@ -413,8 +413,7 @@ void *BMO_iter_map_value_p(BMOIter *iter); float BMO_iter_map_value_f(BMOIter *iter); #define BMO_ITER(ele, iter, bm, op, slotname, restrict) \ - ele = BMO_iter_new(iter, bm, op, slotname, restrict); \ - for ( ; ele; ele = BMO_iter_step(iter)) + for (ele = BMO_iter_new(iter, bm, op, slotname, restrict); ele; ele = BMO_iter_step(iter)) /******************* Inlined Functions********************/ typedef void (*opexec)(BMesh *bm, BMOperator *op); |