Wing IDE is an integrated development environment that can be used to develop, test, and debug Python code written for Autodesk Maya, a commercial 3D modeling application. Wing provides auto-completion, call tips, a powerful debugger, and many other features that help you write, navigate, and understand Python code.
To get started using Wing, refer to the tutorial in the Help menu in Wing and/or the Wing IDE Quickstart Guide.
When debugging Python code running under Maya, the debug process is initiated from outside of Wing IDE, and must connect to the IDE. This is done with wingdbstub according to the instructions in the Debugging Externally Launched Code section of the manual.
Because of how Maya sets up the interpreter, be sure to set kEmbedded=1 in your copy of wingdbstub.py and use the debugger API to ensure the debugger is connected to the IDE before any other code executes as follows:
import wingdbstub wingdbstub.Ensure()
Then click on the bug icon in lower left of Wing's window and make sure that Accept Debug Connections is checked. After that, you should be able to reach breakpoints by causing the scripts to be invoked from Maya.
To use the mayapy executable found in the Maya application directory to run Wing's Python Shell tool and to debug standalone Python scripts, enter the full path of the mayapy file (mayapy.exe on Windows) in the Python Executable field of the Project Properties dialog.
Better Static Auto-completion
Maya's Python support scripts do not come with source code, but rather only with pyc files. Because Wing cannot statically analyze those files, it will fail to offer auto-completion for them unless .pi files are used. A set of .pi files generated by the PyMEL project can be found in Maya 2011 or in the PyMEL distribution.
- Maya 2011 ships with .pi files in the devkit/pymel/extras/completion/pi subdirectory of the Maya 2011 install directory.
- For other Maya versions, .pi files from the PyMEL distribution at http://code.google.com/p/pymel/ may be used. PyMEL does not need to be installed or used to make use of the .pi files; it's enough to simply unpack the source distribution. The pi directory within the PyMEL 1.0.2 distribution is extras/completion/pi
Add the pi directory to the list of interface file directories that Wing uses by adding it to the Interface File Path preference in the Source Analysis -> Advanced preference page. After adding the directory to the path, Wing will offer auto-completion if you import xxx and then type xxx.
Some additional information about using Wing IDE with Maya can be found in For Python: Maya 'Script Editor' Style IDE. This includes extension scripts for more closely integrating Wing Pro and Maya and some additional details. For example, sending Python and MEL code to Maya from Wing is explained here
See also the section Using Wing IDE with Maya in Autodesk Maya Online Help: Tips and tricks for scripters new to Python.
Wing IDE provides many other options and tools. For more information:
|« 4.0. Using Wing IDE with Blender||Table of Contents||4.2. Using Wing IDE with NUKE and NUKEX »|