From 71c38978e14ebf3522fe60fc239ad04f10ef30ab Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 5 May 2009 09:56:22 +0000 Subject: 2.5 Buttons - Insert/Delete Keyframe Menu Tweaks * Added 'Replace Keyframes' entry that appears in addition to delete, since it is often useful to be able to directly replace values instead of having to delete and reinsert keyframes. Internally, this just calls the Insert Keyframe operator. * Separated the code to for Driver editing from the tests for keyframes, since they're independent. * Added separators between keyframe and driver operations. This could be removed if the UI-mafia consider it overkill. --- source/blender/editors/interface/interface_anim.c | 37 +++++++++++++++-------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index af8aa91f358..ac6f5d970eb 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -121,36 +121,49 @@ void ui_but_anim_menu(bContext *C, uiBut *but) if(but->rnapoin.data && but->rnaprop) { pup= uiPupMenuBegin(RNA_property_ui_name(but->rnaprop), 0); layout= uiPupMenuLayout(pup); - + length= RNA_property_array_length(but->rnaprop); - + if(but->flag & UI_BUT_ANIMATED_KEY) { if(length) { + uiItemBooleanO(layout, "Replace Keyframes", 0, "ANIM_OT_insert_keyframe_button", "all", 1); + uiItemBooleanO(layout, "Replace Single Keyframe", 0, "ANIM_OT_insert_keyframe_button", "all", 0); uiItemBooleanO(layout, "Delete Keyframes", 0, "ANIM_OT_delete_keyframe_button", "all", 1); uiItemBooleanO(layout, "Delete Single Keyframe", 0, "ANIM_OT_delete_keyframe_button", "all", 0); - - uiItemBooleanO(layout, "Remove Driver", 0, "ANIM_OT_remove_driver_button", "all", 1); - uiItemBooleanO(layout, "Remove Single Driver", 0, "ANIM_OT_remove_driver_button", "all", 0); } else { + uiItemBooleanO(layout, "Replace Keyframe", 0, "ANIM_OT_insert_keyframe_button", "all", 0); uiItemBooleanO(layout, "Delete Keyframe", 0, "ANIM_OT_delete_keyframe_button", "all", 0); - - uiItemBooleanO(layout, "Remove Driver", 0, "ANIM_OT_remove_driver_button", "all", 0); } } else if(RNA_property_animateable(&but->rnapoin, but->rnaprop)) { if(length) { uiItemBooleanO(layout, "Insert Keyframes", 0, "ANIM_OT_insert_keyframe_button", "all", 1); uiItemBooleanO(layout, "Insert Single Keyframe", 0, "ANIM_OT_insert_keyframe_button", "all", 0); - + } + else + uiItemBooleanO(layout, "Insert Keyframe", 0, "ANIM_OT_insert_keyframe_button", "all", 0); + } + + if(but->flag & UI_BUT_DRIVEN) { + uiItemS(layout); + + if(length) { + uiItemBooleanO(layout, "Remove Driver", 0, "ANIM_OT_remove_driver_button", "all", 1); + uiItemBooleanO(layout, "Remove Single Driver", 0, "ANIM_OT_remove_driver_button", "all", 0); + } + else + uiItemBooleanO(layout, "Remove Driver", 0, "ANIM_OT_remove_driver_button", "all", 0); + } + else if(RNA_property_animateable(&but->rnapoin, but->rnaprop)) { + uiItemS(layout); + + if(length) { uiItemBooleanO(layout, "Add Driver", 0, "ANIM_OT_add_driver_button", "all", 1); uiItemBooleanO(layout, "Add Single Driver", 0, "ANIM_OT_add_driver_button", "all", 0); } - else { - uiItemBooleanO(layout, "Insert Keyframe", 0, "ANIM_OT_insert_keyframe_button", "all", 0); - + else uiItemBooleanO(layout, "Add Driver", 0, "ANIM_OT_add_driver_button", "all", 0); - } } uiPupMenuEnd(C, pup); -- cgit v1.2.3