diff options
author | Joshua Leung <aligorith@gmail.com> | 2015-08-06 17:23:55 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2015-08-06 17:46:37 +0300 |
commit | 579329388af58b44f545c2e4411bbd987256b923 (patch) | |
tree | e886f57b455c5a3f90926ca5ac4e63ad773fb225 /source/blender/editors/animation/keyframes_general.c | |
parent | 0e80e3d20c70066cea1f3aa900350c75aa868ffc (diff) |
Fix T45166: Keyframes pasted at wrong position when NLA strip has offset
Paste keyframes code seemed to have overlooked the NLA mapping issue, causing
keyframes to get pasted in the wrong places.
Diffstat (limited to 'source/blender/editors/animation/keyframes_general.c')
-rw-r--r-- | source/blender/editors/animation/keyframes_general.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index cb49c2fc861..3642c07b758 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -869,7 +869,7 @@ static void paste_animedit_keys_fcurve(FCurve *fcu, tAnimCopybufItem *aci, float */ insert_bezt_fcurve(fcu, bezt, INSERTKEY_OVERWRITE_FULL); - + /* un-apply offset from src beztriple after copying */ bezt->vec[0][0] -= offset; bezt->vec[1][0] -= offset; @@ -971,6 +971,7 @@ short paste_animedit_keys(bAnimContext *ac, ListBase *anim_data, * - if names do matter, only check if id-type is ok for now (group check is not that important) * - most importantly, rna-paths should match (array indices are unimportant for now) */ + AnimData *adt = ANIM_nla_mapping_get(ac, ale); FCurve *fcu = (FCurve *)ale->data; /* destination F-Curve */ tAnimCopybufItem *aci = NULL; @@ -994,9 +995,17 @@ short paste_animedit_keys(bAnimContext *ac, ListBase *anim_data, /* copy the relevant data from the matching buffer curve */ if (aci) { totmatch++; - paste_animedit_keys_fcurve(fcu, aci, offset, merge_mode, flip); + + if (adt) { + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); + paste_animedit_keys_fcurve(fcu, aci, offset, merge_mode, flip); + ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); + } + else { + paste_animedit_keys_fcurve(fcu, aci, offset, merge_mode, flip); + } } - + ale->update |= ANIM_UPDATE_DEFAULT; } |