This is work in progress. If you have any feedback please mail me at email@example.com
Execute Python code in Maya from Visual Studio
Category: Free work
Use visual studio to execute python code in Maya. If you haven’t got the Python Tools for Visual Studio installed, get a look at http://pytools.codeplex.com/
- Download (VS2012 VS2013 VS2015) ToMaya.vsix file and execute it (Microsoft Visual Studio Version Selector). This will install the extension.
- Type the following code in the Maya script editor and drag it to the shelf or use it in a startup script.
import maya.cmds as cmds try: cmds.commandPort(name="127.0.0.1:6000", close=True, echoOutput=True) except: pass cmds.commandPort(name="127.0.0.1:6000", echoOutput=True)
- If you restart or open Visual studio you should find it under tools.
- Go to Tools -> Options -> Keyboard
- Search for “ToMaya” and create a new shortcut. I use Alt+Space
How it works
- Press the shelve button in Maya
- Creating a file in Visual Studio and type
import maya.cmds as cmds cmds.polySphere()
- Select the code and press the shortcut or press the menu entry.
- If you see a sphere in Maya everything is setup.
If you see the following error press the shelf button again and check if it gives no error