Example #1
0
        void BuildOutputs()
        {
            //Debug.Log("Building outputs for " + GetType());

            outputsVisuals = new OutputVisual[node.outputs.Count];
            oldOutputTypes = new Type[outputsVisuals.Length];

            for (int i = 0; i < node.outputs.Count; i++)//outputs
            {
                OutputVisual outp = CreateOutputVisual(node.outputs[i], GetOutputLabel(i));
                outp.name = "output_" + i;
                outp.UpdateType();

                outputsVisuals[i] = outp;
                oldOutputTypes[i] = node.outputs[i].GetDataType();
            }
            PlaceOutputs();
        }
Example #2
0
        void OutputsCountChanged()
        {
            List <OutputVisual> nOutputVisuals  = new List <OutputVisual>();
            List <Type>         nOldOutputTypes = new List <Type>();

            for (int i = 0; i < node.outputs.Count; i++)
            {
                if (outputsVisuals.Length > i)
                {
                    //if there is an old output here
                    //update it
                    UpdateOutput(i);
                    nOutputVisuals.Add(outputsVisuals[i]);
                    nOldOutputTypes.Add(node.outputs[i].GetDataType());
                }
                else
                {
                    //if there is not and old outpute here
                    //create output
                    OutputVisual outp = CreateOutputVisual(node.outputs[i], GetOutputLabel(i));
                    outp.name = "output_" + i;
                    outp.UpdateType();

                    PlaceOutput(outp, i);
                    nOutputVisuals.Add(outp);
                    nOldOutputTypes.Add(node.outputs[i].GetDataType());
                }
            }
            if (outputsVisuals.Length > node.outputs.Count)
            {
                //there is some output in surplus
                //delete them (the surplus)
                for (int i = node.outputs.Count; i < outputsVisuals.Length; i++)
                {
                    outputsVisuals[i].Disconnect();
                    Destroy(outputsVisuals[i].gameObject);
                }
            }
            outputsVisuals = nOutputVisuals.ToArray();
            oldOutputTypes = nOldOutputTypes.ToArray();
        }