public virtual void UpdateData(bool withOutputs = true) { if (withOutputs) { //update all outputs foreach (NodePort np in Outputs) { for (int i = 0; i < np.ConnectionCount; i++) { PCGNode nn = (PCGNode)np.GetConnection(i).node; if (nn != null) { nn.UpdateData(); } } } } }
private void ProcessNodes() { for (int i = ToBeProcessed.Count - 1; i >= 0; i--) { PCGNode node = ToBeProcessed[i]; ToBeProcessed.RemoveAt(i); node.UpdateData(false); Processed.Add(node); } for (int i = UnProcessed.Count - 1; i >= 0; i--) { PCGNode node = UnProcessed[i]; bool canBeProcessed = true; foreach (NodePort np in node.Inputs) { foreach (NodePort outer in np.GetConnections()) { PCGNode connectedNode = outer.node as PCGNode; if (connectedNode != null) { if (!Processed.Contains(connectedNode)) { canBeProcessed = false; break; } } } } if (canBeProcessed) { UnProcessed.RemoveAt(i); ToBeProcessed.Add(node); } } }