BlendInTextureLayersInsp

Introduced

v4.0

Description

Locates all the default texture connection points on the immediate shaders attached to the given objects. Creates the requested presets/images, and blends them all together with any existing shaders on the located connection points.

Same as BlendInTextureLayers except that it also inspects the newly created shaders.

Scripting Syntax

oReturn = BlendInTextureLayersInsp( [PresetNames], [InputObjs], [SharedMatAction], [NotifyNoResult], [Mode], [Ambient], [Diffuse], [Transparency], [Reflection] );

Return Value

Returns the layers created as an XSICollection. If the value of Mode is siReplaceNoBlend, the first preset is returned as a shader rather than a layer.

Parameters

Parameter Type Description
PresetNames String Shader Presets corresponding to the shaders and/or images you want to layer

Default Value: "Image"

InputObjs String List of objects to search for default texture connection points

Default Value: Current selection

SharedMatAction Integer Make shared materials local? Note: If "2" or "3" is used, a pop up dialog appears prompting the user to answer (0=No or 1=Yes). When the logged command is replayed, if "2" was used the command will automatically answer yes or no depending on the user's response. If "3" was used, the pop up dialog will reappear.

Default Value: 2 (Ask Beginner User)

Possible Values:

Description:

0 No
1 Yes
2 Ask beginner user
3 Ask advanced user
NotifyNoResult Boolean True to notify user if no presets created.

Default Value: False (no notification)

Mode siBlendInTextureLayersModes Method for blending in the new presets

Default Value: siBlendInTextureLayers (no replacement)

Ambient Boolean If true, blend in to the ambient port (if present)

Default Value: True (apply to ambient)

Diffuse Boolean If true, blend in to the diffuse port (if present)

Default Value: True (apply to diffuse)

Transparency Boolean If true, blend in to the transparency port (if present)

Default Value: false (don't apply to transparency)

Reflection Boolean If true, blend in to the reflection port (if present)

Default Value: false (don't apply to reflection)

Examples

VBScript Example

'

' This example demonstrates how to apply blended shaders to all texture ports on a

' cube. It also shows how to access the shader information both from the collection 

' returned by BlendInTextureLayersInsp and through the object's material.

'

NewScene , false

' Create a default cube

Set oBox = ActiveSceneRoot.AddGeometry( "Cube", "MeshSurface" )

' Apply Cloud and Gradient presets on all texture ports

Set oLayers = BlendInTextureLayersInsp( "Cloud,Gradient", oBox, 1, False, False )

' At this point you will also see a Multiple Property Sets page pop up for the shaders.

' Now display the name of the created shaders:

For Each oLayer In oLayers

	Set oShader = SIGetShaderOnCnxPoint( oLayer & ".color" )

	Application.LogMessage oLayer.Name & " created with shader " & oShader.Name

Next

' View the results in a rendered frame. (The colors appear quite smooth.)

RenderPasses oDefPass, 1, 1

' Set the mode of the Gradient to "Darken":

SetValue oBox.Material.Shaders( "Phong" ) & ".Gradient_Layer.mode", 8

' View the results in a rendered frame. (Now the colors seem to be quite mottled.) 

RenderPasses oDefPass, 1, 1

' Output of above script:

'INFO : "Cloud_Layer created with shader Cloud"

'INFO : "Gradient_Layer created with shader Gradient"

See Also

BlendInTextureLayers BlendInTextureLayersWithPorts BlendInTextureLayersWithPortsInsp BlendClipsInTextureLayers BlendClipsInTextureLayersWithPorts BlendClipsInTextureLayersWithPortsInsp SIConnectShaderToCnxPoint