Skip to content

Commit b256c6d

Browse files
authored
Merge pull request #25 from RyouBakura/master
Update all ports when edge gets connected/disconnected
2 parents f8b6960 + 55763a9 commit b256c6d

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Assets/Examples/DefaultNodes/Nodes/CustomPortsNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected override void Process()
3131
[CustomPortBehavior(nameof(inputs))]
3232
IEnumerable< PortData > ListPortBehavior(List< SerializableEdge > edges)
3333
{
34-
portCount = Mathf.Max(portCount, edges.Count + 1);
34+
portCount = edges.Count + 1;
3535

3636
for (int i = 0; i < portCount; i++)
3737
{

Assets/com.alelievr.NodeGraphProcessor/Editor/Views/BaseGraphView.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,6 @@ public bool ConnectView(EdgeView e, bool autoDisconnectInputs = true)
584584

585585
edgeViews.Add(e);
586586

587-
inputNodeView.RefreshPorts();
588-
outputNodeView.RefreshPorts();
589-
590587
e.isConnected = true;
591588

592589
return true;
@@ -608,6 +605,11 @@ public bool Connect(EdgeView e, bool autoDisconnectInputs = true)
608605

609606
UpdateComputeOrder();
610607

608+
inputNodeView.nodeTarget.UpdateAllPorts();
609+
outputNodeView.nodeTarget.UpdateAllPorts();
610+
inputNodeView.RefreshPorts();
611+
outputNodeView.RefreshPorts();
612+
611613
return true;
612614
}
613615

@@ -622,13 +624,19 @@ public void DisconnectView(EdgeView e, bool refreshPorts = true)
622624
{
623625
e.input.Disconnect(e);
624626
if (refreshPorts)
627+
{
628+
inputNodeView.nodeTarget.UpdateAllPorts();
625629
inputNodeView.RefreshPorts();
630+
}
626631
}
627632
if (e?.output?.node is BaseNodeView outputNodeView)
628633
{
629634
e.output.Disconnect(e);
630635
if (refreshPorts)
636+
{
637+
outputNodeView.nodeTarget.UpdateAllPorts();
631638
outputNodeView.RefreshPorts();
639+
}
632640
}
633641

634642
edgeViews.Remove(e);

0 commit comments

Comments
 (0)