v1.0
shader
指定したアイテムにシェーダを適用します。 アイテムとは、オブジェクト、グループ、パーティション、クラスタ、シーン ルート、マテリアル、コンポーネント、ライト、カメラなど、シェーダに対応する対象物全般を指します。
oReturn = SIApplyShader( PresetObj, InputObjs, [Name], [PropagationType] ); |
Shader を含む XSICollection を戻します。
| パラメータ | タイプ | 詳細 |
|---|---|---|
| PresetObj | 文字列 またはプリセット オブジェクト(「SIGetPreset」を参照) | シェーダ プリセット |
| InputObjs | 文字列 | オブジェクトのリスト
デフォルト値: 現在選択されている値 |
| Name | 文字列 | シェーダ名
デフォルト値:デフォルトのシェーダ名 |
| PropagationType | siBranchFlag | シェーダ、ノード、またはブランチのプロパゲーション タイプ
デフォルト値: siUnspecified |
'
' This example creates a sphere, applies a lambert shader to it, prints out
' the list of connection points to that shader, disconnects the shadow and
' photon connection points from the shader and then prints the updated list.
'
' Create the sphere to which the shader will be connected
set oSphere = CreatePrim( "Sphere", "NurbsSurface" )
' Apply a default shader to instantiate the material
set oShader = SIApplyShader( InstallationPath( siFactoryPath ) _
& "\Data\DSPresets\Shaders\Material\Lambert.Preset", _
oSphere, "Christopher" )
' Convert the shader to a Shader object
set oShader = oShader(0)
' Print shader info (before disconnecting)
printShaderInfo oShader
' For convenience, create a collection to hold the parameters
' to be disconnected (Shadow and Photon connection points).
set oCnxPoints = CreateObject( "XSI.Collection" )
oCnxPoints.Add oSphere & ".material.Shadow"
oCnxPoints.Add oSphere & ".material.Photon"
' Use that collection to disconnect the shader from the material
RemoveShaderFromCnxPoint oShader, oCnxPoints
' Print shader info (after disconnecting)
printShaderInfo oShader
' This is a convenience routine that prints information about the shader
sub printShaderInfo( in_shader )
' From the shader object you can get the material it belongs to
set oMaterial = in_shader.Owners(0)
' Use the material to return the parameters that are connected and
' print out their names
for each p in oMaterial.Parameters
if TypeName( p.Source ) <> "Nothing" then
LogMessage p.ScriptName & " is connected to " & p.Source.Name
end if
next
end sub
' Output of the above script:
' ...before disconnecting
'INFO : "surface is connected to Christopher"
'INFO : "shadow is connected to Christopher"
'INFO : "Photon is connected to Christopher"
'
' ...after disconnecting
'INFO : "surface is connected to Christopher"
|