diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-12 01:01:38 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-12 01:07:44 +0300 |
commit | cfbd605567f48229a923df382baf6db98fbafc61 (patch) | |
tree | d4218c49672047d6c3b37517034660b3b5dcd966 /source/blender/python/bmesh/bmesh_py_api.c | |
parent | 71a57a37b2eebbed53b5335019287b4df9c30519 (diff) | |
parent | 7212ebd09f9720883581221be923ae5e97ff5d76 (diff) |
Merge branch 'master' into blender2.8
Conflicts:
intern/cycles/blender/addon/ui.py
source/blender/blenkernel/BKE_particle.h
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_distribute.c
source/blender/blenkernel/intern/texture.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_relations.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/physics/particle_object.c
source/blender/editors/transform/transform_snap_object.c
Diffstat (limited to 'source/blender/python/bmesh/bmesh_py_api.c')
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_api.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c index 7c5d1961849..eb1594688c7 100644 --- a/source/blender/python/bmesh/bmesh_py_api.c +++ b/source/blender/python/bmesh/bmesh_py_api.c @@ -53,17 +53,31 @@ #include "bmesh_py_api.h" /* own include */ PyDoc_STRVAR(bpy_bm_new_doc, -".. method:: new()\n" +".. method:: new(use_operators=True)\n" "\n" +" :arg use_operators: Support calling operators in :mod:`bmesh.ops` (uses some extra memory per vert/edge/face).\n" +" :type use_operators: bool\n" " :return: Return a new, empty BMesh.\n" " :rtype: :class:`bmesh.types.BMesh`\n" ); -static PyObject *bpy_bm_new(PyObject *UNUSED(self)) +static PyObject *bpy_bm_new(PyObject *UNUSED(self), PyObject *args, PyObject *kw) { + static const char *kwlist[] = {"use_operators", NULL}; BMesh *bm; - bm = BM_mesh_create(&bm_mesh_allocsize_default); + bool use_operators = true; + + if (!PyArg_ParseTupleAndKeywords( + args, kw, "|$O&:new", (char **)kwlist, + PyC_ParseBool, &use_operators)) + { + return NULL; + } + + bm = BM_mesh_create( + &bm_mesh_allocsize_default, + &((struct BMeshCreateParams){.use_toolflags = use_operators,})); return BPy_BMesh_CreatePyObject(bm, BPY_BMFLAG_NOP); } @@ -155,7 +169,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}, + {"new", (PyCFunction)bpy_bm_new, METH_VARARGS | METH_KEYWORDS, 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 | METH_KEYWORDS, bpy_bm_update_edit_mesh_doc}, {NULL, NULL, 0, NULL} |