## Shader.GetShaderInputType

### Introduced

v5.0

### Description

Returns the shader input type for a parameter. If the parameter cannot be connected to a shader, GetShaderInputType returns siUnknownParameterType.

### C# Syntax

    siShaderParameterType Shader.GetShaderInputType( String in_Param );

### Scripting Syntax

    oReturn = Shader.GetShaderInputType( ParameterScriptName );

### Return Value

siShaderParameterType

### Parameters

Parameter | Type | Description
--- | --- | ---
ParameterScriptName | String | Script name of parameter.

### Examples

#### JScript Example

    /*
            This example shows how to traverse a shader tree and list the
            available shader inputs and their input types.
    */
    NewScene(null,false);
    // Create an object with a texture shader
    var root = Application.ActiveProject.ActiveScene.Root;
    var model = root.AddModel();
    model.name = "MyModel";
    var object = model.AddGeometry( "Sphere", "MeshSurface" );
    BlendInPresets( "Image", object, 1, false );
    CreateProjection( object, siTxtSpherical, siTxtDefaultSpherical, "TxtSupport", "TxtProjection" );
    var filename = Application.InstallationPath( siFactoryPath ) +
            "\\Data\\XSI_SAMPLES\\Pictures\\xsilogo.jpg";
    var imageclip = CreateImageClip( filename, "XSILogo" );
    // Set up the texture space on texture shader
    var mat = object.Material;
    var textureshader = object.Material.CurrentTexture;
    // Set the texturespace parameter
    SetInstanceDataValue(null, textureshader+".tspace_id", "TxtProjection");
    textureshader.parameters("tex").Connect(imageclip);
    // Select the texture shader
    SelectObj("MyModel.sphere.Material.Image");
    // Get an object from the selection list
    var obj = selection(0);
    // Object is a shader
    if ( obj.isclassof( siShaderID ) )
    {
            // Get the material from shader
            var mat = obj.Root;
            traverse_shadernode(mat);
    }
    // Expected results:
    // INFO : Sources.Materials.DefaultLib.Material.ambient_blend.base_color is free to be connected to a shader that will match input type siColorParameterType
    // INFO : Sources.Materials.DefaultLib.Material.Image.repeats is free to be connected to a shader that will match input type siVectorParameterType
    // INFO : Sources.Materials.DefaultLib.Material.Image.alt_x is free to be connected to a shader that will match input type siBooleanParameterType
    // INFO : Sources.Materials.DefaultLib.Material.Image.alt_y is free to be connected to a shader that will match input type siBooleanParameterType
    // INFO : Sources.Materials.DefaultLib.Material.Image.alt_z is free to be connected to a shader that will match input type siBooleanParameterType
    // INFO : Sources.Materials.DefaultLib.Material.Image.min is free to be connected to a shader that will match input type siVectorParameterType
    // INFO : Sources.Materials.DefaultLib.Material.Image.max is free to be connected to a shader that will match input type siVectorParameterType
    // etc.
    // Helper functions
    function traverse_shadernode( shadernode )
    {
            if ( ! shadernode ) { return; }
            if (! ( shadernode.isclassof( siShaderID ) ||
                     shadernode.isclassof( siMaterialID ) ||
                     shadernode.isclassof( siLightID ) ||
                     shadernode.isclassof( siCameraID )) )
                    { return; }
            // Traverse the occupied shader inputs
            var eParam = new Enumerator(shadernode.parameters);
            for ( ;!eParam.atEnd(); eParam.moveNext() )
            {
                    var param = eParam.item();
                    if (param.capabilities & siTexturable)
                    {
                            var nextnode = param.source;
                            // parameter connected to shader node
                            if ( nextnode != null )
                                    traverse_shadernode( nextnode );
                            else // parameter free
                            {
                                    var inputtype = shadernode.GetShaderInputType(param.scriptname);
                                    LogMessage( param.fullname + " is free to be connected to a shader that will match input type "
                                            + ShaderParameterTypeAsText(inputtype));
                            }
                    }
            }
    }
    function ShaderParameterTypeAsText(type)
    {
            switch (type)
            {
                    case siUnknownParameterType : return "siUnknownParameterType";
                    case siBooleanParameterType : return "siBooleanParameterType";
                    case siColorParameterType : return "siColorParameterType";
                    case siDataParameterType : return "siDataParameterType";
                    case siIntegerParameterType : return "siIntegerParameterType";
                    case siLensParameterType : return "siLensParameterType";
                    case siLightParameterType : return "siLightParameterType";
                    case siMaterialParameterType : return "siMaterialParameterType";
                    case siMatrixParameterType : return "siMatrixParameterType";
                    case siModelParameterType : return "siModelParameterType";
                    case siRealTimeParameterType : return "siRealTimeParameterType";
                    case siReferenceParameterType : return "siReferenceParameterType";
                    case siScalarParameterType : return "siScalarParameterType";
                    case siShaderParameterType : return "siShaderParameterType";
                    case siStringParameterType : return "siStringParameterType";
                    case siStructParameterType : return "siStructParameterType";
                    case siTextureParameterType : return "siTextureParameterType";
                    case siTextureSpaceParameterType : return "siTextureSpaceParameterType";
                    case siVectorParameterType : return "siVectorParameterType";
                    default: return type;
            }
    }

### See Also

Shader.GetShaderParameterTargets Shader.GetShaderParameterType Shader.OutputType Parameter.HasInstanceValue Parameter.SetInstanceValue Parameter.GetInstanceValue Parameter.ScriptName