ShaderArrayParameter

Object Hierarchy | 関連する C++クラス:ShaderArrayParameter

継承

SIObject

Parameter

ShaderParameter

ShaderArrayParameter

導入

v9.0 (2011)

カテゴリ

ICE シェーダ

詳細

Shaderの配列パラメータを表します。配列パラメータは特別な種類のShaderParameterであり、ShaderParameterオブジェクトのセットが含まれます。これらのタイプのパラメータは、パラメータのインスタンス数が動的に変わる場合に便利です。たとえば、Volume Effectsシェーダは「scatter_lights_input」というラベルのライトリファレンスの配列パラメータを含み、任意の数のライトを追加することができます。

このオブジェクトは、コレクション項目がシェーダ配列パラメータの場合に、ParameterCollectionプロパティを繰り返し処理して(Shader.Parameters を介して)取得します。

これらのタイプのパラメータは、ShaderArrayParamDefインターフェイスを使用して定義することができます。

メソッド

Addオペレータ AddCustomOp AddExpression AddFCurve
AddFCurve2 AddScriptedOp AddScriptedOpFromFile AnimatedParameters
Clearオペレータ Connect ConnectFromFile ConnectFromFile2
ConnectFromPreset ConnectFromPreset2 ConnectFromProgID ConnectFromProgID2
Disconnect Enableオペレータ GetInstanceValue GetValue2オペレータ
IsAnimated IsClassOfオペレータ IsEqualToオペレータ IsLockedオペレータ
IsSupportedInstanceValue Moveオペレータ PutValue2オペレータ Removeオペレータ
SetCapabilityFlagオペレータ SetInstanceValue SetLock Showオペレータ
UnSetLock      
       

プロパティ

Animatableオペレータ Application Capabilitiesオペレータ Categories
Countオペレータ DataTypeオペレータ Defaultオペレータ Definitionオペレータ
Descriptionオペレータ FullNameオペレータ HasInstanceValue Help
Itemオペレータ Keyableオペレータ LockLevelオペレータ LockTypeオペレータ
Marked Maxオペレータ Minオペレータ Model
Nameオペレータ NestedObjects Origin OriginPath
OriginalValueオペレータ OverridenObject OverridingObject Parametersオペレータ
Parent Parent3DObject ReadOnlyオペレータ ScriptNameオペレータ
Source Sources SuggestedMaxオペレータ SuggestedMinオペレータ
Tagsオペレータ Targetsオペレータ Typeオペレータ Valueオペレータ
ValueTypeオペレータ      
       

1. Python の例

# 
# This example demonstrates how to work with a ShaderArrayParameter by instantiating
# a shader that implements a shader array parameter, adding 2 elements to that array, 
# setting some values on the new elements, and then finding them again by iterating 
# over the shader parameters.
#
from win32com.client import constants as si
app = Application
app.NewScene("", False)
# Set up a cylinder with a Volume Effects shader 
app.GetPrimLight("Light_Box.Preset", "Light_Box")
app.GetPrimLight("LightFlat.Preset")
app.CreatePrim("Cylinder", "MeshSurface")
sh = app.CreateShaderFromProgID("Softimage.March_Fractal_vol.1.0", "Sources.Materials.DefaultLib.Scene_Material")
app.SIConnectShaderToCnxPoint("Sources.Materials.DefaultLib.Scene_Material.Volume_Effects.out", 
        "Sources.Materials.DefaultLib.Scene_Material.volume", False)
# Add 2 instances of the input array parameters and set some values on them
ap = sh.Parameters("scatter_lights_input");
app.SIAddArrayElement("Sources.Materials.DefaultLib.Scene_Material.Volume_Effects.scatter_lights_input")
app.SetReference2("Sources.Materials.DefaultLib.Scene_Material.Volume_Effects.scatter_lights_input.scatter_lights_input", "Light_Box")
app.SIAddArrayElement("Sources.Materials.DefaultLib.Scene_Material.Volume_Effects.scatter_lights_input")
app.SetReference2("Sources.Materials.DefaultLib.Scene_Material.Volume_Effects.scatter_lights_input.scatter_lights_input[1]", "light1")
# Now we can iterate over the list of items
for param in sh.Parameters :
        if (param.IsClassOf(si.siShaderParameterID)) :
                if (app.ClassName(param) == "ShaderArrayParameter") :
                        app.LogMessage("'" + param.ScriptName + "' is an array with " + str(param.Count) + " members")
# Expected output:
# INFO : 'scatter_lights_input' is an array with 2 members
# INFO : 'shadow_lights_input' is an array with 0 members
# INFO : 'trans_model' is an array with 0 members

2. JScript の例

/* 
        This example demonstrates how to work with a ShaderArrayParameter by instantiating
        a shader that implements a shader array parameter, and then manipulating the array
        using the Add and Remove methods.
        NB: This example manipulates the ParameterCollection directly instead of getting a
        pointer to it (eg., var pArrayParam = sh.Parameters("inputs")) because the proxy
        object (pointer) is not dynamic.
*/
app = Application;
NewScene(null, false);
// Set up a cylinder with a Volume Effects shader 
CreatePrim("Cylinder", "MeshSurface");
var sh = CreateShaderFromProgID("Softimage.March_Fractal_vol.1.0", "Sources.Materials.DefaultLib.Scene_Material");
SIConnectShaderToCnxPoint("Sources.Materials.DefaultLib.Scene_Material.Volume_Effects.out", 
        "Sources.Materials.DefaultLib.Scene_Material.volume", false);
// Add 3 instances of the inputs array parameters
sh.Parameters("shadow_lights_input").Add();
sh.Parameters("shadow_lights_input").Add();
sh.Parameters("shadow_lights_input").Add();
app.LogMessage("Found " + sh.Parameters("shadow_lights_input").Parameters.Count 
        + " element(s) on the inputs array parameter");
// Remove one of the elements
sh.Parameters("shadow_lights_input").Remove(1);
app.LogMessage("Now there are " + sh.Parameters("shadow_lights_input").Parameters.Count + " element(s)");
// Expected output:
// INFO : Found 3 element(s) on the inputs array parameter
// INFO : Now there are 2 element(s)

関連項目

ArrayParameter ShaderParameter