AddClipTextureLayer

Introduced

v4.0

Description

Adds a new texture layer on the input objects provided, connecting the existing clip or source. See AddTextureLayer for more details about layers.

If a source is provided, a clip is automatically created and connected.

Scripting Syntax

oReturn = AddClipTextureLayer( Clip, [InputObjs], [Name], [After], [Reference] );

Return Value

Returns the new TextureLayer object, if one was created.

Parameters

Parameter Type Description
Clip String Clip (or source) to attach to the newly created layer.
InputObjs String List of containers (shaders or materials) to which to add the texture layer. Note that all containers must currently be contained in a single render tree.

Default Value: Current selection.

Name String Name to use for the new layer. If an existing layer is being passed in, then this argument is ignored.
After Boolean True to insert the new texture layer after the reference layer. False to insert it before. If no reference layer, then True will add at the end of the container's list, False will add it at the start.

Default Value: True

Reference String or object Reference texture layer, to indicate where the newly-added layer should be located in the stack. The layer will be inserted adjacent to (before or after) the reference layer. If not specified, then the new layer will be added at the beginning or the end, depending on the value of the "After" argument.

Examples

VBScript Example

' Create a sphere, add a default material and texture projection

NewScene , false

set oSphere =  CreatePrim("Sphere", "MeshSurface")

ApplyShader , , , , siLetLocalMaterialsOverlap

CreateProjection oSphere, siTxtPlanarXY, siTxtDefaultSpherical, "Texture_Support", "Texture_Projection"

' Create a new clip

Dim oSourceObj, ImageFile

ImageFile = Application.InstallationPath( siFactoryPath ) & "/Data/XSI_SAMPLES/Pictures/xsilogo.jpg"

SIAddImageSource ImageFile, "XSIlogo", oSourceObj

' Now create an image clip from the image source.

Dim oClipObj 

set oClipObj = AddImageClip( oSourceObj, "XSIlogo_Clip" )

' Add a new layer with the provided image.

Dim oLayer

set oLayer = AddClipTextureLayer(oClipObj, oSphere.material & ".Phong")

logmessage "Created Layer " & oLayer

' Add the diffuse port to the layer

AddTextureLayerPorts oLayer, oSphere.material & ".Phong.diffuse"

' If we provide a source, a clip is automatically created.

set oLayer = AddClipTextureLayer(oSourceObj, oSphere.material & ".Phong")

logmessage "Created Layer " & oLayer

' Add the transparency port to the layer

AddTextureLayerPorts oLayer, oSphere.material & ".Phong.specular"

'-------------------------

' Output of script:

'

'INFO : "Created Layer Sources.DefaultLib.Material.Phong.XSIlogo_Clip_Layer"

'INFO : "Created Layer Sources.DefaultLib.Material.Phong.XSIlogo_Layer"

'

' If you open the texture layer editor, you will find there are two layers, one affecting

' the diffuse component and the other the transparency component of the Phong shader.

'-------------------------

See Also

AddTextureLayer RemoveTextureLayers MoveTextureLayers AddTextureLayerPorts AddImageTextureLayer AddPresetTextureLayer BlendInTextureLayers Shader.CreateTextureLayer Shader.AddSharedTextureLayer Material.CreateTextureLayer Material.AddSharedTextureLayer