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-11-29 07:25:37 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-29 07:25:37 +0400
commitc86045d7a29c2ffe3f102955560fda214d9f7f2d (patch)
tree23bd8ffa639a1996a2c0a0c817c6097c3c9b25c2 /source/blender/python/bmesh/bmesh_py_types.h
parent078487e98e9e06bd971b132fb7e856ba174b02c6 (diff)
bmesh py api: use generic checking macros to see if an object if from the same bmesh.
- was such a common operation so this saves having exceptions set inline all over the place.
Diffstat (limited to 'source/blender/python/bmesh/bmesh_py_types.h')
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_types.h b/source/blender/python/bmesh/bmesh_py_types.h
index 8de69c2d8a2..d15918a3c11 100644
--- a/source/blender/python/bmesh/bmesh_py_types.h
+++ b/source/blender/python/bmesh/bmesh_py_types.h
@@ -158,9 +158,6 @@ PyObject *BPy_BMIter_CreatePyObject(BMesh *bm);
PyObject *BPy_BMElem_CreatePyObject(BMesh *bm, BMHeader *ele); /* just checks type and creates v/e/f/l */
-int bpy_bm_generic_valid_check(BPy_BMGeneric *self);
-void bpy_bm_generic_invalidate(BPy_BMGeneric *self);
-
void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_size,
const char htype,
const char do_unique_check, const char do_bm_check,
@@ -171,9 +168,20 @@ int BPy_BMElem_CheckHType(PyTypeObject *type, const char htype);
char *BPy_BMElem_StringFromHType_ex(const char htype, char ret[32]);
char *BPy_BMElem_StringFromHType(const char htype);
-
-#define BPY_BM_CHECK_OBJ(obj) if (UNLIKELY(bpy_bm_generic_valid_check((BPy_BMGeneric *)obj) == -1)) { return NULL; } (void)0
-#define BPY_BM_CHECK_INT(obj) if (UNLIKELY(bpy_bm_generic_valid_check((BPy_BMGeneric *)obj) == -1)) { return -1; } (void)0
+void bpy_bm_generic_invalidate(BPy_BMGeneric *self);
+int bpy_bm_generic_valid_check(BPy_BMGeneric *self);
+int bpy_bm_generic_valid_check_source(BPy_BMGeneric *self, BMesh *bm_source, const char *error_prefix);
+
+#define BPY_BM_CHECK_OBJ(obj) \
+ if (UNLIKELY(bpy_bm_generic_valid_check((BPy_BMGeneric *)obj) == -1)) { return NULL; } (void)0
+#define BPY_BM_CHECK_INT(obj) \
+ if (UNLIKELY(bpy_bm_generic_valid_check((BPy_BMGeneric *)obj) == -1)) { return -1; } (void)0
+
+/* macros like BPY_BM_CHECK_OBJ/BPY_BM_CHECK_INT that ensure we're from the right BMesh */
+#define BPY_BM_CHECK_SOURCE_OBJ(obj, bm, errmsg) \
+ if (UNLIKELY(bpy_bm_generic_valid_check_source((BPy_BMGeneric *)obj, bm, errmsg) == -1)) { return NULL; } (void)0
+#define BPY_BM_CHECK_SOURCE_INT(obj, bm, errmsg) \
+ if (UNLIKELY(bpy_bm_generic_valid_check_source((BPy_BMGeneric *)obj, bm, errmsg) == -1)) { return -1; } (void)0
#define BPY_BM_IS_VALID(obj) (LIKELY((obj)->bm != NULL))