Object Hierarchy | Related C++ Class: ShaderParamDefContainer
ShaderParamDefContainer
v9.0 (2011)
ICE Shaders
This object allows you to manage the list of input and output
parameters defined on a shader definition object (ShaderDef). It is kind of like an extra level
of abstraction on the ShaderParamDefCollection which
allows you to add and remove members but also access the real
ShaderParamDefCollection (via the ShaderParamDefContainer.Definitions
member) to iterate over the list of parameters.
There are three properties which return a ShaderParamDefContainer:
ShaderDef.InputParamDefs,
ShaderDef.OutputParamDefs, and
ShaderStructParamDef.SubParamDefs.
# # This example demonstrates how to create a dynamic shader definition # and then access/populate its input and output parameters via the # ShaderParamDefContainer interface. # from win32com.client import constants as cns app = Application oShaderDef = XSIFactory.CreateShaderDef("baddog", "mr_piddles", 1, 0)# oShaderDef.AddShaderFamily("mrTexture") app.LogMessage("Shader definition name: " + oShaderDef.Name) # Set up shader parameter definition options to use with new input parameter oShaderInParamDefOptions = XSIFactory.CreateShaderParamDefOptions(); oShaderInParamDefOptions.SetAnimatable(False) oShaderInParamDefOptions.SetTexturable(True) oShaderInParamDefOptions.SetInspectable(True) oShaderInParamDefOptions.SetShortName("Bones-y") # Add input parameter to definition oInputParams = oShaderDef.InputParamDefs oInputParams.AddParamDef("bonesy", cns.siShaderDataTypeColor4, oShaderInParamDefOptions) # Set up shader parameter definition options to use with new output parameter oShaderOutParamDefOptions = XSIFactory.CreateShaderParamDefOptions() oShaderOutParamDefOptions.SetAnimatable(False) oShaderOutParamDefOptions.SetTexturable(True) oShaderOutParamDefOptions.SetInspectable(True) oShaderOutParamDefOptions.SetShortName("Chew Toys") # Add output parameter to definition oOutputParams = oShaderDef.OutputParamDefs oOutputParams.AddArrayParamDef("chewtoys", cns.siShaderDataTypeStructure, oShaderOutParamDefOptions) # Now print info to see what we have for oShaderInParamDef in oShaderDef.InputParamDefs.Definitions : Application.LogMessage("Input parameter name: " + oShaderInParamDef.DisplayName) for oShaderOutParamDef in oShaderDef.OutputParamDefs.Definitions : Application.LogMessage("Output parameter name: " + oShaderOutParamDef.DisplayName) # Expected results: # INFO : Shader definition name: baddog.mr_piddles.1.0 # INFO : Input parameter name: Bones-y # INFO : Output parameter name: Chew Toys |
// See the example under the ShaderParamDefContainer.GetParamDefByName method reference page |