1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-21 01:36:03 +08:00

Fixed bug that would cause nodes without static ports to not properly remove old static ports

This commit is contained in:
Thor Kramer Brigsted 2017-11-07 10:02:58 +01:00
parent 455bb723d2
commit 4f65fcefc6
2 changed files with 5 additions and 4 deletions

View File

@ -9,7 +9,7 @@ namespace BasicNodes {
base.OnBodyGUI();
NodeEditorGUILayout.PortField(target.GetInputPort("input"));
object obj = target.GetValue(null);
if (obj != null) EditorGUILayout.LabelField(target.GetValue(null).ToString());
if (obj != null) EditorGUILayout.LabelField(obj.ToString());
}
}
}

View File

@ -16,9 +16,10 @@ namespace XNode {
Dictionary<string, NodePort> staticPorts = new Dictionary<string, NodePort>();
System.Type nodeType = node.GetType();
if (!portDataCache.ContainsKey(nodeType)) return;
for (int i = 0; i < portDataCache[nodeType].Count; i++) {
staticPorts.Add(portDataCache[nodeType][i].fieldName, portDataCache[nodeType][i]);
if (portDataCache.ContainsKey(nodeType)) {
for (int i = 0; i < portDataCache[nodeType].Count; i++) {
staticPorts.Add(portDataCache[nodeType][i].fieldName, portDataCache[nodeType][i]);
}
}
// Cleanup port dict - Remove nonexisting static ports - update static port types