diff --git a/Scripts/NodeDataCache.cs b/Scripts/NodeDataCache.cs index 3bc8478..027218a 100644 --- a/Scripts/NodeDataCache.cs +++ b/Scripts/NodeDataCache.cs @@ -8,8 +8,20 @@ namespace XNode { public static class NodeDataCache { private static PortDataCache portDataCache; private static Dictionary> formerlySerializedAsCache; + private static Dictionary typeQualifiedNameCache; private static bool Initialized { get { return portDataCache != null; } } + public static string GetTypeQualifiedName(System.Type type) { + if(typeQualifiedNameCache == null) typeQualifiedNameCache = new Dictionary(); + + string name; + if (!typeQualifiedNameCache.TryGetValue(type, out name)) { + name = type.AssemblyQualifiedName; + typeQualifiedNameCache.Add(type, name); + } + return name; + } + /// Update static ports and dynamic ports managed by DynamicPortLists to reflect class fields. public static void UpdatePorts(Node node, Dictionary ports) { if (!Initialized) BuildCache(); diff --git a/Scripts/NodePort.cs b/Scripts/NodePort.cs index 6bcc638..f8bca99 100644 --- a/Scripts/NodePort.cs +++ b/Scripts/NodePort.cs @@ -48,7 +48,7 @@ namespace XNode { } set { valueType = value; - if (value != null) _typeQualifiedName = value.AssemblyQualifiedName; + if (value != null) _typeQualifiedName = NodeDataCache.GetTypeQualifiedName(value); } } private Type valueType;