pymel.core.general.instanceable

instanceable(*args, **kwargs)

Flags one or more DAG nodes so that they can (or cannot) be instanced. This command sets an internal state on the specified DAG nodes which is checked whenever Maya attempts an instancing operation. If no node names are provided on the command line then the current selection list is used. Sets are automatically expanded to their constituent objects. Nodes which are already instanced (or have children which are already instanced) cannot be marked as non-instancable.

Flags:

Long Name / Short Name Argument Types Properties
allow / a bool ../../../_images/create.gif ../../../_images/query.gif
  Specifies the new instanceable state for the node. Specify true to allow the node to be instanceable, and false to prevent it from being instanced. The default is true (i.e. nodes can be instanced by default).
recursive / r bool ../../../_images/create.gif
  Can be specified with the -allow flag in create or edit mode to recursively apply the -allow setting to all non-shape children of the selected node(s). To also affect shapes, also specify the -shape flag along with -recursive.
shape / s bool ../../../_images/create.gif
  Can be specified with the -allow flag in create or edit mode to apply the -allow setting to all shape children of the selected node(s). This flag can be specified in conjunction with the -recursive flag. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.instanceable

Example:

import pymel.core as pm

# create a sphere.
# flag the transform and its shape as non-instanceable, then try to instance the sphere.
# you get an error because the shape is non-instanceable.
pm.sphere()
# Result: [nt.Transform(u'nurbsSphere1'), nt.MakeNurbSphere(u'makeNurbSphere1')] #
pm.instanceable( allow=0, shape=True )
pm.instance()
# Error: '|nurbsSphere1' has non-instanceable children thus it cannot be instanced.
# Flag the sphere and its shape as instanceable. Then it can be instanced.
pm.instanceable( allow=1, shape=True )
pm.instance()
nurbsSphere2