I have an operator which registers a draw callback and it’s working fine. Now, I would like to decide from within the draw callback that another redraw should happen next frame. However, calling context.area.tag_redraw() from within the draw callback appears to have no effect.
def invoke(self, context: bpy.types.Context, event: bpy.types.Event):
args = (self, context, event)
self.drawCallbackHandle = bpy.types.SpaceView3D.draw_handler_add(drawCallback, args, "WINDOW", "POST_PIXEL")
# ...
def drawCallback(op: MyOperator, context: bpy.types.Context, event: bpy.types.Event):
now = time.perf_counter()
holdTime = 1
since = now - op.timeOfSomeEvent
if since >= holdTime:
return
# draw something
context.area.tag_redraw() # draw again soon <- this doesn't work
Essentially I want to use this to animate a text fadeout, but no redraw happens unless I get an event to call tag_redraw() from my operator. Any ideas?