diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-11-29 07:25:37 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-11-29 07:25:37 +0400 |
commit | c86045d7a29c2ffe3f102955560fda214d9f7f2d (patch) | |
tree | 23bd8ffa639a1996a2c0a0c817c6097c3c9b25c2 /source/blender/python/bmesh/bmesh_py_types_select.c | |
parent | 078487e98e9e06bd971b132fb7e856ba174b02c6 (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_select.c')
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types_select.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_types_select.c b/source/blender/python/bmesh/bmesh_py_types_select.c index 2ff731559d1..dfcfbeb0ab5 100644 --- a/source/blender/python/bmesh/bmesh_py_types_select.c +++ b/source/blender/python/bmesh/bmesh_py_types_select.c @@ -114,13 +114,7 @@ static PyObject *bpy_bmeditselseq_add(BPy_BMEditSelSeq *self, BPy_BMElem *value) return NULL; } - BPY_BM_CHECK_OBJ(value); - - if (self->bm != value->bm) { - PyErr_SetString(PyExc_ValueError, - "Element is not from this mesh"); - return NULL; - } + BPY_BM_CHECK_SOURCE_OBJ(value, self->bm, "select_history.add()"); BM_select_history_store(self->bm, value->ele); @@ -145,11 +139,9 @@ static PyObject *bpy_bmeditselseq_remove(BPy_BMEditSelSeq *self, BPy_BMElem *val return NULL; } - BPY_BM_CHECK_OBJ(value); + BPY_BM_CHECK_SOURCE_OBJ(value, self->bm, "select_history.remove()"); - if ((self->bm != value->bm) || - (BM_select_history_remove(self->bm, value->ele) == FALSE)) - { + if (BM_select_history_remove(self->bm, value->ele) == FALSE) { PyErr_SetString(PyExc_ValueError, "Element not found in selection history"); return NULL; |