To find what shader families are defined on an existing shader definition
Use ShaderDef.ShaderFamilies or ShaderDef::GetShaderFamilies to retrieve a safearray of strings:
for sFamily in oShaderDef.ShaderFamilies : Application.LogMessage(sFamily) # ...
To find out the primary family defined on an existing shader definition
Use ShaderDef.PrimaryShaderFamily or ShaderDef::GetPrimaryShaderFamily to return the shader family ID as a string:
Application.LogMessage(oShaderDef.PrimaryShaderFamily)
To find out whether the specified family is defined as one of the shader families for an existing shader definition
Use ShaderDef.IsShaderFamily or ShaderDef::IsShaderFamily with one of the native Softimage shader families or a custom shader family you defined:
if (oShaderDef.IsShaderFamily("mrLight")) : # do something with light shaders else : # do something with non-light shaders
To assign registered shader families to a custom shader definitions
Use ShaderDef.AddShaderFamily or ShaderDef::AddShaderFamily, passing the shader family name for each shader family you want to add; however, the second parameter determines whether that family will be primary or not. So if you don't pass a value for that parameter, the last family added will be considered the primary family:
# Adds the lens shader family only oShaderDef.AddShaderFamily(siShaderFamilyLens) # Adds the data blob and texture families with texture as primary (because it's # the most versatile shader family--it has the fewest connection restrictions of anything) oShaderDef.AddShaderFamily(siShaderFamilyTexture, True) oShaderDef.AddShaderFamily(siShaderFamilyData, False) # Same thing but without specifying second parameter oShaderDef.AddShaderFamily(siShaderFamilyData) oShaderDef.AddShaderFamily(siShaderFamilyTexture)
To register a custom shader family in Softimage, see Creating Custom Shader Families. To use one of the native Softimage shader families, consult Native Softimage Shader Families for a list of supported families.