Page MenuHome

Fix: UI - Center the status bar progress bar text
ClosedPublic

Authored by Vincent Blankfield (vvv) on May 9 2021, 1:19 AM.

Details

Summary

Previously the text was left-aligned and started from the progressbar's
center plus padding. This patch overrides progressbar's draw flags,
making the text centered.


The result is still one pixel off due to the incorrect rounding in
UI_fontstyle_draw_ex. That can be fixed with D11204 .

Diff Detail

Repository
rB Blender

Event Timeline

Vincent Blankfield (vvv) requested review of this revision.May 9 2021, 1:19 AM
Vincent Blankfield (vvv) created this revision.

Set the flags on button creation, not on every redraw.

Julian Eisel (Severin) added inline comments.
source/blender/editors/interface/interface_templates.c
6767 ↗(On Diff #39059)

These flags are set in ui_def_but(): https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/interface/interface.c$4102-4112.
I don't think they should be set in the first place, so I'd just remove UI_BTYPE_PROGRESS_BAR from the ELEM() there. This is the only use case of this button type, so that should be safe to do.

Removed UI_BTYPE_PROGRESS_BAR from the left aligned types in ui_def_but, as suggested.

This revision is now accepted and ready to land.Jul 6 2021, 6:38 PM

(...are you guys aware that the progress bar is not exposed in the API, meaning the add-on coders can not use it in their add-ons?)

The progress bar is just an indicator (a widget). The progress is obtained from the internal window-manager jobs system. Adding a jobs system to the Python API is not a simple task, and not something for the UI module to do.

This revision was automatically updated to reflect the committed changes.