diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-01-08 00:25:33 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-01-09 14:16:58 +0300 |
commit | 2f16098d208058dce7701d6e49ed9052445553f5 (patch) | |
tree | 781ff394a933cd75dd65cba5505eff466c798b4b /source/blender/editors/space_action/action_edit.c | |
parent | 95847f6ac7ce074501d0f7f2b874ef4036601dc4 (diff) |
Gooseberry animation request: Paste flipped pose in action
and graph editor.
This was a tricky commit that was not so straightforward to make work.
The information for bones is not easy to come by in the animation curves,
however we do have some string manipulation tricks to make it happen.
Testing in gooseberry worked for the rigs there, commiting to master now
Diffstat (limited to 'source/blender/editors/space_action/action_edit.c')
-rw-r--r-- | source/blender/editors/space_action/action_edit.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 47a29426192..bc9c578b558 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -545,7 +545,7 @@ static short copy_action_keys(bAnimContext *ac) static short paste_action_keys(bAnimContext *ac, - const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode) + const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode, bool flip) { ListBase anim_data = {NULL, NULL}; int filter, ok = 0; @@ -562,7 +562,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, offset_mode, merge_mode); + ok = paste_animedit_keys(ac, &anim_data, offset_mode, merge_mode, flip); /* clean up */ ANIM_animdata_freelist(&anim_data); @@ -622,6 +622,7 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op) const eKeyPasteOffset offset_mode = RNA_enum_get(op->ptr, "offset"); const eKeyMergeMode merge_mode = RNA_enum_get(op->ptr, "merge"); + const bool flipped = RNA_boolean_get(op->ptr, "flipped"); /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -638,7 +639,7 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op) } else { /* non-zero return means an error occurred while trying to paste */ - if (paste_action_keys(&ac, offset_mode, merge_mode)) { + if (paste_action_keys(&ac, offset_mode, merge_mode, flipped)) { return OPERATOR_CANCELLED; } } @@ -651,6 +652,7 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op) void ACTION_OT_paste(wmOperatorType *ot) { + PropertyRNA *prop; /* identifiers */ ot->name = "Paste Keyframes"; ot->idname = "ACTION_OT_paste"; @@ -667,6 +669,8 @@ void ACTION_OT_paste(wmOperatorType *ot) /* props */ 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 merging pasted keys and existing"); + prop = RNA_def_boolean(ot->srna, "flipped", false, "Flipped", "Paste keyframes from mirrored bones if they exist"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); } /* ******************** Insert Keyframes Operator ************************* */ |