From 02f59984a02ed381a9eaa2a312082b6934841463 Mon Sep 17 00:00:00 2001 From: Icarus <1375400884@qq.com> Date: Tue, 26 Nov 2019 17:43:54 +0800 Subject: [PATCH] =?UTF-8?q?!B=20=E8=8A=82=E7=82=B9=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E6=97=A0=E6=B3=95=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/Editor/NodeEditorAction.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Scripts/Editor/NodeEditorAction.cs b/Scripts/Editor/NodeEditorAction.cs index 6894c88..dbe0e1b 100644 --- a/Scripts/Editor/NodeEditorAction.cs +++ b/Scripts/Editor/NodeEditorAction.cs @@ -221,13 +221,18 @@ namespace XNodeEditor { else if (NodeEditorPreferences.GetSettings().dragToCreate && autoConnectOutput != null) { MenuPopupWindow menu = new MenuPopupWindow(); graphEditor.AddContextMenuItems(menu); + + menu.OnCloseA += () => + { + //Release dragged connection + draggedOutput = null; + draggedOutputTarget = null; + EditorUtility.SetDirty(graph); + if (NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets(); + }; + PopupWindow.Show(new Rect(Event.current.mousePosition, Vector2.zero),menu); } - //Release dragged connection - draggedOutput = null; - draggedOutputTarget = null; - EditorUtility.SetDirty(graph); - if (NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets(); } else if (currentActivity == NodeActivity.DragNode) { IEnumerable nodes = Selection.objects.Where(x => x is XNode.Node).Select(x => x as XNode.Node); foreach (XNode.Node node in nodes) EditorUtility.SetDirty(node);