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.
This commit is contained in:
2009-05-05 09:56:22 +00:00
parent 42bc76511d
commit 71c38978e1

View File

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