From afd757773e4574c658947c83a370e2e240b79d13 Mon Sep 17 00:00:00 2001 From: dyanikoglu Date: Sun, 12 Jul 2026 00:25:01 +0300 Subject: [PATCH] Correctly supply data pins on packaged builds for subgraph node --- .../Private/Nodes/Graph/FlowNode_SubGraph.cpp | 78 +++++++++---------- .../Public/Nodes/Graph/FlowNode_SubGraph.h | 8 +- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Source/Flow/Private/Nodes/Graph/FlowNode_SubGraph.cpp b/Source/Flow/Private/Nodes/Graph/FlowNode_SubGraph.cpp index 3c07698f..f2b446ec 100644 --- a/Source/Flow/Private/Nodes/Graph/FlowNode_SubGraph.cpp +++ b/Source/Flow/Private/Nodes/Graph/FlowNode_SubGraph.cpp @@ -58,6 +58,45 @@ void UFlowNode_SubGraph::FlushContent() } } +FFlowDataPinResult UFlowNode_SubGraph::TrySupplyDataPin(FName PinName) const +{ + if (PinName == AssetParams_MemberName) + { + // Prevent infinite recursion by sourcing the AssetParams pin directly + // (otherwise, it would attempt to resolve it below and infinitely crash our stack. + // don't ask me how I know). + return Super::TrySupplyDataPin(PinName); + } + + if (!IsInputConnected(PinName)) + { + const bool bHasAssetParams = IsInputConnected(AssetParams_MemberName) || !AssetParams.IsNull(); + if (bHasAssetParams) + { + // If not connected, we can source the value from the asset data params (if available) + TObjectPtr Value = nullptr; + const EFlowDataPinResolveResult ResultEnum = Super::TryResolveDataPinValue(AssetParams_MemberName, Value); + if (FlowPinType::IsSuccess(ResultEnum) && IsValid(Value)) + { + if (const IFlowDataPinValueSupplierInterface* SupplierInterface = Cast(Value)) + { + return SupplierInterface->TrySupplyDataPin(PinName); + } + else + { + LogError(FString::Printf(TEXT("Could not cast object %s to IFlowDataPinValueSupplierInterface! This is unexpected."), *Value->GetName())); + + return FFlowDataPinResult(EFlowDataPinResolveResult::FailedWithError); + } + } + } + } + + // Prefer the standard lookup if the pin is connected + // (or if there is no FlowAssetParams to ask) + return Super::TrySupplyDataPin(PinName); +} + void UFlowNode_SubGraph::ExecuteInput(const FName& PinName) { // Since this node implements IFlowPreloadableInterface, @@ -238,45 +277,6 @@ void UFlowNode_SubGraph::AutoGenerateDataPins(FFlowDataPinValueOwner& ValueOwner } } -FFlowDataPinResult UFlowNode_SubGraph::TrySupplyDataPin(FName PinName) const -{ - if (PinName == AssetParams_MemberName) - { - // Prevent infinite recursion by sourcing the AssetParams pin directly - // (otherwise, it would attempt to resolve it below and infinitely crash our stack. - // don't ask me how I know). - return Super::TrySupplyDataPin(PinName); - } - - if (!IsInputConnected(PinName)) - { - const bool bHasAssetParams = IsInputConnected(AssetParams_MemberName) || !AssetParams.IsNull(); - if (bHasAssetParams) - { - // If not connected, we can source the value from the asset data params (if available) - TObjectPtr Value = nullptr; - const EFlowDataPinResolveResult ResultEnum = Super::TryResolveDataPinValue(AssetParams_MemberName, Value); - if (FlowPinType::IsSuccess(ResultEnum) && IsValid(Value)) - { - if (const IFlowDataPinValueSupplierInterface* SupplierInterface = Cast(Value)) - { - return SupplierInterface->TrySupplyDataPin(PinName); - } - else - { - LogError(FString::Printf(TEXT("Could not cast object %s to IFlowDataPinValueSupplierInterface! This is unexpected."), *Value->GetName())); - - return FFlowDataPinResult(EFlowDataPinResolveResult::FailedWithError); - } - } - } - } - - // Prefer the standard lookup if the pin is connected - // (or if there is no FlowAssetParams to ask) - return Super::TrySupplyDataPin(PinName); -} - void UFlowNode_SubGraph::PostLoad() { Super::PostLoad(); diff --git a/Source/Flow/Public/Nodes/Graph/FlowNode_SubGraph.h b/Source/Flow/Public/Nodes/Graph/FlowNode_SubGraph.h index 5d7dfaf6..c8d9ff28 100644 --- a/Source/Flow/Public/Nodes/Graph/FlowNode_SubGraph.h +++ b/Source/Flow/Public/Nodes/Graph/FlowNode_SubGraph.h @@ -51,6 +51,10 @@ class FLOW_API UFlowNode_SubGraph virtual void FlushContent() override; // -- + // IFlowDataPinValueSupplierInterface + virtual FFlowDataPinResult TrySupplyDataPin(FName PinName) const override; + // -- + virtual void ExecuteInput(const FName& PinName) override; virtual void Cleanup() override; @@ -90,10 +94,6 @@ class FLOW_API UFlowNode_SubGraph virtual void AutoGenerateDataPins(FFlowDataPinValueOwner& ValueOwner, FFlowAutoDataPinsWorkingData& InOutWorkingData) override; // -- - // IFlowDataPinValueSupplierInterface - virtual FFlowDataPinResult TrySupplyDataPin(FName PinName) const override; - // -- - // UObject virtual void PostLoad() override; virtual void PreEditChange(FProperty* PropertyAboutToChange) override;