BMesh: add BMO_ITER_INDEX macro
authorCampbell Barton <ideasman42@gmail.com>
Thu, 11 Jun 2015 11:34:59 +0000 (21:34 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 11 Jun 2015 11:54:06 +0000 (21:54 +1000)
source/blender/bmesh/intern/bmesh_operator_api.h

index 3f7fb7b257dea7c2646e01d8aa0f9b14b24caf4b..14e9bf81be7bb1264ecfea3aeee8004eedc83419 100644 (file)
@@ -501,6 +501,11 @@ bool  BMO_iter_map_value_bool(BMOIter *iter);
             ele; \
             BM_CHECK_TYPE_ELEM_ASSIGN(ele) = BMO_iter_step(iter))
 
             ele; \
             BM_CHECK_TYPE_ELEM_ASSIGN(ele) = BMO_iter_step(iter))
 
+#define BMO_ITER_INDEX(ele, iter, slot_args, slot_name, restrict_flag, i_)   \
+       for (BM_CHECK_TYPE_ELEM_ASSIGN(ele) = BMO_iter_new(iter, slot_args, slot_name, restrict_flag), i_ = 0; \
+            ele; \
+            BM_CHECK_TYPE_ELEM_ASSIGN(ele) = BMO_iter_step(iter), i_++)
+
 extern const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES];
 
 int BMO_opcode_from_opname(const char *opname);
 extern const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES];
 
 int BMO_opcode_from_opname(const char *opname);