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/transform/transform_conversions.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/transform/transform_conversions.c')
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 83a336f6a7c..1702fd8fcd3 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -62,6 +62,7 @@ #include "BLI_rect.h" #include "BKE_action.h" +#include "BKE_animsys.h" #include "BKE_armature.h" #include "BKE_constraint.h" #include "BKE_context.h" @@ -6019,13 +6020,17 @@ void autokeyframe_object(bContext *C, Scene *scene, ViewLayer *view_layer, Objec /* only key on available channels */ if (adt && adt->action) { + ListBase nla_cache = {NULL, NULL}; + for (fcu = adt->action->curves.first; fcu; fcu = fcu->next) { fcu->flag &= ~FCURVE_SELECTED; insert_keyframe(bmain, depsgraph, reports, id, adt->action, (fcu->grp ? fcu->grp->name : NULL), fcu->rna_path, fcu->array_index, cfra, - ts->keyframe_type, flag); + ts->keyframe_type, &nla_cache, flag); } + + BKE_animsys_free_nla_keyframing_context_cache(&nla_cache); } } else if (IS_AUTOKEY_FLAG(scene, INSERTNEEDED)) { @@ -6124,6 +6129,7 @@ void autokeyframe_pose(bContext *C, Scene *scene, Object *ob, int tmode, short t ReportList *reports = CTX_wm_reports(C); ToolSettings *ts = scene->toolsettings; KeyingSet *active_ks = ANIM_scene_get_active_keyingset(scene); + ListBase nla_cache = {NULL, NULL}; float cfra = (float)CFRA; short flag = 0; @@ -6167,7 +6173,7 @@ void autokeyframe_pose(bContext *C, Scene *scene, Object *ob, int tmode, short t insert_keyframe(bmain, depsgraph, reports, id, act, ((fcu->grp) ? (fcu->grp->name) : (NULL)), fcu->rna_path, fcu->array_index, cfra, - ts->keyframe_type, flag); + ts->keyframe_type, &nla_cache, flag); } if (pchanName) MEM_freeN(pchanName); @@ -6228,6 +6234,8 @@ void autokeyframe_pose(bContext *C, Scene *scene, Object *ob, int tmode, short t BLI_freelistN(&dsources); } } + + BKE_animsys_free_nla_keyframing_context_cache(&nla_cache); } else { /* tag channels that should have unkeyed data */ |