public void LoadConnection(string id) { var connections = Node.GetConnections(); foreach (var con in connections) { if (con.node.Equals(id)) { string nid = con.node; int idx = con.index; int odx = con.outIndex; IUIGraphNode on = Graph.GetNode(nid); if (on != null) { if (idx >= 0 && idx < on.InputNodes.Count) { UINodePoint p = on.InputNodes[idx]; //connect if (odx >= 0 && odx < OutputNodes.Count) { OutputNodes[odx].ConnectToNode(p, true); } } else { //log error Log.Warn("Failed to connect a node's output to input"); } } else { //log error Log.Warn("Node does not exist for connection"); } break; } } }
public void LoadConnections(Dictionary <string, IUIGraphNode> lookup) { var connections = Node.GetConnections(); foreach (var con in connections) { string nid = con.node; int idx = con.index; int odx = con.outIndex; IUIGraphNode on = null; if (lookup.TryGetValue(nid, out on)) { if (idx >= 0 && idx < on.InputNodes.Count) { UINodePoint p = on.InputNodes[idx]; //connect if (odx >= 0 && odx < OutputNodes.Count) { OutputNodes[odx].ConnectToNode(p, true); } } else { //log error Log.Warn("Failed to connect a node's output to input"); } } else { //log error Log.Warn("Node does not exist for connection"); } } }