From d00a2ea63f8676da50f085d00bff9c6033545e64 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 2 Apr 2025 09:22:23 +0200 Subject: [PATCH] Fix crash when using anim graph asset after it's reloaded (after editing) --- Source/Engine/Animations/Graph/AnimGraph.cpp | 1 + Source/Engine/Animations/Graph/AnimGraph.h | 1 - Source/Engine/Animations/Graph/AnimGroup.Animation.cpp | 6 ------ 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Source/Engine/Animations/Graph/AnimGraph.cpp b/Source/Engine/Animations/Graph/AnimGraph.cpp index eda4dfca6..af14f5f56 100644 --- a/Source/Engine/Animations/Graph/AnimGraph.cpp +++ b/Source/Engine/Animations/Graph/AnimGraph.cpp @@ -145,6 +145,7 @@ bool AnimGraph::Load(ReadStream* stream, bool loadMeta) { Version++; _bucketsCounter = 0; + _bucketInitializerList.Clear(); _customNodes.Clear(); // Base diff --git a/Source/Engine/Animations/Graph/AnimGraph.h b/Source/Engine/Animations/Graph/AnimGraph.h index 398471ea1..aa361edbe 100644 --- a/Source/Engine/Animations/Graph/AnimGraph.h +++ b/Source/Engine/Animations/Graph/AnimGraph.h @@ -698,7 +698,6 @@ public: : AnimGraphBase(this) , _isFunction(isFunction) , _isRegisteredForScriptingEvents(false) - , _bucketInitializerList(64) , _owner(owner) { } diff --git a/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp b/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp index 91ef4457b..ff8c32c20 100644 --- a/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp +++ b/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp @@ -1764,12 +1764,6 @@ 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)