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

Module typ

source code

Houses the MetaClass able to setup new types to work within the system. This can be considered the heart of the node wrapping engine, but it plays together with the implementation in the base module.
Classes [hide private]
    Metaclasses
  MetaClassCreatorNodes
Builds the base hierarchy for the given classname based on our typetree :todo: build classes with slots only as members are pretermined
Functions [hide private]
    Utilities
 
prefetchMFnMethods()
Fetch and install all mfn methods on all types supporting a function set.
source code
    Initialization
 
_addCustomType(targetmoduledict, parentclsname, newclsname, metaclass=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
source code
 
_removeCustomType(targetmoduledict, customTypeName)
Remove the given typename from the given target module's dictionary as well as from internal caches
source code
 
_addCustomTypeFromDagtree(targetmoduledict, dagtree, metaclass=MetaClassCreatorNodes, force_creation=False, **kwargs)
As _addCustomType, but allows to enter the type relations using a mrv.util.DAGTree instead of individual names.
source code
 
initTypeNameToMfnClsMap()
Fill the cache map supplying additional information about the MFNClass to use when creating the classes
source code
 
initNodeHierarchy()
Initialize the global tree of types, providing a hierarchical relationship between the node typename strings
source code
 
initWrappers(targetmoduledict)
Create Standin Classes that will delay the creation of the actual class till the first instance is requested
source code
Variables [hide private]
  log = logging.getLogger("mrv.maya.nt.typ")
    Caches
  _nodesdict = None
hash(x)
  nodeTypeTree = None
hash(x)
  nodeTypeToMfnClsMap = dict()
    Globals
  targetModule = None
hash(x)
  mfnclsattr = '_mfncls'
  mfndbattr = '_mfndb'
  apiobjattr = '_apiobj'
  getattrorigname = '__getattr_orig'
  codegen = None
hash(x)
Function Details [hide private]

prefetchMFnMethods()

source code 
Fetch and install all mfn methods on all types supporting a function set. This should only be done to help interactive mode, but makes absolutely no sense in the default mode of operation when everything is produced on demand.
Returns:
integer representing the number of generated methods

Note: Attaches docstrings as well

_addCustomType(targetmoduledict, parentclsname, newclsname, metaclass=MetaClassCreatorNodes, **kwargs)

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

_removeCustomType(targetmoduledict, customTypeName)

source code 
Remove the given typename from the given target module's dictionary as well as from internal caches
Parameters:
  • targetmoduledict - dict of your module to remove the type from
  • customTypeName - name of the type to be removed, its expected to be capitalized

Note: does nothing if the type does not exist

_addCustomTypeFromDagtree(targetmoduledict, dagtree, metaclass=MetaClassCreatorNodes, force_creation=False, **kwargs)

source code 
As _addCustomType, but allows to enter the type relations using a mrv.util.DAGTree instead of individual names. Thus multiple edges can be added at once
Notes:
  • special care is being taken to make force_creation work - first all the standind classes are needed, then we can create them - just iterating the nodes in undefined order will not work as a parent node might not be created yet
  • node names in dagtree must be uncapitalized

initWrappers(targetmoduledict)

source code 
Create Standin Classes that will delay the creation of the actual class till the first instance is requested
Parameters:
  • targetmoduledict - the module's dictionary (globals()) to which to put the wrappers