diff options
Diffstat (limited to 'source/blender/editors/space_nla')
-rw-r--r-- | source/blender/editors/space_nla/nla_channels.c | 46 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_intern.h | 4 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_ops.c | 8 |
3 files changed, 52 insertions, 6 deletions
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index 1dccc874c17..8a9e26b354c 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -507,11 +507,11 @@ static int nlaedit_delete_tracks_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -void NLA_OT_delete_tracks(wmOperatorType *ot) +void NLA_OT_tracks_delete(wmOperatorType *ot) { /* identifiers */ ot->name = "Delete Tracks"; - ot->idname = "NLA_OT_delete_tracks"; + ot->idname = "NLA_OT_tracks_delete"; ot->description = "Delete selected NLA-Tracks and the strips they contain"; /* api callbacks */ @@ -523,3 +523,45 @@ void NLA_OT_delete_tracks(wmOperatorType *ot) } /* *********************************************** */ +/* AnimData Related Operators */ + +/* ******************** Include Objects Operator ***************************** */ +/* Include selected objects in NLA Editor, by giving them AnimData blocks + * NOTE: This doesn't help for non-object AnimData, where we do not have any effective + * selection mechanism in place. Unfortunately, this means that non-object AnimData + * once again becomes a second-class citizen here. However, at least for the most + * common use case, we now have a nice shortcut again. + */ + +static int nlaedit_objects_add_exec(bContext *C, wmOperator *UNUSED(op)) +{ + CTX_DATA_BEGIN (C, Object *, ob, selected_objects) + { + /* ensure that object has AnimData... that's all */ + BKE_id_add_animdata(&ob->id); + } + CTX_DATA_END; + + /* set notifier that things have changed */ + WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL); + + /* done */ + return OPERATOR_FINISHED; +} + +void NLA_OT_selected_objects_add(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Include Selected Objects"; + ot->idname = "NLA_OT_selected_objects_add"; + ot->description = "Make selected objects in NLA Editor by adding Animation Data"; + + /* api callbacks */ + ot->exec = nlaedit_objects_add_exec; + ot->poll = nlaop_poll_tweakmode_off; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + +/* *********************************************** */ diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h index 398d2d5f1f4..450b85738ad 100644 --- a/source/blender/editors/space_nla/nla_intern.h +++ b/source/blender/editors/space_nla/nla_intern.h @@ -125,7 +125,9 @@ void NLA_OT_fmodifier_paste(wmOperatorType *ot); void NLA_OT_channels_click(wmOperatorType *ot); void NLA_OT_tracks_add(wmOperatorType *ot); -void NLA_OT_delete_tracks(wmOperatorType *ot); +void NLA_OT_tracks_delete(wmOperatorType *ot); + +void NLA_OT_selected_objects_add(wmOperatorType *ot); /* **************************************** */ /* nla_ops.c */ diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c index 54ade829c0d..fb0f11ffd87 100644 --- a/source/blender/editors/space_nla/nla_ops.c +++ b/source/blender/editors/space_nla/nla_ops.c @@ -120,7 +120,9 @@ void nla_operatortypes(void) WM_operatortype_append(NLA_OT_channels_click); WM_operatortype_append(NLA_OT_tracks_add); - WM_operatortype_append(NLA_OT_delete_tracks); + WM_operatortype_append(NLA_OT_tracks_delete); + + WM_operatortype_append(NLA_OT_selected_objects_add); /* select */ WM_operatortype_append(NLA_OT_click_select); @@ -188,8 +190,8 @@ static void nla_keymap_channels(wmKeyMap *keymap) RNA_boolean_set(kmi->ptr, "above_selected", TRUE); /* delete tracks */ - WM_keymap_add_item(keymap, "NLA_OT_delete_tracks", XKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "NLA_OT_delete_tracks", DELKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "NLA_OT_tracks_delete", XKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "NLA_OT_tracks_delete", DELKEY, KM_PRESS, 0, 0); } static void nla_keymap_main(wmKeyConfig *keyconf, wmKeyMap *keymap) |