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