diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-12 06:06:15 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-12 06:06:15 +0400 |
commit | 3116062a828e24ed2e91c219ab338a38030f2f42 (patch) | |
tree | fe77a0722deaee3afd521b4a596bbe5c1c827b2e /source/blender/editors/interface | |
parent | 8b9bb47a3faf753cb0ca2ec0e9c6a741c7af31c2 (diff) |
2.5: Couple of small fun features
* Text window font size now supports full range 8-32, instead of
just 12 and 15. I added BLF_fixed_width to get the character
width of a fixed size font.
* Buttons do undo push on change again.
* Animated/Keyframe/Driver colors are now themable, with blend
value to blend with original color. Set this to 0.5 now to
give colors less constrast.
* Fix tooltip popping up with RMB menu open, and missing redraw.
* Autokeyframe now works for buttons.
* Driver expressions can be edited in place in a button now.
(still some refresh issues).
* Also made python driver default for the Add Driver function
in the RMB button. This way you don't have to open a Graph
editor if you just want to type an expression. Also, the
default expression then is the current value.
* Tooltips now show some extra info, not sure what is good to
have, but currently I added:
* Shortcut key for operator buttons.
* Python struct & property name for RNA buttons.
* Expression for driven values.
* Value for text/search/pointer buttons.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface.c | 9 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_anim.c | 141 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 82 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_intern.h | 3 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 77 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 47 |
6 files changed, 288 insertions, 71 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 6f86e3e809a..63e16c7933a 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1312,8 +1312,10 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen) BLI_strncpy(str, but->poin, maxlen); return; } + else if(ui_but_anim_expression_get(but, str, maxlen)) + ; /* driver expression */ else { - /* number */ + /* number editing */ double value; value= ui_get_but_val(but); @@ -1384,7 +1386,12 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) BLI_strncpy(but->poin, str, but->hardmax); return 1; } + else if(ui_but_anim_expression_set(but, str)) { + /* driver expression */ + return 1; + } else { + /* number editing */ double value; /* XXX 2.50 missing python api */ diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 7c439f408ba..4a2ef50a31b 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -10,6 +10,7 @@ #include "DNA_screen_types.h" #include "BLI_listbase.h" +#include "BLI_string.h" #include "BKE_animsys.h" #include "BKE_context.h" @@ -27,49 +28,135 @@ #include "interface_intern.h" -void ui_but_anim_flag(uiBut *but, float cfra) +static FCurve *ui_but_get_fcurve(uiBut *but, bAction **action, int *driven) { - but->flag &= ~(UI_BUT_ANIMATED|UI_BUT_ANIMATED_KEY|UI_BUT_DRIVEN); - + FCurve *fcu= NULL; + + *driven= 0; + /* there must be some RNA-pointer + property combo for this button */ - if (but->rnaprop && but->rnapoin.id.data && + if(but->rnaprop && but->rnapoin.id.data && RNA_property_animateable(&but->rnapoin, but->rnaprop)) { AnimData *adt= BKE_animdata_from_id(but->rnapoin.id.data); - FCurve *fcu; char *path; - if (adt) { - if ((adt->action && adt->action->curves.first) || (adt->drivers.first)) { + if(adt) { + if((adt->action && adt->action->curves.first) || (adt->drivers.first)) { /* XXX this function call can become a performance bottleneck */ path= RNA_path_from_ID_to_property(&but->rnapoin, but->rnaprop); - - if (path) { + + if(path) { /* animation takes priority over drivers */ - if (adt->action && adt->action->curves.first) { + if(adt->action && adt->action->curves.first) fcu= list_find_fcurve(&adt->action->curves, path, but->rnaindex); - - if (fcu) { - but->flag |= UI_BUT_ANIMATED; - - if (fcurve_frame_has_keyframe(fcu, cfra, 0)) - but->flag |= UI_BUT_ANIMATED_KEY; - } - } /* if not animated, check if driven */ - if ((but->flag & UI_BUT_ANIMATED)==0 && (adt->drivers.first)) { + if(!fcu && (adt->drivers.first)) { fcu= list_find_fcurve(&adt->drivers, path, but->rnaindex); - if (fcu) - but->flag |= UI_BUT_DRIVEN; + if(fcu) + *driven= 1; } - + + if(fcu && action) + *action= adt->action; + MEM_freeN(path); } } } } + + return fcu; +} + +void ui_but_anim_flag(uiBut *but, float cfra) +{ + FCurve *fcu; + int driven; + + but->flag &= ~(UI_BUT_ANIMATED|UI_BUT_ANIMATED_KEY|UI_BUT_DRIVEN); + + fcu= ui_but_get_fcurve(but, NULL, &driven); + + if(fcu) { + if(!driven) { + but->flag |= UI_BUT_ANIMATED; + + if(fcurve_frame_has_keyframe(fcu, cfra, 0)) + but->flag |= UI_BUT_ANIMATED_KEY; + } + else { + but->flag |= UI_BUT_DRIVEN; + } + } +} + +int ui_but_anim_expression_get(uiBut *but, char *str, int maxlen) +{ + FCurve *fcu; + ChannelDriver *driver; + int driven; + + fcu= ui_but_get_fcurve(but, NULL, &driven); + + if(fcu && driven) { + driver= fcu->driver; + + if(driver && driver->type == DRIVER_TYPE_PYTHON) { + BLI_strncpy(str, driver->expression, maxlen); + return 1; + } + } + + return 0; +} + +int ui_but_anim_expression_set(uiBut *but, const char *str) +{ + FCurve *fcu; + ChannelDriver *driver; + int driven; + + fcu= ui_but_get_fcurve(but, NULL, &driven); + + if(fcu && driven) { + driver= fcu->driver; + + if(driver && driver->type == DRIVER_TYPE_PYTHON) { + BLI_strncpy(driver->expression, str, sizeof(driver->expression)); + return 1; + } + } + + return 0; +} + +void ui_but_anim_autokey(uiBut *but, Scene *scene, float cfra) +{ + ID *id; + bAction *action; + FCurve *fcu; + int driven; + + fcu= ui_but_get_fcurve(but, &action, &driven); + + if(fcu && !driven) { + id= but->rnapoin.id.data; + + if(autokeyframe_cfra_can_key(scene, id)) { + short flag = 0; + + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) + flag |= INSERTKEY_NEEDED; + if (IS_AUTOKEY_FLAG(AUTOMATKEY)) + flag |= INSERTKEY_MATRIX; + + fcu->flag &= ~FCURVE_SELECTED; + insert_keyframe(id, action, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag); + } + } } void uiAnimContextProperty(const bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop, int *index) @@ -140,6 +227,7 @@ void ui_but_anim_menu(bContext *C, uiBut *but) uiItemBooleanO(layout, "Delete Keyframe", 0, "ANIM_OT_delete_keyframe_button", "all", 0); } } + else if(but->flag & UI_BUT_DRIVEN); else if(RNA_property_animateable(&but->rnapoin, but->rnaprop)) { if(length) { uiItemBooleanO(layout, "Insert Keyframes", 0, "ANIM_OT_insert_keyframe_button", "all", 1); @@ -153,17 +241,18 @@ void ui_but_anim_menu(bContext *C, uiBut *but) uiItemS(layout); if(length) { - uiItemBooleanO(layout, "Remove Driver", 0, "ANIM_OT_remove_driver_button", "all", 1); - uiItemBooleanO(layout, "Remove Single Driver", 0, "ANIM_OT_remove_driver_button", "all", 0); + uiItemBooleanO(layout, "Delete Drivers", 0, "ANIM_OT_remove_driver_button", "all", 1); + uiItemBooleanO(layout, "Delete Single Driver", 0, "ANIM_OT_remove_driver_button", "all", 0); } else - uiItemBooleanO(layout, "Remove Driver", 0, "ANIM_OT_remove_driver_button", "all", 0); + uiItemBooleanO(layout, "Delete Driver", 0, "ANIM_OT_remove_driver_button", "all", 0); } + else if(but->flag & UI_BUT_ANIMATED_KEY); else if(RNA_property_animateable(&but->rnapoin, but->rnaprop)) { uiItemS(layout); if(length) { - uiItemBooleanO(layout, "Add Driver", 0, "ANIM_OT_add_driver_button", "all", 1); + uiItemBooleanO(layout, "Add Drivers", 0, "ANIM_OT_add_driver_button", "all", 1); uiItemBooleanO(layout, "Add Single Driver", 0, "ANIM_OT_add_driver_button", "all", 0); } else diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index e0ce6a7a83f..10e495cde94 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -32,6 +32,7 @@ #include "DNA_color_types.h" #include "DNA_object_types.h" +#include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_texture_types.h" #include "DNA_userdef_types.h" @@ -49,6 +50,7 @@ #include "BKE_utildefines.h" #include "ED_screen.h" +#include "ED_util.h" #include "UI_interface.h" @@ -166,6 +168,10 @@ typedef struct uiAfterFunc { PropertyRNA *rnaprop; bContextStore *context; + + char undostr[512]; + + int autokey; } uiAfterFunc; static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y); @@ -174,6 +180,7 @@ static int ui_handler_region_menu(bContext *C, wmEvent *event, void *userdata); static int ui_handler_popup(bContext *C, wmEvent *event, void *userdata); static void ui_handler_remove_popup(bContext *C, void *userdata); static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type); +static void button_timers_tooltip_remove(bContext *C, uiBut *but); /* ******************** menu navigation helpers ************** */ @@ -271,6 +278,32 @@ static void ui_apply_but_func(bContext *C, uiBut *but) } } +static void ui_apply_autokey_undo(bContext *C, uiBut *but) +{ + Scene *scene= CTX_data_scene(C); + uiAfterFunc *after; + char *str= NULL; + + if ELEM5(but->type, BLOCK, BUT, LABEL, PULLDOWN, ROUNDBOX); + else { + /* define which string to use for undo */ + if ELEM(but->type, LINK, INLINK) str= "Add button link"; + else if ELEM(but->type, MENU, ICONTEXTROW) str= but->drawstr; + else if(but->drawstr[0]) str= but->drawstr; + else str= but->tip; + } + + /* delayed, after all other funcs run, popups are closed, etc */ + if(str) { + after= MEM_callocN(sizeof(uiAfterFunc), "uiAfterFunc"); + BLI_strncpy(after->undostr, str, sizeof(after->undostr)); + BLI_addtail(&UIAfterFuncs, after); + } + + /* try autokey */ + ui_but_anim_autokey(but, scene, scene->r.cfra); +} + static void ui_apply_but_funcs_after(bContext *C) { uiAfterFunc *afterf, after; @@ -311,6 +344,9 @@ static void ui_apply_but_funcs_after(bContext *C) after.handle_func(C, after.handle_func_arg, after.retval); if(after.butm_func) after.butm_func(C, after.butm_func_arg, after.a2); + + if(after.undostr[0]) + ED_undo_push(C, after.undostr); } } @@ -1324,7 +1360,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) but->editstr= data->str; but->pos= strlen(data->str); but->selsta= 0; - but->selend= strlen(but->drawstr) - strlen(but->str); + but->selend= strlen(data->str); /* optional searchbox */ if(but->type==SEARCH_MENU) { @@ -1539,7 +1575,8 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle } if(changed) { - if(data->interactive) ui_apply_button(C, block, but, data, 1); + /* never update while typing for now */ + if(0/*data->interactive*/) ui_apply_button(C, block, but, data, 1); else ui_check_but(but); if(data->searchbox) @@ -3090,6 +3127,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) } /* handle menu */ else if(event->type == RIGHTMOUSE && event->val == KM_PRESS) { + button_timers_tooltip_remove(C, but); ui_but_anim_menu(C, but); return WM_UI_HANDLER_BREAK; } @@ -3315,6 +3353,27 @@ static int button_modal_state(uiHandleButtonState state) BUTTON_STATE_TEXT_SELECTING, BUTTON_STATE_MENU_OPEN); } +static void button_timers_tooltip_remove(bContext *C, uiBut *but) +{ + uiHandleButtonData *data; + + data= but->active; + + if(data->tooltiptimer) { + WM_event_remove_window_timer(data->window, data->tooltiptimer); + data->tooltiptimer= NULL; + } + if(data->tooltip) { + ui_tooltip_free(C, data->tooltip); + data->tooltip= NULL; + } + + if(data->autoopentimer) { + WM_event_remove_window_timer(data->window, data->autoopentimer); + data->autoopentimer= NULL; + } +} + static void button_tooltip_timer_reset(uiBut *but) { uiHandleButtonData *data; @@ -3362,20 +3421,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s } else { but->flag |= UI_SELECT; - - if(data->tooltiptimer) { - WM_event_remove_window_timer(data->window, data->tooltiptimer); - data->tooltiptimer= NULL; - } - if(data->tooltip) { - ui_tooltip_free(C, data->tooltip); - data->tooltip= NULL; - } - - if(data->autoopentimer) { - WM_event_remove_window_timer(data->window, data->autoopentimer); - data->autoopentimer= NULL; - } + button_timers_tooltip_remove(C, but); } /* text editing */ @@ -3502,6 +3548,10 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b } } + /* autokey & undo push */ + if(!data->cancel) + ui_apply_autokey_undo(C, but); + /* disable tooltips until mousemove */ ui_blocks_set_tooltips(data->region, 0); diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 8c254419ec3..5760a28cb5c 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -455,6 +455,9 @@ void ui_but_anim_delete_keyframe(struct bContext *C); void ui_but_anim_add_driver(struct bContext *C); void ui_but_anim_remove_driver(struct bContext *C); void ui_but_anim_menu(struct bContext *C, uiBut *but); +int ui_but_anim_expression_get(uiBut *but, char *str, int maxlen); +int ui_but_anim_expression_set(uiBut *but, const char *str); +void ui_but_anim_autokey(uiBut *but, struct Scene *scene, float cfra); #endif diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index e0c6fbd7134..c574cf1072f 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -294,19 +294,33 @@ void ui_remove_temporary_region(bContext *C, bScreen *sc, ARegion *ar) typedef struct uiTooltipData { rcti bbox; uiFontStyle fstyle; - char *tip; + char lines[5][512]; + int totline; + int toth, spaceh, lineh; } uiTooltipData; static void ui_tooltip_region_draw(const bContext *C, ARegion *ar) { uiTooltipData *data= ar->regiondata; + rcti bbox= data->bbox; + int a; ui_draw_menu_back(U.uistyles.first, NULL, &data->bbox); /* draw text */ - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); uiStyleFontSet(&data->fstyle); - uiStyleFontDraw(&data->fstyle, &data->bbox, data->tip); + + bbox.ymax= bbox.ymax - 0.5f*((bbox.ymax - bbox.ymin) - data->toth); + bbox.ymin= bbox.ymax - data->lineh; + + for(a=0; a<data->totline; a++) { + if(a == 0) glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + else glColor4f(0.5f, 0.5f, 0.5f, 1.0f); + + uiStyleFontDraw(&data->fstyle, &bbox, data->lines[a]); + bbox.ymin -= data->lineh + data->spaceh; + bbox.ymax -= data->lineh + data->spaceh; + } } static void ui_tooltip_region_free(ARegion *ar) @@ -314,7 +328,6 @@ static void ui_tooltip_region_free(ARegion *ar) uiTooltipData *data; data= ar->regiondata; - MEM_freeN(data->tip); MEM_freeN(data); ar->regiondata= NULL; } @@ -325,9 +338,11 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) static ARegionType type; ARegion *ar; uiTooltipData *data; + IDProperty *prop; + char buf[512]; float fonth, fontw, aspect= but->block->aspect; float x1f, x2f, y1f, y2f; - int x1, x2, y1, y2, winx, winy, ofsx, ofsy; + int x1, x2, y1, y2, winx, winy, ofsx, ofsy, w, h, a; if(!but->tip || strlen(but->tip)==0) return NULL; @@ -342,18 +357,64 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* create tooltip data */ data= MEM_callocN(sizeof(uiTooltipData), "uiTooltipData"); - data->tip= BLI_strdup(but->tip); + + BLI_strncpy(data->lines[0], but->tip, sizeof(data->lines[0])); + data->totline= 1; + + if(but->optype && !(but->block->flag & UI_BLOCK_LOOP)) { + /* operator keymap (not menus, they already have it) */ + prop= (but->opptr)? but->opptr->data: NULL; + + if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) { + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Shortcut: %s", buf); + data->totline++; + } + } + + if(ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) { + /* full string */ + ui_get_but_string(but, buf, sizeof(buf)); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Value: %s", buf); + data->totline++; + } + + if(but->rnaprop) { + if(but->flag & UI_BUT_DRIVEN) { + if(ui_but_anim_expression_get(but, buf, sizeof(buf))) { + /* expression */ + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Expression: %s", buf); + data->totline++; + } + } + + /* rna info */ + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); + data->totline++; + } /* set font, get bb */ data->fstyle= style->widget; /* copy struct */ data->fstyle.align= UI_STYLE_TEXT_CENTER; ui_fontscale(&data->fstyle.points, aspect); uiStyleFontSet(&data->fstyle); - fontw= aspect * BLF_width(data->tip); - fonth= aspect * BLF_height(data->tip); + + h= BLF_height(data->lines[0]); + + for(a=0, fontw=0, fonth=0; a<data->totline; a++) { + w= BLF_width(data->lines[a]); + fontw= MAX2(fontw, w); + fonth += (a == 0)? h: h+5; + } + + fontw *= aspect; + fonth *= aspect; ar->regiondata= data; + data->toth= fonth; + data->lineh= h*aspect; + data->spaceh= 5*aspect; + /* compute position */ ofsx= (but->block->panel)? but->block->panel->ofsx: 0; ofsy= (but->block->panel)? but->block->panel->ofsy: 0; diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 2cd7c1d61cd..8f40b2e4bfd 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -85,15 +85,6 @@ typedef struct uiWidgetTrias { } uiWidgetTrias; -typedef struct uiWidgetStateColors { - char inner_anim[4]; - char inner_anim_sel[4]; - char inner_key[4]; - char inner_key_sel[4]; - char inner_driven[4]; - char inner_driven_sel[4]; -} uiWidgetStateColors; - typedef struct uiWidgetBase { int totvert, halfwayvert; @@ -116,6 +107,7 @@ typedef struct uiWidgetType { /* pointer to theme color definition */ uiWidgetColors *wcol_theme; + uiWidgetStateColors *wcol_state; /* converted colors for state */ uiWidgetColors wcol; @@ -918,6 +910,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB char inner_key_sel[4]; char inner_driven[4]; char inner_driven_sel[4]; + float blend; */ @@ -925,9 +918,10 @@ static struct uiWidgetStateColors wcol_state= { {115, 190, 76, 255}, {90, 166, 51, 255}, {240, 235, 100, 255}, - {148, 204, 76, 255}, + {215, 211, 75, 255}, {180, 0, 255, 255}, - {153, 0, 230, 255} + {153, 0, 230, 255}, + 0.5f, 0.0f }; /* uiWidgetColors @@ -1147,7 +1141,6 @@ static struct uiWidgetColors wcol_tmp= { /* called for theme init (new theme) and versions */ void ui_widget_color_init(ThemeUI *tui) { - tui->wcol_regular= wcol_regular; tui->wcol_tool= wcol_tool; tui->wcol_text= wcol_text; @@ -1162,24 +1155,37 @@ void ui_widget_color_init(ThemeUI *tui) tui->wcol_menu_item= wcol_menu_item; tui->wcol_box= wcol_box; tui->wcol_scroll= wcol_scroll; + + tui->wcol_state= wcol_state; } /* ************ button callbacks, state ***************** */ +static void widget_state_blend(char *cp, char *cpstate, float fac) +{ + if(fac != 0.0f) { + cp[0]= (int)((1.0f-fac)*cp[0] + fac*cpstate[0]); + cp[1]= (int)((1.0f-fac)*cp[1] + fac*cpstate[1]); + cp[2]= (int)((1.0f-fac)*cp[2] + fac*cpstate[2]); + } +} + /* copy colors from theme, and set changes in it based on state */ static void widget_state(uiWidgetType *wt, int state) { + uiWidgetStateColors *wcol_state= wt->wcol_state; + wt->wcol= *(wt->wcol_theme); if(state & UI_SELECT) { + QUATCOPY(wt->wcol.inner, wt->wcol.inner_sel) + if(state & UI_BUT_ANIMATED_KEY) - QUATCOPY(wt->wcol.inner, wcol_state.inner_key_sel) + widget_state_blend(wt->wcol.inner, wcol_state->inner_key_sel, wcol_state->blend); else if(state & UI_BUT_ANIMATED) - QUATCOPY(wt->wcol.inner, wcol_state.inner_anim_sel) + widget_state_blend(wt->wcol.inner, wcol_state->inner_anim_sel, wcol_state->blend); else if(state & UI_BUT_DRIVEN) - QUATCOPY(wt->wcol.inner, wcol_state.inner_driven_sel) - else - QUATCOPY(wt->wcol.inner, wt->wcol.inner_sel) + widget_state_blend(wt->wcol.inner, wcol_state->inner_driven_sel, wcol_state->blend); VECCOPY(wt->wcol.text, wt->wcol.text_sel); @@ -1190,11 +1196,11 @@ static void widget_state(uiWidgetType *wt, int state) } else { if(state & UI_BUT_ANIMATED_KEY) - QUATCOPY(wt->wcol.inner, wcol_state.inner_key) + widget_state_blend(wt->wcol.inner, wcol_state->inner_key, wcol_state->blend); else if(state & UI_BUT_ANIMATED) - QUATCOPY(wt->wcol.inner, wcol_state.inner_anim) + widget_state_blend(wt->wcol.inner, wcol_state->inner_anim, wcol_state->blend); else if(state & UI_BUT_DRIVEN) - QUATCOPY(wt->wcol.inner, wcol_state.inner_driven) + widget_state_blend(wt->wcol.inner, wcol_state->inner_driven, wcol_state->blend); if(state & UI_ACTIVE) { /* mouse over? */ wt->wcol.inner[0]= wt->wcol.inner[0]>=240? 255 : wt->wcol.inner[0]+15; @@ -2039,6 +2045,7 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type) /* defaults */ wt.wcol_theme= &btheme->tui.wcol_regular; + wt.wcol_state= &btheme->tui.wcol_state; wt.state= widget_state; wt.draw= widget_but; wt.custom= NULL; |