diff options
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/bmesh_class.h | 1 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_query.c | 21 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_query.h | 1 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_normals.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_intersect.c | 2 |
5 files changed, 17 insertions, 10 deletions
diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h index 0783bb445a2..9899d67c008 100644 --- a/source/blender/bmesh/bmesh_class.h +++ b/source/blender/bmesh/bmesh_class.h @@ -390,6 +390,7 @@ typedef bool (*BMVertFilterFunc)(const BMVert *, void *user_data); typedef bool (*BMEdgeFilterFunc)(const BMEdge *, void *user_data); typedef bool (*BMFaceFilterFunc)(const BMFace *, void *user_data); typedef bool (*BMLoopFilterFunc)(const BMLoop *, void *user_data); +typedef bool (*BMLoopPairFilterFunc)(const BMLoop *, const BMLoop *, void *user_data); /* defines */ #define BM_ELEM_CD_SET_INT(ele, offset, f) \ diff --git a/source/blender/bmesh/intern/bmesh_query.c b/source/blender/bmesh/intern/bmesh_query.c index 0d8b5cf4590..03655bccf1c 100644 --- a/source/blender/bmesh/intern/bmesh_query.c +++ b/source/blender/bmesh/intern/bmesh_query.c @@ -2612,6 +2612,7 @@ int BM_mesh_calc_face_groups(BMesh *bm, int *r_groups_array, int (**r_group_index)[2], BMLoopFilterFunc filter_fn, + BMLoopPairFilterFunc filter_pair_fn, void *user_data, const char hflag_test, const char htype_step) @@ -2707,10 +2708,12 @@ int BM_mesh_calc_face_groups(BMesh *bm, BMLoop *l_radial_iter = l_iter->radial_next; if ((l_radial_iter != l_iter) && ((filter_fn == NULL) || filter_fn(l_iter, user_data))) { do { - BMFace *f_other = l_radial_iter->f; - if (BM_elem_flag_test(f_other, BM_ELEM_TAG) == false) { - BM_elem_flag_enable(f_other, BM_ELEM_TAG); - STACK_PUSH(stack, f_other); + if ((filter_pair_fn == NULL) || filter_pair_fn(l_iter, l_radial_iter, user_data)) { + BMFace *f_other = l_radial_iter->f; + if (BM_elem_flag_test(f_other, BM_ELEM_TAG) == false) { + BM_elem_flag_enable(f_other, BM_ELEM_TAG); + STACK_PUSH(stack, f_other); + } } } while ((l_radial_iter = l_radial_iter->radial_next) != l_iter); } @@ -2725,10 +2728,12 @@ int BM_mesh_calc_face_groups(BMesh *bm, if ((filter_fn == NULL) || filter_fn(l_iter, user_data)) { BMLoop *l_other; BM_ITER_ELEM (l_other, &liter, l_iter, BM_LOOPS_OF_LOOP) { - BMFace *f_other = l_other->f; - if (BM_elem_flag_test(f_other, BM_ELEM_TAG) == false) { - BM_elem_flag_enable(f_other, BM_ELEM_TAG); - STACK_PUSH(stack, f_other); + if ((filter_pair_fn == NULL) || filter_pair_fn(l_iter, l_other, user_data)) { + BMFace *f_other = l_other->f; + if (BM_elem_flag_test(f_other, BM_ELEM_TAG) == false) { + BM_elem_flag_enable(f_other, BM_ELEM_TAG); + STACK_PUSH(stack, f_other); + } } } } diff --git a/source/blender/bmesh/intern/bmesh_query.h b/source/blender/bmesh/intern/bmesh_query.h index d2c71d8c71d..5627f3820c2 100644 --- a/source/blender/bmesh/intern/bmesh_query.h +++ b/source/blender/bmesh/intern/bmesh_query.h @@ -254,6 +254,7 @@ int BM_mesh_calc_face_groups(BMesh *bm, int *r_groups_array, int (**r_group_index)[2], BMLoopFilterFunc filter_fn, + BMLoopPairFilterFunc filter_pair_fn, void *user_data, const char hflag_test, const char htype_step) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3); diff --git a/source/blender/bmesh/operators/bmo_normals.c b/source/blender/bmesh/operators/bmo_normals.c index 93a377ac2ca..8e7bfbb649d 100644 --- a/source/blender/bmesh/operators/bmo_normals.c +++ b/source/blender/bmesh/operators/bmo_normals.c @@ -272,7 +272,7 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op) int(*group_index)[2]; const int group_tot = BM_mesh_calc_face_groups( - bm, groups_array, &group_index, bmo_recalc_normal_loop_filter_cb, NULL, 0, BM_EDGE); + bm, groups_array, &group_index, bmo_recalc_normal_loop_filter_cb, NULL, NULL, 0, BM_EDGE); int i; BMO_slot_buffer_flag_enable(bm, op->slots_in, "faces", BM_FACE, FACE_FLAG); diff --git a/source/blender/bmesh/tools/bmesh_intersect.c b/source/blender/bmesh/tools/bmesh_intersect.c index a47de4390a7..db05abe0e48 100644 --- a/source/blender/bmesh/tools/bmesh_intersect.c +++ b/source/blender/bmesh/tools/bmesh_intersect.c @@ -1533,7 +1533,7 @@ bool BM_mesh_intersect(BMesh *bm, groups_array = MEM_mallocN(sizeof(*groups_array) * (size_t)bm->totface, __func__); group_tot = BM_mesh_calc_face_groups( - bm, groups_array, &group_index, bm_loop_filter_fn, &user_data_wrap, 0, BM_EDGE); + bm, groups_array, &group_index, bm_loop_filter_fn, NULL, &user_data_wrap, 0, BM_EDGE); #ifdef USE_DUMP printf("%s: Total face-groups: %d\n", __func__, group_tot); |