diff --git a/Source/Engine/Animations/Graph/AnimGraph.cpp b/Source/Engine/Animations/Graph/AnimGraph.cpp index 93bfc2609..2fc9332ba 100644 --- a/Source/Engine/Animations/Graph/AnimGraph.cpp +++ b/Source/Engine/Animations/Graph/AnimGraph.cpp @@ -221,6 +221,7 @@ void AnimGraphExecutor::Update(AnimGraphInstanceData& data, float dt) context.NodePath.Clear(); context.Data = &data; context.DeltaTime = dt; + context.StackOverFlow = false; context.CurrentFrameIndex = ++data.CurrentFrame; context.CallStack.Clear(); context.Functions.Clear(); @@ -411,9 +412,12 @@ VisjectExecutor::Value AnimGraphExecutor::eatBox(Node* caller, Box* box) auto& context = *Context.Get(); // Check if graph is looped or is too deep + if (context.StackOverFlow) + return Value::Zero; if (context.CallStack.Count() >= ANIM_GRAPH_MAX_CALL_STACK) { OnError(caller, box, TEXT("Graph is looped or too deep!")); + context.StackOverFlow = true; return Value::Zero; } #if !BUILD_RELEASE diff --git a/Source/Engine/Animations/Graph/AnimGraph.h b/Source/Engine/Animations/Graph/AnimGraph.h index b570cf9fe..c069ddb06 100644 --- a/Source/Engine/Animations/Graph/AnimGraph.h +++ b/Source/Engine/Animations/Graph/AnimGraph.h @@ -796,6 +796,7 @@ struct AnimGraphContext AnimGraphInstanceData* Data; AnimGraphImpulse EmptyNodes; AnimGraphTransitionData TransitionData; + bool StackOverFlow; Array> CallStack; Array> GraphStack; Array > NodePath;