This patch attempts to add an oft requested feature to the Image editor space to show the current zoom level in use. This is one of the ideas from this RCS entry: https://blender.community/c/rightclickselect/wGgbbc/
Unfortunately this simple request has various problems which are detailed below.
Implementation
- Hooks RNA up to the SpaceImage.zoom field (not to be confused with the current RNA zoom property on the same type which is related but also different)
- Ensures that all operators which modify the zoom field also properly update the user interface now
- Adds the relevant UI layout to space_image.py
It is available on for all image editors for consistency, not just for renders, and there's no option to disable it.
The widget allows input so the user is free to type in the exact percentage they desire.
Problem - type of widget used to display zoom
The implementation has one very unfortunate downside however: Being a PROP_PERCENTAGE, blender will always show it as a "slider" widget; despite the python layout saying otherwise. This would typically be fine except for 2 things:
- The range of this slider is _very_ wide. From the code that existed before, the zoom will range from ~0.1% all the way to ~204800%. This makes a slider useless in practice. Restricting the UI range to something lower causes bad behavior when the value exceeds the range (the bar's size becomes erratic).
- The range of zoom is also dynamic and depends on the size of the window's region/area; so there's no good range to assign to the RNA property in the first place. I had to use what I've found to be the widest range based on my setup here.
Ideally there would be a way to just display a percentage value without a slider…
Alternatives:
- Forgo allowing input entirely and just use a text Label element that shows the zoom level
- The Compositor space uses a decimal factor value to control the background image's zoom level. Trying that here is also suboptimal IMO due again to the shear range of the numbers that will be used and displayed as well as the fact that it's quite non-standard and not user friendly.
- Attempt to fix the layout code to "properly" respect the slider value
- The current default for the layout slider value is False. This means that every PROP_PERCENTAGE widget currently in use would have to be explicitly marked with a slider=True flag to ensure no regressions from current functionality/UI. This would also affect addons.
- This looks to be a rather invasive change as currently the code that creates widgets (a widget_numbut vs. a widget_numslider) is not passed the information it needs from the layout to do the correct thing. There's code that attempts to change a button's type after creation oddly enough… but that did not work for me when trying to change from slider -> regular. A proper API change to the creation method itself is possible but would ripple pretty far.
Problem - UI location
Currently this is placed in the main Header area. The image editor has no status bar along the bottom and this seemed like the best place for it. However, the header is already pretty crowded, especially when viewing the individual render passes.
Thoughts on a better place for it?
Example

