RemoveTextureLayers
 
 
 

RemoveTextureLayers

Introduced

v4.0

Description

Removes a list of texture layers from a container (shader or material). If no container is provided, then it removes the layer(s) from all containers, effectively deleting them.

Scripting Syntax

RemoveTextureLayers( [InputObjs], [Container] );

Parameters

Parameter Type Description
InputObjs String List of layers which are to be removed from a container.

Default Value: Current selection.

Container String or object The container from which to remove the layers (if it currently contains them). If not specified, then the layers will be deleted from all containers in which they are found.

Examples

VBScript Example

'
' This example creates two shaders in a simple render tree, and applies
' texture layers to them.  Then it removes some of the layers, illustrating
' the RemoveTextureLayers command.
' In particular, it builds the following stacks of layers.
'
' Phong      Fractal
'   A           A
'   B           B
'   C           C
'
option explicit
dim oSph, oPhong, oFractal, oLyr(2)
' Build our shaders (a Phong and a Fractal), which will be the "texture
' layer containers" that will each be able to hold a stack of layers.
NewScene , False
set oSph = CreatePrim( "Sphere", "MeshSurface" )
set oPhong = SIApplyShader( "Phong", oSph )
set oFractal = BlendInPresetsInsp( "Fractal", , , True, siReplaceNoBlend, False, False, True )
' Now create and add all the layers, as indicated above.
' Add 'A', 'B' and 'C' to both containers at the end.
set oLyr(0) = AddTextureLayer( , oPhong & "," & oFractal, "A", True )
set oLyr(1) = AddTextureLayer( , oPhong & "," & oFractal, "B", True )
set oLyr(2) = AddTextureLayer( , oPhong & "," & oFractal, "C", True )
'
' Now start removing.  First we'll remove layer 'A' from just one
' of the containers.
RemoveTextureLayers oLyr(0), oPhong(0)
' Now we'll remove layer 'B' from all containers which hold it.
RemoveTextureLayers oLyr(1)
PrintTextureLayersInContainer oPhong
PrintTextureLayersInContainer oFractal
sub PrintTextureLayersInContainer( in_cont )
        dim oStack, oItem, oStr
        oStr = "Texture Layers in Container: " & in_cont & vbCrLf
        set oStack = EnumElements( in_cont & ".TextureLayers" )
        for each oItem in oStack
                oStr = oStr & "    " & oItem.name & vbCrLf
        next
        logmessage oStr
end sub
'
' The output from the example should look something like this:
'
'INFO : Texture Layers in Container: sphere.Material.Phong
'    C
'
'INFO : Texture Layers in Container: sphere.Material.Phong.Fractal
'    A
'    C
'

See Also

AddTextureLayer MoveTextureLayers AddTextureLayerPorts Shader.RemoveTextureLayer Material.RemoveTextureLayer