Fix sampling Multi Blend 1D animation at out of bounds to the right point

This commit is contained in:
Wojtek Figat
2025-03-31 20:52:08 +02:00
parent 5202d11af4
commit a8eca76cd1

View File

@@ -1470,7 +1470,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
AnimSampleData a(node->Assets[aIndex].As<Animation>(), aData.W, aIndex);
// Check single A case or the last valid animation
if (x <= aData.X + ANIM_GRAPH_BLEND_THRESHOLD || bIndex == ANIM_GRAPH_MULTI_BLEND_INVALID)
if (x <= aData.X + ANIM_GRAPH_BLEND_THRESHOLD || i + 2 == data.Count)
{
MultiBlendAnimData::BeforeSample(context, bucket, prevList, a, speed);
value = SampleAnimation(node, loop, startTimePos, a);
@@ -1776,6 +1776,12 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
const float blendDuration = (float)tryGetValue(node->GetBox(2), node->Values[1]);
const int32 poseCount = Math::Clamp(node->Values[2].AsInt, 0, MaxBlendPoses);
const AlphaBlendMode mode = (AlphaBlendMode)node->Values[3].AsInt;
if (bucket.PreviousBlendPoseIndex >= poseCount || bucket.PreviousBlendPoseIndex < -1)
{
// TODO: find out why BlendPoseBucketInit is not called in some state machines?
bucket.TransitionPosition = 0.0f;
bucket.PreviousBlendPoseIndex = -1;
}
// Skip if nothing to blend
if (poseCount == 0 || poseIndex < 0 || poseIndex >= poseCount)