1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-03-26 22:49:02 +08:00

Fixed formatting and compile error

This commit is contained in:
Thor Brigsted 2019-09-06 18:12:13 +02:00
parent 36c5c3f922
commit 1438b1463a
2 changed files with 10 additions and 10 deletions

View File

@ -503,7 +503,7 @@ namespace XNodeEditor {
if (stoppedDraggingPort) { if (stoppedDraggingPort) {
if (draggedPort != null && draggedPort.IsOutput) { if (draggedPort != null && draggedPort.IsOutput) {
GenericMenu menu = new GenericMenu(); GenericMenu menu = new GenericMenu();
graphEditor.AddContextMenuItems(menu, ConnectOnCreate); graphEditor.AddContextMenuItems(menu);
menu.DropDown(new Rect(Event.current.mousePosition, Vector2.zero)); menu.DropDown(new Rect(Event.current.mousePosition, Vector2.zero));
} }
stoppedDraggingPort = false; stoppedDraggingPort = false;
@ -528,7 +528,7 @@ namespace XNodeEditor {
Rect windowRect = new Rect(nodePos, new Vector2(width / zoom, 30 / zoom)); Rect windowRect = new Rect(nodePos, new Vector2(width / zoom, 30 / zoom));
return windowRect.Contains(mousePos); return windowRect.Contains(mousePos);
} }
public void ConnectOnCreate() { public void ConnectOnCreate() {
if (graph.nodes.Last().Ports.Where(r => r.IsInput == true).Any(r => r.ValueType == draggedPort.ValueType)) if (graph.nodes.Last().Ports.Where(r => r.IsInput == true).Any(r => r.ValueType == draggedPort.ValueType))
draggedPort.Connect(graph.nodes.Last().Ports.Where(r => r.IsInput == true).Where(r => r.ValueType == draggedPort.ValueType).ToArray() [0]); draggedPort.Connect(graph.nodes.Last().Ports.Where(r => r.IsInput == true).Where(r => r.ValueType == draggedPort.ValueType).ToArray() [0]);
@ -536,4 +536,4 @@ namespace XNodeEditor {
draggedPort.Connect(graph.nodes.Last().Ports.Where(r => r.IsInput == true).ToArray() [0]); draggedPort.Connect(graph.nodes.Last().Ports.Where(r => r.IsInput == true).ToArray() [0]);
} }
} }
} }

View File

@ -50,11 +50,11 @@ namespace XNodeEditor {
//Get node context menu path //Get node context menu path
string path = GetNodeMenuName(type); string path = GetNodeMenuName(type);
if (string.IsNullOrEmpty(path)) continue; if (string.IsNullOrEmpty(path)) continue;
menu.AddItem(new GUIContent(path), false, () => { menu.AddItem(new GUIContent(path), false, () => {
CreateNode(type, pos); CreateNode(type, pos);
if(!NodeEditorWindow.stoppedDraggingPort) NodeEditorWindow.current.ConnectOnCreate(); if (!NodeEditorWindow.stoppedDraggingPort) NodeEditorWindow.current.ConnectOnCreate();
}); });
} }
menu.AddSeparator(""); menu.AddSeparator("");
if (NodeEditorWindow.copyBuffer != null && NodeEditorWindow.copyBuffer.Length > 0) menu.AddItem(new GUIContent("Paste"), false, () => NodeEditorWindow.current.PasteNodes(pos)); if (NodeEditorWindow.copyBuffer != null && NodeEditorWindow.copyBuffer.Length > 0) menu.AddItem(new GUIContent("Paste"), false, () => NodeEditorWindow.current.PasteNodes(pos));
@ -115,7 +115,7 @@ namespace XNodeEditor {
[AttributeUsage(AttributeTargets.Class)] [AttributeUsage(AttributeTargets.Class)]
public class CustomNodeGraphEditorAttribute : Attribute, public class CustomNodeGraphEditorAttribute : Attribute,
XNodeEditor.Internal.NodeEditorBase<NodeGraphEditor, NodeGraphEditor.CustomNodeGraphEditorAttribute, XNode.NodeGraph>.INodeEditorAttrib { XNodeEditor.Internal.NodeEditorBase<NodeGraphEditor, NodeGraphEditor.CustomNodeGraphEditorAttribute, XNode.NodeGraph>.INodeEditorAttrib {
private Type inspectedType; private Type inspectedType;
public string editorPrefsKey; public string editorPrefsKey;
/// <summary> Tells a NodeGraphEditor which Graph type it is an editor for </summary> /// <summary> Tells a NodeGraphEditor which Graph type it is an editor for </summary>
@ -131,4 +131,4 @@ namespace XNodeEditor {
} }
} }
} }
} }