BMesh: ensure iterator macros assign to valid types

note, this is for C++ code which expects a cast, (will be added later)
also add a macro for nop-expressions (EXPR_NOP),
when we never want an expression to be evaluated, but it should still be valid.
This commit is contained in:
2014-12-08 10:54:56 +01:00
parent 690345a826
commit 3e7e97f127
6 changed files with 53 additions and 27 deletions

View File

@@ -198,16 +198,17 @@ int bpy_bm_generic_valid_check_source(BMesh *bm_source, const char *error_prefi
#define BPY_BM_IS_VALID(obj) (LIKELY((obj)->bm != NULL))
#define BM_ITER_BPY_BM_SEQ(ele, iter, bpy_bmelemseq) \
for (ele = BM_iter_new(iter, \
(bpy_bmelemseq)->bm, \
(bpy_bmelemseq)->itype, \
(bpy_bmelemseq)->py_ele ? \
((BPy_BMElem *)(bpy_bmelemseq)->py_ele)->ele : \
NULL \
); \
ele; \
ele = BM_iter_step(iter))
#define BM_ITER_BPY_BM_SEQ(ele, iter, bpy_bmelemseq) \
for (BM_CHECK_TYPE_ELEM_ASSIGN(ele) = BM_iter_new( \
iter, \
(bpy_bmelemseq)->bm, \
(bpy_bmelemseq)->itype, \
(bpy_bmelemseq)->py_ele ? \
((BPy_BMElem *)(bpy_bmelemseq)->py_ele)->ele : \
NULL \
); \
ele; \
BM_CHECK_TYPE_ELEM_ASSIGN(ele) = BM_iter_step(iter))
#ifdef __PY_CAPI_UTILS_H__