Skip to content

Commit

Permalink
Fix for AutoConnect method. (#255)
Browse files Browse the repository at this point in the history
Prevents incompatible connections between node ports when creating a new node on connection drag.
  • Loading branch information
Dan Erhardt authored Apr 26, 2020
1 parent d9d90f0 commit a1cf78d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Scripts/Editor/NodeEditorAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -535,13 +535,13 @@ public void AutoConnect(XNode.Node node) {
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);
if (NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets();
autoConnectOutput = null;
}
}
}
}

0 comments on commit a1cf78d

Please sign in to comment.