Changeset View
Changeset View
Standalone View
Standalone View
source/blender/bmesh/intern/bmesh_query.c
| Show First 20 Lines • Show All 2,606 Lines • ▼ Show 20 Lines | |||||
| * \param htype_step: BM_VERT to walk over face-verts, BM_EDGE to walk over faces edges | * \param htype_step: BM_VERT to walk over face-verts, BM_EDGE to walk over faces edges | ||||
| * (having both set is supported too). | * (having both set is supported too). | ||||
| * \return The number of groups found. | * \return The number of groups found. | ||||
| */ | */ | ||||
| int BM_mesh_calc_face_groups(BMesh *bm, | int BM_mesh_calc_face_groups(BMesh *bm, | ||||
| int *r_groups_array, | int *r_groups_array, | ||||
| int (**r_group_index)[2], | int (**r_group_index)[2], | ||||
| BMLoopFilterFunc filter_fn, | BMLoopFilterFunc filter_fn, | ||||
| BMLoopPairFilterFunc filter_pair_fn, | |||||
| void *user_data, | void *user_data, | ||||
| const char hflag_test, | const char hflag_test, | ||||
| const char htype_step) | const char htype_step) | ||||
| { | { | ||||
| #ifdef DEBUG | #ifdef DEBUG | ||||
| int group_index_len = 1; | int group_index_len = 1; | ||||
| #else | #else | ||||
| int group_index_len = 32; | int group_index_len = 32; | ||||
| ▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | while ((f = STACK_POP(stack))) { | ||||
| if (htype_step & BM_EDGE) { | if (htype_step & BM_EDGE) { | ||||
| /* search for other faces */ | /* search for other faces */ | ||||
| l_iter = l_first = BM_FACE_FIRST_LOOP(f); | l_iter = l_first = BM_FACE_FIRST_LOOP(f); | ||||
| do { | do { | ||||
| BMLoop *l_radial_iter = l_iter->radial_next; | BMLoop *l_radial_iter = l_iter->radial_next; | ||||
| if ((l_radial_iter != l_iter) && ((filter_fn == NULL) || filter_fn(l_iter, user_data))) { | if ((l_radial_iter != l_iter) && ((filter_fn == NULL) || filter_fn(l_iter, user_data))) { | ||||
| do { | do { | ||||
| if ((filter_pair_fn == NULL) || filter_pair_fn(l_iter, l_radial_iter, user_data)) { | |||||
| BMFace *f_other = l_radial_iter->f; | BMFace *f_other = l_radial_iter->f; | ||||
| if (BM_elem_flag_test(f_other, BM_ELEM_TAG) == false) { | if (BM_elem_flag_test(f_other, BM_ELEM_TAG) == false) { | ||||
| BM_elem_flag_enable(f_other, BM_ELEM_TAG); | BM_elem_flag_enable(f_other, BM_ELEM_TAG); | ||||
| STACK_PUSH(stack, f_other); | STACK_PUSH(stack, f_other); | ||||
| } | } | ||||
| } | |||||
| } while ((l_radial_iter = l_radial_iter->radial_next) != l_iter); | } while ((l_radial_iter = l_radial_iter->radial_next) != l_iter); | ||||
| } | } | ||||
| } while ((l_iter = l_iter->next) != l_first); | } while ((l_iter = l_iter->next) != l_first); | ||||
| } | } | ||||
| if (htype_step & BM_VERT) { | if (htype_step & BM_VERT) { | ||||
| BMIter liter; | BMIter liter; | ||||
| /* search for other faces */ | /* search for other faces */ | ||||
| l_iter = l_first = BM_FACE_FIRST_LOOP(f); | l_iter = l_first = BM_FACE_FIRST_LOOP(f); | ||||
| do { | do { | ||||
| if ((filter_fn == NULL) || filter_fn(l_iter, user_data)) { | if ((filter_fn == NULL) || filter_fn(l_iter, user_data)) { | ||||
| BMLoop *l_other; | BMLoop *l_other; | ||||
| BM_ITER_ELEM (l_other, &liter, l_iter, BM_LOOPS_OF_LOOP) { | BM_ITER_ELEM (l_other, &liter, l_iter, BM_LOOPS_OF_LOOP) { | ||||
| if ((filter_pair_fn == NULL) || filter_pair_fn(l_iter, l_other, user_data)) { | |||||
| BMFace *f_other = l_other->f; | BMFace *f_other = l_other->f; | ||||
| if (BM_elem_flag_test(f_other, BM_ELEM_TAG) == false) { | if (BM_elem_flag_test(f_other, BM_ELEM_TAG) == false) { | ||||
| BM_elem_flag_enable(f_other, BM_ELEM_TAG); | BM_elem_flag_enable(f_other, BM_ELEM_TAG); | ||||
| STACK_PUSH(stack, f_other); | STACK_PUSH(stack, f_other); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| } while ((l_iter = l_iter->next) != l_first); | } while ((l_iter = l_iter->next) != l_first); | ||||
| } | } | ||||
| } | } | ||||
| group_curr++; | group_curr++; | ||||
| } | } | ||||
| MEM_freeN(stack); | MEM_freeN(stack); | ||||
| ▲ Show 20 Lines • Show All 263 Lines • Show Last 20 Lines | |||||