UI: show decorator icon for static-override
authorCampbell Barton <ideasman42@gmail.com>
Sat, 16 Jun 2018 16:26:34 +0000 (18:26 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 16 Jun 2018 16:27:04 +0000 (18:27 +0200)
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_anim.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_intern.h

index cc3f450..8c37054 100644 (file)
@@ -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);
+               }
        }
 
 
index 6a0dfcb..f2b6ef0 100644 (file)
@@ -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;
        }
 }
 
index af7803c..23859ef 100644 (file)
@@ -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) {
index 15e04c5..6f029b8 100644 (file)
@@ -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);