Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-07-02 05:46:08 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-07-05 11:36:33 +0300
commit04313f1bb5ff89168099cdc03d1855ae5118d29c (patch)
tree8f3238a4edbbdb0e12de8b111d31454f1bb5509b /source/blender/bmesh/operators
parentafe7387be81ef04dc566a182ccadb2b1e739f809 (diff)
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.
Diffstat (limited to 'source/blender/bmesh/operators')
-rw-r--r--source/blender/bmesh/operators/bmo_bisect_plane.c2
-rw-r--r--source/blender/bmesh/operators/bmo_bridge.c6
-rw-r--r--source/blender/bmesh/operators/bmo_connect.c2
-rw-r--r--source/blender/bmesh/operators/bmo_dissolve.c2
-rw-r--r--source/blender/bmesh/operators/bmo_fill_grid.c7
-rw-r--r--source/blender/bmesh/operators/bmo_hull.c2
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide_edgering.c6
7 files changed, 14 insertions, 13 deletions
diff --git a/source/blender/bmesh/operators/bmo_bisect_plane.c b/source/blender/bmesh/operators/bmo_bisect_plane.c
index 2663f271b6e..55b6337bea4 100644
--- a/source/blender/bmesh/operators/bmo_bisect_plane.c
+++ b/source/blender/bmesh/operators/bmo_bisect_plane.c
@@ -50,7 +50,7 @@ void bmo_bisect_plane_exec(BMesh *bm, BMOperator *op)
BMO_slot_vec_get(op->slots_in, "plane_no", plane_no);
if (is_zero_v3(plane_no)) {
- BMO_error_raise(bm, op, "Zero normal given");
+ BMO_error_raise(bm, op, BMO_ERROR_CANCEL, "Zero normal given");
return;
}
diff --git a/source/blender/bmesh/operators/bmo_bridge.c b/source/blender/bmesh/operators/bmo_bridge.c
index 005b8a2f5e8..fb913d4f19f 100644
--- a/source/blender/bmesh/operators/bmo_bridge.c
+++ b/source/blender/bmesh/operators/bmo_bridge.c
@@ -576,12 +576,12 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
BM_mesh_edgeloops_calc_center(bm, &eloops);
if (count < 2) {
- BMO_error_raise(bm, op, "Select at least two edge loops");
+ BMO_error_raise(bm, op, BMO_ERROR_CANCEL, "Select at least two edge loops");
goto cleanup;
}
if (use_pairs && (count % 2)) {
- BMO_error_raise(bm, op, "Select an even number of loops to bridge pairs");
+ BMO_error_raise(bm, op, BMO_ERROR_CANCEL, "Select an even number of loops to bridge pairs");
goto cleanup;
}
@@ -595,7 +595,7 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
}
}
if (!match) {
- BMO_error_raise(bm, op, "Selected loops must have equal edge counts");
+ BMO_error_raise(bm, op, BMO_ERROR_CANCEL, "Selected loops must have equal edge counts");
goto cleanup;
}
}
diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c
index b701c1291a6..abc040f7564 100644
--- a/source/blender/bmesh/operators/bmo_connect.c
+++ b/source/blender/bmesh/operators/bmo_connect.c
@@ -211,7 +211,7 @@ void bmo_connect_verts_exec(BMesh *bm, BMOperator *op)
/* connect faces */
while ((f = BLI_LINKSTACK_POP(faces))) {
if (bm_face_connect_verts(bm, f, check_degenerate) == -1) {
- BMO_error_raise(bm, op, "Could not connect vertices");
+ BMO_error_raise(bm, op, BMO_ERROR_FATAL, "Could not connect vertices");
}
}
diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c
index c0ce63fb0eb..efba0ec99ec 100644
--- a/source/blender/bmesh/operators/bmo_dissolve.c
+++ b/source/blender/bmesh/operators/bmo_dissolve.c
@@ -257,7 +257,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
}
}
- BLI_assert(!BMO_error_occurred(bm));
+ BLI_assert(!BMO_error_occurred_at_level(bm, BMO_ERROR_FATAL));
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "region.out", BM_FACE, FACE_NEW);
diff --git a/source/blender/bmesh/operators/bmo_fill_grid.c b/source/blender/bmesh/operators/bmo_fill_grid.c
index 4ba7dbad736..2e09b21c9cc 100644
--- a/source/blender/bmesh/operators/bmo_fill_grid.c
+++ b/source/blender/bmesh/operators/bmo_fill_grid.c
@@ -619,6 +619,7 @@ void bmo_grid_fill_exec(BMesh *bm, BMOperator *op)
* extract two 'rail' loops from a single edge loop, see T72075. */
BMO_error_raise(bm,
op,
+ BMO_ERROR_CANCEL,
"Select two edge loops "
"or a single closed edge loop from which two edge loops can be calculated");
goto cleanup;
@@ -633,7 +634,7 @@ void bmo_grid_fill_exec(BMesh *bm, BMOperator *op)
v_b_last = ((LinkData *)BM_edgeloop_verts_get(estore_b)->last)->data;
if (BM_edgeloop_is_closed(estore_a) || BM_edgeloop_is_closed(estore_b)) {
- BMO_error_raise(bm, op, "Closed loops unsupported");
+ BMO_error_raise(bm, op, BMO_ERROR_CANCEL, "Closed loops unsupported");
goto cleanup;
}
@@ -671,7 +672,7 @@ void bmo_grid_fill_exec(BMesh *bm, BMOperator *op)
bm_edgeloop_flag_set(estore_b, BM_ELEM_HIDDEN, false);
if (BLI_listbase_is_empty(&eloops_rail)) {
- BMO_error_raise(bm, op, "Loops are not connected by wire/boundary edges");
+ BMO_error_raise(bm, op, BMO_ERROR_CANCEL, "Loops are not connected by wire/boundary edges");
goto cleanup;
}
@@ -679,7 +680,7 @@ void bmo_grid_fill_exec(BMesh *bm, BMOperator *op)
BLI_assert(v_a_last != v_b_last);
if (BM_edgeloop_overlap_check(estore_rail_a, estore_rail_b)) {
- BMO_error_raise(bm, op, "Connecting edge loops overlap");
+ BMO_error_raise(bm, op, BMO_ERROR_CANCEL, "Connecting edge loops overlap");
goto cleanup;
}
diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c
index dd2fe52293f..0801300b6c2 100644
--- a/source/blender/bmesh/operators/bmo_hull.c
+++ b/source/blender/bmesh/operators/bmo_hull.c
@@ -554,7 +554,7 @@ void bmo_convex_hull_exec(BMesh *bm, BMOperator *op)
/* Verify that at least three verts in the input */
if (!hull_num_input_verts_is_ok(op)) {
- BMO_error_raise(bm, op, "Requires at least three vertices");
+ BMO_error_raise(bm, op, BMO_ERROR_CANCEL, "Requires at least three vertices");
return;
}
diff --git a/source/blender/bmesh/operators/bmo_subdivide_edgering.c b/source/blender/bmesh/operators/bmo_subdivide_edgering.c
index caca24f4409..d015b715a69 100644
--- a/source/blender/bmesh/operators/bmo_subdivide_edgering.c
+++ b/source/blender/bmesh/operators/bmo_subdivide_edgering.c
@@ -1143,7 +1143,7 @@ void bmo_subdivide_edgering_exec(BMesh *bm, BMOperator *op)
count = BM_mesh_edgeloops_find(bm, &eloops_rim, bm_edge_rim_test_cb, (void *)bm);
if (count < 2) {
- BMO_error_raise(bm, op, "No edge rings found");
+ BMO_error_raise(bm, op, BMO_ERROR_CANCEL, "No edge rings found");
goto cleanup;
}
else if (count == 2) {
@@ -1167,7 +1167,7 @@ void bmo_subdivide_edgering_exec(BMesh *bm, BMOperator *op)
changed = true;
}
else {
- BMO_error_raise(bm, op, "Edge-ring pair isn't connected");
+ BMO_error_raise(bm, op, BMO_ERROR_CANCEL, "Edge-ring pair isn't connected");
goto cleanup;
}
}
@@ -1179,7 +1179,7 @@ void bmo_subdivide_edgering_exec(BMesh *bm, BMOperator *op)
LoopPairStore **lpair_arr;
if (eloop_pairs_gs == NULL) {
- BMO_error_raise(bm, op, "Edge-rings are not connected");
+ BMO_error_raise(bm, op, BMO_ERROR_CANCEL, "Edge-rings are not connected");
goto cleanup;
}