From 2f49908a5e57a3476e5abf19267988775072c76d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 29 Apr 2022 16:17:58 +0200 Subject: NLA: Key influence when pushing down to NLA When pushing down an Action onto an NLA track, set the new Strip's influence to the Action's influence. This is done by setting a key due to the way the NLA Strip influence works (it's either animated, or ignored). Reviewed By: sybren, RiggingDojo Differential Revision: https://developer.blender.org/D14719 --- source/blender/blenkernel/intern/nla.c | 37 +++++++++++++++------------------- 1 file changed, 16 insertions(+), 21 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 9b6d768b2d3..5d804f53779 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1818,7 +1818,6 @@ bool BKE_nla_action_stash(AnimData *adt, const bool is_liboverride) void BKE_nla_action_pushdown(AnimData *adt, const bool is_liboverride) { NlaStrip *strip; - const bool is_first = (adt) && (adt->nla_tracks.first == NULL); /* sanity checks */ /* TODO: need to report the error for this */ @@ -1848,27 +1847,23 @@ void BKE_nla_action_pushdown(AnimData *adt, const bool is_liboverride) /* copy current "action blending" settings from adt to the strip, * as it was keyframed with these settings, so omitting them will * change the effect [T54233] - * - * NOTE: We only do this when there are no tracks */ - if (is_first == false) { - strip->blendmode = adt->act_blendmode; - strip->influence = adt->act_influence; - strip->extendmode = adt->act_extendmode; - - if (adt->act_influence < 1.0f) { - /* enable "user-controlled" influence (which will insert a default keyframe) - * so that the influence doesn't get lost on the new update - * - * NOTE: An alternative way would have been to instead hack the influence - * to not get always get reset to full strength if NLASTRIP_FLAG_USR_INFLUENCE - * is disabled but auto-blending isn't being used. However, that approach - * is a bit hacky/hard to discover, and may cause backwards compatibility issues, - * so it's better to just do it this way. - */ - strip->flag |= NLASTRIP_FLAG_USR_INFLUENCE; - BKE_nlastrip_validate_fcurves(strip); - } + strip->blendmode = adt->act_blendmode; + strip->influence = adt->act_influence; + strip->extendmode = adt->act_extendmode; + + if (adt->act_influence < 1.0f) { + /* enable "user-controlled" influence (which will insert a default keyframe) + * so that the influence doesn't get lost on the new update + * + * NOTE: An alternative way would have been to instead hack the influence + * to not get always get reset to full strength if NLASTRIP_FLAG_USR_INFLUENCE + * is disabled but auto-blending isn't being used. However, that approach + * is a bit hacky/hard to discover, and may cause backwards compatibility issues, + * so it's better to just do it this way. + */ + strip->flag |= NLASTRIP_FLAG_USR_INFLUENCE; + BKE_nlastrip_validate_fcurves(strip); } /* make strip the active one... */ -- cgit v1.2.3