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-28 10:01:58 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-03-28 10:01:58 +0400
commit765060acd4ddacaf75641989e2edddcdbcff10fd (patch)
treedb72f9232be3b85e3da2d9c5187edc80a33984cc /source/blender/bmesh/intern/bmesh_iterators.c
parentabac71c4741d9a84ca6c3ddb48c302e344e61f5a (diff)
BMesh: make the context create operator (Fkay) more logical, before calling each operator check the state that it can even run and do something.
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_iterators.c')
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c
index a1dde035224..89348f23b9d 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.c
+++ b/source/blender/bmesh/intern/bmesh_iterators.c
@@ -105,6 +105,33 @@ int BM_iter_as_array(BMesh *bm, const char itype, void *data, void **array, cons
return i;
}
+/**
+ * \brief Operator Iterator as Array
+ *
+ * Sometimes its convenient to get the iterator as an array.
+ */
+int BMO_iter_as_array(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const char restrictmask,
+ void **array, const int len)
+{
+ int i = 0;
+
+ /* sanity check */
+ if (len > 0) {
+ BMOIter oiter;
+ void *ele;
+
+ for (ele = BMO_iter_new(&oiter, slot_args, slot_name, restrictmask); ele; ele = BMO_iter_step(&oiter)) {
+ array[i] = ele;
+ i++;
+ if (i == len) {
+ return len;
+ }
+ }
+ }
+
+ return i;
+}
+
/**
* \brief Iterator as Array