Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-11-17 16:02:15 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-11-17 16:02:54 +0300
commita993600323867211f45f636058f20b66f144c34b (patch)
tree989a3c22cae13e9f315d8c42615ebaf88187ac62 /source/blender/bmesh/intern
parent6694d7ac5f651ea03ea61a465330652cc26ecb38 (diff)
BMesh: support for comparing loops when calculating face-groups
Add an optional callback to check source/destination loops for BM_mesh_calc_face_groups. This is needed so it can be used to calculate UV islands.
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r--source/blender/bmesh/intern/bmesh_query.c21
-rw-r--r--source/blender/bmesh/intern/bmesh_query.h1
2 files changed, 14 insertions, 8 deletions
diff --git a/source/blender/bmesh/intern/bmesh_query.c b/source/blender/bmesh/intern/bmesh_query.c
index 791fa64ae7d..e95243f4f32 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);