public NodeLink Connect(NodeLinkPort other) { NodeLink link = GetEmptyLink(); other.Link.Connect(other.Node, link); return(link); }
public void Disconnect(NodeLinkPort other) { var existing = GetConnections().Find(x => x.to == other.Node || x.from == other.Node); if (existing) { other.Link.Disconnect(other.Node, existing); } }
public bool CanConnectTo(NodeLinkPort other) { List <NodeLink> thisConnections = GetConnections(); List <NodeLink> otherConnections = other.GetConnections(); bool canConnectThis = Link.IsList || thisConnections.Count < 1; bool canConnectOther = other.Link.IsList || otherConnections.Count < 1; return(canConnectThis && canConnectOther); }
public bool IsConnectedTo(NodeLinkPort hoveredLink) { List <NodeLink> thisConnections = GetConnections(); List <NodeLink> otherConnections = hoveredLink.GetConnections(); foreach (var con in thisConnections) { foreach (var oth in otherConnections) { if (con == oth) { return(true); } } } return(false); }
public NodeLink GetConnectionTo(NodeLinkPort other) { return(Item2.GetConnections(Item1).FirstOrDefault(x => IsInput ? (x.from == other.Node && x.fromField == other.Link.FieldName) : (x.to == other.Node && x.toField == other.Link.FieldName))); }