RemoveShaderFromCnxPoint

RemoveShaderFromCnxPoint

導入

v1.0

詳細

指定のシェーダの接続ポイントからシェーダを切り離します。

スクリプト構文

oReturn = RemoveShaderFromCnxPoint( [Source], [InputObjs], [DeleteOnLastDisconnection] );

戻り値

接続解除されたシェーダを戻します。

パラメータ

パラメータ タイプ 説明
Source 文字列 接続解除するシェーダ

デフォルト値: 現在選択されている値

InputObjs 文字列 接続ポイントのリスト

デフォルト値: 現在選択されている値

DeleteOnLastDisconnection Boolean True を設定すると、このコマンドによって接続解除された既存のシェーダが削除されます。

デフォルト値: True

VBScript の例

'

' 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 lambert 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"

関連項目

AddObjectsToShader RemoveObjectsFromShader ApplyShader RemoveAllShadersFromCnxPoint SIConnectShaderToCnxPoint