Пример #1
0
        // Automatically add a  streaming feedback node and correctly connect it to stack samples are connected to it and it is connected to the master node output
        public static List <string> GetFeedbackVariables(SubGraphOutputNode masterNode)
        {
            // TODO: make use a generic interface instead of hard-coding the node types that we need to look at here
            var VTNodes       = GraphUtil.FindDownStreamNodesOfType <SampleVirtualTextureNode>(masterNode);
            var subGraphNodes = GraphUtil.FindDownStreamNodesOfType <SubGraphNode>(masterNode);

            List <string> result = new List <string>();

            // Early out if there are no nodes we care about in the graph
            if (subGraphNodes.Count <= 0 && VTNodes.Count <= 0)
            {
                return(result);
            }

            // Add inputs to feedback node
            foreach (var node in VTNodes)
            {
                if (node.noFeedback)
                {
                    continue;
                }
                result.Add(node.GetFeedbackVariableName());
            }

            foreach (var node in subGraphNodes)
            {
                if (node.asset == null)
                {
                    continue;
                }
                // TODO: subgraph.GetFeedbackVariableNames(...)
                foreach (var feedbackSlot in node.asset.vtFeedbackVariables)
                {
                    result.Add(node.GetVariableNameForNode() + "_" + feedbackSlot);
                }
            }

            return(result);
        }