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

Method RefreshGraph

Source/FlowEditor/Private/Graph/FlowGraph.cpp:46–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46void UFlowGraph::RefreshGraph()
47{
48 if (!GEditor || GEditor->PlayWorld)
49 {
50 // don't run fixup in PIE
51 return;
52 }
53
54 // Locking updates to the graph while we update it
55 {
56 LockUpdates();
57
58 // check if all Graph Nodes have expected, up-to-date type
59 const UFlowGraphSchema* FlowGraphSchema = CastChecked<UFlowGraphSchema>(GetSchema());
60 FlowGraphSchema->GatherNodes();
61
62 for (const TPair<FGuid, UFlowNode*>& Node : GetFlowAsset()->GetNodes())
63 {
64 UFlowNode* FlowNode = Node.Value;
65 if (IsValid(FlowNode))
66 {
67 UFlowGraphNode* const ExistingFlowGraphNode = Cast<UFlowGraphNode>(FlowNode->GetGraphNode());
68 UFlowGraphNode* RefreshedFlowGraphNode = ExistingFlowGraphNode;
69
70 const TSubclassOf<UEdGraphNode> ExpectGraphNodeClass = UFlowGraphSchema::GetAssignedGraphNodeClass(FlowNode->GetClass());
71 const UClass* ExistingFlowGraphNodeClass = IsValid(ExistingFlowGraphNode) ? ExistingFlowGraphNode->GetClass() : nullptr;
72 if (ExistingFlowGraphNodeClass != ExpectGraphNodeClass)
73 {
74 // Create a new Flow Graph Node of proper type
75 RefreshedFlowGraphNode = FFlowGraphSchemaAction_NewNode::RecreateNode(this, ExistingFlowGraphNode, FlowNode);
76 }
77
78 RecursivelyRefreshAddOns(*RefreshedFlowGraphNode);
79 }
80 }
81
82 // This function will (eventually) result in all graph nodes being reconstructed
83 UnlockUpdates();
84 }
85}
86
87void UFlowGraph::RecursivelyRefreshAddOns(UFlowGraphNode& FromFlowGraphNode)
88{

Callers 2

RefreshAssetMethod · 0.80
ImportBlueprintGraphMethod · 0.80

Calls 3

GetFlowAssetFunction · 0.85
IsValidFunction · 0.85
GatherNodesMethod · 0.80

Tested by

no test coverage detected