RemoveAllShadersFromCnxPoint

導入

v1.0

詳細

指定のシェーダの接続ポイントから、すべてのシェーダを接続解除します。接続しているシェーダに関する情報のほか、実際にシェーダが接続していたかどうかは表示されません。

2 番目の引数により、接続解除するシェーダのタイプを指定できます。

注: 以前に接続を解除して使用されなくなったシェーダは自動的に削除されます。

スクリプト構文

RemoveAllShadersFromCnxPoint( [InputObjs], [Type] );

パラメータ

パラメータ タイプ 説明
InputObjs 文字列 接続ポイントのリスト。

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

Type siShaderCnxPointType 接続解除する接続ポイントのタイプ

デフォルト値: siShaderCnxPointAll

VBScript の例

'

' This example demonstrates how to disconnect shaders on a scene object. It

' also shows how you can find out whether the object's material is connected

' to a shader or a texture.

'

sPath = XSIUtils.BuildPath( _

	Application.InstallationPath( siFactoryPath ), _

	"Data", "XSI_SAMPLES", "Scenes", "Rendering", _

	"Rendertree_Displacement_Cell.scn" _

)

OpenScene sPath, False

' Select the grid and get a pointer to it

SelectObj "grid"

Set oGrid = Selection(0)

' Output at this point (before removing the shaders):

' INFO : --------------------------------------------

' INFO : Found a shader on Surface

' INFO : Found a texture on Displacement

' INFO : Found a shader on Shadow

' INFO : Found a shader on Photon

displayDetails oGrid

' Disconnect the shaders, if any, connected to the grid material Volume,

' Displacement and Photon connection points. (Note that specifying the 

' Volume parameter is redundant in this case since it is not connected)

Set oCnxPoints = CreateObject( "XSI.Collection" )

oCnxPoints.Add oGrid.Material.Parameters( "volume" )

oCnxPoints.Add oGrid.Material.Parameters( "displacement" )

oCnxPoints.Add oGrid.Material.Parameters( "photon" )

RemoveAllShadersFromCnxPoint oCnxPoints, siShaderCnxPointAll

' Output at this point (notice that we only disconnected the shaders on the

' Displacement and Photon points so we still have shaders on Surface and

' Shadow):

' INFO : --------------------------------------------

' INFO : Found a shader on Surface

' INFO : Found a shader on Shadow

displayDetails oGrid

' ----------------------------------------------------------------------

function displayDetails( in_obj )

	Application.LogMessage "--------------------------------------------"

	' Look for each parameter that is connected to a shader and print its name

	For Each p In in_obj.Material.Parameters

		If TypeName( p.Source ) = "Shader" Then

			Application.LogMessage "Found a shader on " & p.Name

		ElseIf TypeName( p.Source ) = "Texture" Then

			Application.LogMessage "Found a texture on " & p.Name

		End If

	Next

end function

関連項目

AddObjectsToShader RemoveObjectsFromShader ApplyShader RemoveShaderFromCnxPoint SIConnectShaderToCnxPoint