pymel.core.rendering.binMembership

binMembership(*args, **kwargs)

Command to assign nodes to bins.

Flags:

Long Name / Short Name Argument Types Properties
addToBin / add unicode ../../../_images/create.gif
  Add the nodes in a node list to a bin.
exists / ex unicode ../../../_images/create.gif
  Query if a node exists in a bin. The exists flag can take only one node.
inheritBinsFromNodes / ibn PyNode ../../../_images/create.gif
  Let the node in the flag’s argument inherit bins from nodes in the specified node list. The node list is specified as the object of the command.
isValidBinName / ivn unicode ../../../_images/create.gif
  Query if the specified bin name is valid. If so, return true. Otherwise, return false.
listBins / lb bool ../../../_images/create.gif ../../../_images/query.gif
  Query and return a list of bins a list of nodes belong to. If a bin contains any of the nodes in the selection list, then it should be included in the returned bin list.
makeExclusive / mke unicode ../../../_images/create.gif
  Make the specified nodes belong exclusively in the specified bin.
notifyChanged / nfc bool ../../../_images/create.gif
  This flag is used to notify that binMembership has been changed.
removeFromBin / rm unicode ../../../_images/create.gif
  Remove the nodes in a node list from a bin. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.binMembership

Example:

import pymel.core as pm

# Add a given node to a bin.
#
pm.binMembership( 'lambert1', addToBin='wood' )
# Add a selection of nodes to a given bin.
#
newLambertNode = pm.createNode('lambert')
list = ("lambert1", newLambertNode)
pm.binMembership( list, addToBin='grass' )
# Check if a node exists in a bin.
#
pm.binMembership( 'lambert1', exists='wood' )
# Result: True #
# Query and return all the nodes which belong to the bin.
#
newLambertNode = pm.createNode('lambert')
nodeList = ("lambert1", newLambertNode)
pm.binMembership( nodeList, query=True, listBins=True )
# Result: [u'wood', u'grass'] #
# Make the nodes belong exclusively in bin "wood".
#
newLambertNode = pm.createNode('lambert')
nodeList = ("lambert1", newLambertNode)
pm.binMembership( nodeList, makeExclusive='wood' )
# Let the dest node inherit bins from nodes in the src node list.
# The dest node is specified by the "inheritBinsFromNodes" flag's
# argument.
#
pm.binMembership( 'lambert1', addToBin='wood' )
node = pm.createNode('lambert')
pm.binMembership( node, addToBin='grass' )
srcNodeList = ("lambert1", node)
destNode = pm.createNode('blinn')
pm.binMembership( srcNodeList, inheritBinsFromNodes=destNode )
# Notify that binMembership has been changed.
#
pm.binMembership( notifyChanged=True )
# Check if a bin name is valid or not.  If valid, return true.
# Otherwise, return false.
#
pm.binMembership( isValidBinName='wood' )
# Result: True #