I have an addon with awkward complicated work flows. My users frequently get frustrated. Until I can fix that fundamental problem, I would like to make a little floating "wizard" which attempts to guide them along by assesing custom blend data related to my addon. I have some loose ideas that I will be trying (outlined below). Any tips or hints greatly appreciated.

  1. The user will have to initiate or stop the "wizard" with an operator, because the wizard will need to access blend data, doing this at Addon registration will not work.

  2. The operator will add a persistent 'scene_update_post' app handler. This persistent function which will asses the custom data and blend file data, and generate some "helpful" instructions whenever the scene updates. These instructions will be stored as text data as a global at the "help.py" module level.

  3. The operator will register a draw callback, which parses and displays the text data generated by the persistent app handler.

  4. When unregistering the addon, it will check for the existence of the app_handler and the draw_callback and unregister them

How to manage Handlers in an add-on?

  1. There will be a "close help" operator which manually removes those handlers.

    class MY_ADDON_OT_interactive_help(bpy.types.Operator):
        add gui help
        bl_label="Start Helper Wizard"
        def poll(cls, context):
        if not hasattr(context.scene, 'my_addon_props'):
            return False
        return True
        def execute(self, context):
            #add a app handler to asses info
            #add draw callback to display info
            global help_app_handle
            help_app_handle = bpy.app.handlers.scene_update_pre.append(my_addon_help_parser)
            global help_draw_handle
            help_draw_handle = bpy.types.SpaceView3D.draw_handler_add(my_addon_help_draw, (self, context), 'WINDOW', 'POST_PIXEL')
            return {'FINISHED'}
  • 1
    $\begingroup$ So what's your question? Regarding "scene_update_post": are you aware that this callback is called around 20 times per second? $\endgroup$
    – CodeManX
    Sep 5, 2015 at 21:58
  • $\begingroup$ my question is. "Is this a good approach and are there any things I should look out for?" which your comment points out exactly what I'm looking for. I don't need it to be updated that often, more or less only when things are changed or altered. $\endgroup$
    – patmo141
    Sep 5, 2015 at 23:10
  • $\begingroup$ Well there is blender.org/api/blender_python_api_2_75_release/…, but it may not work the way you expect it to. There are no proper change callbacks in Blender. What exactly is it that your users try to achieve with your addon? $\endgroup$
    – CodeManX
    Sep 6, 2015 at 12:46
  • $\begingroup$ My suggestion would be a modal timer operator used akin to a daemon. $\endgroup$
    – batFINGER
    Sep 6, 2015 at 15:26
  • $\begingroup$ As an update, I have been using the scene_update_post handler with no problems. Since it's is only reading through some addon_preferences and assessing a few simple attributes of objects in the scene,it appears to have no problems despite being redundantly called 20time/sec $\endgroup$
    – patmo141
    Oct 3, 2015 at 17:02


You must log in to answer this question.

Browse other questions tagged .