[Bf-committers] Please help me debugging

Nicholas Bishop nicholasbishop at gmail.com
Sun Nov 6 00:08:16 CET 2011


Most UI controls are either invoking operators or setting properties
through RNA. You can usually see the name of an operator/property in
the buttons tooltip. You can also run blender with the `-d' flag which
will then spit out the operator name on stdout when you click
something.

Sometimes setting a property will do more than update the value; you
can check the RNA definitions in makesrna/intern/rna_* to see if it
has functions associated with it.

For operators, the Python name shown by the UI is a bit different from
the name in the C source code, e.g. `bpy.ops.sculpt.brush_stroke' vs.
`SCULPT_OT_brush_stroke', so be aware of that when grepping for
definitions.

So, to give example, if I wanted to see find the C function called
when creating a cube, I'd run `blender -d', shift+AKEY to add the
cube, which prints out `MESH_OT_primitive_cube_add' in the console.
Then you can grep (or even quicker, TAGS file or equivalent) for
`primitive_add_cube', which leads you to editmesh_add.c:1436. This
shows the operator definition, and the actual functions called will be
set in the operator's invoke/exec fields.

There are probably more automated ways to go about this too, but
hopefully that helps a bit.

-Nicholas

On Sat, Nov 5, 2011 at 6:42 PM, Rainer Hohne <rahohne at googlemail.com> wrote:
> Hi there,
>
> being quite new to debugging, I would be glad if you could explain to me
> how to trace function calls from the GUI. Currently I can only see what
> function blender is at when it crashes (using DDD on Ubuntu), but I need to
> know which C function is being called for example if I click a certain
> button in the GUI.
>
> So can someone please explain what I need to do to get such a "live"
> backtrace of GUI interactions (if possible at all) - do I need a debug
> build of python or something like that ?
>
> Rainer
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list