SIGetShaderOnCnxPoint

導入

v1.0

詳細

指定の接続ポイントにシェーダを接続します。

スクリプト構文

oReturn = SIGetShaderOnCnxPoint( InputObj );

戻り値

Shaderオブジェクトを戻します。

パラメータ

パラメータ タイプ 説明
InputObj 文字列 シェーダの接続ポイント

1. VBScript の例

' create objects for example. 

NewScene , false

CreatePrim "Cube", "MeshSurface"

ApplyShader

' Connect clear glass shader to material's surface

SIApplyShaderToCnxPoint InstallationPath(siFactoryPath) & "\Data\DSPresets\Shaders\Material\soft3d\Fire.Preset", "cube.Material.surface"

set shader = SIGetShaderOnCnxPoint(  "cube.Material.surface" )

logmessage "shader connected to cube.Material.surface: " & shader

'INFO : "shader connected to cube.Material.surface: cube.Material.Fire"

2. VBScript の例

'

' This example creates a sphere, applies a lambert shader to it, prints out

' the list of connection points to that shader, connects the toon shader 

' to the surface and shadow connection points 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

SIApplyShader InstallationPath( siFactoryPath ) _

				& "\Data\DSPresets\Shaders\Material\Lambert.Preset", _

				oSphere, "Christopher" 

' Log the name of the default shader connected to the material Surface 

' connection point

set oShader = SIGetShaderOnCnxPoint(  "sphere.material.Surface" )

' Print lambert shader info 

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:

'INFO : "surface is connected to Christopher"

'INFO : "shadow is connected to Christopher"

'INFO : "Photon is connected to Christopher"

関連項目

SIApplyShaderToCnxPoint RemoveShaderFromCnxPoint RemoveAllShadersFromCnxPoint SIConnectShaderToCnxPoint