Page MenuHome

Display current zoom level in the Image Editor space
Needs ReviewPublic

Authored by Jesse Yurkovich (deadpin) on Jan 2 2021, 12:41 AM.

Details

Reviewers
None
Group Reviewers
User Interface
Summary

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

Diff Detail

Repository
rB Blender
Branch
image-zoom (branched from master)
Build Status
Buildable 11943
Build 11943: arc lint + arc unit

Event Timeline

Jesse Yurkovich (deadpin) requested review of this revision.Jan 2 2021, 12:41 AM
Jesse Yurkovich (deadpin) created this revision.

It's not clear what your goal is. Do you want to show just a label with the current zoom, or let easily change the value?

If just a label then it should be an overlay something like 3d statistics. (not sure if this is very useful)

If you want to change the zoom, I would prefer a menu/enum with values like 50% 100% 200%. This is more useful. But it can also show the current zoom level like this:

Or, I would put it in the sidebar (view/display) since the header is already quite cluttered.

I'm not sure if this should be a slider (with blue filling). But there should be some soft limits and some comfortable sensitivity, it is currently unusable.

Ultimately I think I want the zoom to be easily changeable, to any arbitrary value. I wouldn't want to checkin a feature that eliminates part of one RCS wish item just to have another RCS entry pop up a day later with a request to be able to type any value. Or worse, users filing bugs thinking the feature is broken or incomplete.

My reference was other image manipulation programs that allow arbitrary scaling. Some have a solution similar to yours. They have a ui widget that is like a "typeable menu". When you click you get pre-defined zoom levels, but the user is free to type any particular value too.

For the menu above, there's already the View->Fractional Zoom menu that provides that so we'd have to de-duplicate.

Workaround the slider issue in a somewhat brute-force way.

  • Add new property subtype to workaround slider issue