diff options
author | Joshua Leung <aligorith@gmail.com> | 2014-04-28 16:07:15 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2014-04-28 17:59:41 +0400 |
commit | 68c3b6350ad702195a86adfcde65687269820afd (patch) | |
tree | 468a0b3537cde7a18f7526b0ceed7ff0ae99d36e /source/blender/editors/space_nla | |
parent | 27db75363e67f1da272fc9e4ca340e4eb8bf77d1 (diff) |
NLA Editor: Duplicate/Duplicate Linked
This commit changes the default strip duplication behaviour (Shift-D) so that it will
create a copy of whatever action it uses. Previously, it was very hard, if not impossible
in some cases to create a new copy of an action to start working on in the NLA.
If you want the old behaviour, you'll need to use ALt-D (Linked Duplicates).
(Note: Although the new Shift-D may not be so optimal in all cases, I've decided to go
with this version since it aligns better with the way this works for objects. Doing the
opposite for NLA would just have added to the confusion)
Diffstat (limited to 'source/blender/editors/space_nla')
-rw-r--r-- | source/blender/editors/space_nla/nla_edit.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_ops.c | 6 |
2 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 8221fb0199b..bb1e0e4245f 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -887,7 +887,7 @@ void NLA_OT_meta_remove(wmOperatorType *ot) * the originals were housed in. */ -static int nlaedit_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) +static int nlaedit_duplicate_exec(bContext *C, wmOperator *op) { bAnimContext ac; @@ -895,6 +895,7 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) bAnimListElem *ale; int filter; + bool linked = RNA_boolean_get(op->ptr, "linked"); bool done = false; /* get editor data */ @@ -920,7 +921,7 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) /* if selected, split the strip at its midpoint */ if (strip->flag & NLASTRIP_FLAG_SELECT) { /* make a copy (assume that this is possible) */ - nstrip = copy_nlastrip(strip); + nstrip = copy_nlastrip(strip, linked); /* in case there's no space in the track above, or we haven't got a reference to it yet, try adding */ if (BKE_nlatrack_add_strip(nlt->next, nstrip) == 0) { @@ -985,6 +986,9 @@ void NLA_OT_duplicate(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + /* own properties */ + ot->prop = RNA_def_boolean(ot->srna, "linked", false, "Linked", "When duplicating strips, assign new copies of the actions they use"); + /* to give to transform */ RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", ""); } @@ -1102,7 +1106,7 @@ static void nlaedit_split_strip_actclip(AnimData *adt, NlaTrack *nlt, NlaStrip * /* make a copy (assume that this is possible) and append * it immediately after the current strip */ - nstrip = copy_nlastrip(strip); + nstrip = copy_nlastrip(strip, true); BLI_insertlinkafter(&nlt->strips, strip, nstrip); /* set the endpoint of the first strip and the start of the new strip diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c index 373879a278b..9dc598bc382 100644 --- a/source/blender/editors/space_nla/nla_ops.c +++ b/source/blender/editors/space_nla/nla_ops.c @@ -256,7 +256,11 @@ static void nla_keymap_main(wmKeyConfig *keyconf, wmKeyMap *keymap) WM_keymap_add_item(keymap, "NLA_OT_meta_remove", GKEY, KM_PRESS, KM_ALT, 0); /* duplicate */ - WM_keymap_add_item(keymap, "NLA_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0); + kmi = WM_keymap_add_item(keymap, "NLA_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "linked", false); + + kmi = WM_keymap_add_item(keymap, "NLA_OT_duplicate", DKEY, KM_PRESS, KM_ALT, 0); + RNA_boolean_set(kmi->ptr, "linked", true); /* delete */ WM_keymap_add_item(keymap, "NLA_OT_delete", XKEY, KM_PRESS, 0, 0); |