/// <summary> /// Finds all descendents nodes /// </summary> /// <param name="n">Node</param> /// <returns>Descendents nodes</returns> public static IEnumerable <Node> Descendents(this Node n) { for (int i = 0; i < n.OutputPorts.Length; i++) { NodeOutput o = n.OutputPorts[i]; for (int j = 0; j < o.TargetInputs.Length; j++) { Node child = o.TargetInputs[j].Parent; yield return(child); foreach (Node children in Descendents(child)) { yield return(children); } } } }
/// <summary> /// Does the connection with the output is valid ? /// </summary> /// <param name="output">Output port</param> /// <returns>Connection valid boolean</returns> protected abstract bool ValidConnection(NodeOutput output);
/// <summary> /// Called when disconnect an output from this input /// </summary> /// <param name="output"></param> public virtual void OnRemoveConnection(NodeOutput output) { }
/// <summary> /// Called when an output connects to this input /// </summary> /// <param name="output"></param> public virtual void OnAddConnection(NodeOutput output) { }