Fix #27921: optimal display with 2 subsurf modifiers fails.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 11 Jul 2011 09:05:10 +0000 (09:05 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 11 Jul 2011 09:05:10 +0000 (09:05 +0000)
source/blender/blenkernel/intern/subsurf_ccg.c

index a66caf8879f2b79679d9d9032e51ac108a864b4b..67d7e7bffd6b479c77864b27d2594d2975f51a5c 100644 (file)
@@ -1176,7 +1176,8 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(draw
        CCGSubSurf *ss = ccgdm->ss;
        CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss);
        CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss);
-       int i, edgeSize = ccgSubSurf_getEdgeSize(ss);
+       int i, j, edgeSize = ccgSubSurf_getEdgeSize(ss);
+       int totedge = ccgSubSurf_getNumEdges(ss);
        int gridSize = ccgSubSurf_getGridSize(ss);
        int useAging;
 
@@ -1184,13 +1185,16 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(draw
 
        ccgSubSurf_getUseAgeCounts(ss, &useAging, NULL, NULL, NULL);
 
-       for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) {
-               CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
+       for (j=0; j< totedge; j++) {
+               CCGEdge *e = ccgdm->edgeMap[j].edge;
                DMGridData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
 
                if (!drawLooseEdges && !ccgSubSurf_getEdgeNumFaces(e))
                        continue;
 
+               if(ccgdm->edgeFlags && !(ccgdm->edgeFlags[j] & ME_EDGEDRAW))
+                       continue;
+
                if (useAging && !(G.f&G_BACKBUFSEL)) {
                        int ageCol = 255-ccgSubSurf_getEdgeAge(ss, e)*4;
                        glColor3ub(0, ageCol>0?ageCol:0, 0);