mrv.maya.nt.anim

Epydoc: mrv.maya.nt.anim

Contains implementations of animation specific types and utilities

Classes

Epydoc: mrv.maya.nt.anim.AnimCurve

class mrv.maya.nt.anim.AnimCurve

Bases: mrv.maya.nt.DependNode

Type representing a maya animation cuvrve, fixes existing MFnAnimCurve methods and provides new convenience methods as well

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 !

classmethod findAnimation(iter_nodes, asNode=True)
Returns:

list-compatible object containing animation curves attached to the nodes in the given object.

Parameters:
  • iter_nodes – MSelection list or list of MObjects or Nodes containing whose animation you would like to retrieve.
  • asNode – If True, the animation curves will be wrapped, or MObjects otherwise ( to gain performance )
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
getTangent(index, isInTangent)
Returns:

tuple(x,y) tuple containing the x and y positions of the tangent at index:

  • x is the x value of the slope of the tangent in seconds
  • y is the absolute y value of the slope of the tangent
Parameters:
  • index – Index of the key for which the tangent x,y value is required
  • isInTangent – If true, the in-tangent is returned, else, the out-tangent is returned
getTangentAsAngle(index, isInTangent)
Returns:tuple(MAngle, weight) tuple containing the angle and weight of the tangent.
Note:See getTangent for all other parameters
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

Table Of Contents

Previous topic

mrv.maya.nt.apipatch

Next topic

mrv.maya.nt.util

This Page