public void SetOutputValueType(ValueType vt)
        {
            //Debug.Log("Trying to set to " + vt);

            if (vt == ValueType.VTv1v2)
            {
                vt = ValueType.VTv2;
            }
            if (vt == ValueType.VTv1v3)
            {
                vt = ValueType.VTv3;
            }
            if (vt == ValueType.VTv1v4)
            {
                vt = ValueType.VTv4;
            }


            output.SetValueType(vt);

            int ccCalc;

            if (SF_Tools.CompCountOf(vt, out ccCalc))
            {
                if (ccCalc != output.node.texture.CompCount)
                {
                    //Debug.Log("Trying to set to " + ccCalc + " from " + vt);
                    output.node.texture.CompCount = ccCalc;
                }
            }


            //Debug.Log("Setting output type of " + output.node.nodeName + " to " + output.valueType); // THIS IS SET TO PENDING VOR VEC1 INPUTS
        }
示例#2
0
        public int GetCompCount()
        {
            if (conType == ConType.cInput)
            {
                if (IsConnected())
                {
                    return(inputCon.GetCompCount());
                }
                else
                {
                    int cc = 0;
                    if (SF_Tools.CompCountOf(valueType, out cc))
                    {
                        return(cc);
                    }
                    else
                    {
                        Debug.LogWarning("[Shader Forge] - invalid component count in [" + label + "] of " + node.name + "");
                        return(node.texture.CompCount);                        // This is super weird, shouldn't read from the max comp count, read from the connection type instead
                    }
                }
            }



            OutChannel oc = outputChannel;

            if (oc == OutChannel.All)
            {
                int cc = 0;
                if (SF_Tools.CompCountOf(valueType, out cc))
                {
                    return(cc);
                }
                else
                {
                    Debug.LogWarning("[Shader Forge] - invalid component count in [" + label + "] of " + node.name + "");
                    return(node.texture.CompCount);                    // This is super weird, shouldn't read from the max comp count, read from the connection type instead
                }
            }
            else if (oc == OutChannel.RGB)
            {
                return(3);
            }
            if (oc == OutChannel.RG)
            {
                return(2);
            }

            int custCount = SF_Tools.ComponentCountOf(customValueType);

            if (custCount != 0)
            {
                return(custCount);
            }

            return(1);
        }