[Bf-python] Remove a modal handler from the window manager

"Martin Bürbaum" martin.buerbaum at gmx.at
Fri Feb 24 17:46:57 CET 2012


Dalai Felinto <dfelinto at gmail.com> wrote:

> Can't you remove the handler as part of the unregister routine?

Yes, that's the plan, but what code do I need to execute to remove a modal handler?

There are actually two things that get added, see the operator VIEW3D_OT_display_measurements in this file [1]:

1.) VIEW3D_OT_display_measurements is added via modal_handler_add to the window manager and

2.) draw_measurements_callback is added via callback_add to the window region of the 3D view(s).

I think 1. is already removed correctly (need to double-check that), but  concerning the 2. point I have found no solution how that would/should work. The actual code to add the handler/callback already looks pretty hack-ish to me :-/
I really want to solve this in a clean way, so any help would be appreciated.

Cheers,
Martin

[1] http://projects.blender.org/scm/viewvc.php/trunk/py/scripts/addons/space_view3d_panel_measure.py?view=markup&revision=3013&root=bf-extensions



More information about the Bf-python mailing list