Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions Source/FlowEditor/Private/Graph/FlowGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "Graph/FlowGraphSchema.h"
#include "Graph/FlowGraphSchema_Actions.h"
#include "Graph/Nodes/FlowGraphNode.h"
#include "Graph/Nodes/FlowGraphNode_Reroute.h"
#include "AddOns/FlowNodeAddOn.h"
#include "Nodes/FlowNode.h"
#include "FlowEditorLogChannels.h"
Expand Down Expand Up @@ -472,9 +473,52 @@ void UFlowGraph::LockUpdates()
void UFlowGraph::UnlockUpdates()
{
bLockUpdates = false;

// Apply any deferred reroute type updates first, while we're in a stable post-paste state.
ProcessPendingRerouteTypeFixups();

// Existing behavior
UpdateAsset();
}

void UFlowGraph::EnqueueRerouteTypeFixup(UFlowGraphNode_Reroute* RerouteNode)
{
if (!IsValid(RerouteNode))
{
return;
}

// If not locked, run immediately (keeps behavior responsive outside paste/locked updates)
if (!IsLocked())
{
RerouteNode->NodeConnectionListChanged();
return;
}

PendingRerouteTypeFixups.Add(RerouteNode);
}

void UFlowGraph::ProcessPendingRerouteTypeFixups()
{
if (PendingRerouteTypeFixups.Num() == 0)
{
return;
}

// Move aside so re-entrancy (or new enqueue) doesn't invalidate iteration
TSet<TObjectPtr<UFlowGraphNode_Reroute>> Local = MoveTemp(PendingRerouteTypeFixups);
PendingRerouteTypeFixups.Reset();

for (UFlowGraphNode_Reroute* RerouteNode : Local)
{
if (IsValid(RerouteNode))
{
// This will call into reroute's centralized retype path via ReconfigureFromConnections()
RerouteNode->NodeConnectionListChanged();
}
}
}

void UFlowGraph::RecursivelySetupAllFlowGraphNodesForEditing(UFlowGraphNode& FromFlowGraphNode)
{
UFlowNodeBase* FromNodeInstance = FromFlowGraphNode.GetFlowNodeBase();
Expand Down
Loading