Debugging Python in Maya
Download
1 / 19

Debugging Python in Maya - PowerPoint PPT Presentation


  • 73 Views
  • Uploaded on

Debugging Python in Maya. Cyrille Fauvel - ADN. About the Presenter. Cyrille Fauvel - Autodesk Developer Network

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Debugging Python in Maya' - graiden-scott


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Debugging python in maya

Debugging Python in Maya

Cyrille Fauvel - ADN


About the presenter
About the Presenter

Cyrille Fauvel - Autodesk Developer Network

Cyrille is a member of the M&E workgroup of the Autodesk Developer Network (ADN) team, providing developer support, training, and conference presentations on AutoCAD, RealDWG, Inventor, Maya, 3ds Max, FBX API, and many others.

He joined Autodesk in 1994 as an AutoCAD developer based in Switzerland and California, USA. Later moved to the Developer Support group, and Consulting division.

Cyrille graduated in Mechanics and Electronics in France, worked as a teacher and C++ developer for a 3rd party developer on AutoCAD. He is fluent in six programming languages, tries to learn Japanese which turns out to be more difficult than learning English, has two kids, plays the guitar and piano, likes reading, love sailing on oceans, sports, and especially hand-ball.


M e adn sparks program today
M&E ADN Sparks program today

  • Access to almost all Autodesk software and SDK’s

    • Includes early access to beta software

  • Members-only website with thousands of technical articles

  • Unlimited technical support

  • Product direction through conferences

  • Marketing benefits

    • Exposure on autodesk.com

    • Promotional opportunities

  • One to three free API training classes

    • Based on user level

      www.autodesk.com/joinadn


M e adn sparks program today1
M&E ADN Sparks program today

Members in the following categories:

  • Commercial plug-in developers

  • Corporate (customer sites)

  • Authors and Publishers

  • Hardware partners

  • Consultants

  • Universities


Agenda
Agenda

  • Maya and Python

  • Maya integration and Python development

  • Debugging Python in Maya

    • What benefits? What risks?

  • Exploring various solutions (with demos)

  • Q&A


Maya and python
Maya and Python

  • Introduced in the 8.5 release

    • Scripting & API

    • For scripting, see PyMEL (more pythonic)

  • Adoption in 2010/2011 releases

    • Maya engineering team continues to improve Python support in Maya releases


Maya python scripting
Maya Python Scripting

  • Wraps MEL

  • Embedded UI

    • Color syntax

    • Automatically saved

    • Automatically reparsed

    • No intellisense

    • No debugger


Maya python api
Maya Python API

  • C++ wrappers

  • OpenMaya & Maya

    • Works like C++ plug-ins / applications

    • Difficult to debug


What risks
What risks?

Debugging Python in Maya

What benefits?


Python internal
Python internal

  • Pythons dictionaries

    • Python loads module only once

    • References are saved into internal Dictionaries

    • I.e.: imp.load_module and __builtin__.__import__


Risks
Risks

  • If not using reload(), code is not reparsed

  • Python variables may be initialized already

    • Internal and application variables

  • Maya may have references set already

    • Nodes or UI


Not using a debugger
Not using a debugger

  • Use print() ?

    • Painful and cumbersome

    • Slow process

    • No control on execution

  • Needs overriding __str__() for better Runtime Information


Using a debugger
Using a debugger

  • Conditional Breakpoint

  • Inspect variables / Evaluating some expression

  • Code changes / Alter debug data values

  • Exception traceback reporting

  • Call stack

  • Remote debugging


Solutions available
Solutions available

  • Python pdb debugger

  • Winpdbhttp://winpdb.org/docs/embedded-debugging/

  • Eclipse and pydevhttp://pydev.org/

  • Wingware IDE http://www.wingware.com/


Python pdb debugger
Python pdb debugger

  • Available in all Python distribution

    import pdb

    pdb.run(“…”)

  • Maya Script editor does not support pdb

    • Requires you to redirect the sys.stdin and sys.stdout in order to control pdb i/o

  • Not really a solution for plug-ins


Winpdb
Winpdb

  • Light debugger and IDE

    • But free

  • Breakpoints

  • Callstack

  • Inspect values

  • Exceptions


Eclipse and pydev
Eclipse and pydev

  • Stronger debugger and IDE

    • Still free, but requires more work at install time,


Wingware ide
Wingware IDE

  • Stronger debugger and IDE

    • Commercial release


Thank you
Thank You !

Q & A

ADN SparksAutodesk