1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-20 09:16:01 +08:00

Fix drawing instance twice for instanceportlists

This commit is contained in:
Thor Brigsted 2019-03-04 18:29:43 +01:00
parent 29acbf6348
commit 6783324018
2 changed files with 13 additions and 0 deletions

View File

@ -64,6 +64,7 @@ namespace XNodeEditor {
// Iterate through instance ports and draw them in the order in which they are serialized
foreach(XNode.NodePort instancePort in target.InstancePorts) {
if (NodeEditorGUILayout.IsInstancePortListPort(instancePort)) continue;
NodeEditorGUILayout.PortField(instancePort);
}

View File

@ -254,6 +254,18 @@ namespace XNodeEditor {
GUI.color = col;
}
/// <summary> Is this port part of an InstancePortList? </summary>
public static bool IsInstancePortListPort(XNode.NodePort port) {
string[] parts = port.fieldName.Split(' ');
if (parts.Length != 2) return false;
Dictionary<string, ReorderableList> cache;
if (reorderableListCache.TryGetValue(port.node, out cache)) {
ReorderableList list;
if (cache.TryGetValue(parts[0], out list)) return true;
}
return false;
}
/// <summary> Draw an editable list of instance ports. Port names are named as "[fieldName] [index]" </summary>
/// <param name="fieldName">Supply a list for editable values</param>
/// <param name="type">Value type of added instance ports</param>