ls()
includes a type
flag, which lets you find scene nodes of a particular type. For example:
cameras = cmds.ls(type='camera')
// [u'topShape', u'sideShape', u'perspShape', u'frontShape']
You can search for multiple types in the same call:
geometry = cmds.ls(type=('mesh', 'nurbsCurve', 'nurbsSurface'))
You can also search for 'abstract' types, which correspond to Maya's internal class hierarchy. These to find out what node types a particular object represents, use the nodeType
command:
cmds.nodeType('pCubeShape1', i=True) # 'i' includes the inherited object types
// Result: [u'containerBase',
u'entity',
u'dagNode',
u'shape',
u'geometryShape',
u'deformableShape',
u'controlPoint',
u'surfaceShape',
u'mesh'] //
# in this example, ls with any of the above types will return `pCubeShape1`