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) {