TL;DR: Skip middle paragraph.
I'm trying to make an addon that draws certain info in the view, and have it do that basically all the time that the addon is on.
The way I've been told bgl drawing works is that you put the drawing code in a modal operator. However, all examples I've seen involve starting it from the invoke()
method, which is run
when the user executes the operator - not what I want. I've also tried putting the bpy.context.window_manager.modal_handler_add(self)
code in the register()
class method, but because that method does not have access to self
, I only got errors with the various arguments I tried (which were: none, the class (its general name), the cls
argument that register(cls)
gets, and some others. If needed I'll expand on this).
How do I make the operator run "on startup", or how else can I achieve my goal?
bpy.app.handlers.load_post.append(load_handler)
for running at startup $\endgroup$load_handler
be in that context? $\endgroup$bpy.app.handlers.frame_change_post
to draw my stuff and skip the operator altogether? $\endgroup$