[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52286] trunk/blender/source/blender/bmesh /operators/bmo_bevel.c: more straightforward way to implement quad-strip face filling suggested by Howard Trickey ,

Campbell Barton ideasman42 at gmail.com
Fri Nov 16 22:05:30 CET 2012


Revision: 52286
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52286
Author:   campbellbarton
Date:     2012-11-16 21:05:27 +0000 (Fri, 16 Nov 2012)
Log Message:
-----------
more straightforward way to implement quad-strip face filling suggested by Howard Trickey,

also some other changes - no need to check the new loops face is larger and no longer split up the ngon more times then there are subdivisions in the face strip (now ngons will remain on both sides).

Modified Paths:
--------------
    trunk/blender/source/blender/bmesh/operators/bmo_bevel.c

Modified: trunk/blender/source/blender/bmesh/operators/bmo_bevel.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_bevel.c	2012-11-16 17:14:01 UTC (rev 52285)
+++ trunk/blender/source/blender/bmesh/operators/bmo_bevel.c	2012-11-16 21:05:27 UTC (rev 52286)
@@ -1193,48 +1193,38 @@
 
 	if (f) {
 		/* we have a polygon which we know starts at this vertex, make it into strips */
-		EdgeHalf *eh_first, *eh_iter;
-		EdgeHalf *eh_a = NULL, *eh_b = NULL;
-		BMVert *v_a_first, *v_b_first;
+		EdgeHalf *eh_a = bv->vmesh->boundstart->elast;
+		EdgeHalf *eh_b = next_bev(bv, eh_a->next);  /* since (selcount == 2) we know this is valid */
+		BMLoop *l_a = BM_face_vert_share_loop(f, eh_a->rightv->nv.v);
+		BMLoop *l_b = BM_face_vert_share_loop(f, eh_b->leftv->nv.v);
+		int seg_count = bv->vmesh->seg;  /* ensure we don't walk past the segments */
 
-		BMLoop *l_a;
-		BMLoop *l_b;
-
-		/* find both edges */
-		eh_iter = eh_first = bv->vmesh->boundstart->efirst;
-		do {
-			if (eh_iter->seg) {
-				if (eh_a == NULL) {
-					eh_a = eh_iter;
-				}
-				else if (eh_b == NULL) {
-					eh_b = eh_iter;
-					break;
-				}
-			}
-		} while ((eh_iter = eh_iter->next) != NULL);
-
-		v_a_first = eh_a->rightv->nv.v;
-		v_b_first = eh_b->leftv->nv.v;
-
-		l_a = BM_face_vert_share_loop(f, v_a_first);
-		l_b = BM_face_vert_share_loop(f, v_b_first);
 		if (l_a == l_b) {
 			/* step once around if we hit the same loop */
 			l_a = l_a->prev;
 			l_b = l_b->next;
+			seg_count--;
 		}
 
+		BLI_assert(l_a != l_b);
+
 		while (f->len > 4) {
 			BMLoop *l_new;
 			BLI_assert(l_a->f == f);
 			BLI_assert(l_b->f == f);
 
 			BM_face_split(bm, f, l_a->v, l_b->v, &l_new, NULL, FALSE);
+			if (seg_count-- == 0) {
+				break;
+			}
 
+			/* turns out we don't need this,
+			 * because of how BM_face_split works we always get the loop of the larger face */
+#if 0
 			if (l_new->f->len < l_new->radial_next->f->len) {
 				l_new = l_new->radial_next;
 			}
+#endif
 			f = l_new->f;
 
 			/* walk around the new face to get the next verts to split */




More information about the Bf-blender-cvs mailing list