Material.FindShaders

Introduced

v5.0

Description

Returns all shaders applied to the material that match a filter. If no matching shaders are found, FindShaders returns an empty collection.

C# Syntax

ShaderCollection Material.FindShaders( String Filter );

Scripting Syntax

oReturn = Material.FindShaders( Filter );

Return Value

ShaderCollection

Parameters

Parameter Type Description
Filter String Name of a shader Filter object. For example, you can use siShaderFilter (the standard Softimage shader filter), or you can use a custom filter.

Examples

JScript Example

/*

	This example demonstrates how to create an object 

	with a texture shader

*/

NewScene("", false);

var root = Application.ActiveProject.ActiveScene.Root;

var object = root.AddGeometry( "Cube", "MeshSurface" );

BlendInPresets( "Image", object, 1, false );

CreateProjection( object, siTxtSpherical, siTxtDefaultSpherical, "TxtSupport", "TxtProjection" );

var filename = XSIUtils.BuildPath(

	Application.InstallationPath(siFactoryPath),

	"Data", "XSI_SAMPLES", "Pictures", "xsilogo.jpg"

);

var imageclip = CreateImageClip( filename, "XSILogo" );

// Find the texture shader using the built-in Softimage shader filter

var colShaders = object.Material.FindShaders(siShaderFilter);

var textureshader = colShaders("Image");

// Set up a texture projection and image clip for the texture shader

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

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

See Also

Material.GetShaderInputType Light.FindShaders