public OnNodeEvent(EventType type, Node node, Vector2 localMousePos, ConnectionPoint conPoint) { this.eventType = type; this.eventSourceNode = node; this.eventSourceConnectionPoint = conPoint; this.globalMousePosition = new Vector2(localMousePos.x + node.GetX(), localMousePos.y + node.GetY()); }
public static Connection NewConnection (string label, string startNodeId, ConnectionPoint output, string endNodeId, ConnectionPoint input) { return new Connection( label, Guid.NewGuid().ToString(), startNodeId, output, endNodeId, input ); }
public static Connection LoadConnection (string label, string connectionId, string startNodeId, ConnectionPoint output, string endNodeId, ConnectionPoint input) { return new Connection( label, connectionId, startNodeId, output, endNodeId, input ); }
private Connection (string label, string connectionId, string startNodeId, ConnectionPoint output, string endNodeId, ConnectionPoint input) { conInsp = ScriptableObject.CreateInstance<ConnectionInspector>(); conInsp.hideFlags = HideFlags.DontSave; this.label = label; this.connectionId = connectionId; this.startNodeId = startNodeId; this.outputPoint = output; this.endNodeId = endNodeId; this.inputPoint = input; connectionButtonStyle = "sv_label_0"; }
public static bool ContainsConnection(this List<Connection> connections, Node start, ConnectionPoint output, Node end, ConnectionPoint input) { foreach (var con in connections) { if (con.IsSameDetail(start, output, end, input)) return true; } return false; }
private Rect OutputRect (ConnectionPoint outputPoint) { return new Rect( baseRect.x + baseRect.width - 8f, baseRect.y + outputPoint.buttonRect.y + 1f, AssetGraphGUISettings.CONNECTION_POINT_MARK_SIZE, AssetGraphGUISettings.CONNECTION_POINT_MARK_SIZE ); }
public Vector2 GlobalConnectionPointPosition(ConnectionPoint p) { var x = baseRect.x + p.buttonRect.x; if (p.isInput) x = baseRect.x + p.buttonRect.x; if (p.isOutput) x = baseRect.x + p.buttonRect.x + NodeEditorSettings.POINT_SIZE; var y = baseRect.y + p.buttonRect.y + NodeEditorSettings.POINT_SIZE/2; return new Vector2(x, y); }
private void DeleteConnectionByRelation(Node startNode, ConnectionPoint startPoint, Node endNode, ConnectionPoint endPoint) { connections.Where(con => con.IsSameDetail(startNode, startPoint, endNode, endPoint)). Select(con => connections.Remove(con)); }
private Connection(string label, string connectionId, string startNodeId, ConnectionPoint output, string endNodeId, ConnectionPoint input) { conInsp = ScriptableObject.CreateInstance <ConnectionInspector>(); conInsp.hideFlags = HideFlags.DontSave; this.label = label; this.connectionId = connectionId; this.startNodeId = startNodeId; this.outputPoint = output; this.endNodeId = endNodeId; this.inputPoint = input; connectionButtonStyle = "sv_label_0"; }
public static Connection NewConnection(string label, string startNodeId, ConnectionPoint output, string endNodeId, ConnectionPoint input) { return(new Connection( label, Guid.NewGuid().ToString(), startNodeId, output, endNodeId, input )); }
public static bool ContainsConnection(this List <Connection> connections, Node start, ConnectionPoint output, Node end, ConnectionPoint input) { foreach (var con in connections) { if (con.IsSameDetail(start, output, end, input)) { return(true); } } return(false); }
public static Connection LoadConnection(string label, string connectionId, string startNodeId, ConnectionPoint output, string endNodeId, ConnectionPoint input) { return(new Connection( label, connectionId, startNodeId, output, endNodeId, input )); }
public bool IsEndAtConnectionPoint(ConnectionPoint p) { return(inputPoint == p); }
public bool IsStartAtConnectionPoint(ConnectionPoint p) { return(outputPoint == p); }
public Vector2 GlobalConnectionPointPosition(ConnectionPoint p) { var x = 0f; var y = 0f; if (p.isInput) { x = baseRect.x; y = baseRect.y + p.buttonRect.y + (p.buttonRect.height / 2f) - 1f; } if (p.isOutput) { x = baseRect.x + baseRect.width; y = baseRect.y + p.buttonRect.y + (p.buttonRect.height / 2f) - 1f; } return new Vector2(x, y); }
private bool IsConnectablePointFromTo(ConnectionPoint sourcePoint, ConnectionPoint destPoint) { if (sourcePoint.isOutput != destPoint.isOutput && sourcePoint.isInput != destPoint.isInput) { return true; } return false; }
/** create new connection if same relationship is not exist yet. */ private void AddConnection(string label, Node startNode, ConnectionPoint startPoint, Node endNode, ConnectionPoint endPoint) { Undo.RecordObject(this, "Add Connection"); var connectionsFromThisNode = connections .Where(con => con.startNodeId == startNode.nodeId) .Where(con => con.outputPoint == startPoint) .ToList(); if (connectionsFromThisNode.Any()) { var alreadyExistConnection = connectionsFromThisNode[0]; DeleteConnectionById(alreadyExistConnection.connectionId); } if (!connections.ContainsConnection(startNode, startPoint, endNode, endPoint)) { connections.Add(Connection.NewConnection(label, startNode.nodeId, startPoint, endNode.nodeId, endPoint)); } }
public bool IsStartAtConnectionPoint (ConnectionPoint p) { return outputPoint == p; }
public void AddConnectionPoint(ConnectionPoint adding) { connectionPoints.Add(adding); // update node size by number of connectionPoint. if (3 < connectionPoints.Count) { this.baseRect = new Rect(baseRect.x, baseRect.y, baseRect.width, NodeEditorSettings.NODE_BASE_HEIGHT + (20 * (connectionPoints.Count - 3))); } // update all connection point's index. UpdateNodeRect(); }
public bool IsEndAtConnectionPoint (ConnectionPoint p) { return inputPoint == p; }
public bool IsSameDetail (Node start, ConnectionPoint output, Node end, ConnectionPoint input) { if ( startNodeId == start.nodeId && outputPoint == output && endNodeId == end.nodeId && inputPoint == input ) { return true; } return false; }
public void AddConnectionPoint (ConnectionPoint adding) { connectionPoints.Add(adding); UpdateNodeRect(); }