Exemple #1
0
        public IEnumerable <PortData> ListMaterialBindings(List <SerializableEdge> edges)
        {
            if (targetMaterial == null)
            {
                yield break;
            }

            var s            = targetMaterial.shader;
            var textureNames = targetMaterial.GetTexturePropertyNames();

            foreach (var textureName in textureNames)
            {
                int index = s.FindPropertyIndex(textureName);

                var flags = s.GetPropertyAttributes(index);
                if (flags.Any(f => f == "HideInInspector" || f == "NonModifiableTextureData"))
                {
                    continue;
                }

                yield return(new PortData {
                    displayName = s.GetPropertyDescription(index),
                    identifier = s.GetPropertyName(index),
                    displayType = TextureUtils.GetTypeFromDimension(s.GetPropertyTextureDimension(index)),
                });
            }
        }
Exemple #2
0
 protected IEnumerable <PortData> ChangeOutputPortType(List <SerializableEdge> edges)
 {
     yield return(new PortData {
         displayName = "output",
         displayType = TextureUtils.GetTypeFromDimension((TextureDimension)rtSettings.dimension),
         identifier = "output",
     });
 }
 protected IEnumerable <PortData> ChangeOutputPortType(List <SerializableEdge> edges)
 {
     yield return(new PortData {
         displayName = "output",
         displayType = TextureUtils.GetTypeFromDimension(TextureDimension.Tex2D),
         identifier = "output",
         acceptMultipleEdges = true,
     });
 }
Exemple #4
0
 protected IEnumerable <PortData> ChangeInputPortType(List <SerializableEdge> edges)
 {
     yield return(new PortData {
         displayName = "Input",
         displayType = TextureUtils.GetTypeFromDimension(rtSettings.GetTextureDimension(graph)),
         identifier = "Input",
         acceptMultipleEdges = false,
     });
 }
Exemple #5
0
        protected IEnumerable <PortData> ChangeOutputPortType(List <SerializableEdge> edges)
        {
            TextureDimension dim = (GetType() == typeof(ExternalOutputNode)) ? rtSettings.GetTextureDimension(graph) : (TextureDimension)rtSettings.dimension;

            yield return(new PortData {
                displayName = "input",
                displayType = TextureUtils.GetTypeFromDimension(dim),
                identifier = "input",
            });
        }
Exemple #6
0
        IEnumerable <PortData> OutputTextureType(List <SerializableEdge> edges)
        {
            var dim = textureAsset == null?rtSettings.GetTextureDimension(graph) : textureAsset is RenderTexture rt ? rt.dimension : textureAsset?.dimension;

            yield return(new PortData
            {
                displayName = "Texture",
                displayType = dim == null ? typeof(Texture) : TextureUtils.GetTypeFromDimension(dim.Value),
                identifier = nameof(outputTexture),
                acceptMultipleEdges = true,
            });
        }
Exemple #7
0
        protected IEnumerable <PortData> ChangeOutputPortType(List <SerializableEdge> edges)
        {
            TextureDimension dim         = (GetType() == typeof(ExternalOutputNode)) ? rtSettings.GetTextureDimension(graph) : (TextureDimension)rtSettings.dimension;
            Type             displayType = TextureUtils.GetTypeFromDimension(dim);

            foreach (var output in outputTextureSettings)
            {
                yield return(new PortData {
                    displayName = "",                     // display name is handled by the port settings UI element
                    displayType = displayType,
                    identifier = output.name,
                });
            }
        }
Exemple #8
0
        protected IEnumerable <PortData> ChangeOutputPortType(List <SerializableEdge> edges)
        {
            var dim = rtSettings.GetTextureDimension(graph);

            if (output != null)
            {
                UpdateTempRenderTexture(ref output);
                dim = output.dimension;
            }

            yield return(new PortData {
                displayName = "output",
                displayType = TextureUtils.GetTypeFromDimension(dim),
                identifier = "output",
                acceptMultipleEdges = true,
            });
        }
Exemple #9
0
        protected Type GetPropertyType(MaterialProperty prop)
        {
            switch (prop.type)
            {
            case MaterialProperty.PropType.Color:
                return(typeof(Color));

            case MaterialProperty.PropType.Float:
            case MaterialProperty.PropType.Range:
                return(typeof(float));

            case MaterialProperty.PropType.Texture:
                return(TextureUtils.GetTypeFromDimension(prop.textureDimension));

            default:
            case MaterialProperty.PropType.Vector:
                return(typeof(Vector4));
            }
        }
Exemple #10
0
        protected Type GetPropertyType(Shader s, int index)
        {
            switch (s.GetPropertyType(index))
            {
            case ShaderPropertyType.Color:
                return(typeof(Color));

            case ShaderPropertyType.Float:
            case ShaderPropertyType.Range:
                return(typeof(float));

            case ShaderPropertyType.Texture:
                return(TextureUtils.GetTypeFromDimension(s.GetPropertyTextureDimension(index)));

            default:
            case ShaderPropertyType.Vector:
                return(typeof(Vector4));
            }
        }