diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-12-24 04:04:03 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-12-24 04:13:58 +0400 |
commit | 04a902965e5e226e69c5c6e912dd2f513448d2ac (patch) | |
tree | c65a2c9613f5a336f6c2739b5dabc5fbad348230 /source/blender/bmesh/tools/bmesh_bisect_plane.c | |
parent | d94db03ac8ef9f6a10e42f01d622421fe3f216bb (diff) |
BMesh optimize face splitting by taking loops rather then verts
- add BM_vert_pair_share_face
- add BM_loop_is_adjacent
- remove BM_verts_connect
Diffstat (limited to 'source/blender/bmesh/tools/bmesh_bisect_plane.c')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_bisect_plane.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.c b/source/blender/bmesh/tools/bmesh_bisect_plane.c index 6aeb26435ac..7001cfa4061 100644 --- a/source/blender/bmesh/tools/bmesh_bisect_plane.c +++ b/source/blender/bmesh/tools/bmesh_bisect_plane.c @@ -139,9 +139,14 @@ static void bm_face_bisect_verts(BMesh *bm, BMFace *f, const float plane[4], con BMLoop *l_new; if (LIKELY(STACK_SIZE(vert_split_arr) == 2)) { + BMLoop *l_a, *l_b; + + l_a = BM_face_vert_share_loop(f, vert_split_arr[0]); + l_b = BM_face_vert_share_loop(f, vert_split_arr[1]); + /* common case, just cut the face once */ l_new = NULL; - BM_face_split(bm, f, vert_split_arr[0], vert_split_arr[1], &l_new, NULL, true); + BM_face_split(bm, f, l_a, l_b, &l_new, NULL, true); if (l_new) { if (oflag_center) { BMO_elem_flag_enable(bm, l_new->e, oflag_center); @@ -254,9 +259,9 @@ static void bm_face_bisect_verts(BMesh *bm, BMFace *f, const float plane[4], con /* in fact this simple test is good enough, * test if the loops are adjacent */ - if (found && (l_a->next != l_b && l_a->prev != l_b)) { + if (found && !BM_loop_is_adjacent(l_a, l_b)) { BMFace *f_tmp; - f_tmp = BM_face_split(bm, face_split_arr[j], l_a->v, l_b->v, NULL, NULL, true); + f_tmp = BM_face_split(bm, face_split_arr[j], l_a, l_b, NULL, NULL, true); if (f_tmp) { if (f_tmp != face_split_arr[j]) { STACK_PUSH(face_split_arr, f_tmp); |