diff options
Diffstat (limited to 'source/blender/python/bmesh/bmesh_py_api.c')
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_api.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c index 18f5d895132..47e6baf8e93 100644 --- a/source/blender/python/bmesh/bmesh_py_api.c +++ b/source/blender/python/bmesh/bmesh_py_api.c @@ -98,7 +98,7 @@ static PyObject *bpy_bm_from_edit_mesh(PyObject *UNUSED(self), PyObject *value) } PyDoc_STRVAR(bpy_bm_update_edit_mesh_doc, -".. method:: update_edit_mesh(mesh, tessface=True)\n" +".. method:: update_edit_mesh(mesh, tessface=True, destructive=True)\n" "\n" " Update the mesh after changes to the BMesh in editmode, \n" " optionally recalculating n-gon tessellation.\n" @@ -107,14 +107,20 @@ PyDoc_STRVAR(bpy_bm_update_edit_mesh_doc, " :type mesh: :class:`bpy.types.Mesh`\n" " :arg tessface: Option to recalculate n-gon tessellation.\n" " :type tessface: boolean\n" +" :arg destructive: Use when grometry has been added or removed.\n" +" :type destructive: boolean\n" ); -static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args) +static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args, PyObject *kw) { + static const char *kwlist[] = {"mesh", "tessface", "destructive", NULL}; PyObject *py_me; Mesh *me; - int do_tessface = TRUE; + int do_tessface = true; + int is_destructive = true; - if (!PyArg_ParseTuple(args, "O|i:update_edit_mesh", &py_me, &do_tessface)) { + if (!PyArg_ParseTupleAndKeywords(args, kw, "O|ii:update_edit_mesh", (char **)kwlist, + &py_me, &do_tessface, &is_destructive)) + { return NULL; } @@ -131,13 +137,8 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args) } { - /* XXX, not great - infact this function could just not use the context at all - * postpone that change until after release: BMESH_TODO - campbell */ - extern struct bContext *BPy_GetContext(void); - extern void EDBM_update_generic(struct bContext *C, BMEditMesh *em, const short do_tessface); - - struct bContext *C = BPy_GetContext(); - EDBM_update_generic(C, me->edit_btmesh, do_tessface); + extern void EDBM_update_generic(BMEditMesh *em, const bool do_tessface, const bool is_destructive); + EDBM_update_generic(me->edit_btmesh, do_tessface, is_destructive); } Py_RETURN_NONE; @@ -146,7 +147,7 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args) static struct PyMethodDef BPy_BM_methods[] = { {"new", (PyCFunction)bpy_bm_new, METH_NOARGS, bpy_bm_new_doc}, {"from_edit_mesh", (PyCFunction)bpy_bm_from_edit_mesh, METH_O, bpy_bm_from_edit_mesh_doc}, - {"update_edit_mesh", (PyCFunction)bpy_bm_update_edit_mesh, METH_VARARGS, bpy_bm_update_edit_mesh_doc}, + {"update_edit_mesh", (PyCFunction)bpy_bm_update_edit_mesh, METH_VARARGS | METH_KEYWORDS, bpy_bm_update_edit_mesh_doc}, {NULL, NULL, 0, NULL} }; |