## Material.GetShaderInputType

### Introduced

v5.0

### Description

Returns the shader input type for the specified parameter. If the parameter cannot be connected to another shader GetShaderInputType returns siUnknownInputType.

### C# Syntax

    siShaderParameterType Material.GetShaderInputType( String Parametername );

### Scripting Syntax

    oReturn = Material.GetShaderInputType( ParameterScriptName );

### Return Value

siShaderParameterType

### Parameters

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

### Examples

#### JScript Example

    NewScene("", 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 the texture shader

    var mat = object.Material;

    var textureshader = null;

    // Different ways to get the texture shader:

    // Method 1

    textureshader = object.Material.CurrentTexture;

    // Method 2

    var shaders = mat.FindShaders(siShaderFilter);

    textureshader = shaders("Image");

    // Method 3

    textureshader = mat.Shaders("Phong").Shaders("diffuse_blend").Shaders("Image");

    // Set the texturespace parameters

    SetInstanceDataValue(null, textureshader+".tspace_id", "TxtProjection");

    textureshader.Parameters("tex").Connect(imageclip);

    // List the names and input types of all parameters that support shader connections

    var eParams = new Enumerator(mat.Parameters);

    for ( ; !eParams.atEnd(); eParams.moveNext() )

    {

    	var param = eParams.item();

    	if (param.capabilities & siTexturable)

    	{

    		var inputtype = mat.GetShaderInputType(param.scriptname);

    		// This parameter supports a shader connection

    		Application.LogMessage( param.FullName + " has shader inputtype = " + ShaderParameterTypeAsText(type) );

    	}

    }

    // Expected results:

    // INFO : MyModel.sphere.Material.surface has shader inputtype = 4

    // INFO : MyModel.sphere.Material.volume has shader inputtype = 4

    // INFO : MyModel.sphere.Material.environment has shader inputtype = 4

    // INFO : MyModel.sphere.Material.contour has shader inputtype = 4

    // INFO : MyModel.sphere.Material.displacement has shader inputtype = 3

    // INFO : MyModel.sphere.Material.shadow has shader inputtype = 4

    // INFO : MyModel.sphere.Material.Photon has shader inputtype = 4

    // INFO : MyModel.sphere.Material.PhotonVolume has shader inputtype = 4

    // INFO : MyModel.sphere.Material.normal has shader inputtype = 5

    // INFO : MyModel.sphere.Material.Lightmap has shader inputtype = 20

    // INFO : MyModel.sphere.Material.RealTime has shader inputtype = 16

    // INFO : MyModel.sphere.Material.material has shader inputtype = 12

    // Helper functions

    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 inputtype;

    	}

    }

### See Also

Shader.OutputType Parameter.ScriptName