一半君的总结纸

听话只听一半君

Wing/Maya Remote Debug Setup

There are some great posts and pages explaining how to setup Wing IDE to remotely debug a Maya session. Eric Pavey first posted how to do this at his WarpCat Blog along with how to send commands back and forth to Maya from Wing.

Luckily, now, many of us are starting to use this workflow and some other little tips and tricks have been discovered. I’d like to spell out all the steps from beginning to end right here.

  1. Hack wingdbstub.py
  2. Adjust Remote Debugging preferences in Wing
  3. Create method to connect to Wing from Maya
  4. Add pythonpath to module

In detail . . .

1. Hack wingdbstub.py

Copy wingdbstub.py from your:

C:/Program Files (x86)/Wing IDE 4.0/.

and put it into your favorite pythonpath folder with the rest of your development code.

Change the lines:

(~ line 96)

[python]

kEmbedded = 0

[/python]

to

[python]

kEmbedded = 1

[/python]

and maker sure this line points to your actual installation dir of wing:

(~ line 116)

[python]
WINGHOME = r”C:\Program Files (x86)\Wing IDE 4.0″
[/python]

for OSX:

[python]
WINGHOME = r”/Applications/wingIDE/WingIDE.app/Contents/MacOS”
[/python]

2. Adjust Remote Debugging preference in Wing

In wing goto Edit -> Preferences -> Debugger -> External/Remote
Check:
‘Enable Passive Listen’
‘Kill Externally Launched’

Then right click on the bug icon in lower left of Wing’s window and make sure that Passive Listen is enabled

3. Create method to connect to Wing from Maya

Now, make a nice method which you can call from a hotkey in Maya. I’d make a method like this:

[python]
# developerTools.py
# make sure this method is in a module in your pythonpath


def connectToWing():
“””
SYNOPSIS
Connects to wingIDE debugger

INPUTS NONE

RETURNS: Nothing
“””
import wingdbstub
if wingdbstub.debugger != None:
wingdbstub.debugger.StartDebug()
print ‘Connected to wingIDE’
else: print ‘Could NOT connect to wingIDE’
[/python]

Now you can make a hotkey in Maya by adding this as the command in the hotkey editor (suggest CTRL+SHIFT+w):

[python]
// this is mel code because that is what hotkey editor recognizes
python(“import developerTools”);
python(“reload (developerTools)”);
python(“developerTools.connectToWing()”)

[/python]

4. Add pythonpath to module

Make sure your the folders that your deverlopTools.py (or wherever you make the connectToWing module) and the folder to your wingdbstub.py are part of your pythonpath. If you ever need to see what pythonpaths your (Maya) environment is aware of, you can just try this:

[python]

# prints all pythonpaths

for p in sys.path: print p

[/python]

Actually there are a bunch of handy paths to consider as a developer for Maya, but I’ll save that for next post. ;-)

Now just:

  • start Wing
  • start Maya
  • call connectToWing() method (CTRL+SHIFT+w) (bug should turn green in Wing)
  • setup a breakpoint in code in Wing
  • call that code from Maya

And if you’re still having trouble, feel free to post questions/comments here or follow these links to my source documentation:

WingWare setup docs

MEL Wiki

Happy debugging!

http://www.jason-parks.com

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: