Object Hierarchy | 関連する C++クラス:ShaderParamDefOptions
ShaderParamDefOptions
v9.0 (2011)
このオブジェクトは、各シェーダパラメータ定義の特性を指定する便利な方法です(たとえば、表示名、デフォルト値、機能など)。表示名(および必要なその他の特性)のみを変更すれば、複数のパラメータに対して同じ ShaderParamDefOptions オブジェクトを使用することができます。
XSIFactory.CreateShaderParamDefOptionsメソッドは新しい ShaderParamDefOptions オブジェクトを作成します。このオブジェクトはパラメータ定義を追加するときにShaderParamDefContainer.AddParamDefまたはShaderParamDefContainer.AddArrayParamDefに渡す必要があります。
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 |