Object Hierarchy | Related C++ Class: ShaderStructParamDef






v9.0 (2011)


This object is a specialization of the ShaderParamDef object. It allows you to access the sub-elements contained by this shader parameter (ShaderStructParamDef.SubParamDefs, which returns a list of sub parameter definitions in a ShaderParamDefContainer).

To create a ShaderStructParamDef object, specify the siShaderDataTypeStructure shader parameter type in the call to ShaderParamDefContainer.AddParamDef or ShaderParamDefContainer.AddArrayParamDef.


IsClassOf operator IsEqualTo operator    


Application Attributes operator Capabilities operator Categories
DataType operator DefaultValue operator DisplayName operator FullName operator
HasDefaultValue operator Help IsArray operator IsInput operator
IsOutput operator IsStructure operator MainPort operator MaxValue operator
MinValue operator Name operator NestedObjects Origin
OriginPath Parent SubParamDefs operator SuggestedMaxValue operator
SuggestedMinValue operator Texturable operator Type operator  


VBScript Example

' This example demonstrates how to create a dynamic shader definition 
' with an input struct parameter and then populate it with some
' sub parameters.
set app = Application
set oShaderDef = XSIFactory.CreateShaderDef("MyParser", "MyStructDemo", 1, 0)
oShaderDef.AddShaderFamily "mrTexture"
app.LogMessage "Shader definition name: " & oShaderDef.Name
' Set up shader parameter definition options to use with new input parameter
set oShaderInParamDefOptions = XSIFactory.CreateShaderParamDefOptions()
oShaderInParamDefOptions.SetAnimatable False
oShaderInParamDefOptions.SetTexturable True
oShaderInParamDefOptions.SetInspectable True
oShaderInParamDefOptions.SetShortName "Main Struct"
' Add input parameter to definition
set oInputParams = oShaderDef.InputParamDefs
oInputParams.AddParamDef "main", siShaderDataTypeStructure, oShaderInParamDefOptions
' Now print info to see what we have
for each oShaderInParamDef in oShaderDef.InputParamDefs.Definitions 
	app.LogMessage "Input parameter name: " & oShaderInParamDef.DisplayName
	app.LogMessage vbTab & "ClassName: " & app.ClassName(oShaderInParamDef)
	app.LogMessage vbTab & "DataType: " & oShaderInParamDef.DataType
	if oShaderInParamDef.DataType =  siShaderDataTypeStructure then
		set oSubContainer = oShaderInParamDef.SubParamDefs
		oShaderInParamDefOptions.SetShortName "SubColor 1"
		oSubContainer.AddParamDef "sub1", siShaderDataTypeColor4, oShaderInParamDefOptions
		oShaderInParamDefOptions.SetShortName "SubColor 2"
		oSubContainer.AddParamDef "sub2", siShaderDataTypeString, oShaderInParamDefOptions
		oShaderInParamDefOptions.SetShortName "SubColor 3"
		oSubContainer.AddParamDef "sub3", siShaderDataTypeGradient, oShaderInParamDefOptions
		app.LogMessage vbTab & "Number of sub parameter definitions: " & oShaderInParamDef.SubParamDefs.Definitions.Count
		for each oSubParamDef in oShaderInParamDef.SubParamDefs.Definitions
			app.LogMessage vbTab & "Sub parameter name: " & oSubParamDef.DisplayName
			app.LogMessage vbTab & vbTab & "ClassName: " & app.ClassName(oSubParamDef)
			app.LogMessage vbTab & vbTab & "DataType: " & oSubParamDef.DataType
	end if
' Expected result:
' INFO : Shader definition name: MyParser.MyStructDemo.1.0
' INFO : Input parameter name: Main Struct
' INFO : 	ClassName: ShaderStructParamDef
' INFO : 	DataType: 64
' INFO : 	Number of sub parameter definitions: 3
' INFO : 	Sub parameter name: SubColor 1
' INFO : 		ClassName: ShaderStructParamDef
' INFO : 		DataType: 10
' INFO : 	Sub parameter name: SubColor 2
' INFO : 		ClassName: ShaderParamDef
' INFO : 		DataType: 11
' INFO : 	Sub parameter name: SubColor 3
' INFO : 		ClassName: ShaderStructParamDef
' INFO : 		DataType: 18

See Also

ShaderParamDefContainer.AddParamDef ShaderParamDefContainer.AddArrayParamDef ShaderParameter.Definition ShaderParamDefContainer ShaderArrayParamDef Shader Definition examples installed with Softimage Shader Parser examples installed with Softimage