[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42306] branches/bmesh/blender/source/ blender/bmesh/operators/dissolveops.c: fix [#28645] TODO: dissolve edges doesn't delete lonely vertices on edges

Campbell Barton ideasman42 at gmail.com
Thu Dec 1 03:20:30 CET 2011


Revision: 42306
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42306
Author:   campbellbarton
Date:     2011-12-01 02:20:24 +0000 (Thu, 01 Dec 2011)
Log Message:
-----------
fix [#28645] TODO: dissolve edges doesn't delete lonely vertices on edges

support for dissolving boundry & loose edges, previously this would only join adjacent faces,
now it collapses edge vertices when the edge has no face users.       

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/bmesh/operators/dissolveops.c

Modified: branches/bmesh/blender/source/blender/bmesh/operators/dissolveops.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/dissolveops.c	2011-12-01 01:41:56 UTC (rev 42305)
+++ branches/bmesh/blender/source/blender/bmesh/operators/dissolveops.c	2011-12-01 02:20:24 UTC (rev 42306)
@@ -194,11 +194,22 @@
 	/* int i; */
 
 	BMO_ITER(e, &oiter, bm, op, "edges", BM_EDGE) {
-		if (BM_Edge_FaceCount(e) == 2) {
+		const int edge_face_count= BM_Edge_FaceCount(e);
+		if (edge_face_count == 2) {
+			/* join faces */
 			BM_Join_TwoFaces(bm, e->l->f,
 			                 e->l->radial_next->f,
 			                 e);
 		}
+		else if (edge_face_count < 2) {
+			/* join verts, assign because first join frees the edge */
+			BMVert *v1= e->v1, *v2= e->v2;
+
+			/*collapse the vert*/
+			if (BM_Vert_EdgeCount(v1) == 2) BM_Collapse_Vert(bm, v1->e, v1, 0.5f);
+			if (BM_Vert_EdgeCount(v2) == 2) BM_Collapse_Vert(bm, v2->e, v2, 0.5f);
+
+		}
 	}
 }
 




More information about the Bf-blender-cvs mailing list