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);
|
||||
// Fallback to input port
|
||||
if (inputPort == null) inputPort = node.Ports.FirstOrDefault(x => x.IsInput);
|
||||
// Autoconnect
|
||||
if (inputPort != null) autoConnectOutput.Connect(inputPort);
|
||||
// Autoconnect if connection is compatible
|
||||
if (inputPort != null && inputPort.CanConnectTo(autoConnectOutput)) autoConnectOutput.Connect(inputPort);
|
||||
|
||||
// Save changes
|
||||
EditorUtility.SetDirty(graph);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user