[Bf-blender-cvs] [80b1adf] master: BMesh: avoid calling delete operator w/ face dissolve

Campbell Barton noreply at git.blender.org
Thu May 12 08:40:49 CEST 2016


Commit: 80b1adf8c2e8f76994403ab60a85b9332b58e7fc
Author: Campbell Barton
Date:   Thu May 12 16:45:47 2016 +1000
Branches: master
https://developer.blender.org/rB80b1adf8c2e8f76994403ab60a85b9332b58e7fc

BMesh: avoid calling delete operator w/ face dissolve

In nearly all cases this isn't needed.

===================================================================

M	source/blender/bmesh/operators/bmo_dissolve.c

===================================================================

diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c
index 52814a8..86062ff 100644
--- a/source/blender/bmesh/operators/bmo_dissolve.c
+++ b/source/blender/bmesh/operators/bmo_dissolve.c
@@ -194,7 +194,10 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
 		BLI_array_append(faces, NULL);
 		BLI_array_append(regions, faces);
 	}
-	
+
+	/* track how many faces we should end up with */
+	int totface_target = bm->totface;
+
 	for (i = 0; i < BLI_array_count(regions); i++) {
 		BMFace *f_new;
 		int tot = 0;
@@ -216,6 +219,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
 			if (act_face && bm->act_face == NULL) {
 				bm->act_face = f_new;
 			}
+			totface_target -= tot - 1;
 		}
 		else {
 			BMO_error_raise(bm, op, BMERR_DISSOLVEFACES_FAILED,
@@ -227,11 +231,12 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
 		 * unmark the original faces for deletion */
 		BMO_elem_flag_disable(bm, f_new, FACE_ORIG);
 		BMO_elem_flag_enable(bm, f_new, FACE_NEW);
-
 	}
 
-	BMO_op_callf(bm, op->flag, "delete geom=%ff context=%i", FACE_ORIG, DEL_FACES);
-
+	/* Typically no faces need to be deleted */
+	if (totface_target != bm->totface) {
+		BMO_op_callf(bm, op->flag, "delete geom=%ff context=%i", FACE_ORIG, DEL_FACES);
+	}
 
 	if (use_verts) {
 		BMIter viter;




More information about the Bf-blender-cvs mailing list