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

Synopsis

editDisplayLayerMembers([clear=boolean], [fullNames=boolean], [noRecurse=boolean], [ufeObjects=boolean])

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

editDisplayLayerMembers is undoable, queryable, and NOT editable.

This command is used to query and edit membership of display layers. No equivalent 'remove' command is necessary since all objects must be in exactly one display layer. Removing an object from a layer can be accomplished by adding it to a different layer.

Return value

intNumber of objects added to the layer
string[]Query: List of objects in layer

In query mode, return type is based on queried flag.

Keywords

displayLayer, display, layer, member, relationship

Related

createDisplayLayer, editDisplayLayerGlobals, layerButton

Flags

clear, fullNames, noRecurse, ufeObjects
Long name (short name) Argument types Properties
clear(clr)
2023
boolean create
Remove all the objects contained in the layer by moving them to the default layer.
fullNames(fn) boolean query
(Query only.) If set then return the full DAG paths of the objects in the layer. Otherwise return just the name of the object.
noRecurse(nr) boolean createquery
If set then only add selected objects to the display layer. Otherwise all descendants of the selected objects will also be added.
ufeObjects(ufe)
2023.3
boolean query
(Query only.) If set will return objects that are defined through the UFE interface as well as native Maya objects.

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

import maya.cmds as cmds

cmds.editDisplayLayerMembers( 'displayLayer1', 'sphere1', 'cone1' )
# Result : 2

cmds.editDisplayLayerMembers( 'displayLayer1', query=True )
# Result : sphere1 cone1

cmds.editDisplayLayerMembers( 'displayLayer1', 'expression1', 'sphere2' )
# Warning : Only DAG objects can be in a display layer.  'expression1' ignored.
# Result : 1

ufeSel = cmds.ls(selection=True, ufe=True)
cmds.editDisplayLayerMembers('layer1', ufeSel, noRecurse=True)
// Result: 1

cmds.editDisplayLayerMembers('layer1', clear=True)
# Result: 1