MCPcopy Create free account
hub / github.com/MothCocoon/FlowGraph / CreateSubFlow

Method CreateSubFlow

Source/Flow/Private/FlowSubsystem.cpp:163–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161}
162
163UFlowAsset* UFlowSubsystem::CreateSubFlow(UFlowNode_SubGraph* SubGraphNode, const FString& SavedInstanceName, const bool bPreloading /* = false */)
164{
165 UFlowAsset* NewInstance = nullptr;
166
167 if (!InstancedSubFlows.Contains(SubGraphNode))
168 {
169 const TWeakObjectPtr<UObject> Owner = SubGraphNode->GetFlowAsset() ? SubGraphNode->GetFlowAsset()->GetOwner() : nullptr;
170 NewInstance = CreateFlowInstance(Owner, SubGraphNode->Asset.LoadSynchronous(), SavedInstanceName);
171
172 if (NewInstance)
173 {
174 InstancedSubFlows.Add(SubGraphNode, NewInstance);
175
176 if (bPreloading)
177 {
178 NewInstance->PreloadNodes();
179 }
180 }
181 }
182
183 if (InstancedSubFlows.Contains(SubGraphNode) && !bPreloading)
184 {
185 // get instanced asset from map - in case it was already instanced by calling CreateSubFlow() with bPreloading == true
186 UFlowAsset* AssetInstance = InstancedSubFlows[SubGraphNode];
187
188 AssetInstance->NodeOwningThisAssetInstance = SubGraphNode;
189 SubGraphNode->GetFlowAsset()->ActiveSubGraphs.Add(SubGraphNode, AssetInstance);
190
191 // don't activate Start Node if we're loading Sub Graph from SaveGame
192 if (SavedInstanceName.IsEmpty())
193 {
194 AssetInstance->StartFlow(SubGraphNode);
195 }
196 }
197
198 return NewInstance;
199}
200
201void UFlowSubsystem::RemoveSubFlow(UFlowNode_SubGraph* SubGraphNode, const EFlowFinishPolicy FinishPolicy)
202{

Callers 2

PreloadContentMethod · 0.80
ExecuteInputMethod · 0.80

Calls 3

IsEmptyMethod · 0.80
StartFlowMethod · 0.80
GetFlowAssetMethod · 0.45

Tested by

no test coverage detected