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

Module mdb

source code

Provides classes and functions operating on the MayaAPI class database
Notes:
Classes [hide private]
    Code Generators
  MFnCodeGeneratorBase
Define the interface and common utility methods to generate a string defining code for a given MFnMethod according to the meta data provided by an MMethodDescriptor.
  PythonMFnCodeGenerator
Specialization to generate python code
    Parsers
  CppHeaderParser
Simplistic regex based parser which will extract information from the file it was initialized with.
    Database
  MMethodDescriptor
Contains meta-information about a given method according to data read from the MFnDatabase
  MEnumDescriptor
Is an ordered list of enumeration names without its values, together with the name of the enumeration type
  MMemberMap
Simple accessor for MFnDatabase access Direct access like db[funcname] returns an entry object with all values
Functions [hide private]
    Initialization
 
nodeHierarchyFile()
Returns: Path to the node hierarchy file of the currently active maya version
source code
 
createDagNodeHierarchy()
Parse the nodes hierarchy file and return a DAGTree with its data :return: DAGTree
source code
 
createTypeNameToMfnClsMap()
Parse a file associating node type names with the best compatible MFn function set and return a dictionary with the data
source code
    Utilities
 
apiModules()
Returns: tuple of api modules containing MayaAPI classes
source code
 
mfnDBPath(mfnclsname)
Generate a path to a database file containing mfn wrapping information
source code
 
headerPath(apiname)
Returns: Path to file containing the c++ header of the given apiclass' name.
source code
 
cacheFilePath(filename, ext, use_version=False)
Return path to cache file from which you would initialize data structures
source code
 
extractMFnFunctions(mfncls)
Extract callables from mfncls, sorted into static methods and instance methods :return: tuple(list(callable_staticmethod, ...), list(callable_instancemethod, ...))
source code
 
hasMEnumeration(mfncls)
Returns: True if the given mfncls has at least one enumeration
source code
 
writeMfnDBCacheFiles()
Create a simple Memberlist of available mfn classes and their members to allow a simple human-editable way of adjusting which methods will be added to the Nodes.
source code
 
_createTmpNode(nodetype)
Return tuple(mobject, modifier) for the nodetype or raise RuntimeError doIt has not yet been called on the modifier, hence the mobject is temporary
source code
 
_iterAllNodeTypes()
Returns iterator which yield tuple(nodeTypeName, MObject, modifier) triplets of nodeTypes, with an MObjects instance of it, created with the given modifier, one for each node type available to maya.
source code
 
generateNodeHierarchy()
Generate the node-hierarchy for the current version based on all node types which can be created in maya.
source code
Variables [hide private]
  log = logging.getLogger("mrv.maya.mdb")
Function Details [hide private]

nodeHierarchyFile()

source code 
Returns:
Path to the node hierarchy file of the currently active maya version

createTypeNameToMfnClsMap()

source code 
Parse a file associating node type names with the best compatible MFn function set and return a dictionary with the data
Returns:
dict(((nodeTypeNameStr : api.MFnCls), ...)) dictionary with nodetypeName MFn class mapping

apiModules()

source code 
Returns:
tuple of api modules containing MayaAPI classes

Note: This takes a moment to load as it will import many api modules. Delay the call as much as possible

headerPath(apiname)

source code 
Parameters:
  • apiname - string name, like 'MFnBase'
Returns:
Path to file containing the c++ header of the given apiclass' name. The file will not be verified, hence it may be inaccessible
Raises:
  • ValueError - if MAYA_LOCATION is not set

cacheFilePath(filename, ext, use_version=False)

source code 
Return path to cache file from which you would initialize data structures
Parameters:
  • use_version - if true, the maya version will be appended to the filename

hasMEnumeration(mfncls)

source code 
Returns:
True if the given mfncls has at least one enumeration

writeMfnDBCacheFiles()

source code 
Create a simple Memberlist of available mfn classes and their members to allow a simple human-editable way of adjusting which methods will be added to the Nodes.

Note: currently writes information about all known api modules

_iterAllNodeTypes()

source code 
Returns iterator which yield tuple(nodeTypeName, MObject, modifier) triplets of nodeTypes, with an MObjects instance of it, created with the given modifier, one for each node type available to maya.

Note: skips manipulators as they tend to crash maya on creation ( perhaps its only one which does that, but its not that important )

generateNodeHierarchy()

source code 
Generate the node-hierarchy for the current version based on all node types which can be created in maya.
Returns:

tuple(DAGTree, typeToMFnClsNameList)

  • DAGTree representing the type hierarchy
  • list represents typeName to MFnClassName associations

Note: should only be run as part of the upgrade process to prepare MRV for a new maya release. Otherwise the nodetype tree will be read from a cache