Recoded how 'handles' were implemented; these were extra wireframe edges
authorTon Roosendaal <ton@blender.org>
Thu, 30 Sep 2004 20:38:35 +0000 (20:38 +0000)
committerTon Roosendaal <ton@blender.org>
Thu, 30 Sep 2004 20:38:35 +0000 (20:38 +0000)
actually, adding vertices and edges to displist.

Now the subsurfer gives editvertices a pointer to the subsurfed vertex
location; allowing not only vertices in 'optimal' draw to show correct, but
also gives proper handling of borderselect and lasso for edges. :)

source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/subsurf.c
source/blender/blenlib/BLI_editVert.h
source/blender/include/BDR_drawobject.h
source/blender/src/drawobject.c
source/blender/src/edit.c
source/blender/src/editmesh_add.c
source/blender/src/editmesh_mods.c
source/blender/src/editmesh_tools.c
source/blender/src/editview.c

index a9e2e879c51ac51efde182410057aa788d4e6d5b..d1542165686616d915438bca5de01b12b719bf0a 100644 (file)
@@ -109,6 +109,7 @@ struct _FastLamp {
 static FastLamp *fastlamplist= NULL;
 static float fviewmat[4][4];
 
+/* only called from subsurf.c when levels is zero */
 DispListMesh *displistmesh_from_editmesh(EditMesh *em) 
 {
        DispListMesh *dlm= MEM_callocN(sizeof(*dlm),"dlm");
@@ -130,6 +131,7 @@ DispListMesh *displistmesh_from_editmesh(EditMesh *em)
        for (eve= em->verts.first; eve; eve= eve->next, i++) {
                MVert *mvNew= &dlm->mvert[i];
                VECCOPY(mvNew->co, eve->co);
+               eve->ssco= eve->co;             /* no subsurf coordinate, but we add a save pointer in it */
                eve->prev= (void*) i;   /* hack to fetch indices */
        }
 
index 00070fef72c24f607b849707fe1010c527bccd0d..6e29f1b4add27286710421736d2f745303bc9f25 100644 (file)
@@ -171,7 +171,7 @@ struct _HyperVert {
        HyperVert *next;
        
        float co[3];
-       float *orig;    // if set, pointer to original vertex, for handles
+       EditVert *orig; // if set, pointer to original vertex
        HyperVert *nmv;
        LinkNode *edges, *faces;
 };
@@ -256,7 +256,7 @@ static HyperVert *hyperedge_other_vert(HyperEdge *e, HyperVert *a) {
        return (a==e->v[0])?e->v[1]:e->v[0];
 }
 
-static HyperVert *hypermesh_add_vert(HyperMesh *hme, float *co, float *orig) {
+static HyperVert *hypermesh_add_vert(HyperMesh *hme, float *co, EditVert *orig) {
        HyperVert *hv= BLI_memarena_alloc(hme->arena, sizeof(*hv));
        
        hv->nmv= NULL;
@@ -454,11 +454,11 @@ static HyperMesh *hypermesh_from_editmesh(EditMesh *em, int subdivLevels) {
        for (ee= em->edges.first; ee; ee= ee->next) {
 
                if(ee->v1->f1) {
-                       ee->v1->prev= (EditVert*) hypermesh_add_vert(hme, ee->v1->co, ee->v1->co);
+                       ee->v1->prev= (EditVert*) hypermesh_add_vert(hme, ee->v1->co, ee->v1);
                        ee->v1->f1= 0;
                }
                if(ee->v2->f1) {
-                       ee->v2->prev= (EditVert*) hypermesh_add_vert(hme, ee->v2->co, ee->v2->co);
+                       ee->v2->prev= (EditVert*) hypermesh_add_vert(hme, ee->v2->co, ee->v2);
                        ee->v2->f1= 0;
                }
                if((ee->h & 1)==0) {
@@ -899,16 +899,6 @@ static int hypermesh_get_nverts(HyperMesh *hme) {
        return count;
 }
 
-static int hypermesh_get_nverts_handles(HyperMesh *hme) {
-       HyperVert *v;
-       int count= 0;
-       
-       for (v= hme->verts; v; v= v->next)
-               if(v->orig) count++;
-       
-       return count;
-}
-
 static int hypermesh_get_nfaces(HyperMesh *hme) {
        HyperFace *f;
        int count= 0;
@@ -929,7 +919,7 @@ static int hypermesh_get_nedges(HyperMesh *hme) {
        return count;
 }
 
-/* flag is me->flag, for handles and 'optim' */
+/* flag is me->flag, for 'optim' */
 static DispListMesh *hypermesh_to_displistmesh(HyperMesh *hme, short flag) {
        int nverts= hypermesh_get_nverts(hme);
        int nedges= hypermesh_get_nedges(hme);
@@ -941,7 +931,7 @@ static DispListMesh *hypermesh_to_displistmesh(HyperMesh *hme, short flag) {
        TFace *tfaces;
        MEdge *med;
        MFace *mfaces, *mf;
-       int i, j, handles=0;
+       int i, j;
 
                /* hme->orig_me==NULL if we are working on an editmesh */
        if (hme->orig_me) {
@@ -952,14 +942,10 @@ static DispListMesh *hypermesh_to_displistmesh(HyperMesh *hme, short flag) {
                mfaces= NULL;
        }
 
-       /* added: handles for editmode */
-       if (hme->orig_me==NULL && (flag & ME_OPT_EDGES)) {
-               handles= hypermesh_get_nverts_handles(hme);
-       }
-       
-       dlm->totvert= nverts+handles;
+       /* removed: handles for editmode. it now stores pointer to subsurfed vertex in editvert */
+       dlm->totvert= nverts;
        dlm->totface= nfaces;
-       dlm->totedge= nedges+handles;
+       dlm->totedge= nedges;
        
        /* calloc for clear flag and nor in mvert */
        dlm->mvert= MEM_callocN(dlm->totvert*sizeof(*dlm->mvert), "dlm->mvert");
@@ -999,23 +985,11 @@ static DispListMesh *hypermesh_to_displistmesh(HyperMesh *hme, short flag) {
                if(e->flag & HE_SEAM) med->flag |= ME_SEAM;
        }
        
-       /* and we add the handles (med is re-used) */
-       if(handles) {
-               MVert *mv= dlm->mvert+nverts;
-
-               i= nverts;
-               for (v= hme->verts; v; v= v->next) {
-                       if(v->orig) {
-                               /* new vertex */
-                               Vec3Cpy(mv->co, v->orig);
-
-                               /* new edge */
-                               med->v1= (int) v->nmv;
-                               med->v2= i;
-                               med->flag = ME_EDGEDRAW;
-                               
-                               med++; i++; mv++;
-                       }
+       /* and we add pointer to subsurfed vertex in editvert */
+       if(hme->orig_me==NULL) {
+               MVert *mv= dlm->mvert;
+               for (v= hme->verts; v; v= v->next, mv++) {
+                       if(v->orig) v->orig->ssco= mv->co;
                }
        }
 
@@ -1094,7 +1068,7 @@ static DispListMesh *hypermesh_to_displistmesh(HyperMesh *hme, short flag) {
        return dlm;
 }
 
-/* flag is me->flag, for handles and 'optim' */
+/* flag is me->flag, and 'optim' */
 static DispListMesh *subsurf_subdivide_to_displistmesh(HyperMesh *hme, short subdiv,
                                                                                                short flag, short type) {
        DispListMesh *dlm;
index 30be5cd7b30d5ce423efe6662d2052f5f6b25b22..51daf7d0a98b727690df4035631c259b307346f3 100644 (file)
@@ -44,6 +44,7 @@ typedef struct EditVert
        struct EditVert *next, *prev, *vn;
        float no[3];
        float co[3];
+       float *ssco;  /* subsurfed coordinate, dont use for temporal storage! it points to DispListMesh */
        short xs, ys;
        unsigned char f, h, f1, f2;
        short fast;     /* only 0 or 1, for editmesh_fastmalloc */
index 77afe41e73b0cef543fb8059f44e89dc921ac8f0..a60840813365e1981080593fd8a863e60073e5ef 100644 (file)
@@ -50,9 +50,10 @@ void helpline(float *vec);
 void drawaxes(float size);
 void drawcamera(struct Object *ob);
 
+extern int subsurf_optimal(struct Object *ob);
+
 void calc_mesh_facedots_ext(void);
 void calc_lattverts_ext(void);
-void calc_meshverts(void);
 void calc_meshverts_ext(void);
 void calc_meshverts_ext_f2(void);
 void calc_nurbverts_ext(void);
index 202abc6bab273a0f3296453dc30955bf00dd5cbf..0c1fb5b087475e5e8d7b8161c2368a1ec91fe2fd 100644 (file)
@@ -957,6 +957,16 @@ static void drawlattice(Object *ob)
 
 /* ***************** ******************** */
 
+int subsurf_optimal(Object *ob)
+{
+       if(ob->type==OB_MESH) {
+               Mesh *me= ob->data;
+               if( (me->flag & ME_OPT_EDGES) && (me->flag & ME_SUBSURF) && me->subdiv) return 1;
+       }
+       return 0;
+}
+
+
 void calc_mesh_facedots_ext(void)
 {
        EditMesh *em = G.editMesh;
@@ -987,7 +997,7 @@ void calc_mesh_facedots_ext(void)
 }
 
 /* window coord, assuming all matrices are set OK */
-void calc_meshverts(void)
+static void calc_meshverts(void)
 {
        EditMesh *em = G.editMesh;
        EditVert *eve;
@@ -999,12 +1009,15 @@ void calc_meshverts(void)
        MTC_Mat4SwapMat4(G.vd->persmat, mat);
        mygetsingmatrix(G.vd->persmat);
 
-       eve= em->verts.first;
-       while(eve) {
-               if(eve->h==0) {
-                       project_short(eve->co, &(eve->xs));
+       if(subsurf_optimal(G.obedit)) { // separate loop for speed 
+               for(eve= em->verts.first; eve; eve= eve->next) {
+                       if(eve->h==0 && eve->ssco) project_short(eve->ssco, &(eve->xs));
+               }
+       }
+       else {
+               for(eve= em->verts.first; eve; eve= eve->next) {
+                       if(eve->h==0) project_short(eve->co, &(eve->xs));
                }
-               eve= eve->next;
        }
        MTC_Mat4SwapMat4(G.vd->persmat, mat);
 }
@@ -1028,6 +1041,7 @@ void calc_meshverts_ext_f2(void)
        EditMesh *em = G.editMesh;
        EditVert *eve;
        float mat[4][4];
+       int optimal= subsurf_optimal(G.obedit);
        
        if(em->verts.first==0) return;
        eve= em->verts.first;
@@ -1040,15 +1054,15 @@ void calc_meshverts_ext_f2(void)
        MTC_Mat4SwapMat4(G.vd->persmat, mat);
        mygetsingmatrix(G.vd->persmat);
 
-       eve= em->verts.first;
-       while(eve) {
+       for(eve= em->verts.first; eve; eve= eve->next) {
                eve->f &= ~2;
                if(eve->h==0) {
-                       project_short_noclip(eve->co, &(eve->xs));
+                       if(optimal && eve->ssco) project_short_noclip(eve->ssco, &(eve->xs));
+                       else project_short_noclip(eve->co, &(eve->xs));
+       
                        if( eve->xs >= 0 && eve->ys >= 0 && eve->xs<curarea->winx && eve->ys<curarea->winy);
                        else eve->f |= 2;
                }
-               eve= eve->next;
        }
        
        /* restore */
@@ -1106,7 +1120,7 @@ void calc_nurbverts_ext(void)
        
 }
 
-static void draw_vertices(short sel)
+static void draw_vertices(int optimal, int sel)
 {
        EditMesh *em = G.editMesh;
        EditVert *eve;
@@ -1143,8 +1157,16 @@ static void draw_vertices(short sel)
                                glColor4ub(col[0], col[1], col[2], 100);
                                
                                bglBegin(GL_POINTS);
-                               for(eve= em->verts.first; eve; eve= eve->next) {
-                                       if(eve->h==0 && (eve->f & SELECT)==sel ) bglVertex3fv(eve->co);
+                               if(optimal) {
+                                       for(eve= em->verts.first; eve; eve= eve->next) {
+                                               if(eve->h==0 && (eve->f & SELECT)==sel ) 
+                                                       if(eve->ssco) bglVertex3fv(eve->ssco);
+                                       }
+                               }
+                               else {
+                                       for(eve= em->verts.first; eve; eve= eve->next) {
+                                               if(eve->h==0 && (eve->f & SELECT)==sel ) bglVertex3fv(eve->co);
+                                       }
                                }
                                bglEnd();
                        }
@@ -1172,42 +1194,20 @@ static void draw_vertices(short sel)
 
        if(G.scene->selectmode & SCE_SELECT_VERTEX) {
 
-               if(0) {// test
-                       float mat[4][4], persmat[4][4], vec4[4];
-                       float zval;
-                       
-                       glFinish();     // maybe for pending polygons
-                       
-                       // remake because of polygon offs
-                       glMatrixMode(GL_PROJECTION);
-                       glGetFloatv(GL_PROJECTION_MATRIX, (float *)mat);
-                       glMatrixMode(GL_MODELVIEW);
-                       Mat4MulMat4(persmat, G.vd->viewmat, mat);       
-
-                       for(eve= em->verts.first; eve; eve= eve->next) {
-                               if(eve->h==0 && (eve->f & SELECT) ) {
-                                       
-                                       VECCOPY(vec4, eve->co);
-                                       vec4[3]= 1.0;
-                                       Mat4MulVec4fl(persmat, vec4);
-                                       vec4[2]/= vec4[3];
-                                       vec4[2]= 0.5 + vec4[2]/2;
-                                       // test; read 9 pixels
-                                       glReadPixels(curarea->winrct.xmin+eve->xs,  curarea->winrct.ymin+eve->ys, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT,  &zval);
-                                       
-                                       //printf("my proj %f zbuf %f mydiff %f\n", vec4[2], zval, vec4[2]-zval);
-                                       if( vec4[2]-zval > 0.0) eve->xs= 3200;
-                               }
-                       }
-               }
-
                glPointSize(size);
                glColor3ub(col[0], col[1], col[2]);
 
                bglBegin(GL_POINTS);
-               for(eve= em->verts.first; eve; eve= eve->next) {
-                       if(eve->xs!=3200)
-                       if(eve->h==0 && (eve->f & SELECT)==sel ) bglVertex3fv(eve->co);
+               if(optimal) {
+                       for(eve= em->verts.first; eve; eve= eve->next) {
+                               if(eve->h==0 && (eve->f & SELECT)==sel ) 
+                                       if(eve->ssco) bglVertex3fv(eve->ssco);
+                       }
+               }
+               else {
+                       for(eve= em->verts.first; eve; eve= eve->next) {
+                               if(eve->h==0 && (eve->f & SELECT)==sel ) bglVertex3fv(eve->co);
+                       }
                }
                bglEnd();
                
@@ -2520,7 +2520,7 @@ static void drawmeshwire(Object *ob)
        EditEdge *eed;
        EditFace *efa;
        float fvec[3], *f1, *f2, *f3, *f4, *extverts=NULL;
-       int a, start, end, test, ok, handles=0;
+       int a, start, end, test, ok, optimal=0;
 
        me= get_mesh(ob);
 
@@ -2529,7 +2529,7 @@ static void drawmeshwire(Object *ob)
                DispListMesh *dlm= NULL;
                if(dl) dlm= dl->mesh;
                
-               if( (me->flag & ME_OPT_EDGES) && (me->flag & ME_SUBSURF) && me->subdiv) handles= 1;
+               optimal= subsurf_optimal(ob);
                
                if( (G.f & (G_FACESELECT+G_DRAWFACES))) {       /* transp faces */
                        char col1[4], col2[4];
@@ -2541,7 +2541,7 @@ static void drawmeshwire(Object *ob)
                        glEnable(GL_BLEND);
                        glDepthMask(0);         // disable write in zbuffer, needed for nice transp
                        
-                       if(dlm && handles) {
+                       if(dlm && optimal) {
                                for(a=0, mface= dlm->mface; a<dlm->totface; a++, mface++) {
                                        if(mface->v3) {
                                                efa= dlm->editface[a];
@@ -2582,12 +2582,12 @@ static void drawmeshwire(Object *ob)
                if(mesh_uses_displist(me)) {
                        
                        /* dont draw the subsurf when solid... then this is a 'drawextra' */
-                       if(handles==0 && ob->dt>OB_WIRE && G.vd->drawtype>OB_WIRE);
+                       if(optimal==0 && ob->dt>OB_WIRE && G.vd->drawtype>OB_WIRE);
                        else {
                                /* don't draw in edge/face mode */
-                               if(handles && (G.scene->selectmode & SCE_SELECT_VERTEX)==0);
+                               if(optimal && (G.scene->selectmode & SCE_SELECT_VERTEX)==0);
                                else {
-                                       if(handles) BIF_ThemeColor(TH_WIRE);
+                                       if(optimal) BIF_ThemeColor(TH_WIRE);
                                        else BIF_ThemeColorBlend(TH_WIRE, TH_BACK, 0.7);
                                                
                                        drawDispListwire(&me->disp);
@@ -2598,7 +2598,7 @@ static void drawmeshwire(Object *ob)
                if(G.scene->selectmode == SCE_SELECT_FACE) {
                
                        glBegin(GL_LINES);
-                       if(dlm && handles) {
+                       if(dlm && optimal) {
                                MEdge *medge= dlm->medge;
                                MVert *mvert= dlm->mvert;
                                
@@ -2659,7 +2659,7 @@ static void drawmeshwire(Object *ob)
                        }
                        else {
                                glBegin(GL_LINES);
-                               if(dlm && handles) {
+                               if(dlm && optimal) {
                                        MEdge *medge= dlm->medge;
                                        MVert *mvert= dlm->mvert;
                                        
@@ -2689,7 +2689,7 @@ static void drawmeshwire(Object *ob)
                                glEnd();
                        }
                }
-               else if(handles==0) {
+               else if(optimal==0) {
                        BIF_ThemeColor(TH_WIRE);
                        glBegin(GL_LINES);
                        for(eed= em->edges.first; eed; eed= eed->next) {
@@ -2703,7 +2703,7 @@ static void drawmeshwire(Object *ob)
 
                if(G.f & G_DRAWCREASES) drawmeshwire_creases();
                
-               if(handles==0 && G.f & G_DRAWSEAMS) {
+               if(optimal==0 && G.f & G_DRAWSEAMS) {
                        BIF_ThemeColor(TH_EDGE_SEAM);
                        glLineWidth(2);
 
@@ -2724,8 +2724,8 @@ static void drawmeshwire(Object *ob)
                
                calc_meshverts();
 
-               draw_vertices(0);
-               draw_vertices(1);
+               draw_vertices(optimal, 0);
+               draw_vertices(optimal, 1);
 
                if(G.f & G_DRAWNORMALS) {       /* normals */
                        /*cpack(0xDDDD22);*/
@@ -4099,7 +4099,7 @@ void draw_object(Base *base)
                                else {
                                        drawmeshsolid(ob, 0);
                                }
-                               dtx |= OB_DRAWWIRE;     // draws edges, transp faces, subsurf handles, vertices
+                               dtx |= OB_DRAWWIRE;     // draws edges, transp faces, subsurf optimal, vertices
                        }
                        if(ob==G.obedit && (G.f & G_PROPORTIONAL)) draw_prop_circle();
                }
@@ -4345,7 +4345,7 @@ void draw_object_ext(Base *base)
 static int bbs_mesh_verts(Object *ob, int offset)
 {
        EditVert *eve;
-       int a= offset;
+       int a= offset, optimal= subsurf_optimal(ob);
        
        glPointSize( BIF_GetThemeValuef(TH_VERTEX_SIZE) );
        
@@ -4353,7 +4353,8 @@ static int bbs_mesh_verts(Object *ob, int offset)
        for(eve= G.editMesh->verts.first; eve; eve= eve->next, a++) {
                if(eve->h==0) {
                        cpack( index_to_framebuffer(a) );
-                       bglVertex3fv(eve->co);
+                       if(optimal && eve->ssco) bglVertex3fv(eve->ssco);
+                       else bglVertex3fv(eve->co);
                }
        }
        bglEnd();
@@ -4372,7 +4373,7 @@ static int bbs_mesh_wire(Object *ob, int offset)
        int index, b, retval, optimal=0;
 
        if(dl) dlm= dl->mesh;
-       if( (me->flag & ME_OPT_EDGES) && (me->flag & ME_SUBSURF) && me->subdiv) optimal= 1;
+       optimal= subsurf_optimal(ob);
        
        if(dlm && optimal) {
                MEdge *medge= dlm->medge;
index f2e44425fe8e7707e142ffc540a96bcaa811afbd..a198a88078156dd39921b5d4c51e4ca91cade477 100644 (file)
@@ -152,11 +152,6 @@ int get_border(rcti *rect, short col)
 
        while(TRUE) {
        
-               /* for when a renderwindow is open, and a mouse cursor activates it */
-               persp(PERSP_VIEW);
-               mywinset(curarea->win);
-               persp(PERSP_WIN);
-               
                /* selection loop while mouse pressed */
                getmouseco_areawin(mval);
 
@@ -173,6 +168,12 @@ int get_border(rcti *rect, short col)
                event= extern_qread(&val);
 
                if(event && val) {
+
+                       /* for when a renderwindow is open, and a mouse cursor activates it */
+                       persp(PERSP_VIEW);
+                       mywinset(curarea->win);
+                       persp(PERSP_WIN);
+                       
                        if(event==ESCKEY) {
                                retval= 0;
                                break;
@@ -277,12 +278,12 @@ int get_border(rcti *rect, short col)
                        
                        event= extern_qread(&val);
                        
-                       /* still because of the renderwindow... */
-                       persp(PERSP_VIEW);
-                       mywinset(curarea->win);
-                       persp(PERSP_WIN);
+                       if(event && val==0) {
+                               /* still because of the renderwindow... */
+                               persp(PERSP_VIEW);
+                               mywinset(curarea->win);
+                               persp(PERSP_WIN);
                                
-                       if(val==0) {
                                if(event==ESCKEY) {
                                        retval= 0;
                                        break;
index fdcd09c96d3dd0671892ac28726f1a891ea6f7a3..e7e412ed9be41b65ebe8ec3962200a1a23f813b3 100644 (file)
@@ -377,7 +377,7 @@ void adduplicate_mesh(void)
        adduplicateflag(SELECT);
 
        waitcursor(0);
-       countall();  /* for G.totvert in calc_meshverts() */
+       countall(); 
        transform('d');
 }
 
index e0788df5cc27a09965decdbbc27e58fd12c401bb..1b123e33b96a4e94481f3a49acc5276a067739c5 100644 (file)
@@ -581,6 +581,7 @@ static EditFace *findnearestface(short *dist)
 /* for interactivity, frontbuffer draw in current window */
 static void unified_select_draw(EditVert *eve, EditEdge *eed, EditFace *efa)
 {
+       int optimal= subsurf_optimal(G.obedit);
 
        glDrawBuffer(GL_FRONT);
 
@@ -608,13 +609,13 @@ static void unified_select_draw(EditVert *eve, EditEdge *eed, EditFace *efa)
                        Mesh *me= G.obedit->data;
                        DispList *dl= find_displist(&me->disp, DL_MESH);
                        DispListMesh *dlm= NULL;
-
+                       
                        if(efa->fgonf==0) {
                                if(efa->f & SELECT) BIF_ThemeColor(TH_EDGE_SELECT);
                                else BIF_ThemeColor(TH_WIRE);
                                
                                if(dl) dlm= dl->mesh;
-                               if(dlm && (me->flag & ME_OPT_EDGES) && (me->flag & ME_SUBSURF) && me->subdiv) {
+                               if(dlm && optimal) {
                                        MEdge *medge= dlm->medge;
                                        MVert *mvert= dlm->mvert;
                                        int b;
@@ -659,10 +660,8 @@ static void unified_select_draw(EditVert *eve, EditEdge *eed, EditFace *efa)
                        Mesh *me= G.obedit->data;
                        DispList *dl= find_displist(&me->disp, DL_MESH);
                        DispListMesh *dlm= NULL;
-                       int optimal=0;
                        
                        if(dl) dlm= dl->mesh;
-                       if( (me->flag & ME_OPT_EDGES) && (me->flag & ME_SUBSURF) && me->subdiv) optimal= 1;
                        
                        if(eed->f & SELECT) BIF_ThemeColor(TH_EDGE_SELECT);
                        else BIF_ThemeColor(TH_WIRE);
@@ -698,20 +697,27 @@ static void unified_select_draw(EditVert *eve, EditEdge *eed, EditFace *efa)
                        else BIF_ThemeColor(TH_VERTEX);
                        
                        bglBegin(GL_POINTS);
-                       bglVertex3fv(eed->v1->co);
-                       bglVertex3fv(eed->v2->co);
+                       if(optimal) {
+                               bglVertex3fv(eed->v1->ssco);
+                               bglVertex3fv(eed->v2->ssco);
+                       } else {
+                               bglVertex3fv(eed->v1->co);
+                               bglVertex3fv(eed->v2->co);
+                       }
                        bglEnd();
                }
        }
        if(eve) {
                if(G.scene->selectmode & SCE_SELECT_VERTEX) {
+
                        glPointSize(BIF_GetThemeValuef(TH_VERTEX_SIZE));
                        
                        if(eve->f & SELECT) BIF_ThemeColor(TH_VERTEX_SELECT);
                        else BIF_ThemeColor(TH_VERTEX);
                        
                        bglBegin(GL_POINTS);
-                       bglVertex3fv(eve->co);
+                       if(optimal) bglVertex3fv(eve->ssco);
+                       else bglVertex3fv(eve->co);
                        bglEnd();
                }
        }
index a14643e5e3a6f2f45677e7473756f17baa1638c4..ccd4e8b7ed71e080c4b004668790c34dc07c908a 100644 (file)
@@ -543,8 +543,7 @@ void extrude_mesh(void)
        }
        else {
                EM_fgon_flags();
-               countall();  /* for G.totvert in calc_meshverts() */
-               calc_meshverts();
+               countall(); 
                transform('n');
        }
 
index d2acf2f3f01b68c83483cd5a3dc1c3a112044524..49a077ced218a312f8ddfa7c96d154c9466edcd8 100644 (file)
@@ -331,36 +331,36 @@ static void do_lasso_select_mesh(short mcords[][2], short moves, short select)
        if(G.scene->selectmode & SCE_SELECT_EDGE) {
                short done= 0;
                
-               if(bbsel==0) calc_meshverts_ext_f2();   /* doesnt clip, drawobject.c */
+               calc_meshverts_ext_f2();        /* doesnt clip, drawobject.c */
                index= em_solidoffs;
+               
                /* two stages, for nice edge select first do 'both points in rect' 
-                       unless bbsel is true */
+                       also when bbsel is true */
                for(eed= em->edges.first; eed; eed= eed->next, index++) {
                        if(eed->h==0) {
-                               if(bbsel) {
-                                       if(EM_check_backbuf_border(index)) {
-                                               EM_select_edge(eed, select);
-                                               done= 1;
-                                       }
-                               }
-                               else if(edge_fully_inside_rect(rect, eed->v1->xs, eed->v1->ys,  eed->v2->xs, eed->v2->ys)) {
+                               if(edge_fully_inside_rect(rect, eed->v1->xs, eed->v1->ys,  eed->v2->xs, eed->v2->ys)) {
                                        if(lasso_inside(mcords, moves, eed->v1->xs, eed->v1->ys)) {
                                                if(lasso_inside(mcords, moves, eed->v2->xs, eed->v2->ys)) {
-                                                       EM_select_edge(eed, select);
-                                                       done = 1;
+                                                       if(EM_check_backbuf_border(index)) {
+                                                               EM_select_edge(eed, select);
+                                                               done = 1;
+                                                       }
                                                }
                                        }
                                }
                        }
                }
                
-               if(bbsel==0 && done==0) {
+               if(done==0) {
                        index= em_solidoffs;
                        for(eed= em->edges.first; eed; eed= eed->next, index++) {
                                if(eed->h==0) {
-                                       if(lasso_inside_edge(mcords, moves, &eed->v1->xs, &eed->v2->xs)) {
+                                       if(bbsel) {
+                                               if(EM_check_backbuf_border(index))
+                                                       EM_select_edge(eed, select);
+                                       }
+                                       else if(lasso_inside_edge(mcords, moves, &eed->v1->xs, &eed->v2->xs)) {
                                                EM_select_edge(eed, select);
-                                               done = 1;
                                        }
                                }
                        }
@@ -1094,13 +1094,13 @@ void borderselect(void)
                                if(G.scene->selectmode & SCE_SELECT_EDGE) {
                                        short done= 0;
                                        
-                                       if(bbsel==0) calc_meshverts_ext_f2();   /* doesnt clip, drawobject.c */
+                                       calc_meshverts_ext_f2();        /* doesnt clip, drawobject.c */
                                        index= em_solidoffs;
                                        /* two stages, for nice edge select first do 'both points in rect'
-                                          unless bbsel is true */
+                                          also when bbsel is true */
                                        for(eed= em->edges.first; eed; eed= eed->next, index++) {
                                                if(eed->h==0) {
-                                                       if(bbsel || edge_fully_inside_rect(rect, eed->v1->xs, eed->v1->ys,  eed->v2->xs, eed->v2->ys)) {
+                                                       if(edge_fully_inside_rect(rect, eed->v1->xs, eed->v1->ys, eed->v2->xs, eed->v2->ys)) {
                                                                if(EM_check_backbuf_border(index)) {
                                                                        EM_select_edge(eed, val==LEFTMOUSE);
                                                                        done = 1;
@@ -1108,14 +1108,17 @@ void borderselect(void)
                                                        }
                                                }
                                        }
-                                       
-                                       if(bbsel==0 && done==0) {
+
+                                       if(done==0) {
                                                index= em_solidoffs;
                                                for(eed= em->edges.first; eed; eed= eed->next, index++) {
                                                        if(eed->h==0) {
-                                                               if(edge_inside_rect(rect, eed->v1->xs, eed->v1->ys,  eed->v2->xs, eed->v2->ys)) {
+                                                               if(bbsel) {
+                                                                       if(EM_check_backbuf_border(index))
+                                                                               EM_select_edge(eed, val==LEFTMOUSE);
+                                                               }
+                                                               else if(edge_inside_rect(rect, eed->v1->xs, eed->v1->ys, eed->v2->xs, eed->v2->ys)) {
                                                                        EM_select_edge(eed, val==LEFTMOUSE);
-                                                                       done = 1;
                                                                }
                                                        }
                                                }