7
$\begingroup$

I've added my own progress bar to the Blender 2.80 status bar (the footer of Blender) with the following abstracted code:

def draw_progress_bar(self, context):
    self.layout.prop(context.scene, "my_progress", text="Simulating")

bpy.types.STATUSBAR_HT_header.append(draw_progress_bar)

Only problem is, when I update the my_progress scene property, the progress bar in the UI doesn't update unless I move my mouse over the area. Typically, this would be solved by running the following code to redraw the area:

def tag_redraw_areas(area_types:iter=["ALL"]):
    """ run tag_redraw for given area types """
    area_types = confirm_list(area_types)
    screens = [bpy.context.screen] if bpy.context.screen else bpy.data.screens
    for screen in screens:
        for area in screen.areas:
            for area_type in area_types:
                if area_type == "ALL" or area.type == area_type:
                    area.tag_redraw()

But in this case, the Status Bar does not seem to be listed in bpy.context.screen.areas. Is there any other way to redraw the status bar in Blender 2.80?

$\endgroup$
1
$\begingroup$

I've found you can cause the status bar to redraw by calling:

bpy.context.workspace.status_text_set_internal(None)

It will of course also remove any currently set custom status text, but unlike the non 'internal' version it does not remove appended draw functions.

$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.