Keying Sets: Added options to add/remove properties from the active Keying Set to...
[blender.git] / source / blender / editors / interface / interface_anim.c
index d7904a19bfe33b20e0ef2bf17cd59e79e953bccd..8e15bbde2015526241d2ab1ff05819ff26ec50fc 100644 (file)
@@ -209,6 +209,18 @@ void ui_but_anim_remove_driver(bContext *C)
        WM_operator_name_call(C, "ANIM_OT_remove_driver_button", WM_OP_INVOKE_DEFAULT, NULL);
 }
 
+void ui_but_anim_add_keyingset(bContext *C)
+{
+       /* this operator calls uiAnimContextProperty above */
+       WM_operator_name_call(C, "ANIM_OT_add_keyingset_button", WM_OP_INVOKE_DEFAULT, NULL);
+}
+
+void ui_but_anim_remove_keyingset(bContext *C)
+{
+       /* this operator calls uiAnimContextProperty above */
+       WM_operator_name_call(C, "ANIM_OT_remove_keyingset_button", WM_OP_INVOKE_DEFAULT, NULL);
+}
+
 void ui_but_anim_menu(bContext *C, uiBut *but)
 {
        uiPopupMenu *pup;
@@ -264,6 +276,20 @@ void ui_but_anim_menu(bContext *C, uiBut *but)
                        else
                                uiItemBooleanO(layout, "Add Driver", 0, "ANIM_OT_add_driver_button", "all", 0);
                }
+               
+               if(RNA_property_animateable(&but->rnapoin, but->rnaprop)) {
+                       uiItemS(layout);
+                       
+                       if(length) {
+                               uiItemBooleanO(layout, "Add All to Keying Set", 0, "ANIM_OT_add_keyingset_button", "all", 1);
+                               uiItemBooleanO(layout, "Add Single to Keying Set", 0, "ANIM_OT_add_keyingset_button", "all", 0);
+                               uiItemBooleanO(layout, "Remove from Keying Set", 0, "ANIM_OT_remove_keyingset_button", "all", 0);
+                       }
+                       else {
+                               uiItemBooleanO(layout, "Add to Keying Set", 0, "ANIM_OT_add_keyingset_button", "all", 0);
+                               uiItemBooleanO(layout, "Remove from Keying Set", 0, "ANIM_OT_remove_keyingset_button", "all", 0);
+                       }
+               }
 
                uiPupMenuEnd(C, pup);
        }