A heterogenous list of MObjects, MPlugs and MDagPaths.
__init__()
Initializes a new, empty MSelectionList object.
__init__(MSelectionList other)
Initializes a new MSelectionList object containing the same
items as another list.
MSelectionList is currently a stub which only implements a small portion of the class's total functionality.
Constructors
Signature
Parameters
Description
MSelectionList()
Default constructor. Returns a new, empty MSelectionList object.
Copy constructor. Returns a new MSelectionList with the same contents as src.
str() Support
Available in Maya 2012 HotFix 1:
Returns a string showing the result of the getSelectionStrings() method as a tuple. E.g. ('time1', 'persp.tx', 'meshShape1.f[3:5]')
repr() Support
Default.
Constructor & Destructor Documentation
OpenMaya.MSelectionList.__init__
(
)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Member Function Documentation
OpenMaya.MSelectionList.__str__
(
)
x.__str__() <==> str(x)
OpenMaya.MSelectionList.add
(
)
add(pattern, searchChildNamespaces=False) -> self
add(item, mergeWithExisting=True) -> self
The first version adds to the list any nodes, DAG paths, components
or plugs which match the given the pattern string.
The second version adds the specific item to the list, where the
item can be a plug (MPlug), a node (MObject), a DAG path (MDagPath)
or a component (tuple of (MDagPath, MObject) ).
Signature:
add(pattern, searchChildNamespaces=False)
Parameters:
pattern - string
searchChildNamespaces - bool
Returns:
Reference to self.
Description:
Adds to the list any nodes, DAG paths, components or plugs which match the given pattern.
Adds a node, DAG path, plug or component to the end of the selection list. A component is passed as a tuple containing the MDagPath of the DAG node and an MObject containing the component.
If mergeWithExisting is True and the item is already on the list then those existing instances of the item will be removed, leaving just the newly added instance at the end of the list. For components this applies at the component element level, meaning that any overlapping elements will be removed from the existing components. If mergeWithExisting is False then the new item is added to the end of the list without affecting any existing instances of the item already on the list.
Replaces the contents of the selection list with a copy of those from src.
OpenMaya.MSelectionList.getComponent
(
)
getComponent(index) -> (MDagPath, MObject)
Returns the index'th item of the list as a component, represented by
a tuple containing an MDagPath and an MObject. If the item is just a
DAG path without a component then MObject.kNullObj will be returned
in the second element of the tuple. Raises TypeError if the item is
neither a DAG path nor a component. Raises IndexError if index is
out of range.
Returns the index'th item of the list as a component, represented by a tuple containing the item's MDagPath and an MObject containing its component. If the item is just a DAG path without a component then MObject.kNullObj will be returned in the second element of the tuple. Raises TypeError if the item is neither a DAG path nor a component. Raises IndexError if index is out of range.
OpenMaya.MSelectionList.getDagPath
(
)
getDagPath(index) -> MDagPath
Returns the DAG path associated with the index'th item of the list.
Raises TypeError if the item is neither a DAG path nor a component.
Raises IndexError if index is out of range.
Returns the DAG path associated with the index'th item of the list. Raises TypeError if the item is neither a DAG path nor a component. Raises IndexError if index is out of range.
Release Note: In Maya 2012 Gold this method returned a tuple containing both the DAG path and the component. In Maya 2012 HotFix 1 that functionality is supplied by the getComponent() method and this method returns only the DAG path. Existing code which uses this method will have to be modified accordingly.
OpenMaya.MSelectionList.getDependNode
(
)
getDependNode(index) -> MObject
Returns the node associated with the index'th item, whether it be a
dependency node, DAG path, component or plug.
Raises kFailure if there is no dependency node associated with the current item.
Raises IndexError if index is out of range.
Returns the node associated with the index'the item, whether it be a dependency node, DAG path, component or plug. Raises IndexError if index is out of range.
OpenMaya.MSelectionList.getPlug
(
)
getPlug(index) -> MPluggetPlug(index, convertComponents) -> MPlug
Returns the index'th item of the list as a plug. Raises TypeError if
the item is not a plug. Raises IndexError if index is out of range.
If convertComponents is True then components in the selection list that have a corresponding plug will return that instead.
Note: This only works if the component selection can be converted into a single plug - single component or all components selected.
Returns the index'th item of the list as a plug. Raises TypeError if the item is not a plug. Raises IndexError if index is out of range.
OpenMaya.MSelectionList.getSelectionStrings
(
)
getSelectionStrings(index=None) -> (string, string, ...)
Returns a tuple containing the string representation of the
specified item. For nodes, DAG paths, plugs and contiguous
components the tuple will only contain a single string, but for non-
contiguous components there will be a separate string for each
distinct block of contiguous elements. If index is not specified
then the string representations of all the items in the selection
list are returned. Raises IndexError if index is out of bounds.
Signature:
getSelectionStrings(index=None)
Parameters:
index - int
Returns:
tuple of strings
Description:
Returns a tuple containing the string representation of the specified item. For nodes, DAG paths, plugs and contiguous components the tuple will only contain a single string, but for non-contiguous components there will be a separate string for each distinct block of contiguous elements. If index is not specified then the string representations of all the items in the selection list are returned. Raises IndexError if index is out of bounds.
OpenMaya.MSelectionList.hasItem
(
)
hasItem(item) -> bool
Returns True if the given item is on the selection list. For a
component this means that all of the elements of the component must
be on the list. A component is passed as a tuple containing the
MDagPath of the DAG node and an MObject containing the component.
Returns True if the given item is on the selection list. For a component this means that all of the elements of the component must be on the list. A component is passed as a tuple containing the MDagPath of the DAG node and an MObject containing the component.
OpenMaya.MSelectionList.hasItemPartly
(
)
hasItemPartly(dagPath, component) -> bool
Returns True if at least one of the component's elements is on the
selection list. Raises TypeError if dagPath is invalid or component
does not contain a component.
Returns True if at least one of the component's elements is on the selection list. Raises TypeError if dagPath is invalid or component does not contain a component.
OpenMaya.MSelectionList.intersect
(
)
intersect(other, expandToLeaves=False) -> self
Modify this list to contain the intersection of itself and the given list.
OpenMaya.MSelectionList.isEmpty
(
)
isEmpty() -> bool
Returns True if the selection list is empty.
Returns the number of items on the selection list.
OpenMaya.MSelectionList.merge
(
)
merge(other, strategy=kMergeNormal) -> self
merge(dagPath, component, strategy=kMergeNormal) -> self
The first version merges the items from another selection list in
with those already on the list, using the given strategy.
The second version merges the specified component with those already
on the list.
Merges the specified<span> component in with those already on the list, using the given<span> strategy.
OpenMaya.MSelectionList.remove
(
)
remove(index) -> self
Removes the index'th item from the list. Raises IndexError if the
index is out of range.
Signature:
remove(index)
Parameters:
index - int
Returns:
Reference to self
Description:
Removes the index'th item from the list. Raises IndexError if the index is out of range.
OpenMaya.MSelectionList.replace
(
)
replace(index, newItem) -> self
Replaces the index'th item on the list with a new item. A component
is passed as a tuple containing the MDagPath of the DAG node and an
MObject containing the component. Raises IndexError if the index is
out of range.
Replaces the index'th item on the list with newItem. A component is passed as a tuple containing the MDagPath of the DAG node and an MObject containing the component. Raises IndexError if the index is out of range.
OpenMaya.MSelectionList.toggle
(
)
toggle(dagPath, component) -> self
Removes from the list those elements of the given component which
are already on it and adds those which are not.