mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 09:16:01 +08:00
Register ConnectionType changes and update existing static NodePorts
This commit is contained in:
parent
aa54950611
commit
55fb7586d8
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user