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
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2006-06-29 13:44:08 +0400
committerTon Roosendaal <ton@blender.org>2006-06-29 13:44:08 +0400
commit5dac88dc58e362a58dcd7fb6df1537fb9949b4a7 (patch)
tree351a055216e8869d077b1a883b006b4092802586 /source
parente5b3fb85e49651cc6fd928b1945e1f0e5fdc9235 (diff)
Bugfix from own testing:
In outliner, the icons sometimes were drawing too large or too small. Same happened in NLA, Action, Image window etc. And it happened for "International fonts" when set to use 'texture drawing'. Reason: the API call for setting icon size BIF_icon_set_aspect() was not used consistantly. Sometimes it was set, sometimes not. And even worse, for every icon drawn in UI buttons, the icon lookup had to be done twice because of the aspect function. Solved it by removing this call, and adding a new function: BIF_icon_draw_aspect() The old BIF_icon_draw() call now draws with aspect 1.0 always. The icons code already had optimal checking for changed sizes, zo a change in aspect won't result in much cpu overhead. Plus it saves calling icons lookup code, which will make it all a bit faster. Andrea: I've added this aspect function a long while ago, I think you also like it better how it is now? Please check!
Diffstat (limited to 'source')
-rw-r--r--source/blender/include/BIF_interface_icons.h5
-rw-r--r--source/blender/src/drawaction.c4
-rw-r--r--source/blender/src/drawimage.c6
-rw-r--r--source/blender/src/drawnla.c8
-rw-r--r--source/blender/src/drawnode.c14
-rw-r--r--source/blender/src/drawtime.c4
-rw-r--r--source/blender/src/editscreen.c19
-rw-r--r--source/blender/src/interface_draw.c5
-rw-r--r--source/blender/src/interface_icons.c70
-rw-r--r--source/blender/src/interface_panel.c5
-rw-r--r--source/blender/src/outliner.c15
11 files changed, 61 insertions, 94 deletions
diff --git a/source/blender/include/BIF_interface_icons.h b/source/blender/include/BIF_interface_icons.h
index 1eb70c5185c..45f00dfb591 100644
--- a/source/blender/include/BIF_interface_icons.h
+++ b/source/blender/include/BIF_interface_icons.h
@@ -48,9 +48,10 @@ struct Material;
void BIF_icons_init(int first_dyn_id);
int BIF_icon_get_width(int icon_id);
int BIF_icon_get_height(int icon_id);
-void BIF_icon_set_aspect(int icon_id, float aspect);
+
void BIF_icon_draw(float x, float y, int icon_id);
-void BIF_icon_draw_blended(float x, float y, int icon_id, int colorid, int shade);
+void BIF_icon_draw_aspect(float x, float y, int icon_id, float aspect);
+void BIF_icon_draw_aspect_blended(float x, float y, int icon_id, float aspect, int shade);
void BIF_icons_free();
void BIF_icons_free_drawinfo(void *drawinfo);
diff --git a/source/blender/src/drawaction.c b/source/blender/src/drawaction.c
index 0a4f52b6174..a76db77ef22 100644
--- a/source/blender/src/drawaction.c
+++ b/source/blender/src/drawaction.c
@@ -788,8 +788,8 @@ static void draw_keylist(gla2DDrawInfo *di, int totvert, BezTriple **blist, floa
gla2DDrawTranslatePt(di, blist[v]->vec[1][0], ypos, &sc_x, &sc_y);
// draw_key_but(sc_x-5, sc_y-6, 13, 13, (blist[v]->f2 & 1));
- if(blist[v]->f2 & 1) BIF_icon_draw_blended(sc_x-7, sc_y-6, ICON_SPACE2, TH_HEADER, 0);
- else BIF_icon_draw_blended(sc_x-7, sc_y-6, ICON_SPACE3, TH_HEADER, 0);
+ if(blist[v]->f2 & 1) BIF_icon_draw_aspect(sc_x-7, sc_y-6, ICON_SPACE2, 1.0f);
+ else BIF_icon_draw_aspect(sc_x-7, sc_y-6, ICON_SPACE3, 1.0f);
}
}
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c
index 7eb30880bdc..dcf880df300 100644
--- a/source/blender/src/drawimage.c
+++ b/source/blender/src/drawimage.c
@@ -674,16 +674,16 @@ static void draw_image_view_icon(void)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if(G.sima->flag & SI_STICKYUVS) {
- BIF_icon_draw(xPos, 5.0, ICON_STICKY2_UVS);
+ BIF_icon_draw_aspect(xPos, 5.0, ICON_STICKY2_UVS, 1.0f);
xPos = 25.0;
}
else if(!(G.sima->flag & SI_LOCALSTICKY)) {
- BIF_icon_draw(xPos, 5.0, ICON_STICKY_UVS);
+ BIF_icon_draw_aspect(xPos, 5.0, ICON_STICKY_UVS, 1.0f);
xPos = 25.0;
}
if(G.sima->flag & SI_SELACTFACE) {
- BIF_icon_draw(xPos, 5.0, ICON_DRAW_UVFACES);
+ BIF_icon_draw_aspect(xPos, 5.0, ICON_DRAW_UVFACES, 1.0f);
}
glBlendFunc(GL_ONE, GL_ZERO);
diff --git a/source/blender/src/drawnla.c b/source/blender/src/drawnla.c
index 9232feb3d41..9c66eae794b 100644
--- a/source/blender/src/drawnla.c
+++ b/source/blender/src/drawnla.c
@@ -132,9 +132,9 @@ static void draw_nla_channels(void)
if(ob->nlastrips.first && ob->action) {
glEnable(GL_BLEND);
if(ob->nlaflag & OB_NLA_OVERRIDE)
- BIF_icon_draw_blended(x+5, y-8, ICON_NLA, TH_HEADER, 0);
+ BIF_icon_draw(x+5, y-8, ICON_NLA);
else
- BIF_icon_draw_blended(x+5, y-8, ICON_ACTION, TH_HEADER, 0);
+ BIF_icon_draw(x+5, y-8, ICON_ACTION);
glDisable(GL_BLEND);
}
y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
@@ -156,7 +156,7 @@ static void draw_nla_channels(void)
if(strip->flag & ACTSTRIP_ACTIVE) break;
if(strip==NULL) {
glEnable(GL_BLEND);
- BIF_icon_draw_blended(x, y-8, ICON_DOT, TH_BACK, 0);
+ BIF_icon_draw(x, y-8, ICON_DOT);
glDisable(GL_BLEND);
}
@@ -180,7 +180,7 @@ static void draw_nla_channels(void)
if(strip->flag & ACTSTRIP_ACTIVE) {
glEnable(GL_BLEND);
- BIF_icon_draw_blended(x+16, y-8, ICON_DOT, TH_BACK, 0);
+ BIF_icon_draw(x+16, y-8, ICON_DOT);
glDisable(GL_BLEND);
}
}
diff --git a/source/blender/src/drawnode.c b/source/blender/src/drawnode.c
index 68fbe34e1db..205aa815b96 100644
--- a/source/blender/src/drawnode.c
+++ b/source/blender/src/drawnode.c
@@ -1473,31 +1473,28 @@ static void node_draw_basis(ScrArea *sa, SpaceNode *snode, bNode *node)
icon_id= ICON_MATERIAL_DEHLT;
iconofs-= 18.0f;
glEnable(GL_BLEND);
- BIF_icon_set_aspect(icon_id, snode->aspect);
- BIF_icon_draw_blended(iconofs, rct->ymax-NODE_DY+2, icon_id, 0, -60);
+ BIF_icon_draw_aspect_blended(iconofs, rct->ymax-NODE_DY+2, icon_id, snode->aspect, -60);
glDisable(GL_BLEND);
}
if(node->type == NODE_GROUP) {
iconofs-= 18.0f;
glEnable(GL_BLEND);
- BIF_icon_set_aspect(ICON_NODE, snode->aspect);
if(node->id->lib) {
glPixelTransferf(GL_GREEN_SCALE, 0.7f);
glPixelTransferf(GL_BLUE_SCALE, 0.3f);
- BIF_icon_draw(iconofs, rct->ymax-NODE_DY+2, ICON_NODE);
+ BIF_icon_draw_aspect(iconofs, rct->ymax-NODE_DY+2, ICON_NODE, snode->aspect);
glPixelTransferf(GL_GREEN_SCALE, 1.0f);
glPixelTransferf(GL_BLUE_SCALE, 1.0f);
}
else {
- BIF_icon_draw_blended(iconofs, rct->ymax-NODE_DY+2, ICON_NODE, 0, -60);
+ BIF_icon_draw_aspect_blended(iconofs, rct->ymax-NODE_DY+2, ICON_NODE, snode->aspect, -60);
}
glDisable(GL_BLEND);
}
if(node->typeinfo->flag & NODE_OPTIONS) {
iconofs-= 18.0f;
glEnable(GL_BLEND);
- BIF_icon_set_aspect(ICON_BUTS, snode->aspect);
- BIF_icon_draw_blended(iconofs, rct->ymax-NODE_DY+2, ICON_BUTS, 0, -60);
+ BIF_icon_draw_aspect_blended(iconofs, rct->ymax-NODE_DY+2, ICON_BUTS, snode->aspect, -60);
glDisable(GL_BLEND);
}
{ /* always hide/reveil unused sockets */
@@ -1509,8 +1506,7 @@ static void node_draw_basis(ScrArea *sa, SpaceNode *snode, bNode *node)
else
shade= -90;
glEnable(GL_BLEND);
- BIF_icon_set_aspect(ICON_PLUS, snode->aspect);
- BIF_icon_draw_blended(iconofs, rct->ymax-NODE_DY+2, ICON_PLUS, 0, shade);
+ BIF_icon_draw_aspect_blended(iconofs, rct->ymax-NODE_DY+2, ICON_PLUS, snode->aspect, shade);
glDisable(GL_BLEND);
}
diff --git a/source/blender/src/drawtime.c b/source/blender/src/drawtime.c
index 7ad6c492c5b..11d38cba844 100644
--- a/source/blender/src/drawtime.c
+++ b/source/blender/src/drawtime.c
@@ -136,9 +136,9 @@ static void draw_marker(TimeMarker *marker)
/* 5 px to offset icon to align properly, space / pixels corrects for zoom */
if(marker->flag & SELECT)
- BIF_icon_draw_blended(xpos-(5.0*(xspace/xpixels)), 12.0*yspace/ypixels, ICON_MARKER_HLT, TH_BACK, 0);
+ BIF_icon_draw(xpos-(5.0*(xspace/xpixels)), 12.0*yspace/ypixels, ICON_MARKER_HLT);
else
- BIF_icon_draw_blended(xpos-(5.0*(xspace/xpixels)), 12.0*yspace/ypixels, ICON_MARKER, TH_BACK, 0);
+ BIF_icon_draw(xpos-(5.0*(xspace/xpixels)), 12.0*yspace/ypixels, ICON_MARKER);
glBlendFunc(GL_ONE, GL_ZERO);
glDisable(GL_BLEND);
diff --git a/source/blender/src/editscreen.c b/source/blender/src/editscreen.c
index 40ab5735e08..429d803bcd4 100644
--- a/source/blender/src/editscreen.c
+++ b/source/blender/src/editscreen.c
@@ -3564,25 +3564,6 @@ void draw_area_emboss(ScrArea *sa)
sdrawline(0, 0, 0, sa->winy);
glDisable( GL_BLEND );
-
-
- /* for test */
- if(FALSE && sa->spacetype==SPACE_VIEW3D) {
- cpack(0xA0A0A0);
- uiSetRoundBox(31);
- uiRoundBoxEmboss(5.0, 5.0, 25.0, 100.0, 8.0, 0);
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- BIF_icon_draw(8.0, 10.0, ICON_MATERIAL_HLT);
- BIF_icon_draw(8.0, 30.0, ICON_IPO_HLT);
- BIF_icon_draw(8.0, 50.0, ICON_HOME);
- BIF_icon_draw(8.0, 70.0, ICON_BORDERMOVE);
-
- glBlendFunc(GL_ONE, GL_ZERO);
- glDisable(GL_BLEND);
- }
}
diff --git a/source/blender/src/interface_draw.c b/source/blender/src/interface_draw.c
index 4f799142769..f42d16a6d5a 100644
--- a/source/blender/src/interface_draw.c
+++ b/source/blender/src/interface_draw.c
@@ -204,9 +204,6 @@ static void ui_draw_icon(uiBut *but, BIFIconID icon)
ys= (but->y1+but->y2- height)/2.0;
}
- /* aspect for the icon has to be stored */
- BIF_icon_set_aspect(icon, aspect);
-
glEnable(GL_BLEND);
/* calculate blend color */
@@ -215,7 +212,7 @@ static void ui_draw_icon(uiBut *but, BIFIconID icon)
else if(but->flag & UI_ACTIVE);
else blend= -60;
}
- BIF_icon_draw_blended(xs, ys, icon, but->themecol, blend);
+ BIF_icon_draw_aspect_blended(xs, ys, icon, aspect, blend);
glDisable(GL_BLEND);
diff --git a/source/blender/src/interface_icons.c b/source/blender/src/interface_icons.c
index 9d759b7aa6d..36c0e766bc6 100644
--- a/source/blender/src/interface_icons.c
+++ b/source/blender/src/interface_icons.c
@@ -772,32 +772,36 @@ static void icon_set_image(ID *id, DrawInfo *di)
}
}
-void BIF_icon_draw(float x, float y, int icon_id)
+void BIF_icon_draw_aspect(float x, float y, int icon_id, float aspect)
{
Icon *icon = NULL;
DrawInfo *di = NULL;
-
+
icon = BKE_icon_get(icon_id);
if (!icon) {
- printf("BIF_icon_draw: Internal error, no icon for icon ID: %d\n", icon_id);
+ printf("BIF_icon_set_aspect: Internal error, no icon for icon ID: %d\n", icon_id);
return;
}
-
+
di = (DrawInfo*)icon->drawinfo;
-
+
if (!di) {
-
di = icon_create_drawinfo();
-
+
icon->changed = 1;
icon->drawinfo = di;
- icon->drawinfo_free = BIF_icons_free_drawinfo;
+ icon->drawinfo_free = BIF_icons_free_drawinfo;
}
-
+
+ di->aspect = aspect;
+ /* scale width and height according to aspect */
+ di->w = (int)(ICON_DEFAULT_HEIGHT/di->aspect + 0.5f);
+ di->h = (int)(ICON_DEFAULT_HEIGHT/di->aspect + 0.5f);
+
if (di->drawFunc) {
/* vector icons use the uiBlock transformation, they are not drawn
- with untransformed coordinates like the other icons */
+ with untransformed coordinates like the other icons */
di->drawFunc(x, y, ICON_DEFAULT_HEIGHT, ICON_DEFAULT_HEIGHT, 1.0f);
}
else {
@@ -808,7 +812,7 @@ void BIF_icon_draw(float x, float y, int icon_id)
icon->changed = 0;
waitcursor(0);
}
-
+
if (!di->rect) return; /* something has gone wrong! */
ui_rasterpos_safe(x, y, di->aspect);
@@ -826,11 +830,11 @@ void BIF_icon_draw(float x, float y, int icon_id)
/* first allocate imbuf for scaling and copy preview into it */
ima = IMB_allocImBuf(di->rw, di->rh, 32, IB_rect, 0);
memcpy(ima->rect, di->rect, di->rw*di->rh*sizeof(unsigned int));
-
+
/* scale it */
IMB_scaleImBuf(ima, di->w, di->h);
glDrawPixels(di->w, di->h, GL_RGBA, GL_UNSIGNED_BYTE, ima->rect);
-
+
IMB_freeImBuf(ima);
}
else
@@ -838,8 +842,13 @@ void BIF_icon_draw(float x, float y, int icon_id)
}
}
+void BIF_icon_draw(float x, float y, int icon_id)
+{
+ BIF_icon_draw_aspect(x, y, icon_id, 1.0f);
+}
+
-void BIF_icon_draw_blended(float x, float y, int icon_id, int colorid, int shade)
+void BIF_icon_draw_aspect_blended(float x, float y, int icon_id, float aspect, int shade)
{
if(shade < 0) {
@@ -847,36 +856,9 @@ void BIF_icon_draw_blended(float x, float y, int icon_id, int colorid, int shade
glPixelTransferf(GL_ALPHA_SCALE, r);
}
- BIF_icon_draw(x, y, icon_id);
-
- glPixelTransferf(GL_ALPHA_SCALE, 1.0);
-}
-
-void BIF_icon_set_aspect(int icon_id, float aspect)
-{
- Icon *icon = NULL;
- DrawInfo *di = NULL;
-
- icon = BKE_icon_get(icon_id);
-
- if (!icon) {
- printf("BIF_icon_set_aspect: Internal error, no icon for icon ID: %d\n", icon_id);
- return;
- }
-
- di = (DrawInfo*)icon->drawinfo;
+ BIF_icon_draw_aspect(x, y, icon_id, aspect);
- if (!di) {
- di = icon_create_drawinfo();
-
- icon->changed = 1;
- icon->drawinfo = di;
- icon->drawinfo_free = BIF_icons_free_drawinfo;
- }
- di->aspect = aspect;
- /* scale width and height according to aspect */
- di->w = (int)(ICON_DEFAULT_HEIGHT/di->aspect + 0.5f);
- di->h = (int)(ICON_DEFAULT_HEIGHT/di->aspect + 0.5f);
-
+ if(shade < 0)
+ glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
}
diff --git a/source/blender/src/interface_panel.c b/source/blender/src/interface_panel.c
index e61d80c6121..36dca12ee67 100644
--- a/source/blender/src/interface_panel.c
+++ b/source/blender/src/interface_panel.c
@@ -1120,11 +1120,6 @@ void ui_draw_panel(uiBlock *block)
if(panel->control & UI_PNL_CLOSE) {
ui_draw_x_icon(block->minx+2+ofsx, block->maxy+5);
- /*
- if(block->aspect>1.1) glPixelZoom(1.0/block->aspect, 1.0/block->aspect);
- BIF_icon_draw(block->minx+4, block->maxy+3, ICON_PANEL_CLOSE);
- if(block->aspect>1.1) glPixelZoom(1.0, 1.0);
- */
ofsx= 22;
}
diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c
index 152e88ef657..f33a4996186 100644
--- a/source/blender/src/outliner.c
+++ b/source/blender/src/outliner.c
@@ -637,6 +637,21 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
outliner_add_element(soops, &te->subtree, key->ipo, te, 0, 0);
}
break;
+ case ID_IP:
+ {
+ Ipo *ipo= (Ipo *)id;
+ IpoCurve *icu;
+ Object *lastadded= NULL;
+
+ for(icu= ipo->curve.first; icu; icu= icu->next) {
+ if(icu->driver && icu->driver->ob) {
+ if(lastadded!=icu->driver->ob) {
+ outliner_add_element(soops, &te->subtree, icu->driver->ob, te, TSE_LINKED_OB, 0);
+ lastadded= icu->driver->ob;
+ }
+ }
+ }
+ }
case ID_AC:
{
bAction *act= (bAction *)id;