- readded Subsurf "optimal" edge drawing/rendering
authorDaniel Dunbar <daniel@zuster.org>
Fri, 12 Aug 2005 21:55:50 +0000 (21:55 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 12 Aug 2005 21:55:50 +0000 (21:55 +0000)
 - added ME_EDGERENDER flag, barely changes things atm except makes
   sure plain meshes with FasterDraw/etc set still render all edges.
   The edge drawing system needs a bit of a revamping - it is a cool
   feature but could use several improvements:
     (1) The algorithm could be better in choosing the best edges to
         draw.
     (2) The drawflags should interact well with modifiers. It is wierd
         to have a large grid with a deformer that draws no edges because
         flags are only calculated based on base mesh.
     (3) Drawflags should not be destroyed by editmode. Better design
         would be a "Draw % of edges" button.

   Of course, could also be the feature is not worth it and we
   should just drop. Feel free to comment if you have an opinion.

source/blender/blenkernel/BKE_DerivedMesh.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenloader/intern/readfile.c
source/blender/makesdna/DNA_meshdata_types.h
source/blender/makesdna/DNA_modifier_types.h
source/blender/python/api2_2x/NMesh.c
source/blender/renderconverter/intern/convertBlenderScene.c
source/blender/src/buttons_editing.c
source/blender/src/editmesh.c

index f4302d12bf6bb5238d9e13f4710f90bf276d4980..b6b1cb69c8e6dd53ecb2f47f6682261ff0f64bb6 100644 (file)
@@ -132,13 +132,9 @@ struct DerivedMesh {
                         * Also called for *final* editmode DerivedMeshes
                         */
        void (*drawEdges)(DerivedMesh *dm);
-
-                       /* Draw mapped edges as lines (no options) */
-       void (*drawMappedEdges)(DerivedMesh *dm);
                        
                        /* Draw all edges without faces as lines (no options) */
        void (*drawLooseEdges)(DerivedMesh *dm);
-
                        
                        /* Draw all faces
                         *  o Set face normal or vertex normal based on inherited face flag
index 65ff9192243bc532368e0ae6d48b0b58ee6c1a70..08c7b55659c1ebc47ce460ef025ff97853496f7d 100644 (file)
@@ -175,7 +175,7 @@ static void meshDM_drawEdges(DerivedMesh *dm)
                
                glBegin(GL_LINES);
                for(a=me->totedge; a>0; a--, medge++) {
-                       if(medge->flag & ME_EDGEDRAW) {
+                       if(medge->flag&ME_EDGEDRAW) {
                                glVertex3fv(mdm->verts[ medge->v1].co);
                                glVertex3fv(mdm->verts[ medge->v2].co);
                        }
@@ -452,7 +452,6 @@ static DerivedMesh *getMeshDerivedMesh(Mesh *me, Object *ob, float (*vertCos)[3]
        mdm->dm.drawVerts = meshDM_drawVerts;
 
        mdm->dm.drawEdges = meshDM_drawEdges;
-       mdm->dm.drawMappedEdges = meshDM_drawEdges;
        mdm->dm.drawLooseEdges = meshDM_drawLooseEdges;
 
        mdm->dm.drawFacesSolid = meshDM_drawFacesSolid;
@@ -978,24 +977,6 @@ static void ssDM_drawMappedFacesEM(DerivedMesh *dm, int (*setDrawOptions)(void *
        }
 }
 
-static void ssDM_drawMappedEdges(DerivedMesh *dm)
-{
-       SSDerivedMesh *ssdm = (SSDerivedMesh*) dm;
-       DispListMesh *dlm = ssdm->dlm;
-       MEdge *medge= dlm->medge;
-       MVert *mvert= dlm->mvert;
-       int a;
-       
-       glBegin(GL_LINES);
-       for (a=0; a<dlm->totedge; a++, medge++) {
-               if (medge->flag&ME_EDGEDRAW) {
-                       glVertex3fv(mvert[medge->v1].co); 
-                       glVertex3fv(mvert[medge->v2].co);
-               }
-       }
-       glEnd();
-}
-
 static void ssDM_drawLooseEdges(DerivedMesh *dm)
 {
        /* Can't implement currently */ 
@@ -1026,8 +1007,10 @@ static void ssDM_drawEdges(DerivedMesh *dm)
        
                glBegin(GL_LINES);
                for (i=0; i<dlm->totedge; i++, medge++) {
-                       glVertex3fv(mvert[medge->v1].co); 
-                       glVertex3fv(mvert[medge->v2].co);
+                       if (medge->flag&ME_EDGEDRAW) {
+                               glVertex3fv(mvert[medge->v1].co); 
+                               glVertex3fv(mvert[medge->v2].co);
+                       }
                }
                glEnd();
        } else {
@@ -1311,7 +1294,6 @@ DerivedMesh *derivedmesh_from_displistmesh(DispListMesh *dlm, float (*vertexCos)
        ssdm->dm.drawVerts = ssDM_drawVerts;
 
        ssdm->dm.drawEdges = ssDM_drawEdges;
-       ssdm->dm.drawMappedEdges = ssDM_drawMappedEdges;
        ssdm->dm.drawLooseEdges = ssDM_drawLooseEdges;
 
        ssdm->dm.drawFacesSolid = ssDM_drawFacesSolid;
index 53011a74e7139ecdd583d7bc970de3cb000a25a0..752ca1abf2a23d36e3f18f107cc1dd05a5730d5f 100644 (file)
@@ -801,6 +801,7 @@ void make_edges(Mesh *me)
                        medge->v1= ed->v1;
                        medge->v2= ed->v2;
                        if(ed->flag) medge->flag= ME_EDGEDRAW;
+                       medge->flag |= ME_EDGERENDER;
                        medge++;
                }
        }
@@ -808,6 +809,7 @@ void make_edges(Mesh *me)
        medge->v1= ed->v1;
        medge->v2= ed->v2;
        if(ed->flag) medge->flag= ME_EDGEDRAW;
+       medge->flag |= ME_EDGERENDER;
 
        MEM_freeN(edsort);
 }
index 8feeb649854631ee7d370b27a1f7a8f841aa67d8..3887fa205bd54227bdf370b0de96e9132800796f 100644 (file)
@@ -196,7 +196,7 @@ static int getFaceIndex(CCGSubSurf *ss, CCGFace *f, int S, int x, int y, int edg
                return faceBase + 1 + (gridSize-2)*numVerts + S*(gridSize-2)*(gridSize-2) + (y-1)*(gridSize-2) + (x-1);
        }
 }
-static DispListMesh *ss_to_displistmesh(CCGSubSurf *ss, CCGDerivedMesh *ccgdm, int ssFromEditmesh, Mesh *inMe, DispListMesh *inDLM, EditVert ***vertMap_r, EditEdge ***edgeMap_r, EditFace ***faceMap_r) {
+static DispListMesh *ss_to_displistmesh(CCGSubSurf *ss, CCGDerivedMesh *ccgdm, int ssFromEditmesh, int drawInteriorEdges, Mesh *inMe, DispListMesh *inDLM, EditVert ***vertMap_r, EditEdge ***edgeMap_r, EditFace ***faceMap_r) {
        DispListMesh *dlm = MEM_callocN(sizeof(*dlm), "dlm");
        int edgeSize = ccgSubSurf_getEdgeSize(ss);
        int gridSize = ccgSubSurf_getGridSize(ss);
@@ -318,7 +318,7 @@ static DispListMesh *ss_to_displistmesh(CCGSubSurf *ss, CCGDerivedMesh *ccgdm, i
                        MEdge *med = &dlm->medge[i];
                        med->v1 = getEdgeIndex(ss, e, x, edgeSize);
                        med->v2 = getEdgeIndex(ss, e, x+1, edgeSize);
-                       med->flag = ME_EDGEDRAW;
+                       med->flag = ME_EDGEDRAW|ME_EDGERENDER;
 
                        if (ssFromEditmesh) {
                                EditEdge *eed = ccgSubSurf_getEdgeEdgeHandle(ss, e);
@@ -354,6 +354,7 @@ static DispListMesh *ss_to_displistmesh(CCGSubSurf *ss, CCGDerivedMesh *ccgdm, i
                for (k=0; k<numVerts; k++) {
                        for (x=0; x<gridSize-1; x++) {
                                MEdge *med = &dlm->medge[i];
+                               if (drawInteriorEdges) med->flag = ME_EDGEDRAW|ME_EDGERENDER;
                                med->v1 = getFaceIndex(ss, f, k, x, 0, edgeSize, gridSize);
                                med->v2 = getFaceIndex(ss, f, k, x+1, 0, edgeSize, gridSize);
                                i++;
@@ -364,11 +365,13 @@ static DispListMesh *ss_to_displistmesh(CCGSubSurf *ss, CCGDerivedMesh *ccgdm, i
                                        MEdge *med;
                                        
                                        med = &dlm->medge[i];
+                                       if (drawInteriorEdges) med->flag = ME_EDGEDRAW|ME_EDGERENDER;
                                        med->v1 = getFaceIndex(ss, f, k, x, y, edgeSize, gridSize);
                                        med->v2 = getFaceIndex(ss, f, k, x, y+1, edgeSize, gridSize);
                                        i++;
 
                                        med = &dlm->medge[i];
+                                       if (drawInteriorEdges) med->flag = ME_EDGEDRAW|ME_EDGERENDER;
                                        med->v1 = getFaceIndex(ss, f, k, y, x, edgeSize, gridSize);
                                        med->v2 = getFaceIndex(ss, f, k, y+1, x, edgeSize, gridSize);
                                        i++;
@@ -615,7 +618,7 @@ struct CCGDerivedMesh {
        DerivedMesh dm;
 
        CCGSubSurf *ss;
-       int fromEditmesh;
+       int fromEditmesh, drawInteriorEdges;
 
        Mesh *me;
        DispListMesh *dlm;
@@ -784,12 +787,12 @@ static void ccgDM_foreachMappedEdgeEM(DerivedMesh *dm, void (*func)(void *userDa
 static DispListMesh *ccgDM_convertToDispListMesh(DerivedMesh *dm, int allowShared) {
        CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
 
-       return ss_to_displistmesh(ccgdm->ss, ccgdm, ccgdm->fromEditmesh, ccgdm->me, ccgdm->dlm, NULL, NULL, NULL);
+       return ss_to_displistmesh(ccgdm->ss, ccgdm, ccgdm->fromEditmesh, ccgdm->drawInteriorEdges, ccgdm->me, ccgdm->dlm, NULL, NULL, NULL);
 }
 static DispListMesh *ccgDM_convertToDispListMeshMapped(DerivedMesh *dm, int allowShared, EditVert ***vertMap_r, EditEdge ***edgeMap_r, EditFace ***faceMap_r) {
        CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
 
-       return ss_to_displistmesh(ccgdm->ss, ccgdm, ccgdm->fromEditmesh, ccgdm->me, ccgdm->dlm, vertMap_r, edgeMap_r, faceMap_r);
+       return ss_to_displistmesh(ccgdm->ss, ccgdm, ccgdm->fromEditmesh, ccgdm->drawInteriorEdges, ccgdm->me, ccgdm->dlm, vertMap_r, edgeMap_r, faceMap_r);
 }
 
 static void ccgDM_drawVerts(DerivedMesh *dm) {
@@ -874,34 +877,36 @@ static void ccgDM_drawEdges(DerivedMesh *dm) {
                glColor3ub(0, 0, 0);
        }
 
-       for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
-               CCGFace *f = ccgFaceIterator_getCurrent(fi);
-               int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
+       if (ccgdm->drawInteriorEdges) {
+               for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
+                       CCGFace *f = ccgFaceIterator_getCurrent(fi);
+                       int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
 
-               if (ccgdm->fromEditmesh) {
-                       EditFace *efa = ccgDM_getFaceHandle(ccgdm, f);
-                       if (efa && efa->h!=0)
-                               continue;
-               }
+                       if (ccgdm->fromEditmesh) {
+                               EditFace *efa = ccgDM_getFaceHandle(ccgdm, f);
+                               if (efa && efa->h!=0)
+                                       continue;
+                       }
 
-               for (S=0; S<numVerts; S++) {
-                       VertData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
+                       for (S=0; S<numVerts; S++) {
+                               VertData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
 
-                       glBegin(GL_LINE_STRIP);
-                       for (x=0; x<gridSize; x++)
-                               glVertex3fv(faceGridData[x].co);
-                       glEnd();
-                       for (y=1; y<gridSize-1; y++) {
                                glBegin(GL_LINE_STRIP);
                                for (x=0; x<gridSize; x++)
-                                       glVertex3fv(faceGridData[y*gridSize + x].co);
-                               glEnd();
-                       }
-                       for (x=1; x<gridSize-1; x++) {
-                               glBegin(GL_LINE_STRIP);
-                               for (y=0; y<gridSize; y++)
-                                       glVertex3fv(faceGridData[y*gridSize + x].co);
+                                       glVertex3fv(faceGridData[x].co);
                                glEnd();
+                               for (y=1; y<gridSize-1; y++) {
+                                       glBegin(GL_LINE_STRIP);
+                                       for (x=0; x<gridSize; x++)
+                                               glVertex3fv(faceGridData[y*gridSize + x].co);
+                                       glEnd();
+                               }
+                               for (x=1; x<gridSize-1; x++) {
+                                       glBegin(GL_LINE_STRIP);
+                                       for (y=0; y<gridSize; y++)
+                                               glVertex3fv(faceGridData[y*gridSize + x].co);
+                                       glEnd();
+                               }
                        }
                }
        }
@@ -909,26 +914,6 @@ static void ccgDM_drawEdges(DerivedMesh *dm) {
        ccgFaceIterator_free(fi);
        ccgEdgeIterator_free(ei);
 }
-static void ccgDM_drawMappedEdges(DerivedMesh *dm) {
-       CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
-       CCGSubSurf *ss = ccgdm->ss;
-       CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss);
-       int i, edgeSize = ccgSubSurf_getEdgeSize(ss);
-
-       for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) {
-               CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
-               VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
-
-               glBegin(GL_LINE_STRIP);
-               for (i=0; i<edgeSize-1; i++) {
-                       glVertex3fv(edgeData[i].co);
-                       glVertex3fv(edgeData[i+1].co);
-               }
-               glEnd();
-       }
-
-       ccgEdgeIterator_free(ei);
-}
 static void ccgDM_drawLooseEdges(DerivedMesh *dm) {
        CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
        CCGSubSurf *ss = ccgdm->ss;
@@ -1334,7 +1319,7 @@ static void ccgDM_release(DerivedMesh *dm) {
        MEM_freeN(ccgdm);
 }
 
-static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, int fromEditmesh, Mesh *me, DispListMesh *dlm, EditVert **vertMap, EditEdge **edgeMap, EditFace **faceMap) {
+static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, int fromEditmesh, int drawInteriorEdges, Mesh *me, DispListMesh *dlm, EditVert **vertMap, EditEdge **edgeMap, EditFace **faceMap) {
        CCGDerivedMesh *ccgdm = MEM_callocN(sizeof(*ccgdm), "ccgdm");
 
        ccgdm->dm.getMinMax = ccgDM_getMinMax;
@@ -1349,7 +1334,6 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, int fromEditmesh, Mesh
 
        ccgdm->dm.drawVerts = ccgDM_drawVerts;
        ccgdm->dm.drawEdges = ccgDM_drawEdges;
-       ccgdm->dm.drawMappedEdges = ccgDM_drawMappedEdges;
        ccgdm->dm.drawLooseEdges = ccgDM_drawLooseEdges;
        ccgdm->dm.drawFacesSolid = ccgDM_drawFacesSolid;
        ccgdm->dm.drawFacesColored = ccgDM_drawFacesColored;
@@ -1363,6 +1347,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, int fromEditmesh, Mesh
        
        ccgdm->ss = ss;
        ccgdm->fromEditmesh = fromEditmesh;
+       ccgdm->drawInteriorEdges = drawInteriorEdges;
        ccgdm->me = me;
        ccgdm->dlm = dlm;
        ccgdm->vertMap = vertMap;
@@ -1377,26 +1362,29 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, int fromEditmesh, Mesh
 DerivedMesh *subsurf_make_derived_from_editmesh(EditMesh *em, SubsurfModifierData *smd, float (*vertCos)[3]) {
        int useSimple = smd->subdivType==ME_SIMPLE_SUBSURF;
        int useAging = smd->flags&eSubsurfModifierFlag_DebugIncr;
+       int drawInteriorEdges = !(smd->flags&eSubsurfModifierFlag_ControlEdges);
 
        smd->emCache = _getSubSurf(smd->emCache, smd->levels, useAging, 0, 0, useSimple);
        ss_sync_from_editmesh(smd->emCache, em, vertCos, useSimple);
 
-       return (DerivedMesh*) getCCGDerivedMesh(smd->emCache, 1, NULL, NULL, NULL, NULL, NULL);
+       return (DerivedMesh*) getCCGDerivedMesh(smd->emCache, 1, drawInteriorEdges, NULL, NULL, NULL, NULL, NULL);
 }
 
 DerivedMesh *subsurf_make_derived_from_dlm_em(DispListMesh *dlm, SubsurfModifierData *smd, float (*vertCos)[3], EditVert **vertMap, EditEdge **edgeMap, EditFace **faceMap) {
        int useSimple = smd->subdivType==ME_SIMPLE_SUBSURF;
        int useAging = smd->flags&eSubsurfModifierFlag_DebugIncr;
+       int drawInteriorEdges = !(smd->flags&eSubsurfModifierFlag_ControlEdges);
                
        smd->emCache = _getSubSurf(smd->emCache, smd->levels, useAging, 0, 0, useSimple);
 
        ss_sync_from_mesh(smd->emCache, NULL, dlm, vertCos, useSimple);
 
-       return (DerivedMesh*) getCCGDerivedMesh(smd->emCache, 0, NULL, dlm, vertMap, edgeMap, faceMap);
+       return (DerivedMesh*) getCCGDerivedMesh(smd->emCache, 0, drawInteriorEdges, NULL, dlm, vertMap, edgeMap, faceMap);
 }
 
 DerivedMesh *subsurf_make_derived_from_mesh(Mesh *me, DispListMesh *dlm, SubsurfModifierData *smd, int useRenderParams, float (*vertCos)[3], int isFinalCalc) {
        int useSimple = smd->subdivType==ME_SIMPLE_SUBSURF;
+       int drawInteriorEdges = !(smd->flags&eSubsurfModifierFlag_ControlEdges);
        DispListMesh *ndlm;
 
                /* Do not use cache in render mode. */
@@ -1405,7 +1393,7 @@ DerivedMesh *subsurf_make_derived_from_mesh(Mesh *me, DispListMesh *dlm, Subsurf
 
                ss_sync_from_mesh(ss, me, dlm, vertCos, useSimple);
 
-               ndlm = ss_to_displistmesh(ss, NULL, 0, me, dlm, NULL, NULL, NULL);
+               ndlm = ss_to_displistmesh(ss, NULL, 0, drawInteriorEdges, me, dlm, NULL, NULL, NULL);
                if (dlm) displistmesh_free(dlm);
 
                ccgSubSurf_free(ss);
@@ -1435,7 +1423,7 @@ DerivedMesh *subsurf_make_derived_from_mesh(Mesh *me, DispListMesh *dlm, Subsurf
 
                        ss_sync_from_mesh(ss, me, dlm, vertCos, useSimple);
 
-                       return (DerivedMesh*) getCCGDerivedMesh(ss, 0, me, dlm, NULL, NULL, NULL);
+                       return (DerivedMesh*) getCCGDerivedMesh(ss, 0, drawInteriorEdges, me, dlm, NULL, NULL, NULL);
                } else {
                        if (smd->mCache && isFinalCalc) {
                                ccgSubSurf_free(smd->mCache);
@@ -1444,7 +1432,7 @@ DerivedMesh *subsurf_make_derived_from_mesh(Mesh *me, DispListMesh *dlm, Subsurf
 
                        ss = _getSubSurf(NULL, smd->levels, 0, 1, useEdgeCreation, useSimple);
                        ss_sync_from_mesh(ss, me, dlm, vertCos, useSimple);
-                       ndlm = ss_to_displistmesh(ss, NULL, 0, me, dlm, NULL, NULL, NULL);
+                       ndlm = ss_to_displistmesh(ss, NULL, 0, drawInteriorEdges, me, dlm, NULL, NULL, NULL);
 
                        if (dlm) displistmesh_free(dlm);
                        ccgSubSurf_free(ss);
index a750ba71f0af3f33236d1c47bed63675de5779c4..342097f435feeb613a8296dd001af0ea3a25e709 100644 (file)
@@ -2065,7 +2065,7 @@ static void lib_link_mesh(FileData *fd, Main *main)
 
 static void direct_link_dverts(FileData *fd, int count, MDeformVert *mdverts)
 {
-       int     i, j;
+       int     i;
 
        if (!mdverts)
                return;
index e039eefaf80f8e46c32dce0a3ba2ea956513a936..558e25869bd168017c0e575cfcea8ca908429444 100644 (file)
@@ -81,6 +81,7 @@ typedef struct MSticky {
 #define ME_SEAM         4
 #define ME_FGON                        8
                                                // reserve 16 for ME_HIDE
+#define ME_EDGERENDER  32
 
 /* puno = vertexnormal (mface) */
 #define ME_FLIPV1              1
index 29703eb3e54a0248372256d3020a5511a15a77fd..78c5b9d8c766ce434c13b1a72993ae47a1de66cc 100644 (file)
@@ -45,7 +45,8 @@ typedef struct ModifierData {
 
 typedef enum {
        eSubsurfModifierFlag_Incremental = (1<<0),
-       eSubsurfModifierFlag_DebugIncr = (1<<1)
+       eSubsurfModifierFlag_DebugIncr = (1<<1),
+       eSubsurfModifierFlag_ControlEdges = (1<<2)
 } SubsurfModifierFlag;
 typedef struct SubsurfModifierData {
        ModifierData modifier;
index fca8d409f11f41a342884679e33bc85800b0156a..d70d5dc80c5ba591d849c82351c65bbc7a0b6836 100644 (file)
@@ -2880,7 +2880,7 @@ static void fill_medge_from_nmesh(Mesh * mesh, BPy_NMesh * nmesh)
       MEdge *medge=mesh->medge+j;
       medge->v1=edge->v1;
       medge->v2=edge->v2;
-      medge->flag=ME_EDGEDRAW;
+      medge->flag=ME_EDGEDRAW|ME_EDGERENDER;
       medge->crease=0;
       ++j;
     }
@@ -3319,6 +3319,7 @@ static PyObject *M_NMesh_EdgeFlagsDict( void )
 
                constant_insert(d, "SELECT", PyInt_FromLong(1));
                constant_insert(d, "EDGEDRAW", PyInt_FromLong(ME_EDGEDRAW));
+               constant_insert(d, "EDGERENDER", PyInt_FromLong(ME_EDGERENDER));
                constant_insert(d, "SEAM", PyInt_FromLong(ME_SEAM));
                constant_insert(d, "FGON", PyInt_FromLong(ME_FGON));
        }
@@ -3425,7 +3426,7 @@ static PyObject *findEdge( BPy_NMesh *nmesh, BPy_NMVert *v1, BPy_NMVert *v2, int
   /* if this line is reached, edge has not been found */
   if (create)
   {
-    PyObject *newEdge=(PyObject *)new_NMEdge(v1, v2, 0, ME_EDGEDRAW);
+    PyObject *newEdge=(PyObject *)new_NMEdge(v1, v2, 0, ME_EDGEDRAW|ME_EDGERENDER);
     PyList_Append(nmesh->edges, newEdge);
     return newEdge;
   }
index a086e3820acf3f82534ea0f7e8e436c3de2870e0..61983d809af5f7ac900f245bfaff55e00aef4bb6 100644 (file)
@@ -1487,29 +1487,31 @@ static void init_render_mesh(Object *ob)
                        medge= dlm?dlm->medge:me->medge;
                        
                        for(a1=0; a1<end; a1++, medge++) {
-                               MVert *v0 = &mvert[medge->v1];
-                               MVert *v1 = &mvert[medge->v2];
+                               if (medge->flag&ME_EDGERENDER) {
+                                       MVert *v0 = &mvert[medge->v1];
+                                       MVert *v1 = &mvert[medge->v2];
 
-                               vlr= RE_findOrAddVlak(R.totvlak++);
-                               vlr->ob= vlr_set_ob(ob);
-                               vlr->v1= RE_findOrAddVert(vertofs+medge->v1);
-                               vlr->v2= RE_findOrAddVert(vertofs+medge->v2);
-                               vlr->v3= vlr->v2;
-                               vlr->v4= NULL;
-                               
-                               xn= (v0->no[0]+v1->no[0]);
-                               yn= (v0->no[1]+v1->no[1]);
-                               zn= (v0->no[2]+v1->no[2]);
-                               /* transpose ! */
-                               vlr->n[0]= imat[0][0]*xn+imat[0][1]*yn+imat[0][2]*zn;
-                               vlr->n[1]= imat[1][0]*xn+imat[1][1]*yn+imat[1][2]*zn;
-                               vlr->n[2]= imat[2][0]*xn+imat[2][1]*yn+imat[2][2]*zn;
-                               Normalise(vlr->n);
-                               
-                               vlr->mat= ma;
-                               vlr->flag= 0;
-                               vlr->ec= ME_V1V2;
-                               vlr->lay= ob->lay;
+                                       vlr= RE_findOrAddVlak(R.totvlak++);
+                                       vlr->ob= vlr_set_ob(ob);
+                                       vlr->v1= RE_findOrAddVert(vertofs+medge->v1);
+                                       vlr->v2= RE_findOrAddVert(vertofs+medge->v2);
+                                       vlr->v3= vlr->v2;
+                                       vlr->v4= NULL;
+                                       
+                                       xn= (v0->no[0]+v1->no[0]);
+                                       yn= (v0->no[1]+v1->no[1]);
+                                       zn= (v0->no[2]+v1->no[2]);
+                                       /* transpose ! */
+                                       vlr->n[0]= imat[0][0]*xn+imat[0][1]*yn+imat[0][2]*zn;
+                                       vlr->n[1]= imat[1][0]*xn+imat[1][1]*yn+imat[1][2]*zn;
+                                       vlr->n[2]= imat[2][0]*xn+imat[2][1]*yn+imat[2][2]*zn;
+                                       Normalise(vlr->n);
+                                       
+                                       vlr->mat= ma;
+                                       vlr->flag= 0;
+                                       vlr->ec= ME_V1V2;
+                                       vlr->lay= ob->lay;
+                               }
                        }
                }
        }
index bbaf2b33ded3d80a97cbd81cf0e86591abf3517d..43725f464f059d9a8dff4f6a931d66e5169c6faf 100644 (file)
@@ -898,7 +898,7 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
                y -= 18;
 
                if (md->type==eModifierType_Subsurf) {
-                       height = 86;
+                       height = 106;
                } else if (md->type==eModifierType_Lattice) {
                        height = 46;
                } else if (md->type==eModifierType_Curve) {
@@ -955,6 +955,8 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
                        uiButSetFunc(but, modifiers_setSubsurfIncremental, ob, md);
 
                        uiDefButBitS(block, TOG, eSubsurfModifierFlag_DebugIncr, B_MODIFIER_RECALC, "Debug", lx+90, cy,70,19,&smd->flags, 0, 0, 0, 0, "Visualize the subsurf incremental calculation, for debugging effect of other modifiers");
+
+                       uiDefButBitS(block, TOG, eSubsurfModifierFlag_ControlEdges, B_MODIFIER_RECALC, "Optimal Draw", lx, (cy-=19), 160,19,&smd->flags, 0, 0, 0, 0, "Skip drawing/rendering of interior subdivided edges");
                } else if (md->type==eModifierType_Lattice) {
                        LatticeModifierData *lmd = (LatticeModifierData*) md;
                        uiDefIDPoinBut(block, modifier_testLatticeObj, B_CHANGEDEP, "Ob: ",     lx, (cy-=19), 120,19, &lmd->object, "Lattice object to deform with");
index a27f9af7c7efabe798e6b831affee179c03cbb22..9f2e23a93a0b6d97abf453d4d07595d6b39ba131 100644 (file)
@@ -1051,7 +1051,7 @@ void load_editMesh(void)
                        medge->v1= (unsigned int) eed->v1->vn;
                        medge->v2= (unsigned int) eed->v2->vn;
                        
-                       medge->flag= eed->f & SELECT;
+                       medge->flag= (eed->f & SELECT) | ME_EDGERENDER;
                        if(eed->f2<2) medge->flag |= ME_EDGEDRAW;
                        if(eed->seam) medge->flag |= ME_SEAM;
                        if(eed->h & EM_FGON) medge->flag |= ME_FGON;    // different defines yes