Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-06-16 15:48:21 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-16 17:28:42 +0300
commitd8c2c63c005b686c7489b06b889cd30cf9eeea9c (patch)
treed713b53a32d691537042fd16a1c61ea46388f1a1 /source/blender/editors/interface/interface_anim.c
parent8f2acda7d72da9370f7ec3013026fadb0842cb54 (diff)
UI: Add property decorator buttons
When use_property_split is enabled, this template adds buttons to set keyframes, (Alternative to showing color). See: T54951
Diffstat (limited to 'source/blender/editors/interface/interface_anim.c')
-rw-r--r--source/blender/editors/interface/interface_anim.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c
index fc0ad7e5dce..6a0dfcb5353 100644
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@ -101,6 +101,23 @@ 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;
+ }
+ }
}
/**
@@ -299,3 +316,35 @@ void ui_but_anim_paste_driver(bContext *C)
/* this operator calls UI_context_active_but_prop_get */
WM_operator_name_call(C, "ANIM_OT_paste_driver_button", WM_OP_INVOKE_DEFAULT, NULL);
}
+
+void ui_but_anim_decorate_cb(bContext *C, void *arg_but, void *UNUSED(arg_dummy))
+{
+ uiBut *but = arg_but;
+ but = but->prev;
+
+ /* FIXME(campbell), swapping active pointer is weak. */
+ SWAP(struct uiHandleButtonData *, but->active, but->next->active);
+
+ if (but->flag & UI_BUT_DRIVEN) {
+ /* pass */
+ /* TODO: report? */
+ }
+ else if (but->flag & UI_BUT_ANIMATED_KEY) {
+ PointerRNA props_ptr;
+ wmOperatorType *ot = WM_operatortype_find("ANIM_OT_keyframe_delete_button", false);
+ WM_operator_properties_create_ptr(&props_ptr, ot);
+ RNA_boolean_set(&props_ptr, "all", false);
+ WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr);
+ WM_operator_properties_free(&props_ptr);
+ }
+ else {
+ PointerRNA props_ptr;
+ wmOperatorType *ot = WM_operatortype_find("ANIM_OT_keyframe_insert_button", false);
+ WM_operator_properties_create_ptr(&props_ptr, ot);
+ RNA_boolean_set(&props_ptr, "all", false);
+ WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr);
+ WM_operator_properties_free(&props_ptr);
+ }
+
+ SWAP(struct uiHandleButtonData *, but->active, but->next->active);
+}