diff options
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_api.c | 22 | ||||
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_ops_call.c | 6 | ||||
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types.c | 2 | ||||
-rw-r--r-- | source/blender/python/generic/bgl.c | 2 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 4 |
5 files changed, 28 insertions, 8 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} diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c index 1dc70c3d288..551a66d1ed8 100644 --- a/source/blender/python/bmesh/bmesh_py_ops_call.c +++ b/source/blender/python/bmesh/bmesh_py_ops_call.c @@ -698,6 +698,12 @@ PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw) BPY_BM_CHECK_OBJ(py_bm); bm = py_bm->bm; + if (bm->use_toolflags == false) { + PyErr_SetString(PyExc_ValueError, + "bmesh created with 'use_operators=False'"); + return NULL; + } + /* could complain about entering with exceptions... */ BMO_error_clear(bm); } diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index fe4360d1e3b..1d951bae48b 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -1824,7 +1824,7 @@ static PyObject *bpy_bmface_calc_tangent_edge(BPy_BMFace *self) PyDoc_STRVAR(bpy_bmface_calc_tangent_edge_pair_doc, ".. method:: calc_tangent_edge_pair()\n" "\n" -" Return face tangent based on the two longest disconected edges.\n" +" Return face tangent based on the two longest disconnected edges.\n" "\n" " - Tris: Use the edge pair with the most similar lengths.\n" " - Quads: Use the longest edge pair.\n" diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index 4bd2e9d8d62..3ea10228ad4 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -983,7 +983,7 @@ static PyObject *Buffer_repr(Buffer *self) switch (self->type) { case GL_BYTE: typestr = "GL_BYTE"; break; case GL_SHORT: typestr = "GL_SHORT"; break; - case GL_INT: typestr = "GL_BYTE"; break; + case GL_INT: typestr = "GL_INT"; break; case GL_FLOAT: typestr = "GL_FLOAT"; break; case GL_DOUBLE: typestr = "GL_DOUBLE"; break; default: typestr = "UNKNOWN"; break; diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 11af0836e1c..311f621e13b 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -901,8 +901,8 @@ static void bpy_module_free(void *UNUSED(mod)) bool BPY_string_is_keyword(const char *str) { /* list is from... - * ", ".join(['"%s"' % kw for kw in __import__("keyword").kwlist]) - */ + * ", ".join(['"%s"' % kw for kw in __import__("keyword").kwlist]) + */ const char *kwlist[] = { "False", "None", "True", "and", "as", "assert", "break", |