top of page
  • Mason Smigel

Dev environment

Updated: Mar 23, 2022

When working on rigamajig2 setting up an efficient development environment was crucial for maintaining and organizing code. In the past I have primarily relied on the Maya script editor or Chris Zurbriggs Charcoal editor 2, however the scale of this project would not allow me to work out of only the script editor.


For development of rigamajig2, I opted to use PyCharm as my primary IDE. For easier use and access within Maya, I also used the plugin MayaCharm which simply forms a connection between the PyCharm UI and Maya to avoid constantly switching between the two applications. For quick development the charcoal editor allowed me to quickly test and experiment with code. Finally, I used Git as my version control system (VCS) within PyCharm.




Python interperter

The first step to preparing PyCharm as a Maya IDE was to add the Maya Python interpreter as the main interpreter for the project.

To add a new Python interpreter in PyCharm. 1. Open the preferences window

2. Navigate to the Project> Project Interpreter panel

3. Click the gear icon and press add.

4. Locate and select the mayapy Python interpreter

MAC: /Applications/Autodesk/<version>/Maya.app/Contents/bin/mayapy
WIN: C:\Program Files\Autodesk\<version>\bin\mayapy.exe

5. Press 'OK' to add the new interpreter


In my case I chose to lock into Maya2020 so I could utilize the new matrix options without fully committing to Python 3 (rigamajig2 is forward compatible with Python 3).


Auto complete

I'm a pretty terrible speller so auto-completion is also a huge productivity booster for me, and it's super easy to add Maya auto-complete in PyCharm.


1. Download and install the Maya devkit

2. Navigate to the Project> Project Interpreter panel

3. Select "Show All..." in the project interpreter dropdown

4. Click the folder icon to edit interpreter paths

5. Add the Python Stubs path from the devkit

MAC: /Applications/Autodesk/maya2020/devkit/other/pymel/extras/completion/py
WIN: C:\Program Files\Autodesk\Maya2019\devkit\other\pymel\extras\completion\py

6. Remove the site-package paths from the interpreter paths



Auto complete works with both Maya commands and open Maya.


MayaCharm

MayaCharm is pretty simple to install, navigate to the plugins option of the preferences, search MayaCharm and install it. To begin using MayaCharm:


1. Create a new configuration and select MayaCharm

2. Select a file to execute (Most of the time for this I like to use a scratch file to store the temp code to run within maya)

3. Open Maya if its not already running

4. Prepare Maya to receive code from PyCharm by opening a command port:

# connect maya to PyCharm
if not cmds.commandPort(':4434', query=True):
    cmds.commandPort(name=':4434')

This can also be added to your userSetup.py

5. In PyCharm navigate to Run> Connect to Maya's Log to see log messages from Maya inside PyCharm

6. Click the execute button. The Code should run within Maya


You can also use alt + S and alt + A to run the selected code or document within Maya.



GIT

For rigamajig2 I used Git for version control. Jetbrains has great documentation about using Git within PyCharm.


bottom of page