diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-11-12 19:41:53 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-12-14 22:19:18 +0300 |
commit | de662e7cd3b3ca45c4220e3830c32e2b3496c9fe (patch) | |
tree | 79b78cc746c5121ac4c964dffef94d961fd14975 /source/blender/editors/space_action/action_edit.c | |
parent | fc74903f272a01784e0376c9ee12c2673017285d (diff) |
NLA: insert keyframes correctly for strips with non-Replace mode.
NLA strips support using the keyframe values in a variety of ways:
adding, subtracting, multiplying, linearly mixing with the result
of strips located below in the stack. This is intended for layering
tweaks on top of a base animation.
However, when inserting keyframes into such strips, it simply inserts
the final value of the property, irrespective of these settings. This
in fact makes the feature nearly useless.
To fix this it is necessary to evaluate the NLA stack below the
edited strip and correctly compute the raw key that would produce
the intended final value, according to the mode and influence.
Differential Revision: https://developer.blender.org/D3927
Diffstat (limited to 'source/blender/editors/space_action/action_edit.c')
-rw-r--r-- | source/blender/editors/space_action/action_edit.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index c2376b506d4..e960c32cf0c 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -54,6 +54,7 @@ #include "RNA_enum_types.h" #include "BKE_action.h" +#include "BKE_animsys.h" #include "BKE_context.h" #include "BKE_fcurve.h" #include "BKE_gpencil.h" @@ -679,6 +680,7 @@ static const EnumPropertyItem prop_actkeys_insertkey_types[] = { static void insert_action_keys(bAnimContext *ac, short mode) { ListBase anim_data = {NULL, NULL}; + ListBase nla_cache = {NULL, NULL}; bAnimListElem *ale; int filter; @@ -711,7 +713,7 @@ static void insert_action_keys(bAnimContext *ac, short mode) */ if (ale->id && !ale->owner) { insert_keyframe(ac->bmain, depsgraph, reports, ale->id, NULL, ((fcu->grp) ? (fcu->grp->name) : (NULL)), - fcu->rna_path, fcu->array_index, cfra, ts->keyframe_type, flag); + fcu->rna_path, fcu->array_index, cfra, ts->keyframe_type, &nla_cache, flag); } else { AnimData *adt = ANIM_nla_mapping_get(ac, ale); @@ -727,6 +729,8 @@ static void insert_action_keys(bAnimContext *ac, short mode) ale->update |= ANIM_UPDATE_DEFAULT; } + BKE_animsys_free_nla_keyframing_context_cache(&nla_cache); + ANIM_animdata_update(ac, &anim_data); ANIM_animdata_freelist(&anim_data); } |