Finding shaders


Before Softimage 2011, we used to use FindObjects() with a shader CLSID to find all instances of a shader. But as of Softimage 2011, all shaders have the same CLSID, so you have to use the ProgID to find all instances of a certain type of shader.

// Find all Color_correction shader nodes

var sProgID = "Softimage.sib_color_correction.1.0"

var oShaderDef = Application.GetShaderDef( sProgID ) ;
oEnum = new Enumerator( oShaderDef.ShaderInstances ) ;
for (;!oEnum.atEnd();oEnum.moveNext() )
{
	var oShaderInstance = oEnum.item() ;
	LogMessage( oShaderInstance.fullname );
}

You can find the ProgID of a shader using the SDK Explorer:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s