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:
parent
29acbf6348
commit
6783324018
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user