mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 01:06:01 +08:00
Fix for AutoConnect method. (#255)
Prevents incompatible connections between node ports when creating a new node on connection drag.
This commit is contained in:
parent
d9d90f0f7b
commit
a1cf78d3fb
@ -535,8 +535,8 @@ namespace XNodeEditor {
|
|||||||
XNode.NodePort inputPort = node.Ports.FirstOrDefault(x => x.IsInput && x.ValueType == autoConnectOutput.ValueType);
|
XNode.NodePort inputPort = node.Ports.FirstOrDefault(x => x.IsInput && x.ValueType == autoConnectOutput.ValueType);
|
||||||
// Fallback to input port
|
// Fallback to input port
|
||||||
if (inputPort == null) inputPort = node.Ports.FirstOrDefault(x => x.IsInput);
|
if (inputPort == null) inputPort = node.Ports.FirstOrDefault(x => x.IsInput);
|
||||||
// Autoconnect
|
// Autoconnect if connection is compatible
|
||||||
if (inputPort != null) autoConnectOutput.Connect(inputPort);
|
if (inputPort != null && inputPort.CanConnectTo(autoConnectOutput)) autoConnectOutput.Connect(inputPort);
|
||||||
|
|
||||||
// Save changes
|
// Save changes
|
||||||
EditorUtility.SetDirty(graph);
|
EditorUtility.SetDirty(graph);
|
||||||
@ -544,4 +544,4 @@ namespace XNodeEditor {
|
|||||||
autoConnectOutput = null;
|
autoConnectOutput = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user