Package mrv :: Package maya :: Package nt :: Module base :: Class DependNode
[hide private]
[frames] | no frames]

Class DependNode

source code

             object --+    
                      |    
                   Node --+
                          |
         object --+       |
                  |       |
interface.Interface --+   |
                      |   |
interface.iDuplicatable --+
                          |
                         DependNode

Implements access to dependency nodes
Instance Methods [hide private]
 
duplicate(self, name=None, *args, **kwargs)
Duplicate our node and return a wrapped version to it
source code
 
setLocked(self, state)
Lock or unloack this node
source code

Inherited from Node: __hash_2009__, __new__

Inherited from interface.iDuplicatable: copyTo, copyToOther

Inherited from interface.Interface: supports

Inherited from object: __delattr__, __format__, __getattribute__, __init__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

    Overridden Methods
 
__getattr__(self, attr)
Interpret attributes not in our dict as attributes on the wrapped node, create a plug for it and add it to our class dict, effectively caching the attribute
source code
 
__str__(self)
Returns: name of this object
source code
 
__repr__(self)
Returns: class call syntax
source code

Inherited from Node: __eq__, __hash__, __ne__

    Sets Handling
 
_getSetPlug(self)
Returns: message plug - for non dag nodes, this will be connected
source code
 
connectedSets(self, setFilter=fSets)
Returns: list of object set compatible Nodes having self as member
source code
 
sets(self, setFilter=fSets)
Returns: list of object set compatible Nodes having self as member
source code
 
isMemberOf(self, setnode, component=MObject())
Returns: True if self is part of setnode
source code
 
addTo(self, setnode, component=MObject(), **kwargs)
Add ourselves to the given set
source code
 
removeFrom(self, setnode, component=MObject())
remove ourselves to the given set
source code
    Edit
 
rename(self, newname, autocreateNamespace=True, renameOnClash=True)
Rename this node to newname
source code
 
delete(self)
Delete this node
source code
 
_addRemoveAttr(self, attr, add)
DoIt function adding or removing attributes with undo
source code
 
addAttribute(self, attr)
Add the given attribute to the node as local dynamic attribute
source code
 
removeAttribute(self, attr)
Remove the given attribute from the node
source code
 
setNamespace(self, newns, **kwargs)
Returns: self after being moved to the given namespace.
source code
    Connections and Attributes
 
connections(self)
Returns: MPlugArray of connected plugs
source code
 
dependencyInfo(self, attribute, by=True)
Returns: list of attributes that given attribute affects or that the given attribute is affected by if the attribute turns dirty.
source code
    Status
 
isValid(self)
Returns: True if the object exists in the scene
source code
 
isAlive(self)
Returns: True if the object exists in memory
source code
    General Query
 
object(self)
Returns: the MObject attached to this Node
source code
 
apiObject(self)
Returns: the MObject attached to this Node
source code
 
referenceFile(self)
Returns: name (str) of file this node is coming from - it could contain a copy number as {x}
source code
 
basename(self)
Returns: name of this instance
source code
    Interface

Inherited from Node: apiType, hasFn

Inherited from interface.iDuplicatable: copyFrom, createInstance

Class Methods [hide private]
    Interface

Inherited from Node: getMFnClasses

Class Variables [hide private]

Inherited from Node: __metaclass__

    preset type filters
  fSetsObject = SetFilter(api.MFn.kSet, True, 0)
  fSets = SetFilter(api.MFn.kSet, False, 0)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__str__(self)
(Informal representation operator)

source code 

str(x)

Returns:
name of this object
Overrides: object.__str__

__repr__(self)
(Representation operator)

source code 

repr(x)

Returns:
class call syntax
Overrides: object.__repr__

duplicate(self, name=None, *args, **kwargs)

source code 
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
Decorators:
  • @notundoable
Overrides: interface.iDuplicatable.duplicate
Notes:
  • the copyTo method may not have not-undoable side-effects to be a proper implementation
  • 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 !

_getSetPlug(self)

source code 
Returns:
message plug - for non dag nodes, this will be connected

connectedSets(self, setFilter=fSets)

source code 
Parameters:
  • 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
Returns:
list of object set compatible Nodes having self as member
Notes:
  • the returned sets order is defined by the order connections to instObjGroups
  • 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

sets(self, setFilter=fSets)

source code 
Parameters:
  • 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
Returns:
list of object set compatible Nodes having self as member
Notes:
  • the returned sets order is defined by the order connections to instObjGroups
  • 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

isMemberOf(self, setnode, component=MObject())

source code 
Returns:
True if self is part of setnode

Note: method is undoable

See Also: sets.ObjectSet

addTo(self, setnode, component=MObject(), **kwargs)

source code 
Add ourselves to the given set

Note: method is undoable

See Also: sets.ObjectSet

removeFrom(self, setnode, component=MObject())

source code 
remove ourselves to the given set

Note: method is undoable

See Also: sets.ObjectSet

rename(self, newname, autocreateNamespace=True, renameOnClash=True)

source code 
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
Decorators:
  • @undoable

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

delete(self)

source code 
Delete this node
Decorators:
  • @undoable
Notes:
  • if the undo queue is enabled, the object becomes invalid, but stays alive until it drops off the queue
  • if you want to delete many nodes, its more efficient to delete them using the global delete method

addAttribute(self, attr)

source code 
Add the given attribute to the node as local dynamic attribute
Parameters:
  • 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

removeAttribute(self, attr)

source code 
Remove the given attribute from the node
Parameters:

setNamespace(self, newns, **kwargs)

source code 
Parameters:
  • newns - Namespace instance to put this Node into
  • kwargs - to be passed to rename
Returns:
self after being moved to the given namespace. This will effectively rename the object.
Decorators:
  • @undoable

setLocked(self, state)

source code 
Lock or unloack this node
Parameters:
  • state - if True, the node is locked. Locked nodes cannot be deleted, renamed or reparented
Decorators:
  • @undoable

Note: you can query the lock state with isLocked

connections(self)

source code 
Returns:
MPlugArray of connected plugs

dependencyInfo(self, attribute, by=True)

source code 
Parameters:
  • attribute - attribute instance or attribute name
  • by - if false, affected attributes will be returned, otherwise the attributes affecting this one
Returns:
list of attributes that given attribute affects or that the given attribute is affected by if the attribute turns dirty.
Notes:
  • see also MPlug.affectedByPlugs
  • USING MEL: as api command and mObject array always crashed on me ... don't know :(

isValid(self)

source code 
Returns:
True if the object exists in the scene

Note: objects on the undo queue are NOT valid, but alive

isAlive(self)

source code 
Returns:
True if the object exists in memory

Note: objects on the undo queue are alive, but NOT valid

object(self)

source code 
Returns:
the MObject attached to this Node

apiObject(self)

source code 
Returns:
the MObject attached to this Node
Overrides: Node.apiObject

referenceFile(self)

source code 
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

basename(self)

source code 
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