From 2b21b0ddc677f4b7bf5aa0c39ac7d24bb06ba842 Mon Sep 17 00:00:00 2001 From: Icarus <1375400884@qq.com> Date: Tue, 26 Nov 2019 18:53:25 +0800 Subject: [PATCH] =?UTF-8?q?!B=20=E7=AB=AF=E5=8F=A3=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E5=90=8E,=E6=B2=A1=E6=9C=89=E9=87=8A=E6=94=BE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/Editor/NodeEditorAction.cs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Scripts/Editor/NodeEditorAction.cs b/Scripts/Editor/NodeEditorAction.cs index 49be164..c66287a 100644 --- a/Scripts/Editor/NodeEditorAction.cs +++ b/Scripts/Editor/NodeEditorAction.cs @@ -222,17 +222,13 @@ namespace XNodeEditor { 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(); - }; + menu.OnCloseA += _releaseDraggedConnection; PopupWindow.Show(new Rect(Event.current.mousePosition, Vector2.zero),menu); } + + _releaseDraggedConnection(); + } 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); @@ -346,6 +342,15 @@ namespace XNodeEditor { } } + private void _releaseDraggedConnection() + { +//Release dragged connection + draggedOutput = null; + draggedOutputTarget = null; + EditorUtility.SetDirty(graph); + if (NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets(); + } + private void RecalculateDragOffsets(Event current) { dragOffset = new Vector2[Selection.objects.Length + selectedReroutes.Count]; // Selected nodes