BUG: FAnimNode_PoseBlendNode holds old curve values

In our project we noticed that character faces were getting stuck when we transitioned them from one animation to another. We looked into it and found the culprit was in FAnimNode_PoseBlendNode::Evaluate_AnyThread. It appears when doing the BulkGet to set the new curve values, it never resets the old curve values. So if animation A uses one set of curves and B uses another, when you move to animation B all of A’s curve values will still be present. We fixed this by doing the following:

if (CachedPoseAsset && PoseExtractContext.PoseCurves.Num() > 0 && CachedPoseAsset->GetSkeleton() != nullptr)
{
	FPoseContext CurrentPose(Output);

	// ENGINE_MOD - Reset all curve values so no leftover data from a different source anim is carried forward
	for (FPoseCurve& curve : PoseExtractContext.PoseCurves)
	{
		curve.Value = 0.0f;
	}
	// ENGINE_MOD

	// Remap incoming curve
	UE::Anim::FCurveUtils::BulkGet(SourceData.Curve, BulkCurves, [this](const UE::Anim::FNamedIndexElement& InBulkElement, float InValue)
	{
		// Remap using chosen BlendOption
		const float RemappedValue = FAlphaBlend::AlphaToBlendOption(InValue, BlendOption, CustomCurve);
		PoseExtractContext.PoseCurves[InBulkElement.Index].Value = RemappedValue;
        });

This fixed our issue and cleared out the old values. Is this a known issue on your end?

Thanks!

Hey there,

This is a known issue and by design. If the code above works for you, that is fine. We also added another node, FAnimNode_RemoveCurve, that you can run before this one if you want to perform a similar operation.

Dustin

Ah ok. We are not on 5.7 yet so we do not have access to that anim node. Once we upgrade we may revisit.

Thanks!