v1.0
Connects the shader to the specified connection point.
oReturn = SIGetShaderOnCnxPoint( InputObj ); |
Returns the Shader object.
| Parameter | Type | Description |
|---|---|---|
| InputObj | String | Shader connection point. |
' 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" |
'
' 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