From 64cd898a659c103c76e964b0f596eeb6cdc1ff3a Mon Sep 17 00:00:00 2001 From: Alex Ray Date: Thu, 27 Nov 2025 18:09:11 +0100 Subject: [PATCH 1/2] Bypassing Call Logic in Editor Preview --- .../MaterialGenerator.Material.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Material.cpp b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Material.cpp index c778c03ee..bdade721e 100644 --- a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Material.cpp +++ b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Material.cpp @@ -790,9 +790,21 @@ void MaterialGenerator::ProcessGroupFunction(Box* box, Node* node, Value& value) // Function Input case 1: { + // Check the stack count.If only 1 graph is present, + // we are processing the graph in isolation (e.g., in the Editor Preview). + // In this case, we skip the caller-finding logic and use the node's default value. + if (_graphStack.Count() < 2) + { + // Use the default value from the function input node's box (usually box 1) + value = tryGetValue(node->TryGetBox(1), Value::Zero); + break; + } + // Find the function call Node* functionCallNode = nullptr; - ASSERT(_graphStack.Count() >= 2); + + // The original ASSERT has been effectively replaced by the 'if' above. + //ASSERT(_graphStack.Count() >= 2); Graph* graph; for (int32 i = _callStack.Count() - 1; i >= 0; i--) { From 0c887cd29eaa3a886ca6bf3e72e967b4111d960d Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 13 Dec 2025 23:11:01 +0100 Subject: [PATCH 2/2] Use fix from #3830 in particle and anim graphs too --- Source/Engine/Animations/Graph/AnimGroup.Animation.cpp | 8 +++++++- .../Graph/CPU/ParticleEmitterGraph.CPU.Particles.cpp | 8 +++++++- .../MaterialGenerator/MaterialGenerator.Material.cpp | 5 +---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp b/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp index fd62ec537..a1f2a4565 100644 --- a/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp +++ b/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp @@ -2553,9 +2553,15 @@ void AnimGraphExecutor::ProcessGroupFunction(Box* boxBase, Node* node, Value& va // Function Input case 1: { + // Skip when graph is too small (eg. preview) and fallback with default value from the function graph + if (context.GraphStack.Count() < 2) + { + value = tryGetValue(node->TryGetBox(1), Value::Zero); + break; + } + // Find the function call AnimGraphNode* functionCallNode = nullptr; - ASSERT(context.GraphStack.Count() >= 2); Graph* graph; for (int32 i = context.CallStack.Count() - 1; i >= 0; i--) { diff --git a/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.Particles.cpp b/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.Particles.cpp index a47e15275..1a7ba37d1 100644 --- a/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.Particles.cpp +++ b/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.Particles.cpp @@ -482,9 +482,15 @@ void ParticleEmitterGraphCPUExecutor::ProcessGroupFunction(Box* box, Node* node, // Function Input case 1: { + // Skip when graph is too small (eg. preview) and fallback with default value from the function graph + if (context.GraphStack.Count() < 2) + { + value = tryGetValue(node->TryGetBox(1), Value::Zero); + break; + } + // Find the function call Node* functionCallNode = nullptr; - ASSERT(context.GraphStack.Count() >= 2); ParticleEmitterGraphCPU* graph; for (int32 i = context.CallStackSize - 1; i >= 0; i--) { diff --git a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Material.cpp b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Material.cpp index bdade721e..09ac78e6b 100644 --- a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Material.cpp +++ b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Material.cpp @@ -790,7 +790,7 @@ void MaterialGenerator::ProcessGroupFunction(Box* box, Node* node, Value& value) // Function Input case 1: { - // Check the stack count.If only 1 graph is present, + // Check the stack count. If only 1 graph is present, // we are processing the graph in isolation (e.g., in the Editor Preview). // In this case, we skip the caller-finding logic and use the node's default value. if (_graphStack.Count() < 2) @@ -802,9 +802,6 @@ void MaterialGenerator::ProcessGroupFunction(Box* box, Node* node, Value& value) // Find the function call Node* functionCallNode = nullptr; - - // The original ASSERT has been effectively replaced by the 'if' above. - //ASSERT(_graphStack.Count() >= 2); Graph* graph; for (int32 i = _callStack.Count() - 1; i >= 0; i--) {