| 44 | } |
| 45 | |
| 46 | void 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 | |
| 87 | void UFlowGraph::RecursivelyRefreshAddOns(UFlowGraphNode& FromFlowGraphNode) |
| 88 | { |
no test coverage detected