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>2012-04-28 22:39:37 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-04-28 22:39:37 +0400
commit4465d2f419a8515df41a8fc415774eedaef0e6f6 (patch)
tree8ea0e2d76fe6f937e4b8b132d614de7909ee4406 /source/blender/bmesh
parent3865276eb8c0f73646a32c05dbe9d8f65babe332 (diff)
bmesh api functions, not used yet:
BM_iter_elem_count_flag() BM_iter_mesh_count_flag()
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators.c44
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators.h2
2 files changed, 46 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c
index 384715d74f7..8103ae1ee11 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.c
+++ b/source/blender/bmesh/intern/bmesh_iterators.c
@@ -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
diff --git a/source/blender/bmesh/intern/bmesh_iterators.h b/source/blender/bmesh/intern/bmesh_iterators.h
index c687e4b4e7a..1361a91a692 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.h
+++ b/source/blender/bmesh/intern/bmesh_iterators.h
@@ -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);