Package mrv :: Package maya :: Package nt
[hide private]
[frames] | no frames]

Package nt

source code

All classes required to wrap maya nodes in an object oriented manner into python objects and allow easy handling of them.

These python classes wrap the API representations of their respective nodes - most general commands will be natively working on them.

These classes follow the node hierarchy as supplied by the maya api.

Optionally: Attribute access is as easy as using properties like:

>>> node.translateX

Default maya commands will require them to be used as strings instead.


Note: it is important not to cache these as the underlying obejcts my change over time. For long-term storage, use handles instead.

Submodules [hide private]
  • mrv.maya.nt.anim: Contains implementations of animation specific types and utilities
  • mrv.maya.nt.apipatch: Contains patch classes that are altering their respective api classes
  • mrv.maya.nt.base: Contains some basic classes that are required to run the nodes system
  • mrv.maya.nt.geometry: Contains implementations ( or improvements ) to mayas geometric shapes
  • mrv.maya.nt.it: Contains different multi-purpose iterators allowing to conveniently walk the dg and dag.
  • mrv.maya.nt.persistence: generic python style persitance plugin This module contains a storage interface able to easily handle python-style data within maya scenes.
  • mrv.maya.nt.set: Contains improved clases for set and partition editing
  • mrv.maya.nt.storage: Contains an implementation for the Persistence plugin for easy access within mrv and derived nodes.
  • mrv.maya.nt.typ: Houses the MetaClass able to setup new types to work within the system.
  • mrv.maya.nt.util: General utility methods

Classes [hide private]
    Utility Classes
  PluginDB
Simple container keeping information about the loaded plugins, namely the node types they register.
Functions [hide private]
    Common
 
addCustomType(newcls, parentClsName=None, **kwargs)
Add a custom class to this module - it will be handled like a native type
source code
 
removeCustomType(customType)
Removes the given type from this module as well as from the type hierarchy.
source code
 
addCustomTypeFromFile(hierarchyfile, **kwargs)
Add a custom classes as defined by the given tab separated file.
source code
 
addCustomClasses(clsobjlist)
Add the given classes to the nodes module, making them available to the sytem
source code
 
forceClassCreation(typeNameList)
Create the types from standin classes from the given typeName iterable.
source code
 
enforcePersistence()
Call this method to ensure that the persistance plugin is loaded and available.
source code
    Initialization
 
_init_package()
Do the main initialization of this package
source code
 
_force_type_creation()
Enforce the creation of all types - must be called once all custom types were imported
source code
 
_init_plugin_db()
Find loaded plugins and provide dummies for their types - this assures iteration will not stop on these types for instance
source code
Variables [hide private]
  _thismodule = __import__("mrv.maya.nt", globals(), locals(), [...
  set = __builtin__.set
  init_done = True
    Globals
  pluginDB = None
hash(x)
Function Details [hide private]

addCustomType(newcls, parentClsName=None, **kwargs)

source code 
Add a custom class to this module - it will be handled like a native type
Parameters:
  • newcls - new class object if metaclass is None, otherwise string name of the type name to be created by your metaclass
  • parentClsName - if metaclass is set, the parentclass name ( of a class existing in the nodeTypeTree ( see /maya/cache/nodeHierarchy.html ) Otherwise, if unset, the parentclassname will be extracted from the newcls object
  • kwargs -
    • force_creation:

      if True, default False, the class type will be created immediately. This can be useful if you wish to use the type for comparison, possibly before it is first being queried by the system. The latter case would bind the StandinClass instead of the actual type.

Raises:
  • KeyError - if the parentClsName does not exist

removeCustomType(customType)

source code 
Removes the given type from this module as well as from the type hierarchy. This makes it unavailble to MRV
Parameters:
  • customType - either string identifying the type's name or the type itself

Note: does nothing if the type does not exist

addCustomTypeFromFile(hierarchyfile, **kwargs)

source code 
Add a custom classes as defined by the given tab separated file. Call addCustomClasses afterwards to register your own base classes to the system This will be required to assure your own base classes will be used instead of auto-generated stand-in classes
Parameters:
  • hierarchyfile - Filepath to file modeling the class hierarchy using tab-indentation. The root node has no indentation, whereas each child node adds one indentation level using tabs.
  • kwargs -
Returns:
iterator providing all class names that have been added
Notes:
  • all attributes of addCustomType are supported
  • there must be exactly one root type

addCustomClasses(clsobjlist)

source code 
Add the given classes to the nodes module, making them available to the sytem
Parameters:
  • clsobjlist - list of class objects whose names are mentioned in the dagtree

Note: first the class hierarchy need to be updated using addCustomTypeFromFile. This must appen before your additional classes are parsed to assure our metaclass creator will not be called before it knows the class hierarchy ( and where to actually put your type ).

forceClassCreation(typeNameList)

source code 
Create the types from standin classes from the given typeName iterable. The typenames must be upper case
Returns:
List of type instances ( the classes ) that have been created

enforcePersistence()

source code 
Call this method to ensure that the persistance plugin is loaded and available. This should by used by plugins which require persitence features but want to be sure it is not disabled on the target system

Variables Details [hide private]

_thismodule

Value:
__import__("mrv.maya.nt", globals(), locals(), ['nt'])