Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2003-10-22 13:06:30 +0400
committerTon Roosendaal <ton@blender.org>2003-10-22 13:06:30 +0400
commit389b06c91e10b34c48fe048f59cea6ee236287bb (patch)
treed8e52b5c4b382a5b9db1ef98ec6305ff87bb35c3 /source/blender
parent26698cfa3fc56e901a3d2e4c6c102d50796ed41c (diff)
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
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/subsurf.c18
-rw-r--r--source/blender/makesdna/DNA_view2d_types.h2
-rw-r--r--source/blender/src/drawipo.c15
-rw-r--r--source/blender/src/drawobject.c16
-rw-r--r--source/blender/src/drawview.c7
-rw-r--r--source/blender/src/interface.c13
6 files changed, 48 insertions, 23 deletions
diff --git a/source/blender/blenkernel/intern/subsurf.c b/source/blender/blenkernel/intern/subsurf.c
index 7ca60982d5d..bc1ea3fc478 100644
--- a/source/blender/blenkernel/intern/subsurf.c
+++ b/source/blender/blenkernel/intern/subsurf.c
@@ -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])
diff --git a/source/blender/makesdna/DNA_view2d_types.h b/source/blender/makesdna/DNA_view2d_types.h
index a0d9bf53b7a..797df42c5a3 100644
--- a/source/blender/makesdna/DNA_view2d_types.h
+++ b/source/blender/makesdna/DNA_view2d_types.h
@@ -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
diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c
index 24b43bc15c9..16cf0d4a36e 100644
--- a/source/blender/src/drawipo.c
+++ b/source/blender/src/drawipo.c
@@ -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;
diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c
index a2bfc701b64..e9d1a938309 100644
--- a/source/blender/src/drawobject.c
+++ b/source/blender/src/drawobject.c
@@ -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);
diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c
index 1d9c58f3ca8..738415d2724 100644
--- a/source/blender/src/drawview.c
+++ b/source/blender/src/drawview.c
@@ -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;
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index 81a26f68ea3..da825cbbdc0 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -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;
+ }
}
}
}