[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44943] trunk/blender/source/blender/bmesh /tools/BME_bevel.c: Fix 30562: bevel was infinite looping when adjacent faces had incompatible normals

Howard Trickey howard.trickey at gmail.com
Sat Mar 17 16:47:56 CET 2012


Revision: 44943
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44943
Author:   howardt
Date:     2012-03-17 15:47:48 +0000 (Sat, 17 Mar 2012)
Log Message:
-----------
Fix 30562: bevel was infinite looping when adjacent faces had incompatible normals

The fix is to check for cases where BME_Bevel_Dissolve_Disk was trying
to join faces with opposite normals and reverse one.  This isn't a great
fix, and the example blend has strange corners at the top after beveling,
but at least it stops the infinite loops.

Modified Paths:
--------------
    trunk/blender/source/blender/bmesh/tools/BME_bevel.c

Modified: trunk/blender/source/blender/bmesh/tools/BME_bevel.c
===================================================================
--- trunk/blender/source/blender/bmesh/tools/BME_bevel.c	2012-03-17 14:42:44 UTC (rev 44942)
+++ trunk/blender/source/blender/bmesh/tools/BME_bevel.c	2012-03-17 15:47:48 UTC (rev 44943)
@@ -166,7 +166,18 @@
 			e = v->e;
 			l1 = e->l;
 			l2 = l1->radial_next;
-			bmesh_jfke(bm, l1->f, l2->f, e);
+			if (l1->v == l2->v) {
+				/* faces have incompatible directions; need to reverse one */
+				if (!bmesh_loop_reverse(bm, l2->f)) {
+					BLI_assert(!"bevel dissolve disk cannot reverse loop");
+					return 0;
+				}
+				l2 = l1->radial_next;
+			}
+			if (!bmesh_jfke(bm, l1->f, l2->f, e)) {
+				BLI_assert(!"bevel dissolve disk cannot join faces");
+				return 0;
+			}
 		}
 
 		e = v->e;
@@ -178,6 +189,14 @@
 
 		l1 = elast->l;
 		l2 = l1->radial_next;
+		if (l1->v == l2->v) {
+			/* faces have incompatible directions */
+				if (!bmesh_loop_reverse(bm, l2->f)) {
+					BLI_assert(!"bevel dissolve disk cannot reverse loop");
+					return 0;
+				}
+				l2 = l1->radial_next;
+		}
 		bmesh_jfke(bm, l1->f, l2->f, elast);
 	}
 




More information about the Bf-blender-cvs mailing list