Object Hierarchy | Related C++ Class: ShaderParamDefOptions
ShaderParamDefOptions
v9.0 (2011)
This object provides a convenient way to specify certain characteristics for each shader parameter
definition (for example, display name, default values, capabilities, etc.). You can use the same
ShaderParamDefOptions object for multiple parameters, changing only the display name (and any other
characteristics you need to).
The XSIFactory.CreateShaderParamDefOptions method creates a new ShaderParamDefOptions
object which you need to pass to the ShaderParamDefContainer.AddParamDef or
ShaderParamDefContainer.AddArrayParamDef when adding parameter definitions.
IsClassOf | IsEqualTo | SetAnimatable | SetAttribute |
SetDefaultValue | SetHardLimit | SetInspectable | SetLongName |
SetReadOnly | SetShortName | SetSoftLimit | SetTexturable |
# # This example demonstrates how to create a dynamic shader definition # with 2 input parameters. Before adding the input parameters, a # ShaderParamDefOptions object is created, populated, and then # passed into the ShaderParamDefContainer.AddParamDef method. # from win32com.client import constants as cns app = Application oShaderDef = XSIFactory.CreateShaderDef("MyParserName", "MyDynamicShader", 1, 0) oShaderDef.AddShaderFamily("mrTexture") app.LogMessage("Shader definition name: " + oShaderDef.Name) # Set up shader parameter definition options to use with the first input parameter oShaderInParamDefOptions = XSIFactory.CreateShaderParamDefOptions() oShaderInParamDefOptions.SetAnimatable(False) oShaderInParamDefOptions.SetTexturable(True) oShaderInParamDefOptions.SetReadOnly(False) oShaderInParamDefOptions.SetInspectable(True) oShaderInParamDefOptions.SetShortName("Main Port") # Add input array parameter to definition oInputParams = oShaderDef.InputParamDefs oInputParams.AddParamDef("main", cns.siColorParameterType, oShaderInParamDefOptions) # You can use the same parameter definition options and just modify what you need oShaderInParamDefOptions.SetAnimatable(True) oShaderInParamDefOptions.SetShortName("Secondary Port") oInputParams.AddParamDef("secondary", cns.siShaderDataTypeBoolean, oShaderInParamDefOptions) # Now print out the info app.LogMessage("Number of parameter(s) found: " + str(oInputParams.Definitions.Count)) for oShaderParamDef in oInputParams.Definitions : app.LogMessage("\t" + oShaderParamDef.DisplayName) # INFO : Shader definition name: MyParserName.MyDynamicShader.1.0 # INFO : Number of parameter(s) found: 2 # INFO : Main Port # INFO : Secondary Port |