Shader Parameter Definitions

 
 
 

Parameter definitions are stored in a special container represented as a ShaderParamDefContainer or ShaderParamDefContainer. On the ShaderDef or ShaderDef there is one ShaderParamDefContainer for input parameter definitions and another for outputs. In addition, when you create a parameter definition of type structure, its members are also stored in a ShaderParamDefContainer.

To get the ShaderParamDefContainer for ...

... use this access member

input parameters

ShaderDef.InputParamDefs or ShaderDef::GetInputParamDefs

output parameters

ShaderDef.OutputParamDefs or ShaderDef::GetOutputParamDefs

structure parameter members

StructParamDef.SubParamDefs or StructParamDef::GetSubParamDefs

From the ShaderParamDefContainer on an instantiated shader, you can access its collection of parameter definitions via the ShaderParamDefContainer.Definitions or ShaderParamDefContainer::GetDefinitions member, or to a specific member via the ShaderParamDefContainer.GetParamDefByName or ShaderParamDefContainer::GetParamDefByName method:

# Iterating over all input parameter definitions to find a struct containing a 
# member parameter definition called "mute"
oInputParamsContainer = oShaderDef.InputParamDefs
for oParamDef in oInputParamsContainer.Definitions :
	if (oParamDef.IsStructure) :
		oStructSubParamDefs = oParamDef.SubParamDefs
		oMuteParamDef = oStructSubParamDefs.GetParamDefByName("mute")
		Application.LogMessage("Found struct member paramdef called %s" % oMuteParamDef.DisplayName)
Important

Because plug-in based shader definitions are only populated when instantiated, you must instantiate a shader (for example, via scripting using the CreateShaderFromProgID command) before any ShaderParamDefContainers or ShaderParamDefContainers can return a list of parameter definitions.

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License