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-05 06:56:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-07-05 11:31:44 +0300
commitb29a8a5dfe3d6eb2fbbdecd0d5dffb3d709b9b91 (patch)
tree9409bbfb55392577356d664aac1c80fa88e4bef8 /source/blender/bmesh/operators
parent9075f63e8f12d36ac216c4d4fdbd75770a7f2b9a (diff)
BMesh: dissolve faces no longer fails when some faces can't dissolve
Previously, any face groups that could not be merged into a face caused the entire operation to report an error and do nothing. Now these cases are skipped over, dissolving faces where possible.
Diffstat (limited to 'source/blender/bmesh/operators')
-rw-r--r--source/blender/bmesh/operators/bmo_dissolve.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c
index 62eaa690077..c0ce63fb0eb 100644
--- a/source/blender/bmesh/operators/bmo_dissolve.c
+++ b/source/blender/bmesh/operators/bmo_dissolve.c
@@ -214,21 +214,29 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
BMFace *f_new = BM_faces_join(bm, faces, faces_len, true);
if (f_new != NULL) {
- /* maintain active face */
+ /* Maintain the active face. */
if (act_face && bm->act_face == NULL) {
bm->act_face = f_new;
}
totface_target -= faces_len - 1;
+
+ /* If making the new face failed (e.g. overlapping test)
+ * un-mark the original faces for deletion. */
+ BMO_face_flag_disable(bm, f_new, FACE_ORIG);
+ BMO_face_flag_enable(bm, f_new, FACE_NEW);
}
else {
- BMO_error_raise(bm, op, "Could not create merged face");
- goto cleanup;
+ /* NOTE: prior to 3.0 this raised an error: "Could not create merged face".
+ * Change behavior since it's not useful to fail entirely when a single face-group
+ * can't be merged into one face. Continue with other face groups instead.
+ *
+ * This could optionally do a partial merge, where some faces are joined. */
+
+ /* Prevent these faces from being removed. */
+ for (i = 0; i < faces_len; i++) {
+ BMO_face_flag_disable(bm, faces[i], FACE_ORIG);
+ }
}
-
- /* if making the new face failed (e.g. overlapping test)
- * unmark the original faces for deletion */
- BMO_face_flag_disable(bm, f_new, FACE_ORIG);
- BMO_face_flag_enable(bm, f_new, FACE_NEW);
}
/* Typically no faces need to be deleted */
@@ -253,7 +261,6 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "region.out", BM_FACE, FACE_NEW);
-cleanup:
/* free/cleanup */
for (i = 0; i < BLI_array_len(regions); i++) {
MEM_freeN(regions[i].faces);