mrv.maya.nt.base

Epydoc: mrv.maya.nt.base

Contains some basic classes that are required to run the nodes system

All classes defined here can replace classes in the node type hierarachy if the name matches. This allows to create hand-implemented types.

Functions

mrv.maya.nt.base._addCustomType(targetmoduledict, parentclsname, newclsname, metaclass=<class 'mrv.maya.nt.typ.MetaClassCreatorNodes'>, **kwargs)

Add a custom type to the system such that a node with the given type will automatically be wrapped with the corresponding class name

Parameters:
  • targetmoduledict – the module’s dict to which standin classes are supposed to be added
  • parentclsname – the name of the parent node type - if your new class has several parents, you have to add the new types beginning at the first exsiting parent as written in the maya/cache/nodeHierarchy.html file
  • newclsname – the new name of your class - it must exist targetmodule
  • metaclass – meta class object to be called to modify your type upon creation It will not be called if the class already exist in targetModule. Its recommended to derive it from the metaclass given as default value.
Raises KeyError:
 

if the parentclsname does not exist

mrv.maya.nt.base._checkedInstanceCreation(apiobj, typeName, clsToBeCreated, basecls)

Utiliy method creating a new class instance according to additional type information Its used by __new__ constructors to finalize class creation

Parameters:
  • apiobj – the MObject or MDagPath of object to wrap
  • typeName – the name of the node type to be created
  • clsToBeCreated – the cls object as passed in to __new__
  • basecls – the class of the caller containing the __new__ method
Returns:

create clsinstance if the proper type (according to nodeTypeTree)

mrv.maya.nt.base._checkedInstanceCreationDagPathSupport(mobject_or_mdagpath, clsToBeCreated, basecls)
Same purpose and attribtues as _checkedInstanceCreation, but supports dagPaths as input as well
mrv.maya.nt.base._createInstByPredicate(apiobj, cls, basecls, predicate)

Allows to wrap objects around MObjects where the actual compatabilty cannot be determined by some nodetypename, but by the function set itself. Thus it uses the nodeTypeToMfnClsMap to get mfn cls for testing

Parameters:
  • cls – the class to be created
  • basecls – the class where __new__ has actually been called
  • predicate – returns true if the given nodetypename is valid, and its mfn should be taken for tests
Returns:

new class instance, or None if no mfn matched the apiobject

mrv.maya.nt.base._getUniqueName(dagpath)
Create a unique name based on the given dagpath by appending numbers
mrv.maya.nt.base._lookup_type(mobject_or_mdagpath)
Returns:node type name of the given MObject or MDagPath
Note:if we have a plugin type, we must use the ‘slow’ way as the type is the same for all plugin nodes
mrv.maya.nt.base._makeAbsolutePath(nodename)
mrv.maya.nt.base.__new__()
T.__new__(S, ...) -> a new object with type S, a subtype of T
mrv.maya.nt.base._setupDagNodeDelayedMethods(dagnode, mobject, mdagpath)
Setup the given dagnode with the instance methods it needs to handle the gven mobject OR mdagpath accordingly, one of them may be None
mrv.maya.nt.base.activeSelectionList()
Returns:MSelectionList of the current selection list
mrv.maya.nt.base.capitalize(s)
Returns:s with first letter capitalized
mrv.maya.nt.base.createNode(*args, **kwargs)

Create a new node of nodetype with given nodename

Parameters:
  • nodename – like mynode``or ``namespace:mynode or |parent|mynode or |ns1:parent|ns1:ns2:parent|ns3:mynode. The name may contain any amount of parents and/or namespaces.
  • nodetype – a nodetype known to maya to be created accordingly
  • autocreateNamespace – if True, namespaces given in the nodename will be created if required
  • renameOnClash – if True, nameclashes will automatcially be resolved by creating a unique name - this only happens if a dependency node has the same name as a dag node
  • forceNewLeaf – if True, nodes will be created anyway if a node with the same name already exists - this will recreate the leaf portion of the given paths. Implies renameOnClash If False, you will receive an already existing node if the name and type matches.
  • maxShapesPerTransform – only used when renameOnClash is True, defining the number of shapes you may have below a transform. If the number would be exeeded by the creation of a shape below a given transform, a new auto-renamed transform will be created automatically. This transform is garantueed to be new and will be used as new parent for the shape.
Note:

For reasons of safety, dag nodes must use absolute paths like |parent|child - otherwise names might be ambiguous ! This method will assume absolute paths !

Raises RuntimeError:
 

If nodename contains namespaces or parents that may not be created

Raises NameError:
 

If name of desired node clashes as existing node has different type

Note:

As this method is checking a lot and tries to be smart, its relatively slow (creates ~1200 nodes / s)

Returns:

the newly create Node

mrv.maya.nt.base.delete(*args, **kwargs)

Delete the given nodes

Parameters:
  • args – Node instances, MObjects, MDagPaths or strings to delete
  • kwargs
    • presort:
      if True, default False, will do alot of pre-work to actually make the deletion work properly using the UI, thus we sort dag nodes by dag path token length to delete top level ones first and individually, to finally delete all dependency nodes in a bunch

    Using this flag will be slower, but yields much better results if deleting complex dag and dependency trees with locked attributes, conversion nodes, transforms and shapes

Note:

in general , no matter which options have been chosen , api deletion does not work well as the used algorithm is totally different and inferior to the mel implementaiton

Note:

will not raise in case of an error, but print a notification message

Note:

all deletions will be stored on one undo operation

mrv.maya.nt.base.findByName(name, **kwargs)
Returns:

list of node matching name, whereas simple regex using * can be used to describe a pattern

Parameters:
  • name – string like pcube, or pcube*, or pcube*|*Shape
  • kwargs – passed to fromSelectionList
mrv.maya.nt.base.fromSelectionList(sellist, handlePlugs=1, **kwargs)
Returns:list of Nodes and MPlugs stored in the given selection list
Parameter:kwargs – passed to selectionListIterator
mrv.maya.nt.base.in_double3_out_vector(function)
Returns:MVector containing result of function with signature function(double [3])
mrv.maya.nt.base.isAbsolutePath(nodename)
mrv.maya.nt.base.iterSelection(filterType=0, **kwargs)
Returns:

iterator over current scene selection

Parameters:
  • filterType – MFn type specifying the node type to iterate upon. Defaults to all node types.
  • kwargs – passed to it.iterSelectionList
Note:

This iterator will always return Nodes

mrv.maya.nt.base.nodeTypeToNodeTypeCls(nodeTypeName, apiobj)

Convert the given node type (str) to the respective python node type class

Parameters:
  • nodeTypeName – the type name you which to have the actual class for
  • apiobj – source api object, its apiType is used as fallback in case we don’t know the node
mrv.maya.nt.base.objExists(objectname)
Returns:True if given object exists, false otherwise
Parameter:objectname – we always use absolute paths to have a unique name
Note:perfer this method over mel as the API is used directly as we have some special handling to assure we get the right nodes
mrv.maya.nt.base.pythonIndex(index, length)
Compute the actual index based on the given index and array length, thus -1 will result in the last array element’s index
mrv.maya.nt.base.select(*nodesOrSelectionList, **kwargs)

Select the given list of wrapped nodes or selection list in maya

Parameters:
  • nodesOrSelectionList – single selection list or multiple wrapped nodes , or multiple names
  • kwargs
    • listAdjustment: default api.MGlobal.kReplaceList
Note:

as this is a convenience function that is not required by the api itself, but for interactive sessions, it will be undoable

Note:

Components are only supported if a selection list is given

Note:

This method is implicitly undoable

mrv.maya.nt.base.selection(filterType=0, **kwargs)
Returns:

list of Nodes from the current selection

Parameters:
  • filterType – The type of nodes to return exclusively. Defaults to returning all nodes.
  • kwargs – passed to fromSelectionList
mrv.maya.nt.base.toApiobj(nodename)

Convert the given nodename to the respective MObject

Note:uses unique names only, and will fail if a non-unique path is given, which is as selection lists do not work properly with partial names !
Note:even dag objects will end up as MObject
Note:code repeats partly in toApiobjOrDagPath as its supposed to be as fast as possible - this method gets called quite a few times in benchmarks
mrv.maya.nt.base.toApiobjOrDagPath(nodename)

Convert the given nodename to the respective MObject or MDagPath

Note:we treat “nodename” and “|nodename” as the same objects as they occupy the same namespace - one time a dep node is meant, the other time a dag node. If querying a dag node, the dep node with the same name is not found, although it is in the same freaking namespace ! IMHO this is a big bug !
mrv.maya.nt.base.toComponentSelectionList(nodeCompList, mergeWithExisting=False)

As above, but only works on DagNodes having components - the components can be a nullObject though to add the whole object after all.

Parameter:nodeCompList – list of tuple(DagNode, Component), Component can be filled component or null MObject
mrv.maya.nt.base.toDagPath(apiobj)
Find ONE valid dag path to the given dag api object
mrv.maya.nt.base.toNodesFromNames(nodenames, **kwargs)
Returns:list of wrapped nodes from the given list of node names
Note:this function is supposed to be faster for multiple nodes compared to just creating a Node directly as we optimize the process due to the intermediate selection list getting the api objects for the given names
Parameter:kwargs – passed to fromSelectionList
mrv.maya.nt.base.toSelectionList(nodeList, mergeWithExisting=False)

Convert an iterable filled with Nodes to a selection list

Parameters:
  • nodeList – iterable filled with dg and dag nodes as well as plugs, dagpaths or mobjects or strings
  • mergeWithExisting – if true, the selection list will not allow dupliacates , but adding objects also takes (much) longer, depending on the size of the list
Returns:

selection list filled with objects from node list

mrv.maya.nt.base.toSelectionListFromNames(nodenames)

Convert the given iterable of nodenames to a selection list

Returns:MSelectionList, use iterSelectionList to retrieve the objects
mrv.maya.nt.base.uncapitalize(s, preserveAcronymns=False)
Returns:s with first letter lower case
Parameter:preserveAcronymns – enabled ensures that ‘NTSC’ does not become ‘nTSC’
Note:from pymel
mrv.maya.nt.base.undoable_in_double3_as_vector(function, vec_old_value, vec_new_value)

function supports the signature function(double [3] const) and will change the underlying instance to the respective values as retrieved from the passed in vector. The calling method must be enclosed in an undoable decorator.

Parameters:
  • vec_old_value – vector with the old value of the corresponding getX method
  • vec_new_value – vector with new value that is to be set

Classes

Epydoc: mrv.maya.nt.base.ArrayAttrsData

class mrv.maya.nt.base.ArrayAttrsData(*args)

Bases: mrv.maya.nt.Data

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.Attribute

class mrv.maya.nt.base.Attribute(*args)

Bases: maya.OpenMaya.MObject, mrv.maya.nt._root_

Represents an attribute in general - this is the base class Use this general class to create attribute wraps - it will return a class of the respective type

apiType()
apiTypeStr()
assign()
className()
classmethod create(full_name, brief_name, *args, **kwargs)
Returns:

A new Attribute

Parameters:
  • full_name – the long name of the attribute
  • brief_name – the brief name of the attribute
Note:

all args and kwargs are passed to the respective function set instance

Note:

specialize this method in derived types if required

hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base

class mrv.maya.nt.base.Call(func, *args, **kwargs)

Bases: object

Call object encapsulating any code, thus providing a simple facade for it :note: derive from it if a more complex call is required

args
func
kwargs

Epydoc: mrv.maya.nt.base.Component

class mrv.maya.nt.base.Component(*args)

Bases: maya.OpenMaya.MObject, mrv.maya.nt._root_

Represents a shape component - its derivates can be used to handle component lists to be used in object sets and shading engines

addElement(*args)

see addElements

Returns:self
Note:do not use this function as it will be really slow when handling many items, use addElements instead
addElements(*args)

Operates exactly as described in the MFn...IndexComponent documentation, but returns self to allow combined calls and on-the-fly component generation

Returns:self
apiType()
apiTypeStr()
assign()
className()
classmethod create(component_type)
Returns:A new component instance carrying data of the given component type
Parameter:component_type – MFn:: component type to be created.
Note:It is important that you call this function on the Component Class of a compatible type, or a RuntimeError will occour
classmethod getMFnType()
Returns:mfn type of this class
Note:the type returned is not the type of the shape component
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.ComponentListData

class mrv.maya.nt.base.ComponentListData(*args)

Bases: mrv.maya.nt.Data

Improves the default wrap by adding some required methods to deal with component lists

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.CompoundAttribute

class mrv.maya.nt.base.CompoundAttribute(*args)

Bases: mrv.maya.nt.Attribute

apiType()
apiTypeStr()
assign()
className()
classmethod create(full_name, brief_name, *args, **kwargs)
Returns:

A new Attribute

Parameters:
  • full_name – the long name of the attribute
  • brief_name – the brief name of the attribute
Note:

all args and kwargs are passed to the respective function set instance

Note:

specialize this method in derived types if required

hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.ContainerBase

class mrv.maya.nt.base.ContainerBase

Bases: mrv.maya.nt.DependNode

addAttribute(attr)

Add the given attribute to the node as local dynamic attribute

Parameter:attr – MObject of attribute or Attribute instance as retrieved from a plug
Returns:plug to the newly added attribute
Note:This method is explicitly not undoable as attributes are being deleted in memory right in the moment they are being removed, thus they cannot reside on the undo queue
classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
addTo(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5c828e0> >, **kwargs)

Add ourselves to the given set

Note:method is undoable
See:sets.ObjectSet
allocateFlag()
apiObject()
Returns:the MObject attached to this Node
apiType()
Returns:the MFn Type id of the wrapped object
basename()
Returns:name of this instance
Note:it is mainly for compatability with dagNodes which need this method in order to return the name of their leaf node
children(predicate=<function <lambda> at 0x7f41dd7c2ed8>)
Returns:list of intermediate children of path, [ child1 , child2 ]
Parameter:predicate – return True to include x in result
Note:the child objects returned are supposed to be valid paths, not just relative paths
childrenDeep(order=1, predicate=<function <lambda> at 0x7f41dd7c5050>)
Returns:

list of all children of path, [ child1 , child2 ]

Parameters:
  • order – order enumeration
  • predicate – returns true if x may be returned
Note:

the child objects returned are supposed to be valid paths, not just relative paths

className()
classification()
connectedSets(setFilter=(459, False, 0))
Returns:list of object set compatible Nodes having self as member
Parameter:setFilter – tuple(apiType, use_exact_type) - the combination of the desired api type and the exact type flag allow precise control whether you which to get only renderable shading engines, only objectfSets (tuple[1] = True), or all objects supporting the given object type. Its preset to only return shading engines
Note:the returned sets order is defined by the order connections to instObjGroups
Note:only sets will be returned that have the whole object as member, thus you will not see sets having component assignments like per-compoent shader assignments or deformer sets
connections()
Returns:MPlugArray of connected plugs
copyFrom(other, *args, **kwargs)

Copy the data from other into self as good as possible Only copy the data that is unique to your specific class - the data of other classes will be taken care of by them !

Note:you must support args and kwargs if one of your iDuplicate bases does
copyTo(instance, *args, **kwargs)

Copy the values of ourselves onto the given instance which must be an instance of our class to be compatible. Only the common classes will be copied to instance

Returns:altered instance
Note:instance will be altered during the process
copyToOther(instance, *args, **kwargs)
As copyTo, but does only require the objects to have a common base. It will match the actually compatible base classes and call copyFrom if possible. As more checking is performed, this method performs worse than copyTo
createInstance(*args, **kwargs)

Create and Initialize an instance of self.__class__( ... ) based on your own data

Returns:new instance of self
Note:using self.__class__ instead of an explicit class allows derived classes that do not have anything to duplicate just to use your implementeation
Note:you must support args and kwargs if one of your iDuplicate bases does
deallocateAllFlags()
deallocateFlag()
delete(*args, **kwargs)

Delete this node

Note:if the undo queue is enabled, the object becomes invalid, but stays alive until it drops off the queue
Note:if you want to delete many nodes, its more efficient to delete them using the global delete method
dependencyInfo(attribute, by=True)
Returns:

list of attributes that given attribute affects or that the given attribute is affected by if the attribute turns dirty.

Parameters:
  • attribute – attribute instance or attribute name
  • by – if false, affected attributes will be returned, otherwise the attributes affecting this one
Note:

see also MPlug.affectedByPlugs

Note:

USING MEL: as api command and mObject array always crashed on me ... don’t know :(

duplicate(*args, **kwargs)

Duplicate our node and return a wrapped version to it

Parameters:
  • name – if given, the newly created node will use the given name
  • kwargs
    • renameOnClash: if Trrue, default True, clashes are prevented by renaming the new node
    • autocreateNamespace: if True, default True, namespaces will be created if mentioned in the name
Note:

the copyTo method may not have not-undoable side-effects to be a proper implementation

Note:

undo could be implemented for dg nodes - but for reasons of consistency, its disabled here - who knows how much it will crap out after a while as duplicate is not undoable (mel command) - it never really worked to undo a mel command from within python, executed using a dgmodifier - unfortunately it does not return any result making it hard to find the newly duplicated object !

fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
classmethod getMFnClasses()
Returns:list of all function set classes this node supports, most derived function set comes first
hasFn(mfntype)
Returns:True if our object supports the given function set type
isAlive()
Returns:True if the object exists in memory
Note:objects on the undo queue are alive, but NOT valid
isMemberOf(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5c1d740> >)
Returns:True if self is part of setnode
Note:method is undoable
See:sets.ObjectSet
isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
isValid()
Returns:True if the object exists in the scene
Note:objects on the undo queue are NOT valid, but alive
iterParents(predicate=<function <lambda> at 0x7f41dd7c5230>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
object()
Returns:the MObject attached to this Node
parent()
Returns:parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
referenceFile()
Returns:name (str) of file this node is coming from - it could contain a copy number as {x}
Note:will raise if the node is not referenced, use isReferenced to figure that out
removeAttribute(attr)

Remove the given attribute from the node

Parameter:attr – see addAttribute
removeFrom(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5b41420> >)

remove ourselves to the given set

Note:method is undoable
See:sets.ObjectSet
rename(*args, **kwargs)

Rename this node to newname

Parameters:
  • newname – new name of the node
  • autocreateNamespace – if true, namespaces given in newpath will be created automatically, otherwise a RuntimeException will be thrown if a required namespace does not exist
  • renameOnClash – if true, clashing names will automatically be resolved by adjusting the name
Returns:

renamed node which is the node itself

Note:

for safety reasons, this node is dagnode aware and uses a dag modifier for them !

root()
Returns:the root of the DAG - it has no further parents
setLocked(*args, **kwargs)

Lock or unloack this node

Parameter:state – if True, the node is locked. Locked nodes cannot be deleted, renamed or reparented
Note:you can query the lock state with isLocked
setNamespace(*args, **kwargs)
Returns:

self after being moved to the given namespace. This will effectively rename the object.

Parameters:
  • newns – Namespace instance to put this Node into
  • kwargs – to be passed to rename
sets(setFilter=(459, False, 0))
Returns:list of object set compatible Nodes having self as member
Parameter:setFilter – tuple(apiType, use_exact_type) - the combination of the desired api type and the exact type flag allow precise control whether you which to get only renderable shading engines, only objectfSets (tuple[1] = True), or all objects supporting the given object type. Its preset to only return shading engines
Note:the returned sets order is defined by the order connections to instObjGroups
Note:only sets will be returned that have the whole object as member, thus you will not see sets having component assignments like per-compoent shader assignments or deformer sets
supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work

Epydoc: mrv.maya.nt.base.DagNode

class mrv.maya.nt.base.DagNode

Bases: mrv.maya.nt.Entity, mrv.interface.iDagItem

Implements access to DAG nodes

addAttribute(attr)

Add the given attribute to the node as local dynamic attribute

Parameter:attr – MObject of attribute or Attribute instance as retrieved from a plug
Returns:plug to the newly added attribute
Note:This method is explicitly not undoable as attributes are being deleted in memory right in the moment they are being removed, thus they cannot reside on the undo queue
addChild(*args, **kwargs)

Add the given childNode as child to this Node. Allows instancing !

Parameters:
  • childNode – Node you wish to add
  • position – the index to which to add the new child, kNextPos will add it as last child. It supports python style negative indices
  • keepExistingParent – if True, the childNode will be instanced as it will have its previous parent(s) and this one, if False, the previous parent will be removed from the child’s parent list
  • renameOnClash – resolve nameclashes by automatically renaming the node to make it unique
  • keepWorldSpace – see reparent, only effective if the node is not instanced
Returns:

childNode whose path is pointing to the new child location

Raises ValueError:
 

if keepWorldSpace is requested with directly instanced nodes

Note:

as maya internally handles add/remove child as instancing operation, even though keepExistingParent is False, it will mess up things and for a short period of time in fact have two n + 1 instances, right before one is unlinked, This still fills a slot or something, and isInstanced will be true, although the pathcount is 1. Long story short: if the item to be added to us is not instanced, we use reparent instead. It will not harm in direct instances, so its save to use.

Note:

if the instance count of the item is 1 and keepExistingParent is False, the position argument is being ignored

addInstancedChild(*args, **kwargs)

Add childnode as instanced child to this node

Note:for more information, see addChild
Note:its a shortcut to addChild allowing to clearly indicate what is happening
addParent(*args, **kwargs)

Adds ourselves as instance to the given parentnode at position

Parameter:kwargs – see addChild
Returns:self with updated dag path
classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
addTo(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5c828e0> >, **kwargs)

Add ourselves to the given set

Note:method is undoable
See:sets.ObjectSet
allocateFlag()
apiObject()
Returns:our dag path as this is our api object - the object defining this node best
apiType()
Returns:the MFn Type id of the wrapped object
basename()
Returns:basename of this path, ‘/hello/world’ -> ‘world’
child(index)
Returns:child of self at index
Note:this method fixes the MFnDagNode.child method - it returns an MObject, which doesnt work well with instanced nodes - a dag path is required, which is what we use to aquire the object
childTransforms(predicate=<function <lambda> at 0x5e9b2a8>)
Returns:list of all transform nodes below this one
children(predicate=<function <lambda> at 0x5e99f50>, asNode=True)
Returns:all child nodes below this dag node if predicate returns True for passed Node
Parameter:asNode – if True, you will receive the children as wrapped Nodes, otherwise you get MDagPaths
childrenByType(nodeType, predicate=<function <lambda> at 0x5e9b0c8>)
Returns:all childnodes below this one matching the given nodeType and the predicate
Parameter:nodeType – class of the nodeTyoe, like nt.Transform
childrenDeep(order=1, predicate=<function <lambda> at 0x7f41dd7c5050>)
Returns:

list of all children of path, [ child1 , child2 ]

Parameters:
  • order – order enumeration
  • predicate – returns true if x may be returned
Note:

the child objects returned are supposed to be valid paths, not just relative paths

className()
classification()
connectedSets(setFilter=(459, False, 0))
Returns:list of object set compatible Nodes having self as member
Parameter:setFilter – tuple(apiType, use_exact_type) - the combination of the desired api type and the exact type flag allow precise control whether you which to get only renderable shading engines, only objectfSets (tuple[1] = True), or all objects supporting the given object type. Its preset to only return shading engines
Note:the returned sets order is defined by the order connections to instObjGroups
Note:only sets will be returned that have the whole object as member, thus you will not see sets having component assignments like per-compoent shader assignments or deformer sets
connections()
Returns:MPlugArray of connected plugs
copyFrom(other, *args, **kwargs)

Copy the data from other into self as good as possible Only copy the data that is unique to your specific class - the data of other classes will be taken care of by them !

Note:you must support args and kwargs if one of your iDuplicate bases does
copyTo(instance, *args, **kwargs)

Copy the values of ourselves onto the given instance which must be an instance of our class to be compatible. Only the common classes will be copied to instance

Returns:altered instance
Note:instance will be altered during the process
copyToOther(instance, *args, **kwargs)
As copyTo, but does only require the objects to have a common base. It will match the actually compatible base classes and call copyFrom if possible. As more checking is performed, this method performs worse than copyTo
createInstance(*args, **kwargs)

Create and Initialize an instance of self.__class__( ... ) based on your own data

Returns:new instance of self
Note:using self.__class__ instead of an explicit class allows derived classes that do not have anything to duplicate just to use your implementeation
Note:you must support args and kwargs if one of your iDuplicate bases does
dagPath()
Returns:the original DagPath attached to this Node - it’s not wrapped for performance
Note:If you plan to alter it, make sure you copy it using the MDagPath(node.dagPath()) construct !
deallocateAllFlags()
deallocateFlag()
delete(*args, **kwargs)

Delete this node - this special version must be

Note:if the undo queue is enabled, the object becomes invalid, but stays alive until it drops off the queue
Note:if you want to delete many nodes, its more efficient to delete them using the global delete method
dependencyInfo(attribute, by=True)
Returns:

list of attributes that given attribute affects or that the given attribute is affected by if the attribute turns dirty.

Parameters:
  • attribute – attribute instance or attribute name
  • by – if false, affected attributes will be returned, otherwise the attributes affecting this one
Note:

see also MPlug.affectedByPlugs

Note:

USING MEL: as api command and mObject array always crashed on me ... don’t know :(

displayOverrideValue(plugName)
Returns:the override display value actually identified by plugName affecting the given object (that should be a leaf node for the result you see in the viewport. The display type in effect is always the last one set in the hierarchy returns None display overrides are disabled
duplicate(*args, **kwargs)

Duplciate the given node to newpath

Parameters:
  • newpath

    result depends on its format:

    • ‘’ - empty string, creates a unique name based on the actual node name by appending a copy number to it, if newTransform is True, the newly created shape/transform will keep its name, but receives a new parent
    • ‘newname’ - relative path, the node will be duplicated not changing its current parent if newTransform is False
    • |parent|newname - absolute path, the node will be duplicated and reparented under the given path
      if newTransform is True, a new transform name will be created based on your name by appending a unique copy number
  • autocreateNamespace – if true, namespaces given in newpath will be created automatically, otherwise a RuntimeException will be thrown if a required namespace does not exist
  • renameOnClash – if true, clashing names will automatically be resolved by adjusting the name
  • newTransform – if True, a new transform will be created based on the name of the parent transform of this shape node, appending a unique copy number to it. Only has an effect for shape nodes
Returns:

newly create Node

Note:

duplicate performance could be improved by checking more before doing work that does not really change the scene, but adds undo operations

Note:

inbetween parents are always required as needed

Todo:

add example for each version of newpath

Note:

instancing can be realized using the addChild function

Note:

If meshes have tweaks applied, the duplicate will not have these tweaks and the meshes will look mislocated. Using MEL works in that case ... (they fixed it there obviously) , but creates invalid objects

Todo:

Undo implementation - every undoable operation must in fact be based on strings to really work, all this is far too much - dagNode.duplicate must be undoable by itself

Todo:

duplicate should be completely reimplemented to support all mel options and actually work with meshes and tweaks - the underlying api duplication would still be used of course, as well as connections (to sets) and so on ...

fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
classmethod getMFnClasses()
Returns:list of all function set classes this node supports, most derived function set comes first
hasChild(node)
Returns:True if node is a child of self
hasFn(mfntype)
Returns:True if our object supports the given function set type
instance(instanceNumber)
Returns:Node to the instance identified by instanceNumber
Parameter:instanceNumber – range(0, self.instanceCount()-1)
instanceNumber()
Returns:our instance number
Note:0 does not indicate that this object is not instanced - use getInstanceCount instead
isAlive()
Returns:True if the object exists in memory
Note:objects on the undo queue are alive, but NOT valid
isMemberOf(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5c1d740> >)
Returns:True if self is part of setnode
Note:method is undoable
See:sets.ObjectSet
isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
isTemplate()
Returns:True if this node is templated - this is the case if itself or one of its parents are templated
isValid()
Returns:True if the object exists in the scene
Note:Handles DAG objects correctly that can be instanced, in which case the MObject may be valid , but the respective dag path is not. Additionally, if the object is not parented below any object, everything appears to be valid, but the path name is empty
isVisible()
Returns:True if this node is visible - its visible if itself and all parents are visible
iterInstances(excludeSelf=False)

Get iterator over all (direct and indirect)instances of this node

Parameter:excludeSelf – if True, self will not be returned, if False, it will be in the list of items
Note:Iterating instances is more efficient than querying all instances individually using instance
Todo:add flag to allow iteration of indirect instances as well
iterParents(predicate=<function <lambda> at 0x7f41dd7c5230>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
name()
Returns:fully qualified (long) name of this dag node
object()
Returns:MObject as retrieved from the MDagPath of our Node
parent()
Returns:Maya node of the parent of this instance or None if this is the root
parentAtIndex(index)
Returns:Node of the parent at the given index - non-instanced nodes only have one parent
Note:if a node is instanced, it can have parentCount parents
Todo:Update dagpath afterwards ! Use dagpaths instead !
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
referenceFile()
Returns:name (str) of file this node is coming from - it could contain a copy number as {x}
Note:will raise if the node is not referenced, use isReferenced to figure that out
removeAttribute(attr)

Remove the given attribute from the node

Parameter:attr – see addAttribute
removeChild(*args, **kwargs)

remove the given childNode (being a child of this node) from our child list, effectively parenting it under world !

Parameters:
  • childNode – Node to unparent - if it is not one of our children, no change takes place
  • allowZeroParents – if True, it is possible to leave a node unparented, thus no valid dag paths leads to it. If False, transforms will just be reparented under the world
Returns:

copy of childnode pointing to the first valid dag path we find.

Note:

to prevent the child (if transform) to dangle in unknown space if the last instance is to be removed, it will instead be reparented to world.

Note:

removing shapes from their last parent will result in an error

removeFrom(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5b41420> >)

remove ourselves to the given set

Note:method is undoable
See:sets.ObjectSet
removeParent(*args, **kwargs)

Remove ourselves from given parentnode

Returns:None
rename(*args, **kwargs)

Rename this node to newname

Parameters:
  • newname – new name of the node
  • autocreateNamespace – if true, namespaces given in newpath will be created automatically, otherwise a RuntimeException will be thrown if a required namespace does not exist
  • renameOnClash – if true, clashing names will automatically be resolved by adjusting the name
Returns:

renamed node which is the node itself

Note:

for safety reasons, this node is dagnode aware and uses a dag modifier for them !

reparent(*args, **kwargs)

Change the parent of all nodes (also instances) to be located below parentnode

Parameters:
  • parentnode – Node instance of transform under which this node should be parented to if None, node will be reparented under the root (which only works for transforms)
  • renameOnClash – resolve nameclashes by automatically renaming the node to make it unique
  • raiseOnInstance – if True, this method will raise if you try to reparent an instanced object. If false, instanced objects will be merged into the newly created path under parentnode, effectively eliminating all other paths , keeping the newly created one
  • keepWorldSpace – if True and node to be reparented is a transform, the world space position will be kept by adjusting the transformation accordingly. WARNNG: Currently we reset pivots when doing so

:return : copy of self pointing to the new dag path self

Note:will remove all instance of this object and leave this object at only one path - if this is not what you want, use the addChild method instead as it can properly handle this case
Note:this method handles namespaces properly
root()
Returns:the root of the DAG - it has no further parents
setLocked(*args, **kwargs)

Lock or unloack this node

Parameter:state – if True, the node is locked. Locked nodes cannot be deleted, renamed or reparented
Note:you can query the lock state with isLocked
setNamespace(*args, **kwargs)
Returns:

self after being moved to the given namespace. This will effectively rename the object.

Parameters:
  • newns – Namespace instance to put this Node into
  • kwargs – to be passed to rename
setParent(*args, **kwargs)

Change the parent of self to parentnode being placed at position

Parameter:kwargs – see addChild
Returns:self with updated dag path
sets(setFilter=(459, False, 0))
Returns:list of object set compatible Nodes having self as member
Parameter:setFilter – tuple(apiType, use_exact_type) - the combination of the desired api type and the exact type flag allow precise control whether you which to get only renderable shading engines, only objectfSets (tuple[1] = True), or all objects supporting the given object type. Its preset to only return shading engines
Note:the returned sets order is defined by the order connections to instObjGroups
Note:only sets will be returned that have the whole object as member, thus you will not see sets having component assignments like per-compoent shader assignments or deformer sets
shapes(predicate=<function <lambda> at 0x5e9b1b8>)
Returns:all our Shape nodes
Note:you could use getChildren with a predicate, but this method is more efficient as it uses dagpath functions to filter shapes
supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work
transform()
Returns:Node to lowest transform in the path attached to our node
Note:for shapes this is the parent, for transforms the transform itself
unparent(*args, **kwargs)
As reparent, but will unparent this transform under the scene root

Epydoc: mrv.maya.nt.base.Data

class mrv.maya.nt.base.Data(*args)

Bases: maya.OpenMaya.MObject, mrv.maya.nt._root_

Represents an data in general - this is the base class Use this general class to create data wrap objects - it will return a class of the respective type

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.DependNode

class mrv.maya.nt.base.DependNode

Bases: mrv.maya.nt.Node, mrv.interface.iDuplicatable

Implements access to dependency nodes

addAttribute(attr)

Add the given attribute to the node as local dynamic attribute

Parameter:attr – MObject of attribute or Attribute instance as retrieved from a plug
Returns:plug to the newly added attribute
Note:This method is explicitly not undoable as attributes are being deleted in memory right in the moment they are being removed, thus they cannot reside on the undo queue
classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
addTo(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5c828e0> >, **kwargs)

Add ourselves to the given set

Note:method is undoable
See:sets.ObjectSet
allocateFlag()
apiObject()
Returns:the MObject attached to this Node
apiType()
Returns:the MFn Type id of the wrapped object
basename()
Returns:name of this instance
Note:it is mainly for compatability with dagNodes which need this method in order to return the name of their leaf node
children(predicate=<function <lambda> at 0x7f41dd7c2ed8>)
Returns:list of intermediate children of path, [ child1 , child2 ]
Parameter:predicate – return True to include x in result
Note:the child objects returned are supposed to be valid paths, not just relative paths
childrenDeep(order=1, predicate=<function <lambda> at 0x7f41dd7c5050>)
Returns:

list of all children of path, [ child1 , child2 ]

Parameters:
  • order – order enumeration
  • predicate – returns true if x may be returned
Note:

the child objects returned are supposed to be valid paths, not just relative paths

className()
classification()
connectedSets(setFilter=(459, False, 0))
Returns:list of object set compatible Nodes having self as member
Parameter:setFilter – tuple(apiType, use_exact_type) - the combination of the desired api type and the exact type flag allow precise control whether you which to get only renderable shading engines, only objectfSets (tuple[1] = True), or all objects supporting the given object type. Its preset to only return shading engines
Note:the returned sets order is defined by the order connections to instObjGroups
Note:only sets will be returned that have the whole object as member, thus you will not see sets having component assignments like per-compoent shader assignments or deformer sets
connections()
Returns:MPlugArray of connected plugs
copyFrom(other, *args, **kwargs)

Copy the data from other into self as good as possible Only copy the data that is unique to your specific class - the data of other classes will be taken care of by them !

Note:you must support args and kwargs if one of your iDuplicate bases does
copyTo(instance, *args, **kwargs)

Copy the values of ourselves onto the given instance which must be an instance of our class to be compatible. Only the common classes will be copied to instance

Returns:altered instance
Note:instance will be altered during the process
copyToOther(instance, *args, **kwargs)
As copyTo, but does only require the objects to have a common base. It will match the actually compatible base classes and call copyFrom if possible. As more checking is performed, this method performs worse than copyTo
createInstance(*args, **kwargs)

Create and Initialize an instance of self.__class__( ... ) based on your own data

Returns:new instance of self
Note:using self.__class__ instead of an explicit class allows derived classes that do not have anything to duplicate just to use your implementeation
Note:you must support args and kwargs if one of your iDuplicate bases does
deallocateAllFlags()
deallocateFlag()
delete(*args, **kwargs)

Delete this node

Note:if the undo queue is enabled, the object becomes invalid, but stays alive until it drops off the queue
Note:if you want to delete many nodes, its more efficient to delete them using the global delete method
dependencyInfo(attribute, by=True)
Returns:

list of attributes that given attribute affects or that the given attribute is affected by if the attribute turns dirty.

Parameters:
  • attribute – attribute instance or attribute name
  • by – if false, affected attributes will be returned, otherwise the attributes affecting this one
Note:

see also MPlug.affectedByPlugs

Note:

USING MEL: as api command and mObject array always crashed on me ... don’t know :(

duplicate(*args, **kwargs)

Duplicate our node and return a wrapped version to it

Parameters:
  • name – if given, the newly created node will use the given name
  • kwargs
    • renameOnClash: if Trrue, default True, clashes are prevented by renaming the new node
    • autocreateNamespace: if True, default True, namespaces will be created if mentioned in the name
Note:

the copyTo method may not have not-undoable side-effects to be a proper implementation

Note:

undo could be implemented for dg nodes - but for reasons of consistency, its disabled here - who knows how much it will crap out after a while as duplicate is not undoable (mel command) - it never really worked to undo a mel command from within python, executed using a dgmodifier - unfortunately it does not return any result making it hard to find the newly duplicated object !

fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
classmethod getMFnClasses()
Returns:list of all function set classes this node supports, most derived function set comes first
hasFn(mfntype)
Returns:True if our object supports the given function set type
isAlive()
Returns:True if the object exists in memory
Note:objects on the undo queue are alive, but NOT valid
isMemberOf(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5c1d740> >)
Returns:True if self is part of setnode
Note:method is undoable
See:sets.ObjectSet
isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
isValid()
Returns:True if the object exists in the scene
Note:objects on the undo queue are NOT valid, but alive
iterParents(predicate=<function <lambda> at 0x7f41dd7c5230>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
object()
Returns:the MObject attached to this Node
parent()
Returns:parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
referenceFile()
Returns:name (str) of file this node is coming from - it could contain a copy number as {x}
Note:will raise if the node is not referenced, use isReferenced to figure that out
removeAttribute(attr)

Remove the given attribute from the node

Parameter:attr – see addAttribute
removeFrom(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5b41420> >)

remove ourselves to the given set

Note:method is undoable
See:sets.ObjectSet
rename(*args, **kwargs)

Rename this node to newname

Parameters:
  • newname – new name of the node
  • autocreateNamespace – if true, namespaces given in newpath will be created automatically, otherwise a RuntimeException will be thrown if a required namespace does not exist
  • renameOnClash – if true, clashing names will automatically be resolved by adjusting the name
Returns:

renamed node which is the node itself

Note:

for safety reasons, this node is dagnode aware and uses a dag modifier for them !

root()
Returns:the root of the DAG - it has no further parents
setLocked(*args, **kwargs)

Lock or unloack this node

Parameter:state – if True, the node is locked. Locked nodes cannot be deleted, renamed or reparented
Note:you can query the lock state with isLocked
setNamespace(*args, **kwargs)
Returns:

self after being moved to the given namespace. This will effectively rename the object.

Parameters:
  • newns – Namespace instance to put this Node into
  • kwargs – to be passed to rename
sets(setFilter=(459, False, 0))
Returns:list of object set compatible Nodes having self as member
Parameter:setFilter – tuple(apiType, use_exact_type) - the combination of the desired api type and the exact type flag allow precise control whether you which to get only renderable shading engines, only objectfSets (tuple[1] = True), or all objects supporting the given object type. Its preset to only return shading engines
Note:the returned sets order is defined by the order connections to instObjGroups
Note:only sets will be returned that have the whole object as member, thus you will not see sets having component assignments like per-compoent shader assignments or deformer sets
supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work

Epydoc: mrv.maya.nt.base.DoubleArrayData

class mrv.maya.nt.base.DoubleArrayData(*args)

Bases: mrv.maya.nt.Data

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.DoubleIndexedComponent

class mrv.maya.nt.base.DoubleIndexedComponent(*args)

Bases: mrv.maya.nt.Component

Fixes some functions that would not work usually

addElement(*args)

see addElements

Returns:self
Note:do not use this function as it will be really slow when handling many items, use addElements instead
addElements(*args)

Operates exactly as described in the MFn...IndexComponent documentation, but returns self to allow combined calls and on-the-fly component generation

Returns:self
apiType()
apiTypeStr()
assign()
className()
classmethod create(component_type)
Returns:A new component instance carrying data of the given component type
Parameter:component_type – MFn:: component type to be created.
Note:It is important that you call this function on the Component Class of a compatible type, or a RuntimeError will occour
elements()
Returns:(uIntArray, vIntArray) tuple containing arrays with the u and v indices this component represents
getElements()
Returns:(uIntArray, vIntArray) tuple containing arrays with the u and v indices this component represents
classmethod getMFnType()
Returns:mfn type of this class
Note:the type returned is not the type of the shape component
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.DynSweptGeometryData

class mrv.maya.nt.base.DynSweptGeometryData(*args)

Bases: mrv.maya.nt.Data

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.Entity

class mrv.maya.nt.base.Entity

Bases: mrv.maya.nt.ContainerBase

addAttribute(attr)

Add the given attribute to the node as local dynamic attribute

Parameter:attr – MObject of attribute or Attribute instance as retrieved from a plug
Returns:plug to the newly added attribute
Note:This method is explicitly not undoable as attributes are being deleted in memory right in the moment they are being removed, thus they cannot reside on the undo queue
classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
addTo(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5c828e0> >, **kwargs)

Add ourselves to the given set

Note:method is undoable
See:sets.ObjectSet
allocateFlag()
apiObject()
Returns:the MObject attached to this Node
apiType()
Returns:the MFn Type id of the wrapped object
basename()
Returns:name of this instance
Note:it is mainly for compatability with dagNodes which need this method in order to return the name of their leaf node
children(predicate=<function <lambda> at 0x7f41dd7c2ed8>)
Returns:list of intermediate children of path, [ child1 , child2 ]
Parameter:predicate – return True to include x in result
Note:the child objects returned are supposed to be valid paths, not just relative paths
childrenDeep(order=1, predicate=<function <lambda> at 0x7f41dd7c5050>)
Returns:

list of all children of path, [ child1 , child2 ]

Parameters:
  • order – order enumeration
  • predicate – returns true if x may be returned
Note:

the child objects returned are supposed to be valid paths, not just relative paths

className()
classification()
connectedSets(setFilter=(459, False, 0))
Returns:list of object set compatible Nodes having self as member
Parameter:setFilter – tuple(apiType, use_exact_type) - the combination of the desired api type and the exact type flag allow precise control whether you which to get only renderable shading engines, only objectfSets (tuple[1] = True), or all objects supporting the given object type. Its preset to only return shading engines
Note:the returned sets order is defined by the order connections to instObjGroups
Note:only sets will be returned that have the whole object as member, thus you will not see sets having component assignments like per-compoent shader assignments or deformer sets
connections()
Returns:MPlugArray of connected plugs
copyFrom(other, *args, **kwargs)

Copy the data from other into self as good as possible Only copy the data that is unique to your specific class - the data of other classes will be taken care of by them !

Note:you must support args and kwargs if one of your iDuplicate bases does
copyTo(instance, *args, **kwargs)

Copy the values of ourselves onto the given instance which must be an instance of our class to be compatible. Only the common classes will be copied to instance

Returns:altered instance
Note:instance will be altered during the process
copyToOther(instance, *args, **kwargs)
As copyTo, but does only require the objects to have a common base. It will match the actually compatible base classes and call copyFrom if possible. As more checking is performed, this method performs worse than copyTo
createInstance(*args, **kwargs)

Create and Initialize an instance of self.__class__( ... ) based on your own data

Returns:new instance of self
Note:using self.__class__ instead of an explicit class allows derived classes that do not have anything to duplicate just to use your implementeation
Note:you must support args and kwargs if one of your iDuplicate bases does
deallocateAllFlags()
deallocateFlag()
delete(*args, **kwargs)

Delete this node

Note:if the undo queue is enabled, the object becomes invalid, but stays alive until it drops off the queue
Note:if you want to delete many nodes, its more efficient to delete them using the global delete method
dependencyInfo(attribute, by=True)
Returns:

list of attributes that given attribute affects or that the given attribute is affected by if the attribute turns dirty.

Parameters:
  • attribute – attribute instance or attribute name
  • by – if false, affected attributes will be returned, otherwise the attributes affecting this one
Note:

see also MPlug.affectedByPlugs

Note:

USING MEL: as api command and mObject array always crashed on me ... don’t know :(

duplicate(*args, **kwargs)

Duplicate our node and return a wrapped version to it

Parameters:
  • name – if given, the newly created node will use the given name
  • kwargs
    • renameOnClash: if Trrue, default True, clashes are prevented by renaming the new node
    • autocreateNamespace: if True, default True, namespaces will be created if mentioned in the name
Note:

the copyTo method may not have not-undoable side-effects to be a proper implementation

Note:

undo could be implemented for dg nodes - but for reasons of consistency, its disabled here - who knows how much it will crap out after a while as duplicate is not undoable (mel command) - it never really worked to undo a mel command from within python, executed using a dgmodifier - unfortunately it does not return any result making it hard to find the newly duplicated object !

fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
classmethod getMFnClasses()
Returns:list of all function set classes this node supports, most derived function set comes first
hasFn(mfntype)
Returns:True if our object supports the given function set type
isAlive()
Returns:True if the object exists in memory
Note:objects on the undo queue are alive, but NOT valid
isMemberOf(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5c1d740> >)
Returns:True if self is part of setnode
Note:method is undoable
See:sets.ObjectSet
isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
isValid()
Returns:True if the object exists in the scene
Note:objects on the undo queue are NOT valid, but alive
iterParents(predicate=<function <lambda> at 0x7f41dd7c5230>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
object()
Returns:the MObject attached to this Node
parent()
Returns:parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
referenceFile()
Returns:name (str) of file this node is coming from - it could contain a copy number as {x}
Note:will raise if the node is not referenced, use isReferenced to figure that out
removeAttribute(attr)

Remove the given attribute from the node

Parameter:attr – see addAttribute
removeFrom(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5b41420> >)

remove ourselves to the given set

Note:method is undoable
See:sets.ObjectSet
rename(*args, **kwargs)

Rename this node to newname

Parameters:
  • newname – new name of the node
  • autocreateNamespace – if true, namespaces given in newpath will be created automatically, otherwise a RuntimeException will be thrown if a required namespace does not exist
  • renameOnClash – if true, clashing names will automatically be resolved by adjusting the name
Returns:

renamed node which is the node itself

Note:

for safety reasons, this node is dagnode aware and uses a dag modifier for them !

root()
Returns:the root of the DAG - it has no further parents
setLocked(*args, **kwargs)

Lock or unloack this node

Parameter:state – if True, the node is locked. Locked nodes cannot be deleted, renamed or reparented
Note:you can query the lock state with isLocked
setNamespace(*args, **kwargs)
Returns:

self after being moved to the given namespace. This will effectively rename the object.

Parameters:
  • newns – Namespace instance to put this Node into
  • kwargs – to be passed to rename
sets(setFilter=(459, False, 0))
Returns:list of object set compatible Nodes having self as member
Parameter:setFilter – tuple(apiType, use_exact_type) - the combination of the desired api type and the exact type flag allow precise control whether you which to get only renderable shading engines, only objectfSets (tuple[1] = True), or all objects supporting the given object type. Its preset to only return shading engines
Note:the returned sets order is defined by the order connections to instObjGroups
Note:only sets will be returned that have the whole object as member, thus you will not see sets having component assignments like per-compoent shader assignments or deformer sets
supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work

Epydoc: mrv.maya.nt.base.EnumAttribute

class mrv.maya.nt.base.EnumAttribute(*args)

Bases: mrv.maya.nt.Attribute

apiType()
apiTypeStr()
assign()
className()
classmethod create(full_name, brief_name, *args, **kwargs)
Returns:

A new Attribute

Parameters:
  • full_name – the long name of the attribute
  • brief_name – the brief name of the attribute
Note:

all args and kwargs are passed to the respective function set instance

Note:

specialize this method in derived types if required

hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.GenericAttribute

class mrv.maya.nt.base.GenericAttribute(*args)

Bases: mrv.maya.nt.Attribute

apiType()
apiTypeStr()
assign()
className()
classmethod create(full_name, brief_name, *args, **kwargs)
Returns:

A new Attribute

Parameters:
  • full_name – the long name of the attribute
  • brief_name – the brief name of the attribute
Note:

all args and kwargs are passed to the respective function set instance

Note:

specialize this method in derived types if required

hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.GeometryData

class mrv.maya.nt.base.GeometryData(*args)

Bases: mrv.maya.nt.Data

Wraps geometry data providing additional convenience methods

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag
uniqueObjectId()
Returns:an object id that is guaranteed to be unique
Note:use it with addObjectGroup to create a new unique group

Epydoc: mrv.maya.nt.base.IntArrayData

class mrv.maya.nt.base.IntArrayData(*args)

Bases: mrv.maya.nt.Data

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.LatticeData

class mrv.maya.nt.base.LatticeData(*args)

Bases: mrv.maya.nt.GeometryData

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag
uniqueObjectId()
Returns:an object id that is guaranteed to be unique
Note:use it with addObjectGroup to create a new unique group

Epydoc: mrv.maya.nt.base.LightDataAttribute

class mrv.maya.nt.base.LightDataAttribute(*args)

Bases: mrv.maya.nt.Attribute

apiType()
apiTypeStr()
assign()
className()
classmethod create(full_name, brief_name, *args, **kwargs)
Returns:

A new Attribute

Parameters:
  • full_name – the long name of the attribute
  • brief_name – the brief name of the attribute
Note:

all args and kwargs are passed to the respective function set instance

Note:

specialize this method in derived types if required

hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base

class mrv.maya.nt.base.MDagPath(*args)

Bases: object

apiType()
assign()
child()
childCount()
className()
exclusiveMatrix()
exclusiveMatrixInverse()
extendToShape()
extendToShapeDirectlyBelow()
fullPathName()
getAPathTo()
getAllPathsTo()
getPath()
hasFn()
inclusiveMatrix()
inclusiveMatrixInverse()
instanceNumber()
isInstanced()
isValid()
length()
node()
numberOfShapesDirectlyBelow()
partialPathName()
pathCount()
pop()
push()
set()
thisown
The membership flag
transform()

Epydoc: mrv.maya.nt.base.MDagPathUtil

class mrv.maya.nt.base.MDagPathUtil

Bases: object

Performs operations on MDagPaths which are hard or inconvenient to do otherwise

Note:We do NOT patch the actual api type as this would make it unusable to be passed in as reference/pointer type unless its being created by maya itself.
classmethod childPathAtIndex(path, index)
Returns:MDagPath pointing to this path’s child at the given index
classmethod childPaths(path, predicate=<function <lambda> at 0x5eb3578>)
Returns:list of child MDagPaths which have path as parent
Parameter:predicate – returns True for each path which should be included in the result.
classmethod childPathsByFn(path, fn, predicate=<function <lambda> at 0x5eb3758>)

Get all children below path supporting the given MFn.type

Returns:

MDagPaths to all matched paths below this path

Parameters:
  • fn – member of MFn
  • predicate – returns True for each path which should be included in the result.
classmethod extendToChild(path, num)

Extend path to the given child number - can be shape or transform

Returns:path itself
classmethod numShapes(path)
Returns:return the number of shapes below path
classmethod parentPath(path)
Returns:MDagPath to the parent of path or None if path is in the scene root.
classmethod pop(path, num)

Pop the given number of items off the end of the path

Returns:path itself
classmethod shapes(path, predicate=<function <lambda> at 0x5eb3848>)
Returns:MDagPaths to all shapes below path
Parameter:predicate – returns True for each path which should be included in the result.
Note:have to explicitly assure we do not get transforms that are compatible to the shape function set for some reason - this is just odd and shouldn’t be, but it happens if a transform has an instanced shape for example, perhaps even if it is not instanced
classmethod transforms(path, predicate=<function <lambda> at 0x5eb3938>)
Returns:MDagPaths to all transforms below path
Parameter:predicate – returns True to include path in result

Epydoc: mrv.maya.nt.base

class mrv.maya.nt.base.MFnDagNode(*args)

Bases: maya.OpenMaya.MFnDependencyNode

addAttribute()
addChild()
allocateFlag()
attribute()
attributeClass()
attributeCount()
boundingBox()
canBeWritten()
child()
childCount()
className()
classification()
create()
dagPath()
dagRoot()
deallocateAllFlags()
deallocateFlag()
dgCallbackIds()
dgCallbacks()
dgTimer()
dgTimerOff()
dgTimerOn()
dgTimerQueryState()
dgTimerReset()
duplicate()
findAlias()
findPlug()
fullPathName()
getAffectedAttributes()
getAffectedByAttributes()
getAliasAttr()
getAliasList()
getAllPaths()
getConnections()
getPath()
hasAttribute()
hasChild()
hasObj()
hasParent()
hasUniqueName()
icon()
inModel()
inUnderWorld()
instanceCount()
isChildOf()
isDefaultNode()
isFlagSet()
isFromReferencedFile()
isInstanceable()
isInstanced()
isInstancedAttribute()
isIntermediateObject()
isLocked()
isNewAttribute()
isParentOf()
isShared()
model()
name()
object()
objectColor()
objectGroupComponent()
parent()
parentCount()
parentNamespace()
partialPathName()
pluginName()
plugsAlias()
removeAttribute()
removeChild()
removeChildAt()
reorderedAttribute()
setAlias()
setDoNotWrite()
setFlag()
setIcon()
setInstanceable()
setIntermediateObject()
setLocked()
setName()
setObject()
setObjectColor()
setUseObjectColor()
thisown
The membership flag
transformationMatrix()
type()
typeId()
typeName()
userNode()
usingObjectColor()

Epydoc: mrv.maya.nt.base

class mrv.maya.nt.base.MObject(*args)

Bases: object

apiType()
apiTypeStr()
assign()
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base

class mrv.maya.nt.base.MObjectHandle(*args)

Bases: object

assign()
hashCode()
isAlive()
isValid()
object()
objectRef()
thisown
The membership flag

Epydoc: mrv.maya.nt.base.MatrixAttribute

class mrv.maya.nt.base.MatrixAttribute(*args)

Bases: mrv.maya.nt.Attribute

apiType()
apiTypeStr()
assign()
className()
classmethod create(full_name, brief_name, *args, **kwargs)
Returns:

A new Attribute

Parameters:
  • full_name – the long name of the attribute
  • brief_name – the brief name of the attribute
Note:

all args and kwargs are passed to the respective function set instance

Note:

specialize this method in derived types if required

hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.MatrixData

class mrv.maya.nt.base.MatrixData(*args)

Bases: mrv.maya.nt.Data

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.MeshData

class mrv.maya.nt.base.MeshData(*args)

Bases: mrv.maya.nt.GeometryData

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag
uniqueObjectId()
Returns:an object id that is guaranteed to be unique
Note:use it with addObjectGroup to create a new unique group

Epydoc: mrv.maya.nt.base.MessageAttribute

class mrv.maya.nt.base.MessageAttribute(*args)

Bases: mrv.maya.nt.Attribute

apiType()
apiTypeStr()
assign()
className()
classmethod create(full_name, brief_name, *args, **kwargs)
Returns:

A new Attribute

Parameters:
  • full_name – the long name of the attribute
  • brief_name – the brief name of the attribute
Note:

all args and kwargs are passed to the respective function set instance

Note:

specialize this method in derived types if required

hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base

class mrv.maya.nt.base.MetaClassCreatorNodes

Bases: mrv.maya.util.MetaClassCreator

Builds the base hierarchy for the given classname based on our typetree :todo: build classes with slots only as members are pretermined

mro
mro() -> list return a type’s method resolution order

Epydoc: mrv.maya.nt.base.NIdData

class mrv.maya.nt.base.NIdData(*args)

Bases: mrv.maya.nt.Data

Note:maya 2011 and newer
apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.NObjectData

class mrv.maya.nt.base.NObjectData(*args)

Bases: mrv.maya.nt.Data

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.Node

class mrv.maya.nt.base.Node

Bases: object

Common base for all maya nodes, providing access to the maya internal object representation Use this class to directly create a maya node of the required type

apiObject()
Returns:the highest qualified api object of the actual superclass, usually either MObject or MDagPath
apiType()
Returns:the MFn Type id of the wrapped object
classmethod getMFnClasses()
Returns:list of all function set classes this node supports, most derived function set comes first
hasFn(mfntype)
Returns:True if our object supports the given function set type

Epydoc: mrv.maya.nt.base.NodeFromObj

class mrv.maya.nt.base.NodeFromObj

Bases: object

Virtual Constructor, producing nodes as the Node does, but it will only accept MObjects or dagpaths which are expected to be valid. As no additional checking is performed, it might be more unsafe to use, but will be faster as it does not perform any runtime checks

It duplicates code from _checkedInstanceCreation and _checkedInstanceCreationDagPathSupport to squeeze out the last tiny bit of performance as it can make quite a few more assumptions and reduces method calls.

Note:Do not derive from this class, derive from Node instead
Note:We will always create the node type as determined by the type hierarchy

Epydoc: mrv.maya.nt.base.NodeFromStr

class mrv.maya.nt.base.NodeFromStr

Bases: object

Virtual constructor similar to NodeFromObj, but it will only accept strings to produce a wrapped node as fast as possible. Therefore, the error checking is left out.

Epydoc: mrv.maya.nt.base.NumericAttribute

class mrv.maya.nt.base.NumericAttribute(*args)

Bases: mrv.maya.nt.Attribute

apiType()
apiTypeStr()
assign()
className()
classmethod create(full_name, brief_name, *args, **kwargs)
Returns:

A new Attribute

Parameters:
  • full_name – the long name of the attribute
  • brief_name – the brief name of the attribute
Note:

all args and kwargs are passed to the respective function set instance

Note:

specialize this method in derived types if required

classmethod createColor(full_name, brief_name)
Returns:

An attribute representing a RGB color

Parameters:
  • full_name – see create
  • brief_name – see create
classmethod createPoint(full_name, brief_name)
Returns:

An attribute representing a point with XYZ coordinates

Parameters:
  • full_name – see create
  • brief_name – see create
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.NumericData

class mrv.maya.nt.base.NumericData(*args)

Bases: mrv.maya.nt.Data

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.NurbsCurveData

class mrv.maya.nt.base.NurbsCurveData(*args)

Bases: mrv.maya.nt.GeometryData

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag
uniqueObjectId()
Returns:an object id that is guaranteed to be unique
Note:use it with addObjectGroup to create a new unique group

Epydoc: mrv.maya.nt.base.NurbsSurfaceData

class mrv.maya.nt.base.NurbsSurfaceData(*args)

Bases: mrv.maya.nt.GeometryData

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag
uniqueObjectId()
Returns:an object id that is guaranteed to be unique
Note:use it with addObjectGroup to create a new unique group

Epydoc: mrv.maya.nt.base.PluginData

class mrv.maya.nt.base.PluginData(*args)

Bases: mrv.maya.nt.Data

Wraps plugin data as received by a plug. If plugin’s registered their data types and tracking dictionaries using the registerPluginDataTrackingDict, the original self pointer can easily be retrieved using this classes interface

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
data()
Returns:python data wrapped by this plugin data object
Note:the python data should be made such that it can be changed using the reference we return - otherwise it will be read-only as it is just a copy !
Note:the data retrieved by this method cannot be used in plug.msetMObject(data) as it is ordinary python data, not an mobject
Raises RuntimeError:
 if the data object’s id is unknown to this class
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.PointArrayData

class mrv.maya.nt.base.PointArrayData(*args)

Bases: mrv.maya.nt.Data

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.Reference

class mrv.maya.nt.base.Reference

Bases: mrv.maya.nt.DependNode

Implements additional utilities to work with references

addAttribute(attr)

Add the given attribute to the node as local dynamic attribute

Parameter:attr – MObject of attribute or Attribute instance as retrieved from a plug
Returns:plug to the newly added attribute
Note:This method is explicitly not undoable as attributes are being deleted in memory right in the moment they are being removed, thus they cannot reside on the undo queue
classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
addTo(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5c828e0> >, **kwargs)

Add ourselves to the given set

Note:method is undoable
See:sets.ObjectSet
allocateFlag()
apiObject()
Returns:the MObject attached to this Node
apiType()
Returns:the MFn Type id of the wrapped object
basename()
Returns:name of this instance
Note:it is mainly for compatability with dagNodes which need this method in order to return the name of their leaf node
children(predicate=<function <lambda> at 0x7f41dd7c2ed8>)
Returns:list of intermediate children of path, [ child1 , child2 ]
Parameter:predicate – return True to include x in result
Note:the child objects returned are supposed to be valid paths, not just relative paths
childrenDeep(order=1, predicate=<function <lambda> at 0x7f41dd7c5050>)
Returns:

list of all children of path, [ child1 , child2 ]

Parameters:
  • order – order enumeration
  • predicate – returns true if x may be returned
Note:

the child objects returned are supposed to be valid paths, not just relative paths

className()
classification()
connectedSets(setFilter=(459, False, 0))
Returns:list of object set compatible Nodes having self as member
Parameter:setFilter – tuple(apiType, use_exact_type) - the combination of the desired api type and the exact type flag allow precise control whether you which to get only renderable shading engines, only objectfSets (tuple[1] = True), or all objects supporting the given object type. Its preset to only return shading engines
Note:the returned sets order is defined by the order connections to instObjGroups
Note:only sets will be returned that have the whole object as member, thus you will not see sets having component assignments like per-compoent shader assignments or deformer sets
connections()
Returns:MPlugArray of connected plugs
copyFrom(other, *args, **kwargs)

Copy the data from other into self as good as possible Only copy the data that is unique to your specific class - the data of other classes will be taken care of by them !

Note:you must support args and kwargs if one of your iDuplicate bases does
copyTo(instance, *args, **kwargs)

Copy the values of ourselves onto the given instance which must be an instance of our class to be compatible. Only the common classes will be copied to instance

Returns:altered instance
Note:instance will be altered during the process
copyToOther(instance, *args, **kwargs)
As copyTo, but does only require the objects to have a common base. It will match the actually compatible base classes and call copyFrom if possible. As more checking is performed, this method performs worse than copyTo
createInstance(*args, **kwargs)

Create and Initialize an instance of self.__class__( ... ) based on your own data

Returns:new instance of self
Note:using self.__class__ instead of an explicit class allows derived classes that do not have anything to duplicate just to use your implementeation
Note:you must support args and kwargs if one of your iDuplicate bases does
deallocateAllFlags()
deallocateFlag()
delete(*args, **kwargs)

Delete this node

Note:if the undo queue is enabled, the object becomes invalid, but stays alive until it drops off the queue
Note:if you want to delete many nodes, its more efficient to delete them using the global delete method
dependencyInfo(attribute, by=True)
Returns:

list of attributes that given attribute affects or that the given attribute is affected by if the attribute turns dirty.

Parameters:
  • attribute – attribute instance or attribute name
  • by – if false, affected attributes will be returned, otherwise the attributes affecting this one
Note:

see also MPlug.affectedByPlugs

Note:

USING MEL: as api command and mObject array always crashed on me ... don’t know :(

duplicate(*args, **kwargs)

Duplicate our node and return a wrapped version to it

Parameters:
  • name – if given, the newly created node will use the given name
  • kwargs
    • renameOnClash: if Trrue, default True, clashes are prevented by renaming the new node
    • autocreateNamespace: if True, default True, namespaces will be created if mentioned in the name
Note:

the copyTo method may not have not-undoable side-effects to be a proper implementation

Note:

undo could be implemented for dg nodes - but for reasons of consistency, its disabled here - who knows how much it will crap out after a while as duplicate is not undoable (mel command) - it never really worked to undo a mel command from within python, executed using a dgmodifier - unfortunately it does not return any result making it hard to find the newly duplicated object !

fileReference()
Returns:FileReference instance initialized with the reference we represent
fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
classmethod getMFnClasses()
Returns:list of all function set classes this node supports, most derived function set comes first
hasFn(mfntype)
Returns:True if our object supports the given function set type
isAlive()
Returns:True if the object exists in memory
Note:objects on the undo queue are alive, but NOT valid
isMemberOf(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5c1d740> >)
Returns:True if self is part of setnode
Note:method is undoable
See:sets.ObjectSet
isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
isValid()
Returns:True if the object exists in the scene
Note:objects on the undo queue are NOT valid, but alive
iterParents(predicate=<function <lambda> at 0x7f41dd7c5230>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
object()
Returns:the MObject attached to this Node
parent()
Returns:parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
referenceFile()
Returns:name (str) of file this node is coming from - it could contain a copy number as {x}
Note:will raise if the node is not referenced, use isReferenced to figure that out
removeAttribute(attr)

Remove the given attribute from the node

Parameter:attr – see addAttribute
removeFrom(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5b41420> >)

remove ourselves to the given set

Note:method is undoable
See:sets.ObjectSet
rename(*args, **kwargs)

Rename this node to newname

Parameters:
  • newname – new name of the node
  • autocreateNamespace – if true, namespaces given in newpath will be created automatically, otherwise a RuntimeException will be thrown if a required namespace does not exist
  • renameOnClash – if true, clashing names will automatically be resolved by adjusting the name
Returns:

renamed node which is the node itself

Note:

for safety reasons, this node is dagnode aware and uses a dag modifier for them !

root()
Returns:the root of the DAG - it has no further parents
setLocked(*args, **kwargs)

Lock or unloack this node

Parameter:state – if True, the node is locked. Locked nodes cannot be deleted, renamed or reparented
Note:you can query the lock state with isLocked
setNamespace(*args, **kwargs)
Returns:

self after being moved to the given namespace. This will effectively rename the object.

Parameters:
  • newns – Namespace instance to put this Node into
  • kwargs – to be passed to rename
sets(setFilter=(459, False, 0))
Returns:list of object set compatible Nodes having self as member
Parameter:setFilter – tuple(apiType, use_exact_type) - the combination of the desired api type and the exact type flag allow precise control whether you which to get only renderable shading engines, only objectfSets (tuple[1] = True), or all objects supporting the given object type. Its preset to only return shading engines
Note:the returned sets order is defined by the order connections to instObjGroups
Note:only sets will be returned that have the whole object as member, thus you will not see sets having component assignments like per-compoent shader assignments or deformer sets
supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work

Epydoc: mrv.maya.nt.base.SetFilter

class mrv.maya.nt.base.SetFilter

Bases: tuple

Utility Class returning True or False on call, latter one if the passed object does not match the filter

count
T.count(value) -> integer – return number of occurrences of value
index
T.index(value, [start, [stop]]) -> integer – return first index of value. Raises ValueError if the value is not present.

Epydoc: mrv.maya.nt.base.Shape

class mrv.maya.nt.base.Shape

Bases: mrv.maya.nt.DagNode

Interface providing common methods to all geometry shapes as they can be shaded. They usually support per object and per component shader assignments

Note:as shadingEngines are derived from objectSet, this class deliberatly uses them interchangably when it comes to set handling.
Note:for convenience, this class implements the shader related methods whereever possible
Note:bases determined by metaclass
addAttribute(attr)

Add the given attribute to the node as local dynamic attribute

Parameter:attr – MObject of attribute or Attribute instance as retrieved from a plug
Returns:plug to the newly added attribute
Note:This method is explicitly not undoable as attributes are being deleted in memory right in the moment they are being removed, thus they cannot reside on the undo queue
addChild(*args, **kwargs)

Add the given childNode as child to this Node. Allows instancing !

Parameters:
  • childNode – Node you wish to add
  • position – the index to which to add the new child, kNextPos will add it as last child. It supports python style negative indices
  • keepExistingParent – if True, the childNode will be instanced as it will have its previous parent(s) and this one, if False, the previous parent will be removed from the child’s parent list
  • renameOnClash – resolve nameclashes by automatically renaming the node to make it unique
  • keepWorldSpace – see reparent, only effective if the node is not instanced
Returns:

childNode whose path is pointing to the new child location

Raises ValueError:
 

if keepWorldSpace is requested with directly instanced nodes

Note:

as maya internally handles add/remove child as instancing operation, even though keepExistingParent is False, it will mess up things and for a short period of time in fact have two n + 1 instances, right before one is unlinked, This still fills a slot or something, and isInstanced will be true, although the pathcount is 1. Long story short: if the item to be added to us is not instanced, we use reparent instead. It will not harm in direct instances, so its save to use.

Note:

if the instance count of the item is 1 and keepExistingParent is False, the position argument is being ignored

addInstancedChild(*args, **kwargs)

Add childnode as instanced child to this node

Note:for more information, see addChild
Note:its a shortcut to addChild allowing to clearly indicate what is happening
addParent(*args, **kwargs)

Adds ourselves as instance to the given parentnode at position

Parameter:kwargs – see addChild
Returns:self with updated dag path
classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
addTo(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5c828e0> >, **kwargs)

Add ourselves to the given set

Note:method is undoable
See:sets.ObjectSet
allocateFlag()
apiObject()
Returns:our dag path as this is our api object - the object defining this node best
apiType()
Returns:the MFn Type id of the wrapped object
basename()
Returns:basename of this path, ‘/hello/world’ -> ‘world’
child(index)
Returns:child of self at index
Note:this method fixes the MFnDagNode.child method - it returns an MObject, which doesnt work well with instanced nodes - a dag path is required, which is what we use to aquire the object
childTransforms(predicate=<function <lambda> at 0x5e9b2a8>)
Returns:list of all transform nodes below this one
children(predicate=<function <lambda> at 0x5e99f50>, asNode=True)
Returns:all child nodes below this dag node if predicate returns True for passed Node
Parameter:asNode – if True, you will receive the children as wrapped Nodes, otherwise you get MDagPaths
childrenByType(nodeType, predicate=<function <lambda> at 0x5e9b0c8>)
Returns:all childnodes below this one matching the given nodeType and the predicate
Parameter:nodeType – class of the nodeTyoe, like nt.Transform
childrenDeep(order=1, predicate=<function <lambda> at 0x7f41dd7c5050>)
Returns:

list of all children of path, [ child1 , child2 ]

Parameters:
  • order – order enumeration
  • predicate – returns true if x may be returned
Note:

the child objects returned are supposed to be valid paths, not just relative paths

className()
classification()
componentAssignments(setFilter=(319, False, 0), use_api=True, asComponent=True)
Returns:

list of tuples(ObjectSetNode, Component_or_MObject) defininmg shader assignments on per component basis.

If a shader is assigned to the whole object, the component would be a null object, otherwise it is an instance of a wrapped IndexedComponent class

Note:

The returned Component will be an MObject(kNullObject) only in case the component is not set. Hence you should check whether it isNull() before actually using it.

Parameters:
  • setFilter – see connectedSets
  • use_api – if True, api methods will be used if possible which is usually faster. If False, a custom non-api implementation will be used instead. This can be required if the apiImplementation is not reliable which happens in few cases of ‘weird’ component assignments
  • asComponent – If True, the components will be wrapped into the matching MRV compontent type to provide a nicer interface. This might slightly slow down the process, but this is usually neglectable.
Note:

the sets order will be the order of connections of the respective component list attributes at instObjGroups.objectGroups

Note:

currently only meshes and subdees support per component assignment, whereas only meshes can have per component shader assignments

Note:

SubDivision Components cannot be supported as the component type kSubdivCVComponent cannot be wrapped into any component function set - reevaluate that with new maya versions !

Note:

deformer set component assignments are only returned for instance 0 ! They apply to all output meshes though

connectedSets(setFilter=(459, False, 0))
Returns:list of object set compatible Nodes having self as member
Parameter:setFilter – tuple(apiType, use_exact_type) - the combination of the desired api type and the exact type flag allow precise control whether you which to get only renderable shading engines, only objectfSets (tuple[1] = True), or all objects supporting the given object type. Its preset to only return shading engines
Note:the returned sets order is defined by the order connections to instObjGroups
Note:only sets will be returned that have the whole object as member, thus you will not see sets having component assignments like per-compoent shader assignments or deformer sets
connections()
Returns:MPlugArray of connected plugs
copyFrom(other, *args, **kwargs)

Copy the data from other into self as good as possible Only copy the data that is unique to your specific class - the data of other classes will be taken care of by them !

Note:you must support args and kwargs if one of your iDuplicate bases does
copyTo(instance, *args, **kwargs)

Copy the values of ourselves onto the given instance which must be an instance of our class to be compatible. Only the common classes will be copied to instance

Returns:altered instance
Note:instance will be altered during the process
copyToOther(instance, *args, **kwargs)
As copyTo, but does only require the objects to have a common base. It will match the actually compatible base classes and call copyFrom if possible. As more checking is performed, this method performs worse than copyTo
createInstance(*args, **kwargs)

Create and Initialize an instance of self.__class__( ... ) based on your own data

Returns:new instance of self
Note:using self.__class__ instead of an explicit class allows derived classes that do not have anything to duplicate just to use your implementeation
Note:you must support args and kwargs if one of your iDuplicate bases does
dagPath()
Returns:the original DagPath attached to this Node - it’s not wrapped for performance
Note:If you plan to alter it, make sure you copy it using the MDagPath(node.dagPath()) construct !
deallocateAllFlags()
deallocateFlag()
delete(*args, **kwargs)

Delete this node - this special version must be

Note:if the undo queue is enabled, the object becomes invalid, but stays alive until it drops off the queue
Note:if you want to delete many nodes, its more efficient to delete them using the global delete method
dependencyInfo(attribute, by=True)
Returns:

list of attributes that given attribute affects or that the given attribute is affected by if the attribute turns dirty.

Parameters:
  • attribute – attribute instance or attribute name
  • by – if false, affected attributes will be returned, otherwise the attributes affecting this one
Note:

see also MPlug.affectedByPlugs

Note:

USING MEL: as api command and mObject array always crashed on me ... don’t know :(

displayOverrideValue(plugName)
Returns:the override display value actually identified by plugName affecting the given object (that should be a leaf node for the result you see in the viewport. The display type in effect is always the last one set in the hierarchy returns None display overrides are disabled
duplicate(*args, **kwargs)

Duplciate the given node to newpath

Parameters:
  • newpath

    result depends on its format:

    • ‘’ - empty string, creates a unique name based on the actual node name by appending a copy number to it, if newTransform is True, the newly created shape/transform will keep its name, but receives a new parent
    • ‘newname’ - relative path, the node will be duplicated not changing its current parent if newTransform is False
    • |parent|newname - absolute path, the node will be duplicated and reparented under the given path
      if newTransform is True, a new transform name will be created based on your name by appending a unique copy number
  • autocreateNamespace – if true, namespaces given in newpath will be created automatically, otherwise a RuntimeException will be thrown if a required namespace does not exist
  • renameOnClash – if true, clashing names will automatically be resolved by adjusting the name
  • newTransform – if True, a new transform will be created based on the name of the parent transform of this shape node, appending a unique copy number to it. Only has an effect for shape nodes
Returns:

newly create Node

Note:

duplicate performance could be improved by checking more before doing work that does not really change the scene, but adds undo operations

Note:

inbetween parents are always required as needed

Todo:

add example for each version of newpath

Note:

instancing can be realized using the addChild function

Note:

If meshes have tweaks applied, the duplicate will not have these tweaks and the meshes will look mislocated. Using MEL works in that case ... (they fixed it there obviously) , but creates invalid objects

Todo:

Undo implementation - every undoable operation must in fact be based on strings to really work, all this is far too much - dagNode.duplicate must be undoable by itself

Todo:

duplicate should be completely reimplemented to support all mel options and actually work with meshes and tweaks - the underlying api duplication would still be used of course, as well as connections (to sets) and so on ...

fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
classmethod getMFnClasses()
Returns:list of all function set classes this node supports, most derived function set comes first
hasChild(node)
Returns:True if node is a child of self
hasFn(mfntype)
Returns:True if our object supports the given function set type
instance(instanceNumber)
Returns:Node to the instance identified by instanceNumber
Parameter:instanceNumber – range(0, self.instanceCount()-1)
instanceNumber()
Returns:our instance number
Note:0 does not indicate that this object is not instanced - use getInstanceCount instead
isAlive()
Returns:True if the object exists in memory
Note:objects on the undo queue are alive, but NOT valid
isMemberOf(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5c1d740> >)
Returns:True if self is part of setnode
Note:method is undoable
See:sets.ObjectSet
isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
isTemplate()
Returns:True if this node is templated - this is the case if itself or one of its parents are templated
isValid()
Returns:True if the object exists in the scene
Note:Handles DAG objects correctly that can be instanced, in which case the MObject may be valid , but the respective dag path is not. Additionally, if the object is not parented below any object, everything appears to be valid, but the path name is empty
isVisible()
Returns:True if this node is visible - its visible if itself and all parents are visible
iterInstances(excludeSelf=False)

Get iterator over all (direct and indirect)instances of this node

Parameter:excludeSelf – if True, self will not be returned, if False, it will be in the list of items
Note:Iterating instances is more efficient than querying all instances individually using instance
Todo:add flag to allow iteration of indirect instances as well
iterParents(predicate=<function <lambda> at 0x7f41dd7c5230>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
name()
Returns:fully qualified (long) name of this dag node
object()
Returns:MObject as retrieved from the MDagPath of our Node
parent()
Returns:Maya node of the parent of this instance or None if this is the root
parentAtIndex(index)
Returns:Node of the parent at the given index - non-instanced nodes only have one parent
Note:if a node is instanced, it can have parentCount parents
Todo:Update dagpath afterwards ! Use dagpaths instead !
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
referenceFile()
Returns:name (str) of file this node is coming from - it could contain a copy number as {x}
Note:will raise if the node is not referenced, use isReferenced to figure that out
removeAttribute(attr)

Remove the given attribute from the node

Parameter:attr – see addAttribute
removeChild(*args, **kwargs)

remove the given childNode (being a child of this node) from our child list, effectively parenting it under world !

Parameters:
  • childNode – Node to unparent - if it is not one of our children, no change takes place
  • allowZeroParents – if True, it is possible to leave a node unparented, thus no valid dag paths leads to it. If False, transforms will just be reparented under the world
Returns:

copy of childnode pointing to the first valid dag path we find.

Note:

to prevent the child (if transform) to dangle in unknown space if the last instance is to be removed, it will instead be reparented to world.

Note:

removing shapes from their last parent will result in an error

removeFrom(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5b41420> >)

remove ourselves to the given set

Note:method is undoable
See:sets.ObjectSet
removeParent(*args, **kwargs)

Remove ourselves from given parentnode

Returns:None
rename(*args, **kwargs)

Rename this node to newname

Parameters:
  • newname – new name of the node
  • autocreateNamespace – if true, namespaces given in newpath will be created automatically, otherwise a RuntimeException will be thrown if a required namespace does not exist
  • renameOnClash – if true, clashing names will automatically be resolved by adjusting the name
Returns:

renamed node which is the node itself

Note:

for safety reasons, this node is dagnode aware and uses a dag modifier for them !

reparent(*args, **kwargs)

Change the parent of all nodes (also instances) to be located below parentnode

Parameters:
  • parentnode – Node instance of transform under which this node should be parented to if None, node will be reparented under the root (which only works for transforms)
  • renameOnClash – resolve nameclashes by automatically renaming the node to make it unique
  • raiseOnInstance – if True, this method will raise if you try to reparent an instanced object. If false, instanced objects will be merged into the newly created path under parentnode, effectively eliminating all other paths , keeping the newly created one
  • keepWorldSpace – if True and node to be reparented is a transform, the world space position will be kept by adjusting the transformation accordingly. WARNNG: Currently we reset pivots when doing so

:return : copy of self pointing to the new dag path self

Note:will remove all instance of this object and leave this object at only one path - if this is not what you want, use the addChild method instead as it can properly handle this case
Note:this method handles namespaces properly
root()
Returns:the root of the DAG - it has no further parents
setLocked(*args, **kwargs)

Lock or unloack this node

Parameter:state – if True, the node is locked. Locked nodes cannot be deleted, renamed or reparented
Note:you can query the lock state with isLocked
setNamespace(*args, **kwargs)
Returns:

self after being moved to the given namespace. This will effectively rename the object.

Parameters:
  • newns – Namespace instance to put this Node into
  • kwargs – to be passed to rename
setParent(*args, **kwargs)

Change the parent of self to parentnode being placed at position

Parameter:kwargs – see addChild
Returns:self with updated dag path
sets(setFilter=(459, False, 0))
Returns:list of object set compatible Nodes having self as member
Parameter:setFilter – tuple(apiType, use_exact_type) - the combination of the desired api type and the exact type flag allow precise control whether you which to get only renderable shading engines, only objectfSets (tuple[1] = True), or all objects supporting the given object type. Its preset to only return shading engines
Note:the returned sets order is defined by the order connections to instObjGroups
Note:only sets will be returned that have the whole object as member, thus you will not see sets having component assignments like per-compoent shader assignments or deformer sets
shapes(predicate=<function <lambda> at 0x5e9b1b8>)
Returns:all our Shape nodes
Note:you could use getChildren with a predicate, but this method is more efficient as it uses dagpath functions to filter shapes
supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work
transform()
Returns:Node to lowest transform in the path attached to our node
Note:for shapes this is the parent, for transforms the transform itself
unparent(*args, **kwargs)
As reparent, but will unparent this transform under the scene root

Epydoc: mrv.maya.nt.base.SingleIndexedComponent

class mrv.maya.nt.base.SingleIndexedComponent(*args)

Bases: mrv.maya.nt.Component

precreated class for ease-of-use

addElement(*args)

see addElements

Returns:self
Note:do not use this function as it will be really slow when handling many items, use addElements instead
addElements(*args)

Operates exactly as described in the MFn...IndexComponent documentation, but returns self to allow combined calls and on-the-fly component generation

Returns:self
apiType()
apiTypeStr()
assign()
className()
classmethod create(component_type)
Returns:A new component instance carrying data of the given component type
Parameter:component_type – MFn:: component type to be created.
Note:It is important that you call this function on the Component Class of a compatible type, or a RuntimeError will occour
elements()
Returns:MIntArray containing the indices this component represents
getElements()
Returns:MIntArray containing the indices this component represents
classmethod getMFnType()
Returns:mfn type of this class
Note:the type returned is not the type of the shape component
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.SphereData

class mrv.maya.nt.base.SphereData(*args)

Bases: mrv.maya.nt.Data

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base

class mrv.maya.nt.base.StandinClass(classname, classcreator=<type 'type'>)

Bases: object

Simple Function Object allowing to embed the name of the type as well as the metaclass object supposed to create the actual class. It mus be able to completely create the given class.

Note:Use it at placeholder for classes that are to be created on first call, without vasting large amounts of memory if one wants to precreate them.
classcreator
clsname
createCls()

Create the class of type self.clsname using our classcreator - can only be called once !

:return : the newly created class

Epydoc: mrv.maya.nt.base.StringArrayData

class mrv.maya.nt.base.StringArrayData(*args)

Bases: mrv.maya.nt.Data

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.StringData

class mrv.maya.nt.base.StringData(*args)

Bases: mrv.maya.nt.Data

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.SubdData

class mrv.maya.nt.base.SubdData(*args)

Bases: mrv.maya.nt.GeometryData

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag
uniqueObjectId()
Returns:an object id that is guaranteed to be unique
Note:use it with addObjectGroup to create a new unique group

Epydoc: mrv.maya.nt.base.Transform

class mrv.maya.nt.base.Transform

Bases: mrv.maya.nt.DagNode

Precreated class to allow isinstance checking against their types and to add undo support to MFnTransform functions, as well as for usability

Note:bases determined by metaclass
Note:to have undoable set* functions , get the (improved) transformation matrix make your changes to it and use the set method
addAttribute(attr)

Add the given attribute to the node as local dynamic attribute

Parameter:attr – MObject of attribute or Attribute instance as retrieved from a plug
Returns:plug to the newly added attribute
Note:This method is explicitly not undoable as attributes are being deleted in memory right in the moment they are being removed, thus they cannot reside on the undo queue
addChild(*args, **kwargs)

Add the given childNode as child to this Node. Allows instancing !

Parameters:
  • childNode – Node you wish to add
  • position – the index to which to add the new child, kNextPos will add it as last child. It supports python style negative indices
  • keepExistingParent – if True, the childNode will be instanced as it will have its previous parent(s) and this one, if False, the previous parent will be removed from the child’s parent list
  • renameOnClash – resolve nameclashes by automatically renaming the node to make it unique
  • keepWorldSpace – see reparent, only effective if the node is not instanced
Returns:

childNode whose path is pointing to the new child location

Raises ValueError:
 

if keepWorldSpace is requested with directly instanced nodes

Note:

as maya internally handles add/remove child as instancing operation, even though keepExistingParent is False, it will mess up things and for a short period of time in fact have two n + 1 instances, right before one is unlinked, This still fills a slot or something, and isInstanced will be true, although the pathcount is 1. Long story short: if the item to be added to us is not instanced, we use reparent instead. It will not harm in direct instances, so its save to use.

Note:

if the instance count of the item is 1 and keepExistingParent is False, the position argument is being ignored

addInstancedChild(*args, **kwargs)

Add childnode as instanced child to this node

Note:for more information, see addChild
Note:its a shortcut to addChild allowing to clearly indicate what is happening
addParent(*args, **kwargs)

Adds ourselves as instance to the given parentnode at position

Parameter:kwargs – see addChild
Returns:self with updated dag path
classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
addTo(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5c828e0> >, **kwargs)

Add ourselves to the given set

Note:method is undoable
See:sets.ObjectSet
allocateFlag()
apiObject()
Returns:our dag path as this is our api object - the object defining this node best
apiType()
Returns:the MFn Type id of the wrapped object
basename()
Returns:basename of this path, ‘/hello/world’ -> ‘world’
child(index)
Returns:child of self at index
Note:this method fixes the MFnDagNode.child method - it returns an MObject, which doesnt work well with instanced nodes - a dag path is required, which is what we use to aquire the object
childTransforms(predicate=<function <lambda> at 0x5e9b2a8>)
Returns:list of all transform nodes below this one
children(predicate=<function <lambda> at 0x5e99f50>, asNode=True)
Returns:all child nodes below this dag node if predicate returns True for passed Node
Parameter:asNode – if True, you will receive the children as wrapped Nodes, otherwise you get MDagPaths
childrenByType(nodeType, predicate=<function <lambda> at 0x5e9b0c8>)
Returns:all childnodes below this one matching the given nodeType and the predicate
Parameter:nodeType – class of the nodeTyoe, like nt.Transform
childrenDeep(order=1, predicate=<function <lambda> at 0x7f41dd7c5050>)
Returns:

list of all children of path, [ child1 , child2 ]

Parameters:
  • order – order enumeration
  • predicate – returns true if x may be returned
Note:

the child objects returned are supposed to be valid paths, not just relative paths

className()
classification()
connectedSets(setFilter=(459, False, 0))
Returns:list of object set compatible Nodes having self as member
Parameter:setFilter – tuple(apiType, use_exact_type) - the combination of the desired api type and the exact type flag allow precise control whether you which to get only renderable shading engines, only objectfSets (tuple[1] = True), or all objects supporting the given object type. Its preset to only return shading engines
Note:the returned sets order is defined by the order connections to instObjGroups
Note:only sets will be returned that have the whole object as member, thus you will not see sets having component assignments like per-compoent shader assignments or deformer sets
connections()
Returns:MPlugArray of connected plugs
copyFrom(other, *args, **kwargs)

Copy the data from other into self as good as possible Only copy the data that is unique to your specific class - the data of other classes will be taken care of by them !

Note:you must support args and kwargs if one of your iDuplicate bases does
copyTo(instance, *args, **kwargs)

Copy the values of ourselves onto the given instance which must be an instance of our class to be compatible. Only the common classes will be copied to instance

Returns:altered instance
Note:instance will be altered during the process
copyToOther(instance, *args, **kwargs)
As copyTo, but does only require the objects to have a common base. It will match the actually compatible base classes and call copyFrom if possible. As more checking is performed, this method performs worse than copyTo
createInstance(*args, **kwargs)

Create and Initialize an instance of self.__class__( ... ) based on your own data

Returns:new instance of self
Note:using self.__class__ instead of an explicit class allows derived classes that do not have anything to duplicate just to use your implementeation
Note:you must support args and kwargs if one of your iDuplicate bases does
dagPath()
Returns:the original DagPath attached to this Node - it’s not wrapped for performance
Note:If you plan to alter it, make sure you copy it using the MDagPath(node.dagPath()) construct !
deallocateAllFlags()
deallocateFlag()
delete(*args, **kwargs)

Delete this node - this special version must be

Note:if the undo queue is enabled, the object becomes invalid, but stays alive until it drops off the queue
Note:if you want to delete many nodes, its more efficient to delete them using the global delete method
dependencyInfo(attribute, by=True)
Returns:

list of attributes that given attribute affects or that the given attribute is affected by if the attribute turns dirty.

Parameters:
  • attribute – attribute instance or attribute name
  • by – if false, affected attributes will be returned, otherwise the attributes affecting this one
Note:

see also MPlug.affectedByPlugs

Note:

USING MEL: as api command and mObject array always crashed on me ... don’t know :(

displayOverrideValue(plugName)
Returns:the override display value actually identified by plugName affecting the given object (that should be a leaf node for the result you see in the viewport. The display type in effect is always the last one set in the hierarchy returns None display overrides are disabled
duplicate(*args, **kwargs)

Duplciate the given node to newpath

Parameters:
  • newpath

    result depends on its format:

    • ‘’ - empty string, creates a unique name based on the actual node name by appending a copy number to it, if newTransform is True, the newly created shape/transform will keep its name, but receives a new parent
    • ‘newname’ - relative path, the node will be duplicated not changing its current parent if newTransform is False
    • |parent|newname - absolute path, the node will be duplicated and reparented under the given path
      if newTransform is True, a new transform name will be created based on your name by appending a unique copy number
  • autocreateNamespace – if true, namespaces given in newpath will be created automatically, otherwise a RuntimeException will be thrown if a required namespace does not exist
  • renameOnClash – if true, clashing names will automatically be resolved by adjusting the name
  • newTransform – if True, a new transform will be created based on the name of the parent transform of this shape node, appending a unique copy number to it. Only has an effect for shape nodes
Returns:

newly create Node

Note:

duplicate performance could be improved by checking more before doing work that does not really change the scene, but adds undo operations

Note:

inbetween parents are always required as needed

Todo:

add example for each version of newpath

Note:

instancing can be realized using the addChild function

Note:

If meshes have tweaks applied, the duplicate will not have these tweaks and the meshes will look mislocated. Using MEL works in that case ... (they fixed it there obviously) , but creates invalid objects

Todo:

Undo implementation - every undoable operation must in fact be based on strings to really work, all this is far too much - dagNode.duplicate must be undoable by itself

Todo:

duplicate should be completely reimplemented to support all mel options and actually work with meshes and tweaks - the underlying api duplication would still be used of course, as well as connections (to sets) and so on ...

fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
classmethod getMFnClasses()
Returns:list of all function set classes this node supports, most derived function set comes first
getScale()
Returns:MVector containing the scale of the transform
getShear()
Returns:MVector containing the shear of the transform
hasChild(node)
Returns:True if node is a child of self
hasFn(mfntype)
Returns:True if our object supports the given function set type
instance(instanceNumber)
Returns:Node to the instance identified by instanceNumber
Parameter:instanceNumber – range(0, self.instanceCount()-1)
instanceNumber()
Returns:our instance number
Note:0 does not indicate that this object is not instanced - use getInstanceCount instead
isAlive()
Returns:True if the object exists in memory
Note:objects on the undo queue are alive, but NOT valid
isMemberOf(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5c1d740> >)
Returns:True if self is part of setnode
Note:method is undoable
See:sets.ObjectSet
isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
isTemplate()
Returns:True if this node is templated - this is the case if itself or one of its parents are templated
isValid()
Returns:True if the object exists in the scene
Note:Handles DAG objects correctly that can be instanced, in which case the MObject may be valid , but the respective dag path is not. Additionally, if the object is not parented below any object, everything appears to be valid, but the path name is empty
isVisible()
Returns:True if this node is visible - its visible if itself and all parents are visible
iterInstances(excludeSelf=False)

Get iterator over all (direct and indirect)instances of this node

Parameter:excludeSelf – if True, self will not be returned, if False, it will be in the list of items
Note:Iterating instances is more efficient than querying all instances individually using instance
Todo:add flag to allow iteration of indirect instances as well
iterParents(predicate=<function <lambda> at 0x7f41dd7c5230>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
name()
Returns:fully qualified (long) name of this dag node
object()
Returns:MObject as retrieved from the MDagPath of our Node
parent()
Returns:Maya node of the parent of this instance or None if this is the root
parentAtIndex(index)
Returns:Node of the parent at the given index - non-instanced nodes only have one parent
Note:if a node is instanced, it can have parentCount parents
Todo:Update dagpath afterwards ! Use dagpaths instead !
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
referenceFile()
Returns:name (str) of file this node is coming from - it could contain a copy number as {x}
Note:will raise if the node is not referenced, use isReferenced to figure that out
removeAttribute(attr)

Remove the given attribute from the node

Parameter:attr – see addAttribute
removeChild(*args, **kwargs)

remove the given childNode (being a child of this node) from our child list, effectively parenting it under world !

Parameters:
  • childNode – Node to unparent - if it is not one of our children, no change takes place
  • allowZeroParents – if True, it is possible to leave a node unparented, thus no valid dag paths leads to it. If False, transforms will just be reparented under the world
Returns:

copy of childnode pointing to the first valid dag path we find.

Note:

to prevent the child (if transform) to dangle in unknown space if the last instance is to be removed, it will instead be reparented to world.

Note:

removing shapes from their last parent will result in an error

removeFrom(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x5b41420> >)

remove ourselves to the given set

Note:method is undoable
See:sets.ObjectSet
removeParent(*args, **kwargs)

Remove ourselves from given parentnode

Returns:None
rename(*args, **kwargs)

Rename this node to newname

Parameters:
  • newname – new name of the node
  • autocreateNamespace – if true, namespaces given in newpath will be created automatically, otherwise a RuntimeException will be thrown if a required namespace does not exist
  • renameOnClash – if true, clashing names will automatically be resolved by adjusting the name
Returns:

renamed node which is the node itself

Note:

for safety reasons, this node is dagnode aware and uses a dag modifier for them !

reparent(*args, **kwargs)

Change the parent of all nodes (also instances) to be located below parentnode

Parameters:
  • parentnode – Node instance of transform under which this node should be parented to if None, node will be reparented under the root (which only works for transforms)
  • renameOnClash – resolve nameclashes by automatically renaming the node to make it unique
  • raiseOnInstance – if True, this method will raise if you try to reparent an instanced object. If false, instanced objects will be merged into the newly created path under parentnode, effectively eliminating all other paths , keeping the newly created one
  • keepWorldSpace – if True and node to be reparented is a transform, the world space position will be kept by adjusting the transformation accordingly. WARNNG: Currently we reset pivots when doing so

:return : copy of self pointing to the new dag path self

Note:will remove all instance of this object and leave this object at only one path - if this is not what you want, use the addChild method instead as it can properly handle this case
Note:this method handles namespaces properly
root()
Returns:the root of the DAG - it has no further parents
scaleBy(*args, **kwargs)
Add the given vector to the transform’s scale
set(*args, **kwargs)
Set the transformation of this Transform node
setLocked(*args, **kwargs)

Lock or unloack this node

Parameter:state – if True, the node is locked. Locked nodes cannot be deleted, renamed or reparented
Note:you can query the lock state with isLocked
setNamespace(*args, **kwargs)
Returns:

self after being moved to the given namespace. This will effectively rename the object.

Parameters:
  • newns – Namespace instance to put this Node into
  • kwargs – to be passed to rename
setParent(*args, **kwargs)

Change the parent of self to parentnode being placed at position

Parameter:kwargs – see addChild
Returns:self with updated dag path
setScale(*args, **kwargs)
Set the scale of the transform with undo support from a single vector
setShear(*args, **kwargs)
Set the shear value of the transform with undo support from single vector
sets(setFilter=(459, False, 0))
Returns:list of object set compatible Nodes having self as member
Parameter:setFilter – tuple(apiType, use_exact_type) - the combination of the desired api type and the exact type flag allow precise control whether you which to get only renderable shading engines, only objectfSets (tuple[1] = True), or all objects supporting the given object type. Its preset to only return shading engines
Note:the returned sets order is defined by the order connections to instObjGroups
Note:only sets will be returned that have the whole object as member, thus you will not see sets having component assignments like per-compoent shader assignments or deformer sets
shapes(predicate=<function <lambda> at 0x5e9b1b8>)
Returns:all our Shape nodes
Note:you could use getChildren with a predicate, but this method is more efficient as it uses dagpath functions to filter shapes
shearBy(*args, **kwargs)
Add the given vector to the transform’s shear
supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work
transform()
Returns:Node to lowest transform in the path attached to our node
Note:for shapes this is the parent, for transforms the transform itself
unparent(*args, **kwargs)
As reparent, but will unparent this transform under the scene root

Epydoc: mrv.maya.nt.base.TripleIndexedComponent

class mrv.maya.nt.base.TripleIndexedComponent(*args)

Bases: mrv.maya.nt.Component

precreated class for ease-of-use

addElement(*args)

see addElements

Returns:self
Note:do not use this function as it will be really slow when handling many items, use addElements instead
addElements(*args)

Operates exactly as described in the MFn...IndexComponent documentation, but returns self to allow combined calls and on-the-fly component generation

Returns:self
apiType()
apiTypeStr()
assign()
className()
classmethod create(component_type)
Returns:A new component instance carrying data of the given component type
Parameter:component_type – MFn:: component type to be created.
Note:It is important that you call this function on the Component Class of a compatible type, or a RuntimeError will occour
elements()
Returns:(uIntArray, vIntArray, wIntArray) tuple containing arrays with the u, v and w indices this component represents
getElements()
Returns:(uIntArray, vIntArray, wIntArray) tuple containing arrays with the u, v and w indices this component represents
classmethod getMFnType()
Returns:mfn type of this class
Note:the type returned is not the type of the shape component
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.TypedAttribute

class mrv.maya.nt.base.TypedAttribute(*args)

Bases: mrv.maya.nt.Attribute

apiType()
apiTypeStr()
assign()
className()
classmethod create(full_name, brief_name, *args, **kwargs)
Returns:

A new Attribute

Parameters:
  • full_name – the long name of the attribute
  • brief_name – the brief name of the attribute
Note:

all args and kwargs are passed to the respective function set instance

Note:

specialize this method in derived types if required

hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.UInt64ArrayData

class mrv.maya.nt.base.UInt64ArrayData(*args)

Bases: mrv.maya.nt.Data

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.UnitAttribute

class mrv.maya.nt.base.UnitAttribute(*args)

Bases: mrv.maya.nt.Attribute

apiType()
apiTypeStr()
assign()
className()
classmethod create(full_name, brief_name, *args, **kwargs)
Returns:

A new Attribute

Parameters:
  • full_name – the long name of the attribute
  • brief_name – the brief name of the attribute
Note:

all args and kwargs are passed to the respective function set instance

Note:

specialize this method in derived types if required

hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base.VectorArrayData

class mrv.maya.nt.base.VectorArrayData(*args)

Bases: mrv.maya.nt.Data

apiType()
apiTypeStr()
assign()
className()
classmethod create(*args, **kwargs)
Returns:A new instance of data wrapped in the desired Data type
Note:specialize this method in derived types !
hasFn()
isNull()
kNullObj
thisown
The membership flag

Epydoc: mrv.maya.nt.base

class mrv.maya.nt.base.chain

Bases: object

chain(*iterables) –> chain object

Return a chain object whose .next() method returns elements from the first iterable until it is exhausted, then elements from the next iterable, until all of the iterables are exhausted.

static from_iterable()

chain.from_iterable(iterable) –> chain object

Alternate chain() contructor taking a single iterable argument that evaluates lazily.

next
x.next() -> the next value, or raise StopIteration

Epydoc: mrv.maya.nt.base

class mrv.maya.nt.base.iDagItem

Bases: mrv.interface.Interface

Describes interface for a DAG item. Its used to unify interfaces allowing to access objects in a dag like graph Of the underlying object has a string representation, the defatult implementation will work natively. Otherwise the getParent and getChildren methods should be overwritten

Note:a few methods of this class are abstract and need to be overwritten
Note:this class expects the attribute ‘_sep’ to exist containing the separator at which your object should be split ( for default implementations ). This works as the passed in pointer will belong to derived classes that can define that attribute on instance or on class level
classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
basename()
Returns:basename of this path, ‘/hello/world’ -> ‘world’
children(predicate=<function <lambda> at 0x7f41dd7c2ed8>)
Returns:list of intermediate children of path, [ child1 , child2 ]
Parameter:predicate – return True to include x in result
Note:the child objects returned are supposed to be valid paths, not just relative paths
childrenDeep(order=1, predicate=<function <lambda> at 0x7f41dd7c5050>)
Returns:

list of all children of path, [ child1 , child2 ]

Parameters:
  • order – order enumeration
  • predicate – returns true if x may be returned
Note:

the child objects returned are supposed to be valid paths, not just relative paths

fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
iterParents(predicate=<function <lambda> at 0x7f41dd7c5230>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
parent()
Returns:parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
root()
Returns:the root of the DAG - it has no further parents
supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work

Epydoc: mrv.maya.nt.base

class mrv.maya.nt.base.iDuplicatable

Bases: mrv.interface.Interface

Simple interface allowing any class to be properly duplicated

Note:to implement this interface, implement createInstance and copyFrom in your class
classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
basename()
Returns:basename of this path, ‘/hello/world’ -> ‘world’
children(predicate=<function <lambda> at 0x7f41dd7c2ed8>)
Returns:list of intermediate children of path, [ child1 , child2 ]
Parameter:predicate – return True to include x in result
Note:the child objects returned are supposed to be valid paths, not just relative paths
childrenDeep(order=1, predicate=<function <lambda> at 0x7f41dd7c5050>)
Returns:

list of all children of path, [ child1 , child2 ]

Parameters:
  • order – order enumeration
  • predicate – returns true if x may be returned
Note:

the child objects returned are supposed to be valid paths, not just relative paths

copyFrom(other, *args, **kwargs)

Copy the data from other into self as good as possible Only copy the data that is unique to your specific class - the data of other classes will be taken care of by them !

Note:you must support args and kwargs if one of your iDuplicate bases does
copyTo(instance, *args, **kwargs)

Copy the values of ourselves onto the given instance which must be an instance of our class to be compatible. Only the common classes will be copied to instance

Returns:altered instance
Note:instance will be altered during the process
copyToOther(instance, *args, **kwargs)
As copyTo, but does only require the objects to have a common base. It will match the actually compatible base classes and call copyFrom if possible. As more checking is performed, this method performs worse than copyTo
createInstance(*args, **kwargs)

Create and Initialize an instance of self.__class__( ... ) based on your own data

Returns:new instance of self
Note:using self.__class__ instead of an explicit class allows derived classes that do not have anything to duplicate just to use your implementeation
Note:you must support args and kwargs if one of your iDuplicate bases does
duplicate(*args, **kwargs)

Implements a c-style copy constructor by creating a new instance of self and applying the copyFrom methods from base to all classes implementing the copyfrom method. Thus we will call the method directly on the class

Parameters:
  • args – passed to copyFrom and createInstance method to give additional directions
  • kwargs – see param args
fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
iterParents(predicate=<function <lambda> at 0x7f41dd7c5230>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
parent()
Returns:parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
root()
Returns:the root of the DAG - it has no further parents
supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work

Epydoc: mrv.maya.nt.base

class mrv.maya.nt.base.instancemethod

Bases: object

instancemethod(function, instance, class)

Create an instance method object.

im_class
the class associated with a method
im_func
the function (or other callable) implementing a method
im_self
the instance to which a method is bound; None for unbound methods

Table Of Contents

Previous topic

mrv.maya.ui.browse.finder

Next topic

mrv.maya.nt.it

This Page