UIApplyShaderToCnxPoints

Introduced

v1.0

Description

Pops up a menu of shader presets to let the user select one, then instantiates this shader and connects it to the specified connection points of another shader through intermediate Mix 2 Colors shaders.

Note: The command fails if the selected shader cannot be connected to the connection points because of connection type mismatch or because shaders are already connected to it.

Scripting Syntax

UIApplyShaderToCnxPoints( [InputObj], [InputObjs], [X], [Y] );

Parameters

Parameter Type Description
InputObj This parameter is NOT USED.
InputObjs String List of connection points

Default Value: Current Selection

X Long X screen coordinate of menu (from left of screen)

Default Value: 0

Y Long Y screen coordinate of menu (from top of screen)

Default Value: 0

Examples

VBScript Example

'

' This example demonstrates how to get the user to select a shader and use it to create

' a complex shader with intermediate Mix 2 Colors shaders

'

NewScene , false

' Get the default pass

Set oDefPass = GetValue( "Passes.Default_Pass" )

' Create a sphere and apply a default shader to instantiate a local material.

Set oSphere = CreatePrim( "Sphere", "NurbsSurface" )

ApplyShader , oSphere

' The Render Tree shows a Phong shader connected to the sphere material.

OpenView "Render Tree"

SelectObj oSphere

' Pop up a menu of shader presets on top of the Top viewport

' and let the user interactively select one.

set l_CnxPoints = CreateObject( "XSI.Collection" )

l_CnxPoints.Add "sphere.material.surface.Phong.diffuse"

l_CnxPoints.Add "sphere.material.surface.Phong.specular"

UIApplyShaderToCnxPoints , l_CnxPoints, 300, 100

' The user-selected shader, automatically renamed Shader, is connected

' to the Phong shader Diffuse and Specular connection points through

' intermediate Mix 2 Colors shaders as can be seen in the Render Tree.

OpenView "Render Tree"

SelectObj oSphere

See Also

AddObjectsToShader RemoveObjectsFromShader ApplyShader RemoveShaderFromCnxPoint RemoveAllShadersFromCnxPoint SIConnectShaderToCnxPoint SIApplyShaderToCnxPoint