Contains an implementation for the Persistence plugin for easy access within mrv and derived nodes.
Create a new node of nodetype with given nodename
Parameters: |
|
---|---|
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 |
Returns: | list of all data ids available in the given master plug |
---|---|
Parameter: | data_prefix – the string prefix of data names which must match with the prefix of the data id to be returned, with the matching prefix pruned. By default, all data ids will match |
Delete the given nodes
Parameters: |
|
---|---|
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 |
Delete the object set at the given message data plug, at the given setIndex :note: use this method to delete your sets instead of manual deletion as it will automatically
remove the managed partition in case the last set is being deleted
Returns: | compound plug containing all data and connections for the given dataID |
---|---|
Parameter: | masterPlug – compound plug containing all data |
retrieve or create a plug that corresponds to the given dataID :param dataID: string identifier :return: the created data plug, containing subplugs dval and dmsg
for generic data and message connections respectively
Get an object set identified with setIndex at the given dataId
Parameters: |
|
---|---|
Raises ValueError: | |
if a set does not exist at setIndex and autoCreate is False |
|
Raises AttributeError: | |
if the plug did not exist (and autocreate is False) |
|
Note: | method is implicitly undoable if autoCreate is True, this also means that you cannot explicitly undo this operation as you do not know if undo has been queued or not |
Note: | newly created sets will automatically use partitions if one of the sets does |
Returns: | parition node attached to the sets of the given message data plug or None |
---|
Returns: | all objectSets stored at the given message data plug |
---|
Returns: | plug of the given type, either as tuple of two plugs or the plug specified by plugType |
---|---|
Parameters: |
|
Raises AttributeError: | |
if a plug with dataID does not exist and default value is None |
|
Raises TypeError: | |
if plugtype unknown |
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
Returns: | A new instance of data wrapped in the desired Data type |
---|---|
Note: | specialize this method in derived types ! |
Bases: mrv.maya.nt.Node, mrv.interface.iDuplicatable
Implements access to dependency nodes
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 |
Returns: | item with separator added to it ( just once ) |
---|---|
Note: | operates best on strings |
Parameters: |
|
Add ourselves to the given set
Note: | method is undoable |
---|---|
See: | sets.ObjectSet |
Returns: | the MObject attached to this Node |
---|
Returns: | the MFn Type id of the wrapped object |
---|
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 |
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 |
Returns: | list of all children of path, [ child1 , child2 ] |
---|---|
Parameters: |
|
Note: | the child objects returned are supposed to be valid paths, not just relative paths |
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 |
Returns: | MPlugArray of connected plugs |
---|
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 |
---|
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 |
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 |
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 |
Returns: | list of attributes that given attribute affects or that the given attribute is affected by if the attribute turns dirty. |
---|---|
Parameters: |
|
Note: | see also MPlug.affectedByPlugs |
Note: | USING MEL: as api command and mObject array always crashed on me ... don’t know :( |
Duplicate our node and return a wrapped version to it
Parameters: |
|
---|---|
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 ! |
Returns: | list of all function set classes this node supports, most derived function set comes first |
---|
Returns: | True if our object supports the given function set type |
---|
Returns: | True if the object exists in memory |
---|---|
Note: | objects on the undo queue are alive, but NOT valid |
Returns: | True if self is part of setnode |
---|---|
Note: | method is undoable |
See: | sets.ObjectSet |
Returns: | True if self is a part of other, and thus can be found in other |
---|---|
Note: | operates on strings only |
Returns: | True if this path is the root of the DAG |
---|
Returns: | True other starts with self |
---|---|
Note: | operates on strings |
Note: | we assume other has the same type as self, thus the same separator |
Returns: | True if the object exists in the scene |
---|---|
Note: | objects on the undo queue are NOT valid, but alive |
Returns: | generator retrieving all parents up to the root |
---|---|
Parameter: | predicate – returns True for all x that you want to be returned |
Returns: | the MObject attached to this Node |
---|
Returns: | parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root |
---|
Returns: | all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ] |
---|
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 |
Remove the given attribute from the node
Parameter: | attr – see addAttribute |
---|
remove ourselves to the given set
Note: | method is undoable |
---|---|
See: | sets.ObjectSet |
Rename this node to newname
Parameters: |
|
---|---|
Returns: | renamed node which is the node itself |
Note: | for safety reasons, this node is dagnode aware and uses a dag modifier for them ! |
Returns: | the root of the DAG - it has no further parents |
---|
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 |
Returns: | self after being moved to the given namespace. This will effectively rename the object. |
---|---|
Parameters: |
|
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 |
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 |
Bases: maya.OpenMaya.MFnBase
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
Returns: | the highest qualified api object of the actual superclass, usually either MObject or MDagPath |
---|
Returns: | the MFn Type id of the wrapped object |
---|
Returns: | list of all function set classes this node supports, most derived function set comes first |
---|
Returns: | True if our object supports the given function set type |
---|
Bases: mrv.maya.nt.Entity
Extended and more convenient object set interface dealing with Nodes ( and provides the original MFnSet interface as well
Combined method which takes single or multiple members which are to be added
Parameters: |
|
---|---|
Note: | this method is for convenience only and should not be used to add massive amounts of items |
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 |
Add the item to the set
Parameters: |
|
---|---|
Todo: | handle components - currently its only possible when using selection lists |
Returns: | self |
Add items from iterable or selection list as members to this set
Parameters: |
|
---|---|
Returns: | self |
Returns: | item with separator added to it ( just once ) |
---|---|
Note: | operates best on strings |
Parameters: |
|
Add ourselves to the given set
Note: | method is undoable |
---|---|
See: | sets.ObjectSet |
Returns: | the MObject attached to this Node |
---|
Returns: | the MFn Type id of the wrapped object |
---|
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 |
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 |
Returns: | list of all children of path, [ child1 , child2 ] |
---|---|
Parameters: |
|
Note: | the child objects returned are supposed to be valid paths, not just relative paths |
Clear the set so that it will be empty afterwards
Returns: | self |
---|
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 |
Returns: | MPlugArray of connected plugs |
---|
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 |
---|
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 |
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 |
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 |
Returns: | list of attributes that given attribute affects or that the given attribute is affected by if the attribute turns dirty. |
---|---|
Parameters: |
|
Note: | see also MPlug.affectedByPlugs |
Note: | USING MEL: as api command and mObject array always crashed on me ... don’t know :( |
return the result of self minus objects, thus objects will be substracted from our obejcts
Parameters: |
|
---|---|
Returns: | MSelectionList containing objects of self not being in objects list |
Removes a single member or multiple members from the set
Parameters: |
|
---|
Duplicate our node and return a wrapped version to it
Parameters: |
|
---|---|
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 ! |
return the result of self minus objects, thus objects will be substracted from our obejcts
Parameters: |
|
---|---|
Returns: | MSelectionList containing objects of self not being in objects list |
As union, but returns the intersection ( items in common ) of this set with objects
Parameters: |
|
---|---|
Returns: | MSelectionList of objects being in self and in objects |
Returns: | list of all function set classes this node supports, most derived function set comes first |
---|
Returns: | MSelectionList with members of this set |
---|---|
Parameter: | flatten – if True, members that are objectSets themselves will be resolved to their respective members |
Note: | the members are ordinary api objects that still need to be wrapped |
Note: | use iterMembers to iterate the members as wrapped Nodes |
Create a union of the given items with the members of this set
Parameters: |
|
---|---|
Returns: | MSelectionList of all objects of self and objects |
Returns: | True if our object supports the given function set type |
---|
As union, but returns the intersection ( items in common ) of this set with objects
Parameters: |
|
---|---|
Returns: | MSelectionList of objects being in self and in objects |
Returns: | True if the object exists in memory |
---|---|
Note: | objects on the undo queue are alive, but NOT valid |
Returns: | True if obj is a member of this set |
---|---|
Parameter: | component – is given, the component must be fully part of the set for the object ( dagNode ) to be considered part of the set |
Note: | all keywords of it.iterSelectionList are supported |
Note: | ismember does not appear to be working properly with component assignments. It returns true for components that are not actually in the givne shading group |
Returns: | True if self is part of setnode |
---|---|
Note: | method is undoable |
See: | sets.ObjectSet |
Returns: | True if self is a part of other, and thus can be found in other |
---|---|
Note: | operates on strings only |
Returns: | True if this path is the root of the DAG |
---|
Returns: | True other starts with self |
---|---|
Note: | operates on strings |
Note: | we assume other has the same type as self, thus the same separator |
Returns: | True if the object exists in the scene |
---|---|
Note: | objects on the undo queue are NOT valid, but alive |
As difference, but returns an iterator
Parameter: | kwargs – passed to it.iterSelectionList |
---|
As intersection, but returns an iterator
Parameter: | kwargs – passed to it.iterSelectionList |
---|
Iterate members of this set
Note: | All keywords of iterMembers are supported |
---|---|
Note: | if ‘handlePlugs’ is False, the iteration using a filter type will be faster |
Note: | handleComponents will allow component iteration - see the iterator documentation |
Returns: | generator retrieving all parents up to the root |
---|---|
Parameter: | predicate – returns True for all x that you want to be returned |
As union, but returns an iterator
Parameter: | kwargs – passed to it.iterSelectionList |
---|
Returns: | MSelectionList with members of this set |
---|---|
Parameter: | flatten – if True, members that are objectSets themselves will be resolved to their respective members |
Note: | the members are ordinary api objects that still need to be wrapped |
Note: | use iterMembers to iterate the members as wrapped Nodes |
Returns: | the MObject attached to this Node |
---|
Returns: | parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root |
---|
Returns: | all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ] |
---|
Returns: | list of Nodes of partitions the entity is set is part of |
---|
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 |
Remove the given attribute from the node
Parameter: | attr – see addAttribute |
---|
remove ourselves to the given set
Note: | method is undoable |
---|---|
See: | sets.ObjectSet |
Remove the member from the set
Parameter: | member – member of the list, for types see addMember |
---|
Remove items from iterable or selection list from this set
Parameter: | nodes – see addMembers |
---|---|
Returns: | self |
Rename this node to newname
Parameters: |
|
---|---|
Returns: | renamed node which is the node itself |
Note: | for safety reasons, this node is dagnode aware and uses a dag modifier for them ! |
Returns: | the root of the DAG - it has no further parents |
---|
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 |
Adjust set membership for nodes
Parameters: |
|
---|
Returns: | self after being moved to the given namespace. This will effectively rename the object. |
---|---|
Parameters: |
|
Add, add exclusive or remove the given partition from our partition list
Parameters: |
|
---|---|
Returns: | self for chained operations |
Note: | use the supplied enumeration to specify the mode |
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 |
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 |
Returns: | temporary set that will delete itself once it’s reference count reaches 0. Use rval.setobj to access the actual set, as the returned object is just a hanlde to it. The handle is a valid input to the set functions as well |
---|---|
Parameters: |
|
Note: | useful if you want to use the set member union, intersection or substraction methods efficiently on many sets in a row - these internally operate on a set, thus it is faster to use them with another set from the beginning to prevent creation of intermediate sets |
Create a union of the given items with the members of this set
Parameters: |
|
---|---|
Returns: | MSelectionList of all objects of self and objects |
Bases: maya.OpenMayaMPx.MPxData
Allows to access a pickled data object natively within a maya file. In ascii mode, the pickle will be encoded into string data, in binary mode the cPickle will be taken in its original value.
To get the respective dict-references back, we use a tracking dict as proposed by the API Docs
Note: | This datatype is copies the data by reference which is why maya always calls the copy constructor, even if you retrieve a const data reference, where this would not be required actually. This is fine for most uses |
---|---|
Note: | as the datatype is reference based, undo is currently not supported (or does not work as it is expected to do |
Read in 4 byte packs to cStringIO, unpickle from there
Note: | this method is more complicated than it needs be since asCharPtr does not work ! It returns a string of a single char ... which is not the same :) ! |
---|---|
Note: | YES, this is a CUMBERSOME way to deal with bytes ... terrible, thanks maya :), thanks python |
Epydoc: mrv.maya.nt.storage.StorageBase
Bases: mrv.interface.iDuplicatable
A storage node contains a set of attributes allowing it to store python data and objects being stored in a pickled format upon file save. Additionally you can store connections. Nodes used with this interface must be compatible to the following attribute scheme. To create that scheme, use createStorageAttribute
Attribute Setup:
(shortname (description) [data type])
dta (data)[multi compound]
id (data id)[string]
type (data type) [int] # for your own use, store bitflags to specify attribute
dval (data value) [python pickle]
dmsg (data message)[multi message]
Configuration:
data_prefix: will prefix every value name when setting and getting values - this allows
several clients to use the same storage attribute (on the same node for example)
It acts like a namespace
attr_prefix: prefixes the actual maya attribute to access
maya_node: the maya node holding the actual attributes
Note: | A mrv node should derive from this class to allow easy attribute access of its own compatible attributes - its designed for flexiblity |
---|---|
Note: | attribute accepts on the generic attribute should be set by a plugin node when it creates its attributes |
Todo: | should self._node be stored as weakref ? |
Bases: object
Wrapper object prividing native access to the wrapped python pickle object and to the corresponding value plug, providing utlity methods for easier handling
Returns: | True if the data is from a referenced plug |
---|
Returns: | item with separator added to it ( just once ) |
---|---|
Note: | operates best on strings |
Parameters: |
|
Returns: | our attribute prefix |
---|
Returns: | basename of this path, ‘/hello/world’ -> ‘world’ |
---|
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 |
Returns: | list of all children of path, [ child1 , child2 ] |
---|---|
Parameters: |
|
Note: | the child objects returned are supposed to be valid paths, not just relative paths |
see clearAllData module level method :note: use this method if you want to make sure your node
is empty after it has been duplicated (would usually be done in the postContructor
Copy all values from other to ourselves
Parameter: | kwargs –
|
---|---|
Note: | only does so if the attribute and data prefixes actually match (which should be the case if we get here, checking for it anyway |
Note: | as pickle data always copies by reference to be efficient, we have to explicitly create new data to assure we really copy it |
Todo: | copy connections to our messages as well, make it an option at least |
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 |
Returns: | our data prefix |
---|
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: |
|
---|
Returns: | compound plug with given dataID or None |
---|
Returns: | True if self is a part of other, and thus can be found in other |
---|---|
Note: | operates on strings only |
Returns: | True if this path is the root of the DAG |
---|
Returns: | True other starts with self |
---|---|
Note: | operates on strings |
Note: | we assume other has the same type as self, thus the same separator |
Returns: | generator retrieving all parents up to the root |
---|---|
Parameter: | predicate – returns True for all x that you want to be returned |
Returns: | master plug according to our attributePrefix |
---|
Returns: | parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root |
---|
Returns: | all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ] |
---|
Returns: | partition Node attached to the sets at dataID or None if state is disabled |
---|
Returns: | PyPickleVal object at the given index (it can be modified natively) |
---|---|
Parameters: |
|
Exract the python data using the given plug directly
Parameter: | valplug – data value plug containing the plugin data |
---|---|
Returns: | PyPickleData object allowing data access |
Returns: | the root of the DAG - it has no further parents |
---|
Set ourselves to use the given storage compatible node
Note: | use this if the path of our instance has changed - otherwise trying to access functions will fail as the path of our node might be invalid |
---|
Returns: | all object sets stored under the given dataID |
---|
Returns: | Node actually being used as storage |
---|
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.storage.StorageNode
Bases: mrv.maya.nt.DependNode, mrv.maya.nt.storage.StorageBase
This node can be used as pythonic and easy-to-access value container - it could be connected to your node, and queried for values actually being queried on your node. As value container, it can easily be replaced by another one, or keep different sets of information
Note: | the storage node can only use generic attributes and recover them properly during scene reload if the configuration of the generic attributes have been setup properly - they are unique only per node type, not per instance of the node type. Thus it is recommened to use the storage node attribute base on your own custom type that setsup the generic attributes as it requires during plugin load |
---|
Bases: object
Wrapper object prividing native access to the wrapped python pickle object and to the corresponding value plug, providing utlity methods for easier handling
Returns: | True if the data is from a referenced plug |
---|
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 |
Returns: | item with separator added to it ( just once ) |
---|---|
Note: | operates best on strings |
Parameters: |
|
Add ourselves to the given set
Note: | method is undoable |
---|---|
See: | sets.ObjectSet |
Returns: | the MObject attached to this Node |
---|
Returns: | the MFn Type id of the wrapped object |
---|
Returns: | our attribute prefix |
---|
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 |
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 |
Returns: | list of all children of path, [ child1 , child2 ] |
---|---|
Parameters: |
|
Note: | the child objects returned are supposed to be valid paths, not just relative paths |
see clearAllData module level method :note: use this method if you want to make sure your node
is empty after it has been duplicated (would usually be done in the postContructor
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 |
Returns: | MPlugArray of connected plugs |
---|
Copy all values from other to ourselves
Parameter: | kwargs –
|
---|---|
Note: | only does so if the attribute and data prefixes actually match (which should be the case if we get here, checking for it anyway |
Note: | as pickle data always copies by reference to be efficient, we have to explicitly create new data to assure we really copy it |
Todo: | copy connections to our messages as well, make it an option at least |
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 |
Returns: | our data prefix |
---|
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 |
Returns: | list of attributes that given attribute affects or that the given attribute is affected by if the attribute turns dirty. |
---|---|
Parameters: |
|
Note: | see also MPlug.affectedByPlugs |
Note: | USING MEL: as api command and mObject array always crashed on me ... don’t know :( |
Duplicate our node and return a wrapped version to it
Parameters: |
|
---|---|
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 ! |
Returns: | compound plug with given dataID or None |
---|
Returns: | list of all function set classes this node supports, most derived function set comes first |
---|
Returns: | True if our object supports the given function set type |
---|
Returns: | True if the object exists in memory |
---|---|
Note: | objects on the undo queue are alive, but NOT valid |
Returns: | True if self is part of setnode |
---|---|
Note: | method is undoable |
See: | sets.ObjectSet |
Returns: | True if self is a part of other, and thus can be found in other |
---|---|
Note: | operates on strings only |
Returns: | True if this path is the root of the DAG |
---|
Returns: | True other starts with self |
---|---|
Note: | operates on strings |
Note: | we assume other has the same type as self, thus the same separator |
Returns: | True if the object exists in the scene |
---|---|
Note: | objects on the undo queue are NOT valid, but alive |
Returns: | generator retrieving all parents up to the root |
---|---|
Parameter: | predicate – returns True for all x that you want to be returned |
Returns: | master plug according to our attributePrefix |
---|
Returns: | the MObject attached to this Node |
---|
Returns: | parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root |
---|
Returns: | all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ] |
---|
Returns: | partition Node attached to the sets at dataID or None if state is disabled |
---|
Returns: | PyPickleVal object at the given index (it can be modified natively) |
---|---|
Parameters: |
|
Exract the python data using the given plug directly
Parameter: | valplug – data value plug containing the plugin data |
---|---|
Returns: | PyPickleData object allowing data access |
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 |
Remove the given attribute from the node
Parameter: | attr – see addAttribute |
---|
remove ourselves to the given set
Note: | method is undoable |
---|---|
See: | sets.ObjectSet |
Rename this node to newname
Parameters: |
|
---|---|
Returns: | renamed node which is the node itself |
Note: | for safety reasons, this node is dagnode aware and uses a dag modifier for them ! |
Returns: | the root of the DAG - it has no further parents |
---|
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 |
Returns: | self after being moved to the given namespace. This will effectively rename the object. |
---|---|
Parameters: |
|
Set ourselves to use the given storage compatible node
Note: | use this if the path of our instance has changed - otherwise trying to access functions will fail as the path of our node might be invalid |
---|
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 |
Returns: | all object sets stored under the given dataID |
---|
Returns: | Node actually being used as storage |
---|
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 |
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 |
---|
Returns: | item with separator added to it ( just once ) |
---|---|
Note: | operates best on strings |
Parameters: |
|
Returns: | basename of this path, ‘/hello/world’ -> ‘world’ |
---|
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 |
Returns: | list of all children of path, [ child1 , child2 ] |
---|---|
Parameters: |
|
Note: | the child objects returned are supposed to be valid paths, not just relative paths |
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 |
---|
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 |
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 |
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: |
|
---|
Returns: | True if self is a part of other, and thus can be found in other |
---|---|
Note: | operates on strings only |
Returns: | True if this path is the root of the DAG |
---|
Returns: | True other starts with self |
---|---|
Note: | operates on strings |
Note: | we assume other has the same type as self, thus the same separator |
Returns: | generator retrieving all parents up to the root |
---|---|
Parameter: | predicate – returns True for all x that you want to be returned |
Returns: | parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root |
---|
Returns: | all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ] |
---|
Returns: | the root of the DAG - it has no further parents |
---|
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 |