diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-09-06 10:27:22 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-09-06 10:27:22 +0400 |
commit | 6fdb2ed861b8edf022e51bbc783acabbd2a0e581 (patch) | |
tree | 3b2872aca31f1494a9e8a5d9c1dfb2cfdb69c0d1 /source/blender/bmesh/intern/bmesh_polygon.c | |
parent | 6439ae9d51dfe3a77ff778e35cf83909bbc93acc (diff) |
bmesh utility functions BM_face_as_array_loop_tri, BM_face_as_array_loop_quad
also set attributes for the header and remove debug print in mask.c
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_polygon.c')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_polygon.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 8765bc7d579..a82d3d07712 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -1203,3 +1203,37 @@ void BM_face_as_array_vert_quad(BMFace *f, BMVert *r_verts[4]) r_verts[2] = l->v; l = l->next; r_verts[3] = l->v; } + + +/** + * Small utility functions for fast access + * + * faster alternative to: + * BM_iter_as_array(bm, BM_LOOPS_OF_FACE, f, (void **)l, 3); + */ +void BM_face_as_array_loop_tri(BMFace *f, BMLoop *r_loops[3]) +{ + BMLoop *l = BM_FACE_FIRST_LOOP(f); + + BLI_assert(f->len == 3); + + r_loops[0] = l; l = l->next; + r_loops[1] = l; l = l->next; + r_loops[2] = l; +} + +/** + * faster alternative to: + * BM_iter_as_array(bm, BM_LOOPS_OF_FACE, f, (void **)l, 4); + */ +void BM_face_as_array_loop_quad(BMFace *f, BMLoop *r_loops[4]) +{ + BMLoop *l = BM_FACE_FIRST_LOOP(f); + + BLI_assert(f->len == 4); + + r_loops[0] = l; l = l->next; + r_loops[1] = l; l = l->next; + r_loops[2] = l; l = l->next; + r_loops[3] = l; +} |