SICreateLayer2

Introduced

v8.0 (2010)

Categories

layer

Description

Creates an empty Layer.

This command is similar to the SICreateLayer command except that it does not use output arguments so it is safe to use with languages that don't support passing arguments by reference, such as JScript and Python.

Scripting Syntax

oReturn = SICreateLayer2( [PresetObj], [Name], [LayerGroupName] );

Return Value

Returns the Layer.

Parameters

Parameter Type Description
PresetObj String or a preset object (see SIGetPreset) Layer preset to use

Default Value: "Default_New_Layer"

Possible Values:

Description:

Default_New_Layer Default new layer
Name String Name of the new layer

Default Value: If not specified, the name will be automatically generated.

LayerGroupName String Name of the layer group that will contain the new layer

Default Value: If not specified, the group containing the current layer will be used.

Examples

Python Example

#
# This example demonstrates how to use the SICreateLayer2 command 
#
app = Application
app.NewScene(None, 0)
# Convenience function to 
def checkCurrLayer() :
        # What is the current layer?
        rtn = app.GetCurrentLayer()
        oCurrLayer = rtn.Value("Value")
        app.LogMessage("Current layer is....." + oCurrLayer.FullName)
        app.LogMessage("Current layer is in layer group....." + str(oCurrLayer.LayerGroupName.Value))
# Get initial settings
checkCurrLayer()
# Make a new layer
oNewLayer = app.SICreateLayer2(None, "LayerA")
checkCurrLayer()
# Now explicitly set the new layer as current and check again
app.SetCurrentLayer(oNewLayer)
checkCurrLayer()
# Make another new layer
oNewLayer = app.SICreateLayer2(None, "LayerB", "GroupB")
app.SetCurrentLayer(oNewLayer)
checkCurrLayer()
#OUTPUT OF ABOVE SCRIPT IS:
#INFO : "Current layer is.....Layers.Layer_Default"
#INFO : Current layer is in layer group.....Group_Default
#INFO : "Current layer is.....Layers.Layer_Default"
#INFO : Current layer is in layer group.....Group_Default
#INFO : "Current layer is.....Layers.LayerA"
#INFO : Current layer is in layer group.....Group_Default
#INFO : "Current layer is.....Layers.LayerB"
#INFO : Current layer is in layer group.....GroupB

See Also

RenderPasses CreateLayer CreatePartition CreatePass SICreateLayer SICreateLayerFromSelection SICreateLayerFromSelection2 SICreatePartition