diff options
author | Ton Roosendaal <ton@blender.org> | 2003-10-27 02:47:58 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2003-10-27 02:47:58 +0300 |
commit | e51a46473140f87d1f777f1ce5e6ad19c4e60aae (patch) | |
tree | 996ef70ff340a40c6d927cbd8aa050a3c28775f6 | |
parent | cc35c992b3cecceb822abcdac39e0e3839ceab6a (diff) |
- fixed this nasty selection problem, i hope for good!
- problem was in limiting the abuse of frontbuffer drawing as happended
a lot in 2.28 and older. the less the better...
- bug was not registering a curarea->win_swap=FRONT_OK, to indicate there
was only drawn in frontbuffer
- cleaned up calls further, and made sure it doesnt draw 1 vertex too many!
also means it works better with selecting in solid drawmode now, check!
-rw-r--r-- | source/blender/src/drawobject.c | 9 | ||||
-rw-r--r-- | source/blender/src/editmesh.c | 149 |
2 files changed, 79 insertions, 79 deletions
diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index caca8d490bc..2d5a392fd33 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -1038,7 +1038,7 @@ void tekenvertices(short sel) char col[3]; /* draws in zbuffer mode twice, to show invisible vertices transparent */ - + size= BIF_GetThemeValuef(TH_VERTEX_SIZE); if(sel) BIF_GetThemeColor3ubv(TH_VERTEX_SELECT, col); else BIF_GetThemeColor3ubv(TH_VERTEX, col); @@ -1745,13 +1745,6 @@ static void drawmeshsolid(Object *ob, float *nors) glDisable(GL_LIGHTING); glShadeModel(GL_FLAT); - - //if(ob==G.obedit) { - // calc_meshverts(); - - // tekenvertices(0); - // tekenvertices(1); - //} } else { /* [nors] should never be zero, but is weak code... the displist system needs a make over (ton) diff --git a/source/blender/src/editmesh.c b/source/blender/src/editmesh.c index 96c82518910..a471af975cf 100644 --- a/source/blender/src/editmesh.c +++ b/source/blender/src/editmesh.c @@ -1991,72 +1991,6 @@ static EditVert *findnearestvert(short sel) return act; } -static void tekenvertices_special(int mode, EditVert *act) /* teken = draw */ -{ - /* hackish routine for visual speed: - * mode 0: deselect the selected ones, draw then, except act - * mode 1: only draw act - */ - EditVert *eve; - - if(mode==0) { - eve= (EditVert *)G.edve.first; - while(eve) { - if(eve->h==0) { - if(mode==0) { - if(eve!=act && eve->f & 1) { - eve->f -= 1; - } - } - } - eve= eve->next; - } - } - - if(G.f & (G_FACESELECT|G_DRAWFACES|G_DRAWEDGES)) { - /* update full view later on */ - allqueue(REDRAWVIEW3D, 0); - } - - glDrawBuffer(GL_FRONT); - - /* only this view */ - - persp(PERSP_VIEW); - mymultmatrix(G.obedit->obmat); - - if(mode==0) { - /* zbuffering is off outside of internal drawing loops... */ - if(G.vd->drawtype > OB_WIRE) { - G.zbuf= 1; - glEnable(GL_DEPTH_TEST); - } - tekenvertices(0); - glDisable(GL_DEPTH_TEST); - } - else { - /* only draw active vertex */ - float size= BIF_GetThemeValuef(TH_VERTEX_SIZE); - char col[3]; - - if(act->f & 1) BIF_GetThemeColor3ubv(TH_VERTEX_SELECT, col); - else BIF_GetThemeColor3ubv(TH_VERTEX, col); - glPointSize(size); - glColor3ub(col[0], col[1], col[2]); - - glBegin(GL_POINTS); - glVertex3fv(act->co); - glEnd(); - - glPointSize(1.0); - } - - myloadmatrix(G.vd->viewmat); - - glFinish(); - glDrawBuffer(GL_BACK); - -} static EditEdge *findnearestedge() { @@ -2651,6 +2585,65 @@ void edge_select(void) } } +static void draw_vertices_special(int mode, EditVert *act) /* teken = draw */ +{ + /* (only this view, no other windows) */ + /* hackish routine for visual speed: + * mode 0: deselect the selected ones, draw then, except act + * mode 1: only draw act + */ + EditVert *eve; + float size= BIF_GetThemeValuef(TH_VERTEX_SIZE); + char col[3]; + + glPointSize(size); + + persp(PERSP_VIEW); + glPushMatrix(); + mymultmatrix(G.obedit->obmat); + + if(mode==0) { + BIF_GetThemeColor3ubv(TH_VERTEX, col); + + /* set zbuffer on, its default off outside main drawloops */ + if(G.vd->drawtype > OB_WIRE) { + G.zbuf= 1; + glEnable(GL_DEPTH_TEST); + } + + glBegin(GL_POINTS); + eve= (EditVert *)G.edve.first; + while(eve) { + if(eve->h==0) { + if(eve!=act && (eve->f & 1)) { + eve->f -= 1; + glVertex3fv(act->co); + } + } + eve= eve->next; + } + glEnd(); + + glDisable(GL_DEPTH_TEST); + G.zbuf= 0; + } + + /* draw active vertex */ + if(act->f & 1) BIF_GetThemeColor3ubv(TH_VERTEX_SELECT, col); + else BIF_GetThemeColor3ubv(TH_VERTEX, col); + + glColor3ub(col[0], col[1], col[2]); + + glBegin(GL_POINTS); + glVertex3fv(act->co); + glEnd(); + + glPointSize(1.0); + glPopMatrix(); + + +} + void mouse_mesh(void) { EditVert *act=0; @@ -2663,15 +2656,29 @@ void mouse_mesh(void) act= findnearestvert(1); if(act) { + glDrawBuffer(GL_FRONT); + + if( (act->f & 1)==0) act->f+= 1; + else if(G.qual & LR_SHIFTKEY) act->f-= 1; + if((G.qual & LR_SHIFTKEY)==0) { undo_push_mesh("Vertex select"); - tekenvertices_special(0, act); + draw_vertices_special(0, act); } - if( (act->f & 1)==0) act->f+= 1; - else if(G.qual & LR_SHIFTKEY) act->f-= 1; - - tekenvertices_special(1, act); + else draw_vertices_special(1, act); + countall(); + + glFinish(); + glDrawBuffer(GL_BACK); + + /* signal that frontbuf differs from back */ + curarea->win_swap= WIN_FRONT_OK; + + if(G.f & (G_FACESELECT|G_DRAWFACES|G_DRAWEDGES)) { + /* update full view later on */ + allqueue(REDRAWVIEW3D, 0); + } } rightmouse_transform(); |