More fixes in object drawing:
- transparent faces in editmode don't write in zbuffer anymore (prevents drawing errors) but still read (so behind the subsurf faces for example) - improved drawing 'handles' for subsurf editing - going in editmode to Solid view, will draw extra wire always, including transparent faces when set - works in all combos... http://www.blender.org/docs/ton/subsurf.html - fixed error; padplus/padminus didnt work in buttonswindow anymore - improved buttonswin: when dragging window edge, the buttons dont rescale, but stay same size
This commit is contained in:
@@ -697,7 +697,8 @@ static int hypermesh_get_nhidden(HyperMesh *hme) {
|
||||
return count;
|
||||
}
|
||||
|
||||
static DispList *hypermesh_to_displist(HyperMesh *hme) {
|
||||
/* flag is me->flag, for handles and 'optim' */
|
||||
static DispList *hypermesh_to_displist(HyperMesh *hme, short flag) {
|
||||
int nverts= hypermesh_get_nverts(hme);
|
||||
int nfaces= hypermesh_get_nfaces(hme) + hypermesh_get_nlines(hme) - hypermesh_get_nhidden(hme);
|
||||
DispList *dl= MEM_callocN(sizeof(*dl), "dl");
|
||||
@@ -720,7 +721,7 @@ static DispList *hypermesh_to_displist(HyperMesh *hme) {
|
||||
}
|
||||
|
||||
/* added: handles for editmode */
|
||||
if (hme->orig_me==NULL) {
|
||||
if (hme->orig_me==NULL && (flag & ME_OPT_EDGES)) {
|
||||
handles= hypermesh_get_nverts_handles(hme);
|
||||
}
|
||||
|
||||
@@ -885,7 +886,8 @@ static DispList *hypermesh_to_displist(HyperMesh *hme) {
|
||||
return dl;
|
||||
}
|
||||
|
||||
static DispList *subsurf_subdivide_to_displist(HyperMesh *hme, short subdiv) {
|
||||
/* flag is me->flag, for handles and 'optim' */
|
||||
static DispList *subsurf_subdivide_to_displist(HyperMesh *hme, short subdiv, short flag) {
|
||||
DispList *dl;
|
||||
int i;
|
||||
|
||||
@@ -901,7 +903,7 @@ static DispList *subsurf_subdivide_to_displist(HyperMesh *hme, short subdiv) {
|
||||
hme= tmp;
|
||||
}
|
||||
|
||||
dl= hypermesh_to_displist(hme);
|
||||
dl= hypermesh_to_displist(hme, flag);
|
||||
hypermesh_free(hme);
|
||||
|
||||
return dl;
|
||||
@@ -915,7 +917,7 @@ void subsurf_make_editmesh(Object *ob) {
|
||||
HyperMesh *hme= hypermesh_from_editmesh(G.edve.first, G.eded.first, G.edvl.first);
|
||||
|
||||
free_displist_by_type(&me->disp, DL_MESH);
|
||||
BLI_addtail(&me->disp, subsurf_subdivide_to_displist(hme, me->subdiv));
|
||||
BLI_addtail(&me->disp, subsurf_subdivide_to_displist(hme, me->subdiv, me->flag));
|
||||
|
||||
dl= me->disp.first;
|
||||
if(dl && dl->mesh) dl->mesh->flag= me->flag;
|
||||
@@ -930,7 +932,7 @@ void subsurf_make_mesh(Object *ob, short subdiv) {
|
||||
HyperMesh *hme= hypermesh_from_mesh(me, find_displist(&ob->disp, DL_VERTS));
|
||||
|
||||
free_displist_by_type(&me->disp, DL_MESH);
|
||||
BLI_addtail(&me->disp, subsurf_subdivide_to_displist(hme, subdiv));
|
||||
BLI_addtail(&me->disp, subsurf_subdivide_to_displist(hme, subdiv, me->flag));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -939,7 +941,7 @@ void subsurf_to_mesh(Object *oldob, Mesh *me) {
|
||||
|
||||
if (oldme->totface) {
|
||||
HyperMesh *hme= hypermesh_from_mesh(oldme, NULL);
|
||||
DispList *dl= subsurf_subdivide_to_displist(hme, oldme->subdiv);
|
||||
DispList *dl= subsurf_subdivide_to_displist(hme, oldme->subdiv, oldme->flag);
|
||||
DispListMesh *dlm= dl->mesh;
|
||||
MFace *mfaces;
|
||||
int i;
|
||||
@@ -980,7 +982,7 @@ DispList* subsurf_mesh_to_displist(Mesh *me, DispList *dl, short subdiv)
|
||||
|
||||
hme= hypermesh_from_mesh(me, dl);
|
||||
|
||||
return subsurf_subdivide_to_displist(hme, subdiv);
|
||||
return subsurf_subdivide_to_displist(hme, subdiv, me->flag);
|
||||
}
|
||||
|
||||
void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3])
|
||||
|
||||
@@ -43,6 +43,8 @@ typedef struct View2D {
|
||||
float minzoom, maxzoom;
|
||||
short scroll, keeptot;
|
||||
short keepaspect, keepzoom;
|
||||
short oldwinx, oldwiny;
|
||||
int pad;
|
||||
} View2D;
|
||||
|
||||
#define V2D_KEEPZOOM 0x0001
|
||||
|
||||
@@ -417,12 +417,23 @@ void test_view2d(View2D *v2d, int winx, int winy)
|
||||
}
|
||||
|
||||
if(v2d->keepaspect) {
|
||||
short do_x=0, do_y=0;
|
||||
|
||||
/* when a window edge changes, the aspect ratio can't be used to
|
||||
find which is the best new 'cur' rect. thats why it stores 'old' */
|
||||
if(winx!=v2d->oldwinx) do_x= 1;
|
||||
if(winy!=v2d->oldwiny) do_y= 1;
|
||||
v2d->oldwinx= winx;
|
||||
v2d->oldwiny= winy;
|
||||
|
||||
dx= (cur->ymax-cur->ymin)/(cur->xmax-cur->xmin);
|
||||
dy= ((float)winy)/((float)winx);
|
||||
|
||||
/* dx/dy is the total aspect */
|
||||
if(do_x==do_y) {
|
||||
if( dy > 1.0) do_x= 1; else do_x= 0;
|
||||
}
|
||||
|
||||
if( dx/dy > 1.0) {
|
||||
if( do_x ) {
|
||||
|
||||
/* portrait window: correct for x */
|
||||
dx= cur->ymax-cur->ymin;
|
||||
|
||||
@@ -2387,7 +2387,8 @@ static void drawmeshwire(Object *ob)
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
glDepthMask(0); // disable write in zbuffer, needed for nice transp
|
||||
|
||||
evl= G.edvl.first;
|
||||
while(evl) {
|
||||
if(evl->v1->h==0 && evl->v2->h==0 && evl->v3->h==0) {
|
||||
@@ -2431,13 +2432,18 @@ static void drawmeshwire(Object *ob)
|
||||
evl= evl->next;
|
||||
}
|
||||
glDisable(GL_BLEND);
|
||||
glDepthMask(1); // restore write in zbuffer
|
||||
}
|
||||
|
||||
if(mesh_uses_displist(me)) {
|
||||
if(handles) BIF_ThemeColor(TH_WIRE);
|
||||
else BIF_ThemeColorBlend(TH_WIRE, TH_BACK, 0.5);
|
||||
|
||||
drawDispListwire(&me->disp);
|
||||
/* dont draw the subsurf when solid... then this is a 'drawextra' */
|
||||
if(handles==0 && ob->dt>OB_WIRE && G.vd->drawtype>OB_WIRE);
|
||||
else {
|
||||
if(handles) BIF_ThemeColor(TH_WIRE);
|
||||
else BIF_ThemeColorBlend(TH_WIRE, TH_BACK, 0.7);
|
||||
|
||||
drawDispListwire(&me->disp);
|
||||
}
|
||||
}
|
||||
cpack(0x0);
|
||||
|
||||
|
||||
@@ -458,7 +458,9 @@ static void drawgrid(void)
|
||||
|
||||
dx= fabs(x-(wx)*fx/fw);
|
||||
if(dx==0) dx= fabs(y-(wy)*fy/fw);
|
||||
|
||||
|
||||
glDepthMask(0); // disable write in zbuffer
|
||||
|
||||
/* check zoom out */
|
||||
BIF_ThemeColor(TH_GRID);
|
||||
persp(PERSP_WIN);
|
||||
@@ -539,8 +541,8 @@ static void drawgrid(void)
|
||||
|
||||
fdrawline(x, 0.0, x, (float)curarea->winy);
|
||||
|
||||
glDepthMask(1); // enable write in zbuffer
|
||||
persp(PERSP_VIEW);
|
||||
setlinestyle(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1058,6 +1060,7 @@ void do_viewbuts(unsigned short event)
|
||||
case B_OBJECTPANELMEDIAN:
|
||||
if(ob) {
|
||||
v3d_editvertex_buts(NULL, ob, 1.0);
|
||||
makeDispList(ob);
|
||||
allqueue(REDRAWVIEW3D, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2416,12 +2416,13 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent)
|
||||
}
|
||||
else if(uevent->event==PADPLUSKEY || uevent->event==PADMINUS) {
|
||||
SpaceLink *sl= curarea->spacedata.first;
|
||||
|
||||
if(uevent->event==PADPLUSKEY) sl->blockscale+= 0.1;
|
||||
else sl->blockscale-= 0.1;
|
||||
CLAMP(sl->blockscale, 0.6, 1.0);
|
||||
addqueue(block->winq, REDRAW, 1);
|
||||
retval= UI_CONT;
|
||||
if(curarea->spacetype!=SPACE_BUTS) {
|
||||
if(uevent->event==PADPLUSKEY) sl->blockscale+= 0.1;
|
||||
else sl->blockscale-= 0.1;
|
||||
CLAMP(sl->blockscale, 0.6, 1.0);
|
||||
addqueue(block->winq, REDRAW, 1);
|
||||
retval= UI_CONT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user