1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-21 01:36:03 +08:00

Added filtered node at port contextMenu

Added compatible menus when the right mouse button is clicked on the port and preferences filter is active
This commit is contained in:
juliocp 2020-10-07 20:57:40 -03:00
parent 37d82ad215
commit a03c4c5d0e

View File

@ -118,6 +118,16 @@ namespace XNodeEditor {
contextMenu.AddItem(new GUIContent($"Disconnect({name})"), false, () => hoveredPort.Disconnect(index));
}
contextMenu.AddItem(new GUIContent("Clear Connections"), false, () => hoveredPort.ClearConnections());
//Get compatible nodes with this port
if (NodeEditorPreferences.GetSettings().dragToCreateFilter)
{
contextMenu.AddSeparator("");
if (hoveredPort.direction == XNode.NodePort.IO.Input)
graphEditor.AddContextMenuItems(contextMenu, hoveredPort.ValueType, XNode.NodePort.IO.Output);
else
graphEditor.AddContextMenuItems(contextMenu, hoveredPort.ValueType, XNode.NodePort.IO.Input);
}
contextMenu.DropDown(new Rect(Event.current.mousePosition, Vector2.zero));
if (NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets();
}