[Bf-blender-cvs] [c21499ba4a5] blender2.8: UI: show decorator icon for static-override

Campbell Barton noreply at git.blender.org
Sat Jun 16 18:27:06 CEST 2018


Commit: c21499ba4a53d98a80a0251d770399ef0521d3e9
Author: Campbell Barton
Date:   Sat Jun 16 18:26:34 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBc21499ba4a53d98a80a0251d770399ef0521d3e9

UI: show decorator icon for static-override

===================================================================

M	source/blender/editors/interface/interface.c
M	source/blender/editors/interface/interface_anim.c
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_intern.h

===================================================================

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);



More information about the Bf-blender-cvs mailing list