From 445a47cd1db3b982aeb36149b34cea343ff02c2f Mon Sep 17 00:00:00 2001 From: Thor Brigsted Date: Mon, 9 Sep 2019 00:44:36 +0200 Subject: [PATCH] Autoconnect bugfix 1. Add a node 2. Drag a port and create a new node that it connects to 3. Delete that latest node 4. Create it with just right click, the first node will autoconnect to it --- Scripts/Editor/NodeEditorAction.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Scripts/Editor/NodeEditorAction.cs b/Scripts/Editor/NodeEditorAction.cs index 02cb599..35fbdd1 100644 --- a/Scripts/Editor/NodeEditorAction.cs +++ b/Scripts/Editor/NodeEditorAction.cs @@ -274,11 +274,13 @@ namespace XNodeEditor { ShowPortContextMenu(hoveredPort); } else if (IsHoveringNode && IsHoveringTitle(hoveredNode)) { if (!Selection.Contains(hoveredNode)) SelectNode(hoveredNode, false); + autoConnectOutput = null; GenericMenu menu = new GenericMenu(); NodeEditor.GetEditor(hoveredNode, this).AddContextMenuItems(menu); menu.DropDown(new Rect(Event.current.mousePosition, Vector2.zero)); e.Use(); // Fixes copy/paste context menu appearing in Unity 5.6.6f2 - doesn't occur in 2018.3.2f1 Probably needs to be used in other places. } else if (!IsHoveringNode) { + autoConnectOutput = null; GenericMenu menu = new GenericMenu(); graphEditor.AddContextMenuItems(menu); menu.DropDown(new Rect(Event.current.mousePosition, Vector2.zero)); @@ -526,6 +528,7 @@ namespace XNodeEditor { // Save changes EditorUtility.SetDirty(graph); if (NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets(); + autoConnectOutput = null; } } } \ No newline at end of file