score:1

Accepted answer

i setup debug differently but still based on the lux-render tutorial.

first, create the a .py file, lets call it debug.py, which will contain a function which we will call later to setup debugging. put this file in the same folder as the main __init__.py of your module. as per the lux-renderer tutorial, add the following code, updating pydev_source_dir.

import sys

def startdebug():
    try:
        # set the pydev_source_dir correctly before using the debugger
        pydev_source_dir = 'c:\program files\eclipse\plugins\org.python.pydev.debug_2.5.0.2012040618\pysrc'

        # test if pydev_source_dir already in sys.path, otherwise append it
        if sys.path.count(pydev_source_dir) < 1:
            sys.path.append(pydev_source_dir)

        # import pydevd module
        import pydevd

        # set debugging enabled
        pydevd.settrace(none, true, true, 5678, false, false)
    except:
        pass

when setting the pydev_source_dir ensure you point it to the org.python.pydev.debug_xxxxx. there is another folder similiar to this. to ensure you have the correct folder it will contain a /pysrc folder.

now in your main __init__.py, this must come before any other import statements to work correctly. add the following directly under the bl_info section, as strangely blender parses this itself.

debugging = true
if(debugging):
    import debug
    debug.startdebug()

having it here will avoids adding per file traces like the lux-render tutorial.

  1. add some breakpoint to the version in the add-ons folder,
  2. switch to the debug perspective,
  3. start eclipses debug server,
  4. start blender
  5. run the script and it will hit the breakpoint.

the common problems i find people encounter:

  • pointing the path to the wrong pydev debug folder, ensure that there is a /pysrc folder
  • when pydev updates, update the pydev_source_dir as the debug_xxxxx will have change
  • not having eclipse server running,
  • setting breakpoints on a local copy of the files instead of the version in the blender add-on directory
  • saving the script does not mean that blender will reload it, use imp, disable/renable the add-on or restart blender.

there are good instructions for setting up blender and eclipse for debugging. http://wiki.blender.org/index.php/user:z0r/pydevandprofiling

while this is for blenders game engine, much of it applies to regular blender. hope this help!

edit: i deleted it because i felt that this doesn't answer your question. but here it is since you insisted.


Related Query

More Query from same tag