Eclipse environment for Maya's python modules

流过昼夜 提交于 2019-12-03 16:16:52
T Carrasco

The solution is to import maya.standalone and initialize it. This gives you access to the maya packages and modules therein.

import maya.standalone
maya.standalone.initialize()

import maya
print 'maya:\n', dir(maya)

from maya import cmds
print 'cmds:\n', len(dir(cmds)) # too many to print

print 'sphere: ', cmds.sphere

output:

maya:
['__builtins__', '__doc__', '__file__', '__name__', '__package__', 
'__path__', 'app', 'cmds', 'mel', 'standalone', 'stringTable', 'test', 'utils']

cmds:
2945

sphere:  <built-in method sphere of module object at 0xf33948>
OneMan

If you want you can setup eclipse to run (debug) maya directly on it (using standalone, of course).

If you go in python interpreters you can add a mayapy interpreter. Press new, write the new that you want :D, interpreter executable will be your maya path ) ..\bin\mayapi.exe (eg: D:\Program Files\Autodesk\Maya2013\bin\mayapi.exe)

Include all the the modules that you think you need, and done. now you can use maya interpreter inside eclipse, this it means that with maya standalone, you can run your script as well ( I like to use this way if I need to do a recursive task o similar ;) ).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!