Пример #1
0
 public SubGraphOutputControlView(SubGraphOutputNode node)
 {
     m_Node = node;
     Add(new Button(OnAdd)
     {
         text = "Add Slot"
     });
     Add(new Button(OnRemove)
     {
         text = "Remove Slot"
     });
 }
        public override void Action(int instanceId, string pathName, string resourceFile)
        {
            var graph = new GraphData {
                isSubGraph = true
            };
            var outputNode = new SubGraphOutputNode();

            graph.AddNode(outputNode);
            outputNode.AddSlot(ConcreteSlotValueType.Vector4);
            graph.path = "Sub Graphs";
            FileUtilities.WriteShaderGraphToDisk(pathName, graph);
            AssetDatabase.Refresh();
        }
Пример #3
0
        public override void Action(int instanceId, string pathName, string resourceFile)
        {
            var graph = new GraphData {
                isSubGraph = true
            };
            var outputNode = new SubGraphOutputNode();

            graph.AddNode(outputNode);
            outputNode.AddSlot(ConcreteSlotValueType.Vector4);
            graph.path = "Sub Graphs";
            File.WriteAllText(pathName, EditorJsonUtility.ToJson(graph));
            AssetDatabase.Refresh();
        }
Пример #4
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);
        }
Пример #5
0
 public override void OnAfterDeserialize()
 {
     base.OnAfterDeserialize();
     m_OutputNode = null;
 }