pymel.core.general.selectMode

selectMode(*args, **kwargs)

The selectModecommand is used to change the selection mode. Object, component, root, leaf and template modes are mutually exclusive.

Flags:

Long Name / Short Name Argument Types Properties
component / co bool ../../../_images/create.gif ../../../_images/query.gif
  Set component selection on. Component selection mode allows filtered selection based on the component selection mask. The component selection mask is the set of selection masks related to objects that indicate which components are selectable.
hierarchical / h bool ../../../_images/create.gif ../../../_images/query.gif
  Set hierarchical selection on. There are three types of hierarchical selection: root, leaf and template. Hierarchical mode is set if root, leaf or template mode is set. Setting to hierarchical mode will set the mode to whichever of root, leaf, or template was last on.
leaf / l bool ../../../_images/create.gif ../../../_images/query.gif
  Set leaf selection mode on. This mode allows the leaf level objects to be selected. It is similar to object selection mode but ignores the object selection mask.
object / o bool ../../../_images/create.gif ../../../_images/query.gif
  Set object selection on. Object selection mode allows filtered selection based on the object selection mask. The object selection mask is the set of selection masks related to objects that indicate which objects are selectable. The masks are controlled by the selectTypecommand. Object selection mode selects the leaf level objects.
preset / p bool ../../../_images/create.gif ../../../_images/query.gif
  Allow selection of anything with the mask set, independent of it being an object or a component.
root / r bool ../../../_images/create.gif ../../../_images/query.gif
  Set root selection mode on. This mode allows the root of a hierarchy to be selected by selecting any of its descendents. It ignores the object selection mask.
template / t bool ../../../_images/create.gif ../../../_images/query.gif
  Set template selection mode on. This mode allows selection of templated objects. It selects the templated object closest to the root of the hierarchy. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.selectMode

Example:

import pymel.core as pm

pm.selectMode( object=True )
pm.selectMode( q=True, component=True )
# Result: False #