diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-16 19:26:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-16 19:27:04 +0300 |
commit | c21499ba4a53d98a80a0251d770399ef0521d3e9 (patch) | |
tree | 71fd496f9aa8eb29e5f89d1117ebe1e9e2e7c413 /source/blender/editors/interface | |
parent | 3b7f630a54164285ab4d72cf1ffb77f3a5f9e19b (diff) |
UI: show decorator icon for static-override
Diffstat (limited to 'source/blender/editors/interface')
4 files changed, 29 insertions, 16 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index cc3f450a99d..8c37054098b 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1272,6 +1272,9 @@ void UI_block_end_ex(const bContext *C, uiBlock *block, const int xy[2], int r_x ui_but_anim_flag(but, (scene) ? scene->r.cfra : 0.0f); ui_but_override_flag(but); + if (UI_but_is_decorator(but)) { + ui_but_anim_decorate_update_from_flag(but); + } } diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 6a0dfcb5353..f2b6ef03d98 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -101,22 +101,26 @@ void ui_but_anim_flag(uiBut *but, float cfra) but->flag |= UI_BUT_DRIVEN; } } +} - if (but->next && UI_but_is_decorator(but->next)) { - uiBut *but_decor = but->next; - int flag = but->flag; - if (flag & UI_BUT_DRIVEN) { - but_decor->icon = ICON_AUTO; - } - else if (flag & UI_BUT_ANIMATED_KEY) { - but_decor->icon = ICON_SPACE2; - } - else if (flag & UI_BUT_ANIMATED) { - but_decor->icon = ICON_SPACE3; - } - else { - but_decor->icon = ICON_DOT; - } +void ui_but_anim_decorate_update_from_flag(uiBut *but) +{ + BLI_assert(UI_but_is_decorator(but) && but->prev); + int flag = but->prev->flag; + if (flag & UI_BUT_DRIVEN) { + but->icon = ICON_AUTO; + } + else if (flag & UI_BUT_ANIMATED_KEY) { + but->icon = ICON_SPACE2; + } + else if (flag & UI_BUT_ANIMATED) { + but->icon = ICON_SPACE3; + } + else if (flag & UI_BUT_OVERRIDEN) { + but->icon = ICON_LIBRARY_DATA_OVERRIDE; + } + else { + but->icon = ICON_DOT; } } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index af7803c7002..23859ef8514 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1275,7 +1275,7 @@ static bool ui_drag_toggle_but_is_supported(const uiBut *but) return true; } else if (UI_but_is_decorator(but)) { - return ELEM(but->icon, ICON_SPACE2, ICON_SPACE3, ICON_DOT); + return ELEM(but->icon, ICON_SPACE2, ICON_SPACE3, ICON_DOT, ICON_LIBRARY_DATA_OVERRIDE); } else { return false; @@ -8223,6 +8223,10 @@ void UI_context_update_anim_flag(const bContext *C) for (but = block->buttons.first; but; but = but->next) { ui_but_anim_flag(but, (scene) ? scene->r.cfra : 0.0f); ui_but_override_flag(but); + if (UI_but_is_decorator(but)) { + ui_but_anim_decorate_update_from_flag(but); + } + ED_region_tag_redraw(ar); if (but->active) { diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 15e04c5a2c7..6f029b81e92 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -814,7 +814,9 @@ bool ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen); bool ui_but_anim_expression_set(uiBut *but, const char *str); bool ui_but_anim_expression_create(uiBut *but, const char *str); void ui_but_anim_autokey(struct bContext *C, uiBut *but, struct Scene *scene, float cfra); + void ui_but_anim_decorate_cb(struct bContext *C, void *arg_but, void *arg_dummy); +void ui_but_anim_decorate_update_from_flag(uiBut *but); /* interface_eyedropper.c */ struct wmKeyMap *eyedropper_modal_keymap(struct wmKeyConfig *keyconf); |