diff options
25 files changed, 459 insertions, 153 deletions
diff --git a/source/blender/include/BIF_interface.h b/source/blender/include/BIF_interface.h index e374cb3571e..db3e7c487bf 100644 --- a/source/blender/include/BIF_interface.h +++ b/source/blender/include/BIF_interface.h @@ -42,6 +42,7 @@ struct ScrArea; #define UI_EMBOSSN 1 /* Nothing */ #define UI_EMBOSSM 2 /* Minimal builtin emboss, also for logic buttons */ #define UI_EMBOSSP 3 /* Pulldown */ +#define UI_EMBOSSR 4 /* Rounded */ #define UI_EMBOSSX 0 /* for a python file, which i can't change.... duh! */ diff --git a/source/blender/include/BIF_resources.h b/source/blender/include/BIF_resources.h index 70aa35a03d2..dba837b59aa 100644 --- a/source/blender/include/BIF_resources.h +++ b/source/blender/include/BIF_resources.h @@ -299,9 +299,19 @@ typedef enum { ICON_CURSOR, ICON_ROTATECOLLECTION, ICON_ROTATECENTER, - ICON_ROTACTIVE - -#define BIFICONID_LAST (ICON_ROTACTIVE) + ICON_ROTACTIVE, + + VICON_VIEW3D, + VICON_EDIT, + VICON_EDITMODE_DEHLT, + VICON_EDITMODE_HLT, + VICON_DISCLOSURE_TRI_RIGHT, + VICON_DISCLOSURE_TRI_DOWN, + VICON_MOVE_UP, + VICON_MOVE_DOWN, + VICON_X + +#define BIFICONID_LAST (VICON_X) #define BIFNICONIDS (BIFICONID_LAST-BIFICONID_FIRST + 1) } BIFIconID; @@ -495,8 +505,8 @@ void BIF_load_ui_colors (void); // icon API int BIF_get_icon_width (BIFIconID icon); int BIF_get_icon_height (BIFIconID icon); -void BIF_draw_icon (BIFIconID icon); -void BIF_draw_icon_blended (BIFIconID icon, int colorid, int shade); +void BIF_draw_icon (float x, float y, BIFIconID icon); +void BIF_draw_icon_blended (float x, float y, BIFIconID icon, int colorid, int shade); /* only for buttons in theme editor! */ char *BIF_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid); diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 1449f8c5e2c..657ba97c6eb 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -675,19 +675,13 @@ static void modifiers_setOnCage(void *ob_v, void *md_v) { Object *ob = ob_v; ModifierData *md; - int i, cageIndex = modifiers_getCageIndex(&ob->modifiers, NULL); - for (i=0,md=ob->modifiers.first; md; i++,md=md->next) - if (md==md_v) - break; - - md->mode ^= eModifierMode_OnCage; - - md = md->next; - - for (; md; md=md->next) { + for (md=ob->modifiers.first; md; md=md->next) { md->mode &= ~eModifierMode_OnCage; } + + md = md_v; + md->mode |= eModifierMode_OnCage; } @@ -716,7 +710,7 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco short height, width = 295; uiBlockSetEmboss(block, UI_EMBOSSN); - uiDefIconButBitI(block, ICONTOG, eModifierMode_Expanded, B_MODIFIER_REDRAW, ICON_DISCLOSURE_TRI_RIGHT, x, y, 20, 20, &md->mode, 0.0, 0.0, 0.0, 0.0, "Collapse/Expand Modifier"); + uiDefIconButBitI(block, ICONTOG, eModifierMode_Expanded, B_MODIFIER_REDRAW, VICON_DISCLOSURE_TRI_RIGHT, x, y, 20, 20, &md->mode, 0.0, 0.0, 0.0, 0.0, "Collapse/Expand Modifier"); BIF_ThemeColor(color); uiBlockSetEmboss(block, UI_EMBOSS); @@ -729,43 +723,50 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco BIF_ThemeColor(color); uiDefBut(block, LABEL, B_NOP, mti->name, x+15, y-1, 100, 19, NULL, 0.0, 0.0, 0.0, 0.0, ""); - uiBlockSetEmboss(block, UI_EMBOSSN); + uiBlockSetEmboss(block, UI_EMBOSSR); + if (modifier_couldBeCage(md) && index<=lastCageIndex) { - int icon; + int icon, color; uiSetRoundBox(15); if (index==cageIndex) { - BIF_ThemeColorShadeAlpha(color, 40, 40); - icon = ICON_EDITMODE_HLT; + color = TH_BUT_SETTING; + icon = VICON_EDITMODE_HLT; } else if (index<cageIndex) { - BIF_ThemeColorShade(color, 10); - icon = ICON_EDITMODE_DEHLT; + color = TH_BUT_NEUTRAL; + icon = VICON_EDITMODE_DEHLT; } else { - BIF_ThemeColorShade(color, -20); - icon = ICON_EDITMODE_DEHLT; + color = TH_BUT_NEUTRAL; + icon = ICON_BLANK1; } - uiRoundBox(x+width-120+19, y-13, x+width-120+16+19, y+3, 6.0); - but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, icon, x+width-120, y, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, "Apply modifier to editing cage during Editmode"); + uiBlockSetCol(block, color); + but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, icon, x+width-120, y, 18, 18, NULL, 0.0, 0.0, 0.0, 0.0, "Apply modifier to editing cage during Editmode"); uiButSetFunc(but, modifiers_setOnCage, ob, md); + uiBlockSetCol(block, TH_AUTO); } - but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, ICON_REW, x+width-90, y, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, "Move modifier up in stack"); + uiBlockSetCol(block, TH_BUT_ACTION); + + but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, VICON_MOVE_UP, x+width-70, y, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Move modifier up in stack"); uiButSetFunc(but, modifiers_moveUp, ob, md); - but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, ICON_FF, x+width-90+20, y, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, "Move modifier down in stack"); + but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, VICON_MOVE_DOWN, x+width-70+20, y, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Move modifier down in stack"); uiButSetFunc(but, modifiers_moveDown, ob, md); - but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, ICON_X, x+width-30, y, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, "Delete modifier"); + uiBlockSetEmboss(block, UI_EMBOSSN); + + but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, VICON_X, x+width-70+40, y, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Delete modifier"); uiButSetFunc(but, modifiers_del, ob, md); + uiBlockSetCol(block, TH_AUTO); BIF_ThemeColor(color); uiBlockSetEmboss(block, UI_EMBOSS); if (!(md->mode&eModifierMode_Expanded)) { uiBlockBeginAlign(block); uiDefIconButBitI(block, TOG, eModifierMode_Render, B_MODIFIER_RECALC, ICON_SCENE, x+width-120-90, y, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during rendering"); - uiDefIconButBitI(block, TOG, eModifierMode_Realtime, B_MODIFIER_RECALC, ICON_VIEW3D, x+width-120-90+20, y, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during interactive display"); + uiDefIconButBitI(block, TOG, eModifierMode_Realtime, B_MODIFIER_RECALC, VICON_VIEW3D, x+width-120-90+20, y, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during interactive display"); if (mti->flags&eModifierTypeFlag_SupportsEditmode) { - uiDefIconButBitI(block, TOG, eModifierMode_Editmode, B_MODIFIER_RECALC, ICON_EDIT, x+width-120-90+40, y, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during Editmode"); + uiDefIconButBitI(block, TOG, eModifierMode_Editmode, B_MODIFIER_RECALC, VICON_EDIT, x+width-120-90+40, y, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during Editmode"); } uiBlockEndAlign(block); diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index 26f9ffe746b..0f47dcf5b7c 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -362,7 +362,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s else but = uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Object Constraint%t|Track To%x2|Copy Rotation%x8|Copy Location%x9|Null%x0", *xco+20, *yco, 100, 20, &con->type, 0.0, 0.0, 0.0, 0.0, "Constraint type"); */ - uiBlockSetEmboss(block, UI_EMBOSSX); + uiBlockSetEmboss(block, UI_EMBOSS); /* rounded header */ BIF_ThemeColorShade(curCol, -20); @@ -409,7 +409,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s but = uiDefIconBut(block, BUT, B_CONSTRAINT_DEL, ICON_X, *xco+262, *yco, 19, 19, list, 0.0, 0.0, 0.0, 0.0, "Delete constraint"); uiButSetFunc(but, del_constraint_func, con, list); - uiBlockSetEmboss(block, UI_EMBOSSX); + uiBlockSetEmboss(block, UI_EMBOSS); /* Draw constraint data*/ diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c index 5858a03a2c3..3fd0ba7c131 100644 --- a/source/blender/src/drawimage.c +++ b/source/blender/src/drawimage.c @@ -539,22 +539,22 @@ static void draw_image_prop_circle(ImBuf *ibuf) static void draw_image_view_icon(void) { + float xPos = 5.0; + glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glRasterPos2f(5.0, 5.0); - if(G.sima->flag & SI_STICKYUVS) { - BIF_draw_icon(ICON_STICKY2_UVS); - glRasterPos2f(25.0, 5.0); + BIF_draw_icon(xPos, 5.0, ICON_STICKY2_UVS); + xPos = 25.0; } else if(G.sima->flag & SI_LOCALSTICKY) { - BIF_draw_icon(ICON_STICKY_UVS); - glRasterPos2f(25.0, 5.0); + BIF_draw_icon(xPos, 5.0, ICON_STICKY_UVS); + xPos = 25.0; } if(G.sima->flag & SI_SELACTFACE) { - BIF_draw_icon(ICON_DRAW_UVFACES); + BIF_draw_icon(xPos, 5.0, ICON_DRAW_UVFACES); } glBlendFunc(GL_ONE, GL_ZERO); diff --git a/source/blender/src/drawimasel.c b/source/blender/src/drawimasel.c index e0116459eff..f8d358a9051 100644 --- a/source/blender/src/drawimasel.c +++ b/source/blender/src/drawimasel.c @@ -508,27 +508,24 @@ void draw_sima_area(SpaceImaSel *simasel) sx = simasel->desx; sy = simasel->deey+6; - glRasterPos2f(sx+16*0, sy); if (bitset(simasel->fase, IMS_FOUND_BIP)) { - BIF_draw_icon(ICON_BPIBFOLDER_HLT); + BIF_draw_icon(sx+16*0, sy, ICON_BPIBFOLDER_HLT); } else if (bitset(simasel->fase, IMS_WRITE_NO_BIP)) { - BIF_draw_icon(ICON_BPIBFOLDER_DEHLT); + BIF_draw_icon(sx+16*0, sy, ICON_BPIBFOLDER_DEHLT); } else { - BIF_draw_icon(ICON_BPIBFOLDER_DEHLT); + BIF_draw_icon(sx+16*0, sy, ICON_BPIBFOLDER_DEHLT); } - glRasterPos2f(sx+16*1, sy); if (bitset(simasel->fase, IMS_KNOW_INF)) { - BIF_draw_icon(ICON_FOLDER_HLT); + BIF_draw_icon(sx+16*1, sy, ICON_FOLDER_HLT); } else { - BIF_draw_icon(ICON_FOLDER_DEHLT); + BIF_draw_icon(sx+16*1, sy, ICON_FOLDER_DEHLT); } - glRasterPos2f(sx+16*2, sy); if (bitset(simasel->fase, IMS_KNOW_IMA)) { - BIF_draw_icon(ICON_BLUEIMAGE_HLT); + BIF_draw_icon(sx+16*2, sy, ICON_BLUEIMAGE_HLT); } else { - BIF_draw_icon(ICON_BLUEIMAGE_DEHLT); + BIF_draw_icon(sx+16*2, sy, ICON_BLUEIMAGE_DEHLT); } } diff --git a/source/blender/src/drawnla.c b/source/blender/src/drawnla.c index 0fd3aed4229..98969f795bf 100644 --- a/source/blender/src/drawnla.c +++ b/source/blender/src/drawnla.c @@ -148,8 +148,7 @@ static void draw_nlatree(void) /* Draw the action timeline */ if (ACTIVE_ARMATURE(base)){ - glRasterPos2f(x, y-8); - BIF_draw_icon(ICON_DOWNARROW_HLT); + BIF_draw_icon(x, y-8, ICON_DOWNARROW_HLT); y-=NLACHANNELHEIGHT+NLACHANNELSKIP; if (base->object->action){ diff --git a/source/blender/src/drawoops.c b/source/blender/src/drawoops.c index 8d18466dff9..8785024046f 100644 --- a/source/blender/src/drawoops.c +++ b/source/blender/src/drawoops.c @@ -213,8 +213,7 @@ void draw_icon_oops(float *co, short type) glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glRasterPos2f(co[0], co[1]-0.2); - BIF_draw_icon(icon); + BIF_draw_icon(co[0], co[1]-0.2, icon); glBlendFunc(GL_ONE, GL_ZERO); glDisable(GL_BLEND); diff --git a/source/blender/src/drawtime.c b/source/blender/src/drawtime.c index a41f9c86ce3..8c756972a09 100644 --- a/source/blender/src/drawtime.c +++ b/source/blender/src/drawtime.c @@ -133,18 +133,16 @@ static void draw_marker(TimeMarker *marker) xpixels= G.v2d->mask.xmax-G.v2d->mask.xmin; ypixels= G.v2d->mask.ymax-G.v2d->mask.ymin; - /* 5 px to offset icon to align properly, space / pixels corrects for zoom */ - glRasterPos2f(xpos-(5.0*(xspace/xpixels)), 12.0*yspace/ypixels); - BIF_GetThemeColor3fv(TH_BACK, col); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + /* 5 px to offset icon to align properly, space / pixels corrects for zoom */ if(marker->flag & SELECT) - BIF_draw_icon_blended(ICON_MARKER_HLT, (int)col, 0); + BIF_draw_icon_blended(xpos-(5.0*(xspace/xpixels)), 12.0*yspace/ypixels, ICON_MARKER_HLT, (int)col, 0); else - BIF_draw_icon_blended(ICON_MARKER, (int)col, 0); + BIF_draw_icon_blended(xpos-(5.0*(xspace/xpixels)), 12.0*yspace/ypixels, ICON_MARKER, (int)col, 0); glBlendFunc(GL_ONE, GL_ZERO); glDisable(GL_BLEND); diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index 4a0aecc9523..0cbd5047821 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -1040,8 +1040,7 @@ static void draw_view_icon(void) glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glRasterPos2f(5.0, 5.0); - BIF_draw_icon(icon); + BIF_draw_icon(5.0, 5.0, icon); glBlendFunc(GL_ONE, GL_ZERO); glDisable(GL_BLEND); diff --git a/source/blender/src/editscreen.c b/source/blender/src/editscreen.c index 1fb05cf9372..cf9eb5cb8d3 100644 --- a/source/blender/src/editscreen.c +++ b/source/blender/src/editscreen.c @@ -3202,24 +3202,20 @@ void draw_area_emboss(ScrArea *sa) /* 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); - - glRasterPos2f(8.0, 10.0); - BIF_draw_icon(ICON_MATERIAL_HLT); - glRasterPos2f(8.0, 30.0); - BIF_draw_icon(ICON_IPO_HLT); - glRasterPos2f(8.0, 50.0); - BIF_draw_icon(ICON_HOME); - glRasterPos2f(8.0, 70.0); - BIF_draw_icon(ICON_BORDERMOVE); - - glBlendFunc(GL_ONE, GL_ZERO); - glDisable(GL_BLEND); + 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_draw_icon(8.0, 10.0, ICON_MATERIAL_HLT); + BIF_draw_icon(8.0, 30.0, ICON_IPO_HLT); + BIF_draw_icon(8.0, 50.0, ICON_HOME); + BIF_draw_icon(8.0, 70.0, ICON_BORDERMOVE); + + glBlendFunc(GL_ONE, GL_ZERO); + glDisable(GL_BLEND); } } diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c index e1367d4f722..bd14a933d42 100644 --- a/source/blender/src/header_action.c +++ b/source/blender/src/header_action.c @@ -739,7 +739,7 @@ void action_buttons(void) xco+= xmax; } - uiBlockSetEmboss(block, UI_EMBOSSX); + uiBlockSetEmboss(block, UI_EMBOSS); // object action is allowed to be zero! /* (ton) commented out below line, since people can apparently link Action to any object (mesh) and diff --git a/source/blender/src/header_buttonswin.c b/source/blender/src/header_buttonswin.c index cac244f6c94..ad8c69feb55 100644 --- a/source/blender/src/header_buttonswin.c +++ b/source/blender/src/header_buttonswin.c @@ -587,7 +587,7 @@ void buts_buttons(void) } - uiBlockSetEmboss(block, UI_EMBOSSX); + uiBlockSetEmboss(block, UI_EMBOSS); /* FULL WINDOW */ diff --git a/source/blender/src/header_ipo.c b/source/blender/src/header_ipo.c index 0a81f6454b9..3f617eb613b 100644 --- a/source/blender/src/header_ipo.c +++ b/source/blender/src/header_ipo.c @@ -828,7 +828,7 @@ void ipo_buttons(void) } /* end of pull down menus */ - uiBlockSetEmboss(block, UI_EMBOSSX); + uiBlockSetEmboss(block, UI_EMBOSS); /* mainmenu, only when data is there and no pin */ uiSetButLock(G.sipo->pin, "Can't change because of pinned data"); diff --git a/source/blender/src/header_nla.c b/source/blender/src/header_nla.c index ddedbb446ca..a255247c221 100644 --- a/source/blender/src/header_nla.c +++ b/source/blender/src/header_nla.c @@ -354,7 +354,7 @@ void nla_buttons(void) } - uiBlockSetEmboss(block, UI_EMBOSSX); + uiBlockSetEmboss(block, UI_EMBOSS); /* FULL WINDOW */ diff --git a/source/blender/src/header_oops.c b/source/blender/src/header_oops.c index 7e79a5c4478..1da5dc6100f 100644 --- a/source/blender/src/header_oops.c +++ b/source/blender/src/header_oops.c @@ -370,7 +370,7 @@ void oops_buttons(void) } } - uiBlockSetEmboss(block, UI_EMBOSSX); + uiBlockSetEmboss(block, UI_EMBOSS); if(soops->type==SO_OOPS) { /* ZOOM and BORDER */ diff --git a/source/blender/src/header_script.c b/source/blender/src/header_script.c index 0f00b03d7bf..da51ddce928 100644 --- a/source/blender/src/header_script.c +++ b/source/blender/src/header_script.c @@ -215,7 +215,7 @@ void script_buttons(void) if (!sc || sc->spacetype != SPACE_SCRIPT) return; sprintf(naam, "header %d", curarea->headwin); - block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSSX, UI_HELV, curarea->headwin); + block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSS, UI_HELV, curarea->headwin); if(area_is_active_area(curarea)) uiBlockSetCol(block, TH_HEADER); else uiBlockSetCol(block, TH_HEADERDESEL); @@ -250,7 +250,7 @@ void script_buttons(void) xco+=xmax; } - uiBlockSetEmboss(block, UI_EMBOSSX); + uiBlockSetEmboss(block, UI_EMBOSS); uiDefIconBut(block, BUT, B_SCRIPT2PREV, ICON_GO_LEFT, xco+=XIC, 0, XIC, YIC, 0, 0, 0, 0, 0, "Returns to previous window"); diff --git a/source/blender/src/header_sound.c b/source/blender/src/header_sound.c index f5503aaf686..cebc9e9afd6 100644 --- a/source/blender/src/header_sound.c +++ b/source/blender/src/header_sound.c @@ -279,7 +279,7 @@ void sound_buttons(void) } - uiBlockSetEmboss(block, UI_EMBOSSX); + uiBlockSetEmboss(block, UI_EMBOSS); xco= std_libbuttons(block, xco+8, 0, 0, NULL, B_SOUNDBROWSE, (ID *)G.ssound->sound, 0, &(G.ssound->sndnr), 1, 0, 0, 0, 0); if(G.ssound->sound) { diff --git a/source/blender/src/header_text.c b/source/blender/src/header_text.c index 25c177d778f..33cdf97f57b 100644 --- a/source/blender/src/header_text.c +++ b/source/blender/src/header_text.c @@ -609,7 +609,7 @@ void text_buttons(void) xco+=xmax; } } - uiBlockSetEmboss(block, UI_EMBOSSX); + uiBlockSetEmboss(block, UI_EMBOSS); xco += 10; /* FULL WINDOW */ diff --git a/source/blender/src/header_time.c b/source/blender/src/header_time.c index 83dafeeed8d..c3261aabdea 100644 --- a/source/blender/src/header_time.c +++ b/source/blender/src/header_time.c @@ -393,7 +393,7 @@ void time_buttons(ScrArea *sa) xco+= xmax; } - uiBlockSetEmboss(block, UI_EMBOSSX); + uiBlockSetEmboss(block, UI_EMBOSS); uiBlockBeginAlign(block); uiDefButS(block, NUM, REDRAWALL,"Start:", diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index 5c4843e8664..e47bd98387f 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -2541,7 +2541,7 @@ void uiBlockPickerButtons(uiBlock *block, float *col, float *hsv, float *old, ch } uiBlockEndAlign(block); - uiBlockSetEmboss(block, UI_EMBOSSX); + uiBlockSetEmboss(block, UI_EMBOSS); // buttons rgb_to_hsv(col[0], col[1], col[2], hsv, hsv+1, hsv+2); @@ -2592,7 +2592,7 @@ static int ui_do_but_COL(uiBut *but) } else poin= (float *)but->poin; - block= uiNewBlock(&listb, "colorpicker", UI_EMBOSSX, UI_HELV, but->win); + block= uiNewBlock(&listb, "colorpicker", UI_EMBOSS, UI_HELV, but->win); block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW; block->themecol= TH_BUT_NUM; diff --git a/source/blender/src/interface_draw.c b/source/blender/src/interface_draw.c index bb204b850dc..741cd1c9b64 100644 --- a/source/blender/src/interface_draw.c +++ b/source/blender/src/interface_draw.c @@ -154,6 +154,10 @@ static void ui_draw_icon(uiBut *but, BIFIconID icon) int blend= 0; float xs=0, ys=0; + if (icon==VICON_X) { + int i = 0; + } + // this icon doesn't need draw... if(icon==ICON_BLANK1) return; @@ -178,9 +182,6 @@ static void ui_draw_icon(uiBut *but, BIFIconID icon) ys= (but->y1+but->y2- BIF_get_icon_height(icon))/2.0; } - glRasterPos2f(xs, ys); - // BIF_icon_pos(xs, ys); - if(but->aspect>1.1) glPixelZoom(1.0/but->aspect, 1.0/but->aspect); else if(but->aspect<0.9) glPixelZoom(1.0/but->aspect, 1.0/but->aspect); @@ -193,7 +194,7 @@ static void ui_draw_icon(uiBut *but, BIFIconID icon) else if(but->flag & UI_ACTIVE); else blend= -60; } - BIF_draw_icon_blended(icon, but->themecol, blend); + BIF_draw_icon_blended(xs, ys, icon, but->themecol, blend); glBlendFunc(GL_ONE, GL_ZERO); glDisable(GL_BLEND); @@ -1728,6 +1729,7 @@ void ui_set_embossfunc(uiBut *but, int drawtype) else if(drawtype==UI_EMBOSSM) but->embossfunc= ui_draw_minimal; else if(drawtype==UI_EMBOSSN) but->embossfunc= ui_draw_nothing; else if(drawtype==UI_EMBOSSP) but->embossfunc= ui_draw_pulldown_item; + else if(drawtype==UI_EMBOSSR) but->embossfunc= ui_draw_round; else { int theme= BIF_GetThemeValue(TH_BUT_DRAWTYPE); diff --git a/source/blender/src/interface_panel.c b/source/blender/src/interface_panel.c index fae2ce91b86..a0583e9cf3b 100644 --- a/source/blender/src/interface_panel.c +++ b/source/blender/src/interface_panel.c @@ -1116,9 +1116,8 @@ void ui_draw_panel(uiBlock *block) ui_draw_x_icon(block->minx+2+ofsx, block->maxy+5); /* - glRasterPos2f(block->minx+4, block->maxy+3); if(block->aspect>1.1) glPixelZoom(1.0/block->aspect, 1.0/block->aspect); - BIF_draw_icon(ICON_PANEL_CLOSE); + BIF_draw_icon(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 9957ef2bfdb..ceae2838650 100644 --- a/source/blender/src/outliner.c +++ b/source/blender/src/outliner.c @@ -1888,75 +1888,75 @@ void outliner_operation_menu(ScrArea *sa) /* ***************** DRAW *************** */ -static void tselem_draw_icon(TreeStoreElem *tselem) +static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem) { if(tselem->type) { switch( tselem->type) { case TSE_NLA: - BIF_draw_icon(ICON_NLA); break; + BIF_draw_icon(x, y, ICON_NLA); break; case TSE_NLA_ACTION: - BIF_draw_icon(ICON_ACTION); break; + BIF_draw_icon(x, y, ICON_ACTION); break; case TSE_DEFGROUP_BASE: - BIF_draw_icon(ICON_VERTEXSEL); break; + BIF_draw_icon(x, y, ICON_VERTEXSEL); break; case TSE_BONE: case TSE_EBONE: - BIF_draw_icon(ICON_WPAINT_DEHLT); break; + BIF_draw_icon(x, y, ICON_WPAINT_DEHLT); break; case TSE_CONSTRAINT_BASE: - BIF_draw_icon(ICON_CONSTRAINT); break; + BIF_draw_icon(x, y, ICON_CONSTRAINT); break; case TSE_HOOKS_BASE: - BIF_draw_icon(ICON_HOOK); break; + BIF_draw_icon(x, y, ICON_HOOK); break; case TSE_HOOK: - BIF_draw_icon(ICON_OBJECT); break; + BIF_draw_icon(x, y, ICON_OBJECT); break; case TSE_SCRIPT_BASE: - BIF_draw_icon(ICON_TEXT); break; + BIF_draw_icon(x, y, ICON_TEXT); break; case TSE_POSE_BASE: - BIF_draw_icon(ICON_ARMATURE_DEHLT); break; + BIF_draw_icon(x, y, ICON_ARMATURE_DEHLT); break; case TSE_POSE_CHANNEL: - BIF_draw_icon(ICON_WPAINT_DEHLT); break; + BIF_draw_icon(x, y, ICON_WPAINT_DEHLT); break; default: - BIF_draw_icon(ICON_DOT); break; + BIF_draw_icon(x, y, ICON_DOT); break; } } else { switch( GS(tselem->id->name)) { case ID_SCE: - BIF_draw_icon(ICON_SCENE_DEHLT); break; + BIF_draw_icon(x, y, ICON_SCENE_DEHLT); break; case ID_OB: - BIF_draw_icon(ICON_OBJECT); break; + BIF_draw_icon(x, y, ICON_OBJECT); break; case ID_ME: - BIF_draw_icon(ICON_MESH); break; + BIF_draw_icon(x, y, ICON_MESH); break; case ID_CU: - BIF_draw_icon(ICON_CURVE); break; + BIF_draw_icon(x, y, ICON_CURVE); break; case ID_MB: - BIF_draw_icon(ICON_MBALL); break; + BIF_draw_icon(x, y, ICON_MBALL); break; case ID_LT: - BIF_draw_icon(ICON_LATTICE); break; + BIF_draw_icon(x, y, ICON_LATTICE); break; case ID_LA: - BIF_draw_icon(ICON_LAMP_DEHLT); break; + BIF_draw_icon(x, y, ICON_LAMP_DEHLT); break; case ID_MA: - BIF_draw_icon(ICON_MATERIAL_DEHLT); break; + BIF_draw_icon(x, y, ICON_MATERIAL_DEHLT); break; case ID_TE: - BIF_draw_icon(ICON_TEXTURE_DEHLT); break; + BIF_draw_icon(x, y, ICON_TEXTURE_DEHLT); break; case ID_IP: - BIF_draw_icon(ICON_IPO_DEHLT); break; + BIF_draw_icon(x, y, ICON_IPO_DEHLT); break; case ID_IM: - BIF_draw_icon(ICON_IMAGE_DEHLT); break; + BIF_draw_icon(x, y, ICON_IMAGE_DEHLT); break; case ID_SO: - BIF_draw_icon(ICON_SPEAKER); break; + BIF_draw_icon(x, y, ICON_SPEAKER); break; case ID_AR: - BIF_draw_icon(ICON_WPAINT_DEHLT); break; + BIF_draw_icon(x, y, ICON_WPAINT_DEHLT); break; case ID_CA: - BIF_draw_icon(ICON_CAMERA_DEHLT); break; + BIF_draw_icon(x, y, ICON_CAMERA_DEHLT); break; case ID_KE: - BIF_draw_icon(ICON_EDIT_DEHLT); break; + BIF_draw_icon(x, y, ICON_EDIT_DEHLT); break; case ID_WO: - BIF_draw_icon(ICON_WORLD_DEHLT); break; + BIF_draw_icon(x, y, ICON_WORLD_DEHLT); break; case ID_AC: - BIF_draw_icon(ICON_ACTION); break; + BIF_draw_icon(x, y, ICON_ACTION); break; case ID_NLA: - BIF_draw_icon(ICON_NLA); break; + BIF_draw_icon(x, y, ICON_NLA); break; case ID_TXT: - BIF_draw_icon(ICON_SCRIPT); break; + BIF_draw_icon(x, y, ICON_SCRIPT); break; } } } @@ -1989,8 +1989,7 @@ static void outliner_draw_iconrow(SpaceOops *soops, ListBase *lb, int level, int glEnable(GL_BLEND); } - glRasterPos2i(*offsx, ys); - tselem_draw_icon(tselem); + tselem_draw_icon(*offsx, ys, tselem); te->xs= *offsx; te->ys= ys; te->xend= *offsx+OL_X; @@ -2067,21 +2066,24 @@ static void outliner_draw_tree_element(SpaceOops *soops, TreeElement *te, int st /* open/close icon, only when sublevels, except for scene */ if(te->subtree.first || te->idcode==ID_SCE) { + int icon_x; if(tselem->type==0 && (te->idcode==ID_OB || te->idcode==ID_SCE)) - glRasterPos2i(startx, *starty+2); // icons a bit higher + icon_x = startx; else - glRasterPos2i(startx+5, *starty+2); // icons a bit higher + icon_x = startx+5; + + // icons a bit higher if(tselem->flag & TSE_CLOSED) - BIF_draw_icon(ICON_TRIA_CLOSED); + BIF_draw_icon(icon_x, *starty+2, ICON_TRIA_CLOSED); else - BIF_draw_icon(ICON_TRIA_OPEN); + BIF_draw_icon(icon_x, *starty+2, ICON_TRIA_OPEN); } offsx+= OL_X; /* datatype icon */ - glRasterPos2i(startx+offsx, *starty+2); // icons a bit higher - tselem_draw_icon(tselem); + // icons a bit higher + tselem_draw_icon(startx+offsx, *starty+2, tselem); offsx+= OL_X; glDisable(GL_BLEND); diff --git a/source/blender/src/resources.c b/source/blender/src/resources.c index a841a854718..8ed6beb6bbc 100644 --- a/source/blender/src/resources.c +++ b/source/blender/src/resources.c @@ -58,22 +58,39 @@ #include "datatoc.h" /* global for themes */ +typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha); + static bTheme *theme_active=NULL; static int theme_spacetype= SPACE_VIEW3D; typedef struct { + /* If drawFunc is defined then it is a vector icon, otherwise use data */ + VectorDrawFunc drawFunc; + + int w, h; + + /* Data for image icons */ unsigned char *data; float uv[4][2]; GLuint texid; - int w, h; } Icon; +static Icon *icon_new_vector(VectorDrawFunc drawFunc, int w, int h) +{ + Icon *icon= MEM_callocN(sizeof(*icon), "internicon"); + icon->drawFunc = drawFunc; + icon->w = w; + icon->h = h; + + return icon; +} static Icon *icon_from_data(unsigned char *rect, GLuint texid, int xofs, int yofs, int w, int h, int rowstride) { Icon *icon= MEM_mallocN(sizeof(*icon), "internicon"); int y; + icon->drawFunc = NULL; icon->texid= texid; icon->uv[0][0]= ((float)xofs)/512.0; icon->uv[0][1]= ((float)yofs)/256.0; @@ -142,28 +159,36 @@ static void icon_draw_tex(Icon *icon) #endif -static void icon_draw(Icon *icon) +static void icon_draw(float x, float y, Icon *icon) { - glDrawPixels(icon->w, icon->h, GL_RGBA, GL_UNSIGNED_BYTE, icon->data); + if (icon->drawFunc) { + icon->drawFunc(x, y, icon->w, icon->h, 1.0); + } else { + glRasterPos2f(x, y); + glDrawPixels(icon->w, icon->h, GL_RGBA, GL_UNSIGNED_BYTE, icon->data); + } } -static void icon_draw_blended(Icon *icon, char *blendcol, int shade) +static void icon_draw_blended(float x, float y, Icon *icon, char *blendcol, int shade) { - - if(shade < 0) { - float r= (128+shade)/128.0; - glPixelTransferf(GL_ALPHA_SCALE, r); + if (icon->drawFunc) { + icon->drawFunc(x, y, icon->w, icon->h, shade<0?((128+shade)/128.0):1.0); + } else { + if(shade < 0) { + float r= (128+shade)/128.0; + glPixelTransferf(GL_ALPHA_SCALE, r); + } + glRasterPos2f(x, y); + glDrawPixels(icon->w, icon->h, GL_RGBA, GL_UNSIGNED_BYTE, icon->data); + glPixelTransferf(GL_ALPHA_SCALE, 1.0); } - glDrawPixels(icon->w, icon->h, GL_RGBA, GL_UNSIGNED_BYTE, icon->data); - glPixelTransferf(GL_ALPHA_SCALE, 1.0); - } static void icon_free(Icon *icon) { - MEM_freeN(icon->data); + if (icon->data) MEM_freeN(icon->data); MEM_freeN(icon); } @@ -188,17 +213,16 @@ static void free_common_icons(void) } } -void BIF_draw_icon(BIFIconID icon) +void BIF_draw_icon(float x, float y, BIFIconID icon) { - icon_draw(get_icon(icon)); + icon_draw(x, y, get_icon(icon)); } -void BIF_draw_icon_blended(BIFIconID icon, int colorid, int shade) +void BIF_draw_icon_blended(float x, float y, BIFIconID icon, int colorid, int shade) { char *cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); - icon_draw_blended(get_icon(icon), cp, shade); + icon_draw_blended(x, y, get_icon(icon), cp, shade); // icon_draw_tex(get_icon(icon)); - } int BIF_get_icon_width(BIFIconID icon) @@ -227,6 +251,17 @@ static void def_icon(ImBuf *bbuf, GLuint texid, BIFIconID icon, int xidx, int yi } } +static void def_vicon(BIFIconID icon, int w, int h, VectorDrawFunc drawFunc) +{ + int iconidx= icon-BIFICONID_FIRST; + + if (iconidx>=0 && iconidx<BIFNICONIDS) { + common_icons_arr[iconidx]= icon_new_vector(drawFunc, w, h); + } else { + printf("def_icon: Internal error, bad icon ID: %d\n", icon); + } +} + /* this only works for the hardcoded buttons image, turning the grey AA pixels to alpha, and slight off-grey to half alpha */ static void clear_transp_rect_soft(unsigned char *transp, unsigned char *rect, int w, int h, int rowstride) @@ -278,6 +313,264 @@ static void clear_transp_rect(unsigned char *transp, unsigned char *rect, int w, } } +/* Vector Icon Drawing Routines */ + + /* Utilities */ + +static void viconutil_set_point(int pt[2], int x, int y) +{ + pt[0] = x; + pt[1] = y; +} + +static void viconutil_draw_tri(int (*pts)[2]) +{ + glBegin(GL_TRIANGLES); + glVertex2iv(pts[0]); + glVertex2iv(pts[1]); + glVertex2iv(pts[2]); + glEnd(); +} + +static void viconutil_draw_quad(int (*pts)[2]) +{ + glBegin(GL_QUADS); + glVertex2iv(pts[0]); + glVertex2iv(pts[1]); + glVertex2iv(pts[2]); + glVertex2iv(pts[3]); + glEnd(); +} + +static void viconutil_draw_lineloop(int (*pts)[2], int numPoints) +{ + int i; + + glBegin(GL_LINE_LOOP); + for (i=0; i<numPoints; i++) { + glVertex2iv(pts[i]); + } + glEnd(); +} + +static void viconutil_draw_lineloop_smooth(int (*pts)[2], int numPoints) +{ + glEnable(GL_LINE_SMOOTH); + viconutil_draw_lineloop(pts, numPoints); + glDisable(GL_LINE_SMOOTH); +} + +static void viconutil_draw_points(int (*pts)[2], int numPoints, int pointSize) +{ + int i; + + glBegin(GL_QUADS); + for (i=0; i<numPoints; i++) { + int x = pts[i][0], y = pts[i][1]; + + glVertex2i(x-pointSize,y-pointSize); + glVertex2i(x+pointSize,y-pointSize); + glVertex2i(x+pointSize,y+pointSize); + glVertex2i(x-pointSize,y+pointSize); + } + glEnd(); +} + + /* Drawing functions */ + +static void vicon_x_draw(int x, int y, int w, int h, float alpha) +{ + x += 3; + y += 3; + w -= 6; + h -= 6; + + glEnable( GL_LINE_SMOOTH ); + + glLineWidth(2.5); + + glColor4f(0.0, 0.0, 0.0, alpha); + glBegin(GL_LINES); + glVertex2i(x ,y ); + glVertex2i(x+w,y+h); + glVertex2i(x+w,y ); + glVertex2i(x ,y+h); + glEnd(); + + glLineWidth(1.0); + + glDisable( GL_LINE_SMOOTH ); +} + +static void vicon_view3d_draw(int x, int y, int w, int h, float alpha) +{ + int cx = x + w/2; + int cy = y + h/2; + int d = MAX2(2, h/3); + + glColor4f(0.5, 0.5, 0.5, alpha); + glBegin(GL_LINES); + glVertex2i(x , cy-d); + glVertex2i(x+w, cy-d); + glVertex2i(x , cy+d); + glVertex2i(x+w, cy+d); + + glVertex2i(cx-d, y ); + glVertex2i(cx-d, y+h); + glVertex2i(cx+d, y ); + glVertex2i(cx+d, y+h); + glEnd(); + + glColor4f(0.0, 0.0, 0.0, alpha); + glBegin(GL_LINES); + glVertex2i(x , cy); + glVertex2i(x+w, cy); + glVertex2i(cx, y ); + glVertex2i(cx, y+h); + glEnd(); +} + +static void vicon_edit_draw(int x, int y, int w, int h, float alpha) +{ + int pts[4][2]; + + viconutil_set_point(pts[0], x+3 , y+3 ); + viconutil_set_point(pts[1], x+w-3, y+3 ); + viconutil_set_point(pts[2], x+w-3, y+h-3); + viconutil_set_point(pts[3], x+3 , y+h-3); + + glColor4f(0.0, 0.0, 0.0, alpha); + viconutil_draw_lineloop(pts, 4); + + glColor3f(1, 1, 0.0); + viconutil_draw_points(pts, 4, 1); +} + +static void vicon_editmode_hlt_draw(int x, int y, int w, int h, float alpha) +{ + int pts[3][2]; + + viconutil_set_point(pts[0], x+w/2, y+h-3); + viconutil_set_point(pts[1], x+3, y+3); + viconutil_set_point(pts[2], x+w-3, y+3); + + glColor4f(0.5, 0.5, 0.5, alpha); + viconutil_draw_tri(pts); + + glColor4f(0.0, 0.0, 0.0, 1); + viconutil_draw_lineloop_smooth(pts, 3); + + glColor3f(1, 1, 0.0); + viconutil_draw_points(pts, 3, 1); +} + +static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float alpha) +{ + int pts[3][2]; + + viconutil_set_point(pts[0], x+w/2, y+h-3); + viconutil_set_point(pts[1], x+3, y+3); + viconutil_set_point(pts[2], x+w-3, y+3); + + glColor4f(0.0, 0.0, 0.0, 1); + viconutil_draw_lineloop_smooth(pts, 3); + + glColor3f(.9, .9, .9); + viconutil_draw_points(pts, 3, 1); +} + +static void vicon_disclosure_tri_right_draw(int x, int y, int w, int h, float alpha) +{ + int pts[3][2]; + int cx = x+w/2; + int cy = y+w/2; + int d = w/3, d2 = w/5; + + viconutil_set_point(pts[0], cx-d2, cy+d); + viconutil_set_point(pts[1], cx-d2, cy-d); + viconutil_set_point(pts[2], cx+d2, cy); + + glShadeModel(GL_SMOOTH); + glBegin(GL_TRIANGLES); + glColor4f(0.8, 0.8, 0.8, alpha); + glVertex2iv(pts[0]); + glVertex2iv(pts[1]); + glColor4f(0.3, 0.3, 0.3, alpha); + glVertex2iv(pts[2]); + glEnd(); + glShadeModel(GL_FLAT); + + glColor4f(0.0, 0.0, 0.0, 1); + viconutil_draw_lineloop_smooth(pts, 3); +} + +static void vicon_disclosure_tri_down_draw(int x, int y, int w, int h, float alpha) +{ + int pts[3][2]; + int cx = x+w/2; + int cy = y+w/2; + int d = w/3, d2 = w/5; + + viconutil_set_point(pts[0], cx+d, cy+d2); + viconutil_set_point(pts[1], cx-d, cy+d2); + viconutil_set_point(pts[2], cx, cy-d2); + + glShadeModel(GL_SMOOTH); + glBegin(GL_TRIANGLES); + glColor4f(0.8, 0.8, 0.8, alpha); + glVertex2iv(pts[0]); + glVertex2iv(pts[1]); + glColor4f(0.3, 0.3, 0.3, alpha); + glVertex2iv(pts[2]); + glEnd(); + glShadeModel(GL_FLAT); + + glColor4f(0.0, 0.0, 0.0, 1); + viconutil_draw_lineloop_smooth(pts, 3); +} + +static void vicon_move_up_draw(int x, int y, int w, int h, float alpha) +{ + int i, d=-2, pad=3; + + glEnable(GL_LINE_SMOOTH); + glLineWidth(2); + glColor3f(0.0, 0.0, 0.0); + for (i=0; i<2; i++) { + int offs = (i?2:-2) + 1; + + glBegin(GL_LINE_STRIP); + glVertex2i(x+pad, y+h/2+d + offs); + glVertex2i(x+w/2, y+h/2-d + offs); + glVertex2i(x+w-pad, y+h/2+d + offs); + glEnd(); + } + glLineWidth(1.0); + glDisable(GL_LINE_SMOOTH); +} + +static void vicon_move_down_draw(int x, int y, int w, int h, float alpha) +{ + int i, d=2, pad=3; + + glEnable(GL_LINE_SMOOTH); + glLineWidth(2); + glColor3f(0.0, 0.0, 0.0); + for (i=0; i<2; i++) { + int offs = (i?2:-2) - 1; + + glBegin(GL_LINE_STRIP); + glVertex2i(x+pad, y+h/2+d + offs); + glVertex2i(x+w/2, y+h/2-d + offs); + glVertex2i(x+w-pad, y+h/2+d + offs); + glEnd(); + } + glLineWidth(1.0); + glDisable(GL_LINE_SMOOTH); +} + +/***/ + void BIF_resources_init(void) { ImBuf *bbuf= IMB_ibImageFromMemory((int *)datatoc_blenderbuttons, datatoc_blenderbuttons_size, IB_rect); @@ -325,6 +618,16 @@ void BIF_resources_init(void) } } + def_vicon(VICON_VIEW3D, 16, 16, vicon_view3d_draw); + def_vicon(VICON_EDIT, 16, 16, vicon_edit_draw); + def_vicon(VICON_EDITMODE_DEHLT, 16, 16, vicon_editmode_dehlt_draw); + def_vicon(VICON_EDITMODE_HLT, 16, 16, vicon_editmode_hlt_draw); + def_vicon(VICON_DISCLOSURE_TRI_RIGHT, 16, 16, vicon_disclosure_tri_right_draw); + def_vicon(VICON_DISCLOSURE_TRI_DOWN, 16, 16, vicon_disclosure_tri_down_draw); + def_vicon(VICON_MOVE_UP, 16, 16, vicon_move_up_draw); + def_vicon(VICON_MOVE_DOWN, 16, 16, vicon_move_down_draw); + def_vicon(VICON_X, 16, 16, vicon_x_draw); + IMB_freeImBuf(bbuf); } |