bmesh api functions, not used yet:
BM_iter_elem_count_flag() BM_iter_mesh_count_flag()
This commit is contained in:
@@ -104,6 +104,50 @@ int BM_iter_as_array(BMesh *bm, const char itype, void *data, void **array, cons
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Elem Iter Flag Count
|
||||
*
|
||||
* Counts how many flagged / unflagged items are found in this element.
|
||||
*/
|
||||
int BM_iter_elem_count_flag(const char itype, void *data, const char hflag, const short value)
|
||||
{
|
||||
BMIter iter;
|
||||
BMElem *ele;
|
||||
int count = 0;
|
||||
|
||||
BLI_assert(ELEM(value, TRUE, FALSE));
|
||||
|
||||
for (ele = BM_iter_new(&iter, NULL, itype, data); ele; ele = BM_iter_step(&iter)) {
|
||||
if (BM_elem_flag_test_bool(ele, hflag) == value) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Mesh Iter Flag Count
|
||||
*
|
||||
* Counts how many flagged / unflagged items are found in this mesh.
|
||||
*/
|
||||
int BM_iter_mesh_count_flag(const char itype, BMesh *bm, const char hflag, const short value)
|
||||
{
|
||||
BMIter iter;
|
||||
BMElem *ele;
|
||||
int count = 0;
|
||||
|
||||
BLI_assert(ELEM(value, TRUE, FALSE));
|
||||
|
||||
for (ele = BM_iter_new(&iter, bm, itype, NULL); ele; ele = BM_iter_step(&iter)) {
|
||||
if (BM_elem_flag_test_bool(ele, hflag) == value) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Init Iterator
|
||||
|
||||
@@ -117,6 +117,8 @@ typedef struct BMIter {
|
||||
|
||||
void *BM_iter_at_index(BMesh *bm, const char itype, void *data, int index);
|
||||
int BM_iter_as_array(BMesh *bm, const char itype, void *data, void **array, const int len);
|
||||
int BM_iter_elem_count_flag(const char itype, void *data, const char hflag, const short value);
|
||||
int BM_iter_mesh_count_flag(const char itype, BMesh *bm, const char hflag, const short value);
|
||||
|
||||
/* private for bmesh_iterators_inline.c */
|
||||
void bmiter__vert_of_mesh_begin(struct BMIter *iter);
|
||||
|
||||
Reference in New Issue
Block a user