Update 10 Dec 2010: See this post about finding shaders using the ProgID.
In Softimage 2011, all [factory] shaders have the same Class ID ({6495C5C1-FD18-474E-9703-
AEA66631F7A7}), so FindObjects returns a collection that contains shaders in the scene.
Note that the returned collection will include the soft_light shader, as well as several hidden Lambert shaders that are used under-the-covers by Softimage.
var x = FindObjects(null, "{6495C5C1-FD18-474E-9703-AEA66631F7A7}" );
LogMessage( x.Count );
oEnum = new Enumerator( x ) ;
for (;!oEnum.atEnd();oEnum.moveNext() )
{
var oSelItem = oEnum.item() ;
try {
LogMessage( oSelItem.fullname );
i++;
}
catch(e)
{
LogMessage(e.message);
LogMessage( "\t" + ClassName(oSelItem) + ":" + oSelItem.name);
LogMessage( "\t" + oSelItem.GetShaderContainer() );
}
}
You could filter the returned collection for a specific type of shader. For example:
// Get all shaders
var x = FindObjects(null, "{6495C5C1-FD18-474E-9703-AEA66631F7A7}" );
LogMessage( x.Count );
var oShaderCollection = new ActiveXObject( "XSI.Collection" );
// Build up a collection of all Blinn shaders
oEnum = new Enumerator( x ) ;
for (;!oEnum.atEnd();oEnum.moveNext() )
{
var oShader = oEnum.item() ;
try {
//LogMessage( oShader.ProgID );
if ( oShader.ProgID == "Softimage.material-blinn.1.0" )
{
oShaderCollection.Add( oShader );
}
}
catch(e)
{
LogMessage(e.message);
}
}