/// <summary> /// Creates, Initiates and return a NodeConnection /// </summary> /// <param name="from">The from Node (in the Node marked as OutputConnection)</param> /// <param name="fromPos">The position of the from Handle</param> /// <param name="to">The to Node (in the Node marked as InputConnection)</param> /// <param name="toPos">The position of the to Handle</param> /// <returns>The created Connection</returns> public static NodeConnection CreateConnection(Node from, NodeHandleID fromAttribute, Node to, NodeHandleID toAttribute) { NodeConnection connection = ScriptableObject.CreateInstance <NodeConnection>(); connection.InitiateConnection(from, fromAttribute, to, toAttribute); return(connection); }
/// <summary> /// Adds a Node into the from List /// </summary> /// <param name="from">The node which should be added</param> /// <param name="fromPos">The position of the handle of the added Node</param> public void AddFrom(Node from, NodeHandleID attribute) { if (!Contains(from, attribute.ID, ConnectionPart.From)) { froms.Add(from); fromAttributes.Add(attribute); } }
/// <summary> /// Initiates the Connection with the from and to Nodes and the according positions /// </summary> /// <param name="from">The from Node (in the Node marked as OutputConnection)</param> /// <param name="fromPos">The position of the from Handle</param> /// <param name="to">The to Node (in the Node marked as InputConnection)</param> /// <param name="toPos">The position of the to Handle</param> public void InitiateConnection(Node from, NodeHandleID fromAttribute, Node to, NodeHandleID toAttribute) { this.froms = new List <Node>(); this.froms.Add(from); this.fromAttributes = new List <NodeHandleID>(); this.fromAttributes.Add(fromAttribute); this.to = to; this.toAttribute = toAttribute; }