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>2013-03-27 14:14:09 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-03-27 14:14:09 +0400
commitcb6f4160cce25fb3f233e0e0a623d035836caa32 (patch)
tree4cd9f0760f178f90bedd828871e76230b5425435 /source/blender/bmesh/intern/bmesh_iterators.c
parent93d5e106aac81fb1054d8ba0502f8d336f29b2c5 (diff)
api cleanup: replace BMO_vert_edge_flags_count() with more reusable function - BMO_iter_elem_count_flag().
closely matching existing BM_iter_elem_count_flag() function but checks tool-flags instead.
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_iterators.c')
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c
index 44b76df7432..a1dde035224 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.c
+++ b/source/blender/bmesh/intern/bmesh_iterators.c
@@ -170,7 +170,7 @@ int BM_iter_elem_count_flag(const char itype, void *data, const char hflag, cons
BMElem *ele;
int count = 0;
- for (ele = BM_iter_new(&iter, NULL, itype, data); ele; ele = BM_iter_step(&iter)) {
+ BM_ITER_ELEM (ele, &iter, data, itype) {
if (BM_elem_flag_test_bool(ele, hflag) == value) {
count++;
}
@@ -180,6 +180,30 @@ int BM_iter_elem_count_flag(const char itype, void *data, const char hflag, cons
}
/**
+ * \brief Elem Iter Tool Flag Count
+ *
+ * Counts how many flagged / unflagged items are found in this element.
+ */
+int BMO_iter_elem_count_flag(BMesh *bm, const char itype, void *data,
+ const short oflag, const bool value)
+{
+ BMIter iter;
+ BMElemF *ele;
+ int count = 0;
+
+ /* loops have no header flags */
+ BLI_assert(bm_iter_itype_htype_map[itype] != BM_LOOP);
+
+ BM_ITER_ELEM (ele, &iter, data, itype) {
+ if (BMO_elem_flag_test_bool(bm, ele, oflag) == value) {
+ count++;
+ }
+ }
+ return count;
+}
+
+
+/**
* \brief Mesh Iter Flag Count
*
* Counts how many flagged / unflagged items are found in this mesh.
@@ -190,7 +214,7 @@ int BM_iter_mesh_count_flag(const char itype, BMesh *bm, const char hflag, const
BMElem *ele;
int count = 0;
- for (ele = BM_iter_new(&iter, bm, itype, NULL); ele; ele = BM_iter_step(&iter)) {
+ BM_ITER_MESH (ele, &iter, bm, itype) {
if (BM_elem_flag_test_bool(ele, hflag) == value) {
count++;
}