Maya Python 库的名称是什么?

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

我要区分Python libraries available in Maya:

  1. MEL(嵌入式玛雅语言)
  2. Maya Python 库maya.cmds,还有 maya.standalonemaya.mel.eval
  3. PyMEL [*]pymel.core 等)
  4. 玛雅 Python API 1.0 (maya.OpenMaya)
  5. 玛雅 Python API 2.0 (maya.api.OpenMaya)

Maya Python 库(第 2 项)有名称吗?一个包含2、4和5的名字就足够了。

不是真的。 import Maya 会给你所有的,虽然大多数人从下一级开始,例如,import maya.cmds as cmds 还有一些你在你的列表中遗漏的:OpenMaya,旧的 api,有兄弟姐妹 OpenMayaRenderOpenMayaUI,和 OpenMayaAnimation,还有 maya.util

您可以像这样列出顶级 Maya 模块的完整名单:

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

Maya 2016 中的完整列表是:

'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'>

制作自己的模块并导入其中的一个子集当然是微不足道的。