Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-12-14 18:14:16 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-14 18:14:16 +0300
commit78e7c6b329585a0dd6b4d07112d66e54c2a9d5f4 (patch)
tree845c67e5a03a7da21f11bcfcd66d874d52b97fed /source/blender/editors/space_graph/graph_edit.c
parent93cbc840e088ca0ecb62f96596d2f7c46e5635ee (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_graph/graph_edit.c')
-rw-r--r--source/blender/editors/space_graph/graph_edit.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 798e1b12242..1e6443bba32 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -618,7 +618,8 @@ static short copy_graph_keys (bAnimContext *ac)
return ok;
}
-static short paste_graph_keys (bAnimContext *ac)
+static short paste_graph_keys (bAnimContext *ac,
+ const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode)
{
ListBase anim_data = {NULL, NULL};
int filter, ok=0;
@@ -628,7 +629,7 @@ static short paste_graph_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);
@@ -676,6 +677,9 @@ void GRAPH_OT_copy (wmOperatorType *ot)
static int graphkeys_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)
@@ -686,7 +690,7 @@ static int graphkeys_paste_exec(bContext *C, wmOperator *op)
}
/* paste keyframes */
- if (paste_graph_keys(&ac)) {
+ if (paste_graph_keys(&ac, offset_mode, merge_mode)) {
return OPERATOR_CANCELLED;
}
@@ -707,11 +711,15 @@ void GRAPH_OT_paste (wmOperatorType *ot)
ot->description= "Paste keyframes from copy/paste buffer for the selected channels, starting on the current frame";
/* api callbacks */
+// ot->invoke= WM_operator_props_popup; // better wait for graph redo panel
ot->exec= graphkeys_paste_exec;
ot->poll= graphop_editable_keyframes_poll;
/* 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");
}
/* ******************** Duplicate Keyframes Operator ************************* */