Revision: 40986
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40986
Author:   ender79
Date:     2011-10-13 12:13:56 +0000 (Thu, 13 Oct 2011)
Log Message:
-----------
Temporary workaround (to unblock a BMesh user) for issue #28869 which is 
causing a hang when loading some .blend files.

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

Modified: branches/bmesh/blender/source/blender/bmesh/operators/edgesplitop.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/edgesplitop.c 
2011-10-13 08:56:21 UTC (rev 40985)
+++ branches/bmesh/blender/source/blender/bmesh/operators/edgesplitop.c 
2011-10-13 12:13:56 UTC (rev 40986)
@@ -116,7 +116,8 @@
                        else {
                                /* Only two new edges should be created from 
each original edge
                                   for edge split operation */
-                               BLI_assert(et->newe1 == l2->e || et->newe2 == 
l2->e);
+                               //BLI_assert(et->newe1 == l2->e || et->newe2 == 
l2->e);
+                               et->newe2 = l2->e;
                        }
 
                        if (BMO_TestFlag(bm, l->e, EDGE_SEAM)) {
@@ -140,7 +141,7 @@
        BMLoop *l, *startl;
        BMEdge *e;
        BMVert *v;
-       int i, ok;
+       int i, j, ok;
        
        ok=0;
        while (ok++ < 100000) {         
@@ -164,6 +165,7 @@
                        
                        v = i ? l->next->v : l->v;
 
+                       j = 0;
                        while (1) {
                                et = etags + BM_GetIndex(l->e);
                                if (et->newe1 == l->e) {
@@ -201,6 +203,25 @@
                                }
 
                                v = (l->v == v) ? l->next->v : l->v;
+
+                               /*
+                                * temporary workaround for #28869: this inner 
loop is hanging
+                                * on loading some file with edge split 
modifier. the loop visits
+                                * vertices, and shouldn't execute more 
iterations than there are
+                                * vertices in the mesh.
+                                *
+                                * clear tags and bail if things start to seem 
flaky.
+                                */
+                               if (++j > bm->totvert) {
+                                       BLI_assert(0);
+
+                                       BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, 
NULL) {
+                                               BMO_SetFlag(bm, e, EDGE_RET1);
+                                               BMO_SetFlag(bm, e, EDGE_RET2);
+                                       }
+
+                                       return;
+                               }
                        }
                }
        }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to