From ec7133d862bf21e6fde29988fba1b3c1a66227fd Mon Sep 17 00:00:00 2001 From: Icarus <1375400884@qq.com> Date: Sun, 8 Dec 2019 21:00:06 +0800 Subject: [PATCH] =?UTF-8?q?!W(Node)=20`output`=E5=8A=A8=E6=80=81=E7=AB=AF?= =?UTF-8?q?=E5=8F=A3=E6=B0=B8=E8=BF=9C=E5=9C=A8=E6=9C=80=E5=90=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/Node.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Scripts/Node.cs b/Scripts/Node.cs index 27f208d..66906b5 100644 --- a/Scripts/Node.cs +++ b/Scripts/Node.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using UnityEngine; namespace XNode { @@ -168,7 +169,9 @@ namespace XNode { return ports[fieldName]; } NodePort port = new NodePort(fieldName, type, direction, connectionType, typeConstraint,baseType, this); + ports.Add(fieldName, port); + return port; } @@ -394,6 +397,19 @@ namespace XNode { keys.Clear(); values.Clear(); foreach (KeyValuePair pair in this) { + + if (pair.Value.direction == NodePort.IO.Input) + { + var firstOutIndex = values.FindIndex(x => x.direction == NodePort.IO.Output); + + if (firstOutIndex > -1) + { + keys.Insert(firstOutIndex,pair.Key); + values.Insert(firstOutIndex,pair.Value); + continue; + } + } + keys.Add(pair.Key); values.Add(pair.Value); }