diff --git a/Scripts/Editor/NodeEditorAction.cs b/Scripts/Editor/NodeEditorAction.cs index b0ba037..cdbda1a 100644 --- a/Scripts/Editor/NodeEditorAction.cs +++ b/Scripts/Editor/NodeEditorAction.cs @@ -49,21 +49,14 @@ namespace XNodeEditor { wantsMouseMove = true; Event e = Event.current; switch (e.type) { - case EventType.DragUpdated: case EventType.DragPerform: - - DragAndDrop.visualMode = DragAndDropVisualMode.Copy; - + DragAndDrop.visualMode = DragAndDropVisualMode.Generic; if (e.type == EventType.DragPerform) { DragAndDrop.AcceptDrag(); - - foreach (object droppedItem in DragAndDrop.objectReferences) { - graphEditor.DropItem(droppedItem); - } + graphEditor.OnDropObjects(DragAndDrop.objectReferences); } break; - case EventType.MouseMove: break; case EventType.ScrollWheel: diff --git a/Scripts/Editor/NodeGraphEditor.cs b/Scripts/Editor/NodeGraphEditor.cs index e31d40e..7f2126d 100644 --- a/Scripts/Editor/NodeGraphEditor.cs +++ b/Scripts/Editor/NodeGraphEditor.cs @@ -68,8 +68,9 @@ namespace XNodeEditor { return NodeEditorPreferences.GetTypeColor(type); } - public virtual void DropItem(object droppedItem) { - target.OnDrop(droppedItem, NodeEditorWindow.current.WindowToGridPosition(Event.current.mousePosition)); + /// Deal with objects dropped into the graph through DragAndDrop + public virtual void OnDropObjects(UnityEngine.Object[] objects) { + Debug.Log("No OnDropItems override defined for " + GetType()); } /// Create a node and save it in the graph asset diff --git a/Scripts/NodeGraph.cs b/Scripts/NodeGraph.cs index 5edf38e..6a0cead 100644 --- a/Scripts/NodeGraph.cs +++ b/Scripts/NodeGraph.cs @@ -81,12 +81,5 @@ namespace XNode { // Remove all nodes prior to graph destruction Clear(); } - - /// Is called when something is dragged in the editor - /// The dropped object - public virtual void OnDrop(object droppedObject, Vector2 dropPosition) { - Debug.LogWarning("No OnDrop(NodePort port) override defined for " + GetType()); - } - } } \ No newline at end of file