diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-12-14 18:14:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-12-14 18:14:16 +0300 |
commit | 78e7c6b329585a0dd6b4d07112d66e54c2a9d5f4 (patch) | |
tree | 845c67e5a03a7da21f11bcfcd66d874d52b97fed /source/blender/editors/space_action/action_edit.c | |
parent | 93cbc840e088ca0ecb62f96596d2f7c46e5635ee (diff) |
graph editor & action keyframe paste options.
- Offset, so you can paste at the same time of the original frames, at the current frame or relative to the current frame at time of copying.
- Merge method, so the pasted keys can overwrite keys in their range or the entire curve.
Currently there is no redo panel for these space types so the only way to access these options is with F6 redo popup.
Diffstat (limited to 'source/blender/editors/space_action/action_edit.c')
-rw-r--r-- | source/blender/editors/space_action/action_edit.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 59e4cfcf68f..afda04d1c45 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -291,7 +291,8 @@ static short copy_action_keys (bAnimContext *ac) } -static short paste_action_keys (bAnimContext *ac) +static short paste_action_keys (bAnimContext *ac, + const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode) { ListBase anim_data = {NULL, NULL}; int filter, ok=0; @@ -301,7 +302,7 @@ static short paste_action_keys (bAnimContext *ac) ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* paste keyframes */ - ok= paste_animedit_keys(ac, &anim_data); + ok= paste_animedit_keys(ac, &anim_data, offset_mode, merge_mode); /* clean up */ BLI_freelistN(&anim_data); @@ -341,11 +342,15 @@ void ACTION_OT_copy (wmOperatorType *ot) ot->description= "Copy selected keyframes to the copy/paste buffer"; /* api callbacks */ +// ot->invoke= WM_operator_props_popup; // better wait for graph redo panel ot->exec= actkeys_copy_exec; ot->poll= ED_operator_action_active; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + RNA_def_enum(ot->srna, "offset", keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys"); + RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merking pasted keys and existing"); } @@ -353,6 +358,9 @@ void ACTION_OT_copy (wmOperatorType *ot) static int actkeys_paste_exec(bContext *C, wmOperator *op) { bAnimContext ac; + + const eKeyPasteOffset offset_mode= RNA_enum_get(op->ptr, "offset"); + const eKeyMergeMode merge_mode= RNA_enum_get(op->ptr, "merge"); /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -367,7 +375,7 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op) // FIXME... } else { - if (paste_action_keys(&ac)) { + if (paste_action_keys(&ac, offset_mode, merge_mode)) { BKE_report(op->reports, RPT_ERROR, "No keyframes to paste"); return OPERATOR_CANCELLED; } |