MEL/Python to select all objects from a layer (from one selected object of that layer)


Hello !

I have hundreds of layers.
I select an object in the scene, which is on a layer, lost in the list.
I’m looking for a shelf command to select all other objects on that layer.

Currently I grab the object’s layer name and I do “layerEditorSelectObjects layerName;”
Meaning I copy/paste the layer name for it to work.

Is there a simple way to make it work in one click after selecting an object ?

Thank you !


@AwenC try something like that

import maya.cmds as mc

layer = mc.listConnections(t="displayLayer")
nodeList = mc.listHistory(layer,f=1),d=1)


Hey !

Thank you man ! It works great.
Pretty handy, it will prove quite useful.