From 311a7b8c029431bf9635155665a489699f14566b Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 1 Apr 2025 23:32:12 +0200 Subject: [PATCH] Improve a8eca76cd144830215dcb5fcda5a8e46bffda694 --- .../Animations/Graph/AnimGroup.Animation.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp b/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp index ed7430bcf..91ef4457b 100644 --- a/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp +++ b/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp @@ -1447,8 +1447,8 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu const auto aData = node->Values[4 + aIndex * 2].AsFloat4(); AnimSampleData a(node->Assets[aIndex].As(), aData.W, aIndex); - // Check single A case or the last valid animation - if (x <= aData.X + ANIM_GRAPH_BLEND_THRESHOLD || i + 2 == data.Count) + // Check single A case + if (x <= aData.X + ANIM_GRAPH_BLEND_THRESHOLD) { MultiBlendAnimData::BeforeSample(context, bucket, prevList, a, speed); value = SampleAnimation(node, loop, startTimePos, a); @@ -1480,6 +1480,16 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu MultiBlendAnimData::AfterSample(newList, b); break; } + if (newList.IsEmpty()) + { + // Sample the last animation if had no result + const auto aIndex = data.IndicesSorted[data.Count - 1]; + const auto aData = node->Values[4 + aIndex * 2].AsFloat4(); + AnimSampleData a(node->Assets[aIndex].As(), aData.W, aIndex); + MultiBlendAnimData::BeforeSample(context, bucket, prevList, a, speed); + value = SampleAnimation(node, loop, startTimePos, a); + MultiBlendAnimData::AfterSample(newList, a); + } MultiBlendAnimData::SetList(bucket, newList); bucket.LastUpdateFrame = context.CurrentFrameIndex; @@ -1734,7 +1744,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu break; } - // Blend Pose + // Blend Poses case 14: { ASSERT(box->ID == 0);