mayaconventionspymel

What is the name for the Maya Python library(ies)?


I want to distinguish between the Python libraries available in Maya:

  1. MEL (the embedded Maya language)
  2. Maya Python libraries (maya.cmds, but also maya.standalone and maya.mel.eval)
  3. PyMEL [*] (pymel.core and others)
  4. Maya Python API 1.0 (maya.OpenMaya)
  5. Maya Python API 2.0 (maya.api.OpenMaya)

Do the Maya Python libraries (item 2) have a name? A name that covers 2, 4 and 5 would be sufficient.


Solution

  • Not really. import Maya will give you all of them, though most people start one level down with, for example, import maya.cmds as cmds There are a few more that you missed in your list: OpenMaya , the old api, has siblings OpenMayaRender, OpenMayaUI, and OpenMayaAnimation and there's also maya.util

    You can list the full roster of top-level maya modules like this:

    import maya
    import inspect
    maya_modules = {name:mod for name, mod in inspect.getmembers(maya) if inspect.ismodule(mod) }
    

    the full list in Maya 2016 is:

    'OpenMaya': <module 'maya.OpenMaya' from 'c:\program files\autodesk\maya2016\Python\lib\site-packages\maya\OpenMaya.pyc'>,
    'OpenMayaAnim': <module 'maya.OpenMayaAnim' from 'c:\program files\autodesk\maya2016\Python\lib\site-packages\maya\OpenMayaAnim.pyc'>,
    'OpenMayaFX': <module 'maya.OpenMayaFX' from 'c:\program files\autodesk\maya2016\Python\lib\site-packages\maya\OpenMayaFX.pyc'>,
    'OpenMayaMPx': <module 'maya.OpenMayaMPx' from 'c:\program files\autodesk\maya2016\Python\lib\site-packages\maya\OpenMayaMPx.pyc'>,
    'OpenMayaRender': <module 'maya.OpenMayaRender' from 'c:\program files\autodesk\maya2016\Python\lib\site-packages\maya\OpenMayaRender.pyc'>,
    'OpenMayaUI': <module 'maya.OpenMayaUI' from 'c:\program files\autodesk\maya2016\Python\lib\site-packages\maya\OpenMayaUI.pyc'>,
    'app': <module 'maya.app' from 'c:\program files\autodesk\maya2016\Python\lib\site-packages\maya\app\__init__.py'>,
    'cmds': <module 'maya.cmds' from 'c:\program files\autodesk\maya2016\Python\lib\site-packages\maya\cmds\__init__.py'>,
    'debug': <module 'maya.debug' from 'c:\program files\autodesk\maya2016\Python\lib\site-packages\maya\debug\__init__.py'>,
    'mel': <module 'maya.mel' from 'c:\program files\autodesk\maya2016\Python\lib\site-packages\maya\mel\__init__.py'>,
    'standalone': <module 'maya.standalone' (built-in)>,
    'utils': <module 'maya.utils' from 'c:\program files\autodesk\maya2016\Python\lib\site-packages\maya\utils.py'>
    

    It would of course be trivial to make your own module which imported a subset of those.