soc-2008-mxcurioni: merged changes to revision 23516
[blender.git] / source / blender / editors / interface / interface_anim.c
index 784d820ea52868eec548bdd364bfe6af7bb19109..8037a609a2f09c042800a1dd2fb1320b1e14f7b6 100644 (file)
@@ -152,6 +152,8 @@ void ui_but_anim_autokey(uiBut *but, Scene *scene, float cfra)
                                flag |= INSERTKEY_NEEDED;
                        if (IS_AUTOKEY_FLAG(AUTOMATKEY))
                                flag |= INSERTKEY_MATRIX;
+                       if (IS_AUTOKEY_MODE(scene, EDITKEYS))
+                               flag |= INSERTKEY_REPLACE;
                        
                        fcu->flag &= ~FCURVE_SELECTED;
                        insert_keyframe(id, action, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
@@ -207,6 +209,30 @@ 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_copy_driver(bContext *C)
+{
+       /* this operator calls uiAnimContextProperty above */
+       WM_operator_name_call(C, "ANIM_OT_copy_driver_button", WM_OP_INVOKE_DEFAULT, NULL);
+}
+
+void ui_but_anim_paste_driver(bContext *C)
+{
+       /* this operator calls uiAnimContextProperty above */
+       WM_operator_name_call(C, "ANIM_OT_paste_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;
@@ -250,6 +276,10 @@ void ui_but_anim_menu(bContext *C, uiBut *but)
                        }
                        else
                                uiItemBooleanO(layout, "Delete Driver", 0, "ANIM_OT_remove_driver_button", "all", 0);
+                               
+                       uiItemO(layout, "Copy Driver", 0, "ANIM_OT_copy_driver_button");
+                       if (ANIM_driver_can_paste())
+                               uiItemO(layout, "Paste Driver", 0, "ANIM_OT_paste_driver_button");
                }
                else if(but->flag & UI_BUT_ANIMATED_KEY);
                else if(RNA_property_animateable(&but->rnapoin, but->rnaprop)) {
@@ -261,6 +291,23 @@ void ui_but_anim_menu(bContext *C, uiBut *but)
                        }
                        else
                                uiItemBooleanO(layout, "Add Driver", 0, "ANIM_OT_add_driver_button", "all", 0);
+                       
+                       if (ANIM_driver_can_paste())                    
+                               uiItemO(layout, "Paste Driver", 0, "ANIM_OT_paste_driver_button");
+               }
+               
+               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);
+                               uiItemO(layout, "Remove from Keying Set", 0, "ANIM_OT_remove_keyingset_button");
+                       }
+                       else {
+                               uiItemBooleanO(layout, "Add to Keying Set", 0, "ANIM_OT_add_keyingset_button", "all", 0);
+                               uiItemO(layout, "Remove from Keying Set", 0, "ANIM_OT_remove_keyingset_button");
+                       }
                }
 
                uiPupMenuEnd(C, pup);