From 04313f1bb5ff89168099cdc03d1855ae5118d29c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 2 Jul 2021 12:46:08 +1000 Subject: BMesh: remove redundant mesh-backups from EDBM_op_* API Using BMesh operators through the edit-mesh API created a full copy of the mesh so it was possible to restore the mesh in case one of the operators raised an error. Remove support for automatic backup/restore from the EDBM_op_* API's as it adds significant overhead and was rarely used. Operators that need this can use the BMBackup API to backup & restore the mesh in case of failure. Add warning levels to BMO_error_raise so operators can report problems without it being interpreted as a request to cancel the operation. For high-poly meshes creating and freeing a full copy is an expensive operation, removing this gives a speedup of ~1.77x for most operators except for "connect_verts" / "connect_vert_pair" which still uses this functionality. --- source/blender/python/bmesh/bmesh_py_ops_call.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/python') diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c index 6d500c44fb2..3d5aabcfda9 100644 --- a/source/blender/python/bmesh/bmesh_py_ops_call.c +++ b/source/blender/python/bmesh/bmesh_py_ops_call.c @@ -44,10 +44,10 @@ BLI_STATIC_ASSERT(sizeof(PyC_FlagSet) == sizeof(BMO_FlagSet), "size mismatch"); static int bpy_bm_op_as_py_error(BMesh *bm) { - if (BMO_error_occurred(bm)) { + if (BMO_error_occurred_at_level(bm, BMO_ERROR_FATAL)) { /* NOTE: we could have multiple errors. */ const char *errmsg; - if (BMO_error_get(bm, &errmsg, NULL)) { + if (BMO_error_get(bm, &errmsg, NULL, NULL)) { PyErr_Format(PyExc_RuntimeError, "bmesh operator: %.200s", errmsg); BMO_error_clear(bm); return -1; -- cgit v1.2.3