AddImageTextureLayer

Introduced

v4.0

Description

Adds a new texture layer on the input objects provided, and creates and connects a clip with the provided image file. See AddTextureLayer for more details about layers.

Scripting Syntax

oReturn = AddImageTextureLayer( FileName, [InputObjs], [Name], [After], [Reference] );

Return Value

Returns the new TextureLayer object, if one was created.

Parameters

Parameter Type Description
FileName String File name
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"

' Get an image to connect

Dim ImageFile

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

' Add a new layer with the provided image.

Dim oLayer

set oLayer = AddImageTextureLayer(ImageFile, oSphere.material & ".Phong")

logmessage "Created Layer " & oLayer

' Add the diffuse port to the layer

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

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

' Output of script:

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

'

' If you open the texture layer editor, you will find there is a single layer affecting

' the diffuse port of the Phong shader.

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

See Also

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