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
This commit is contained in:
Sybren A. Stüvel 2022-04-29 16:17:58 +02:00
parent baae87ce86
commit 2f49908a5e
1 changed files with 15 additions and 20 deletions

View File

@ -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;
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);
}
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... */