Go to: Synopsis. Return value. Keywords. Related. Flags. Python examples.

Synopsis

createDisplayLayer([empty=boolean], [makeCurrent=boolean], [name=string], [noRecurse=boolean], [number=int])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

createDisplayLayer is undoable, NOT queryable, and NOT editable.

Create a new display layer. The display layer number will be assigned based on the first unassigned number not less than the base index number found in the display layer global parameters. Normally all objects and their descendants will be added to the new display layer but if the '-nr' flag is specified then only the objects themselves will be added.

Return value

stringName of display layer node that was created

Keywords

displayLayer, display, layer, color, playback, render

Related

editDisplayLayerGlobals, editDisplayLayerMembers, layerButton

Flags

empty, makeCurrent, name, noRecurse, number
Long name (short name) Argument types Properties
empty(e) boolean create
If set then create an empty display layer. ie. Do not add the selected items to the new display layer.
makeCurrent(mc) boolean create
If set then make the new display layer the current one.
name(n) string create
Name of the new display layer being created.
noRecurse(nr) boolean create
If set then only add selected objects to the display layer. Otherwise all descendants of the selected objects will also be added.
number(num) int create
Number for the new display layer being created.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

#    Create a sphere.
#
objectArray = cmds.sphere()

#    Select the sphere.
#
cmds.select( objectArray[0] )

#    Create a layer. The selected object will be placed
#    in this layer. Note in this case both the nurbsSphere
#    and nurbsSphere shape are placed in the layer.
#
cmds.createDisplayLayer()

#    Create a cone.
#
objectArray = cmds.cone()

#    Select the cone.
#
cmds.select( objectArray[0] )

#    Create a layer but only put the nurbsCone in the layer.
#    The nurbsConeShape will remain in the default layer
#    as a result of specifying the -nr/noRecurse flag.
#
#    Note also that you can specify the name of the layer
#    with the -n/name flag.
#

cmds.createDisplayLayer( noRecurse=True, name='ExampleLayer' )