Maya Python: Visual Studio 2013

Setup Visual Studio to write python code for Maya in 5 steps

1

Instal the Python Tools for Visual Studio. This is a free plugin that turns Visual Studio into a python IDE. If you don’t want to pay for VS, you can install the free PTVS integrated version (at the bottom of the downloads).
- Create a new Python Project in VS. Open the properties of your project.
- You can also put in the Interpreter Path for the standalone setup:
C:\Program Files\Autodesk\Maya2014\bin\mayapy.exe

2

You can Debug your python code by clicking Attach to Process under the Debug menu. Choose for the maya.exe. This works for me in Maya2013 and Maya2014.

3

For fast script execution I wrote a plugin for Visual Studio 2013 called ToMaya. With this plugin you can easily execute your python script directly in Maya.

4

Maya python command completion. Add the the following paths to the search paths in your Solution Exlorer:

  •  Maya 20##

…\PyMel-1.0.2\extras\completion\py\maya\
…\Python\Lib\site-packages\PyQt4\

C:\Program Files\Autodesk\Maya2014\Python\lib\site-packages

  •  Maya 2014

C:\Program Files\Autodesk\Maya2014\Python\lib\site-packages
C:\Program Files\Autodesk\Maya2014\devkit\other\pymel\extras\completion\py\maya

5

I also wrote a add-in for Visual Studio 2013 MayaPythonDoc to easily open the python command documentation.

6 thoughts on “Maya Python: Visual Studio 2013

  1. Luca says:

    Thanks for all.
    Everything works with Visual Studio Community 2015
    Can you update the MayaPythonDoc as well?

  2. Siew Yi Liang says:

    Hi Jos:

    I still can’t get Intellisense working reliably on either of my setups home/work. Did you have to do anything with the registry key listed at:

    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\PythonTools\Options\Advanced]
    “CrossModuleAnalysisLimit”=”3000″

    To get all your modules with Intellisense working right? I can get pymel command completion working (though it’s extremely wonky with some methods missing like pm.xform, translate etc.), but not maya.mel or maya.cmds, among others.

    Some screenshots of the problem:
    http://i.imgur.com/WMr2Dzw.png

    http://i.imgur.com/hOJNSNs.png

  3. Parker says:

    Hi, I tried your methods for Maya2015 and they didn’t work, your VS plug-in “ToMaya” works fine, but in VS, I don’t have the python command completion, and VS cannot recognize the Maya python commands.

    Any suggestions?

    • Jos says:

      Thanks for trying out. What version are you using of visual studio?
      For the command completion make sure you have the search path set up. C:\Program Files\Autodesk\Maya2014\devkit\other\pymel\extras\completion\py\maya and make sure you do the import statement (import maya.cmds as cmds; cmds…)
      Let me know!

      • Derrick says:

        Hey Joe,

        I’ve set up the search paths and am able to see maya.cmds when I import, but after that none of the completion works. For example I can do “import maya.cmds as cmds” but then “cmds….” doesn’t have any completion. Any tips?

        Also can you speak to how necessary it is to set up a “python environment” in the project? I’ve currently set one up for mayapy.exe

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>