Using Eclipse as a Maya IDE
This tutorial was updated in May 2014.
There are many choices when it comes to deciding on an IDE. At the time when I decided on Eclipse (back in 2005) I needed an editor that could do the following:
- useable across multiple platforms
- supported programming in Python, C++, mel, Java
- had syntax highlighting and code completion
- supported writing of plugins (I needed to connect with Maya's environment)
This tutorial will outline the steps I've taken to make Eclipse my Maya IDE. I will address the following:
- enabling communication to and from Maya within Eclipse
- quickly access documentation from often used libraries
- setting up code completion for Maya Python commands and Maya API
- provide a mel editor with syntax highlighting
Please let me know if there are further improvements you'd like addressed.
A. Basic resources.
Pydev the open source python plugin for Eclipse
Eclipse Color Themes
Eclipse Colorer Plugin
Maya Eclipse Editor Plugin
Eclipse Autocompletion for Maya
Maya Eclipse mel Plugin
B. Maya Editor
- Import the script being edited (add the script location to sys.path and import/reload it)
- Send the entire contents of an editor to Maya
- Send a highlighted selection to Maya
- Get results back from Maya in a dedicated console view
- Anything done within Maya's own script editor is also echoed in the console view
- Change the port number of the socket at any time
- Open up documentation for Maya's Python API, Python Commands, Pymel, Qt, PySide, PyQt
New - Use the Eclipse Marketplace to install the plugin
Open the Help/Marketplace and search for "Maya Eclipse Connect" and follow the instructions to install
1. Get the plugin from the link above and unzip the downloaded file in a temp directory
2. Within Eclipse, you should be able to use the "Help/Install New Software" menu. But I've found this to not always work. Even though it's frowned upon, the easiest way is to manually copy the
to: [your Eclipse directory]/plugins/
3. Relaunch Eclipse and once it's back, the EclipseMaya toolbar should be visible
In Maya, create a new python shelf button with the following code or put it in the Startup script. This will launch a Maya command port that enables communication with Eclipse. The port number should match the port number within the Eclipse plugin preferences.
import maya.cmds as cmds
if cmds.commandPort(':7720', q=True) !=1:
cmds.commandPort(n=':7720', eo = False, nr = True)
- Ctrl + \ -> Import/Reload the script in the editor to Maya
- Ctrl + Return -> Send all editor contents to Maya
- Ctrl + ' -> Send highlighted selection to Maya
- Ctrl + ] -> Connect Eclipse to Maya
You can remap these hotkeys if you want something different. Go into "Window/Preferences/General/Keys" and use a filter to display the Maya Editor commands. The filter should be: *Maya
- Port Number - By default, the port number has been set to 7720. It can be changed at any time. Remember to press the "Reconnect Eclipse to Maya" button. This is handy if you have more than one instance of Maya open at once.
- Update Interval: This sets how often Eclipse checks to see if there's any new text in Maya. It is in time units of seconds.
- The next eight text fields set the location of the various sets of documentation. They can be entered either as web URLs or local file paths depending on where the docs are located. There are 2 user defined options for other documentation sites (If anyone needs more, let me know and I can add more).