Ejemplo n.º 1
0
        void Setup()
        {
            int count = 0;

            if (GraphInst.InputNodes.Count > 0)
            {
                count = GraphInst.InputNodes.Count;
                for (int i = 0; i < count; i++)
                {
                    string id = GraphInst.InputNodes[i];
                    Node   n;
                    if (GraphInst.NodeLookup.TryGetValue(id, out n))
                    {
                        InputNode inp = (InputNode)n;
                        NodeInput np  = new NodeInput(NodeType.Color | NodeType.Gray, this, inp.Name);

                        inp.SetInput(np);
                        Inputs.Add(np);
                    }
                }
            }

            if (GraphInst.OutputNodes.Count > 0)
            {
                count = GraphInst.OutputNodes.Count;
                for (int i = 0; i < count; i++)
                {
                    string id = GraphInst.OutputNodes[i];
                    Node   n;
                    if (GraphInst.NodeLookup.TryGetValue(id, out n))
                    {
                        OutputNode op = (OutputNode)n;

                        NodeOutput ot;

                        ot = new NodeOutput(NodeType.Color | NodeType.Gray, n, op.Name);
                        //we add to our graph instance outputs so things can actually connect
                        //to the output
                        Outputs.Add(ot);
                        op.SetOutput(ot);

                        n.OnUpdate += N_OnUpdate;
                    }
                }
            }

            //name map used in parameter mapping for quicker lookup
            count = GraphInst.CustomParameters.Count;
            for (int i = 0; i < count; i++)
            {
                var param = GraphInst.CustomParameters[i];
                nameMap[param.Name] = param;
            }
        }
Ejemplo n.º 2
0
        void Setup()
        {
            if (GraphInst.InputNodes.Count > 0)
            {
                foreach (string id in GraphInst.InputNodes)
                {
                    Node n;
                    if (GraphInst.NodeLookup.TryGetValue(id, out n))
                    {
                        InputNode inp = (InputNode)n;
                        NodeInput np  = new NodeInput(NodeType.Color | NodeType.Gray, this, inp.Name);

                        inp.SetInput(np);
                        Inputs.Add(np);
                    }
                }
            }

            if (GraphInst.OutputNodes.Count > 0)
            {
                foreach (string id in GraphInst.OutputNodes)
                {
                    Node n;
                    if (GraphInst.NodeLookup.TryGetValue(id, out n))
                    {
                        OutputNode op = (OutputNode)n;

                        NodeOutput ot;

                        ot = new NodeOutput(NodeType.Color | NodeType.Gray, n, op.Name);
                        //we add to our graph instance outputs so things can actually connect
                        //to the output
                        Outputs.Add(ot);
                        op.SetOutput(ot);

                        n.OnUpdate += N_OnUpdate;
                    }
                }
            }

            //TODO:
            //setup paramater links later
        }