float ProcessNode(PWNodeProcessInfo nodeInfo) { float calculTime = 0; //if you are in editor mode, update the process time of the node if (!realMode) { Stopwatch st = new Stopwatch(); st.Start(); nodeInfo.node.Process(); st.Stop(); nodeInfo.node.processTime = st.ElapsedMilliseconds; calculTime = nodeInfo.node.processTime; } else { nodeInfo.node.Process(); } if (realMode) { nodeInfo.node.EndFrameUpdate(); } ProcessNodeLinks(nodeInfo.node); //if node was an external node, compute his subgraph if (nodeInfo.graphName != null) { PWNodeGraph g = FindGraphByName(nodeInfo.graphName); float time = g.ProcessGraph(); if (!realMode) { nodeInfo.node.processTime = time; } } return(calculTime); }
public void ForeachAllNodes(System.Action <PWNode> callback, bool recursive = false, bool graphInputAndOutput = false, PWNodeGraph graph = null) { if (graph == null) { graph = this; } foreach (var node in graph.nodes) { callback(node); } foreach (var subgraphName in graph.subgraphReferences) { var g = FindGraphByName(subgraphName); if (g == null) { continue; } callback(g.externalGraphNode); if (recursive) { ForeachAllNodes(callback, recursive, graphInputAndOutput, g); } } if (graphInputAndOutput) { callback(graph.inputNode); callback(graph.outputNode); } }