From 55fb7586d8f5ea9cfd3de0e0ab63e90ce44af9a2 Mon Sep 17 00:00:00 2001 From: Thor Brigsted Date: Sun, 21 Jan 2018 22:45:20 +0100 Subject: [PATCH] Register ConnectionType changes and update existing static NodePorts --- Scripts/NodeDataCache.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Scripts/NodeDataCache.cs b/Scripts/NodeDataCache.cs index 262ef04..d6b7062 100644 --- a/Scripts/NodeDataCache.cs +++ b/Scripts/NodeDataCache.cs @@ -23,12 +23,17 @@ namespace XNode { } // Cleanup port dict - Remove nonexisting static ports - update static port types + // Loop through current node ports foreach (NodePort port in ports.Values.ToList()) { + // If port still exists, check it it has been changed if (staticPorts.ContainsKey(port.fieldName)) { NodePort staticPort = staticPorts[port.fieldName]; - if (port.IsDynamic || port.direction != staticPort.direction) ports.Remove(port.fieldName); + // If port exists but with wrong settings, remove it. Re-add it later. + if (port.connectionType != staticPort.connectionType || port.IsDynamic || port.direction != staticPort.direction) ports.Remove(port.fieldName); else port.ValueType = staticPort.ValueType; - } else if (port.IsStatic) ports.Remove(port.fieldName); + } + // If port doesn't exist anymore, remove it + else if (port.IsStatic) ports.Remove(port.fieldName); } // Add missing ports foreach (NodePort staticPort in staticPorts.Values) {