WIP: UI: Image Editor Interactive Zoom Control #117050

Draft
Harley Acheson wants to merge 2 commits from Harley/blender:ImageZoom into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

Zoom factor widget in the header of Image Editor to interactively
change the zoom percentage. Allows entering specific values and also
works for users without a middle-mouse button.


In the Header a percentage slider, then a menu to select discrete values:

image

With the change to showing percentages, the "Fractional Zoom" menu also changes:

image

Note this PR also changes "Zoom to Border" to say "Zoom Region..." like similar operation in the 3D viewport. And also adds an ellipsis to end of "Resize" since this brings up a dialog. Of course these could be in a separate PR but these are such trivial changes.

Zoom factor widget in the header of Image Editor to interactively change the zoom percentage. Allows entering specific values and also works for users without a middle-mouse button. --- In the Header a percentage slider, then a menu to select discrete values: ![image](/attachments/53d04681-917b-482c-be3e-ccb7e9a917b1) With the change to showing percentages, the "Fractional Zoom" menu also changes: ![image](/attachments/1114818c-9c0a-4843-ab42-1ac2d72632ec) Note this PR also changes "Zoom to Border" to say "Zoom Region..." like similar operation in the 3D viewport. And also adds an ellipsis to end of "Resize" since this brings up a dialog. Of course these could be in a separate PR but these are such trivial changes.
Jesse Yurkovich reviewed 2024-01-12 02:22:18 +01:00
Jesse Yurkovich left a comment
Member

Glad to see someone taking a stab at this feature. I attempted it many years ago but didn't follow through with it as I ran into some UI troubles I didn't know how to get past back then.

Left a few minor comments. Also, there's some missing notifications that I also had to deal with in my attempt. Using the mouse wheel to zoom or using the Keyboard shortcuts for the View -> Fractional Zoom menu won't update the UI immediately.

Glad to see someone taking a stab at this feature. I attempted it many years ago but didn't follow through with it as I ran into some UI troubles I didn't know how to get past back then. Left a few minor comments. Also, there's some missing notifications that I also had to deal with in my attempt. Using the mouse wheel to zoom or using the Keyboard shortcuts for the View -> Fractional Zoom menu won't update the UI immediately.
@ -843,2 +843,4 @@
layout.separator_spacer()
# Image zoom controls.
layout.operator("image.view_all", text="", icon='IMAGE_PLANE').fit_view = True

I think I'd prefer to leave fit_view off and have this button snap back to a 1:1 zoom, though I can see merits to fitting to the window too. Wonder what others think?

I think I'd prefer to leave fit_view off and have this button snap back to a 1:1 zoom, though I can see merits to fitting to the window too. Wonder what others think?
Harley marked this conversation as resolved
@ -5576,3 +5576,2 @@
prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
RNA_def_property_array(prop, 2);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_array(prop, 1);

This is technically a breaking change. Cycles will need to be updated at least, see https://projects.blender.org/blender/blender/src/branch/main//intern/cycles/blender/session.cpp#L853

This is technically a breaking change. Cycles will need to be updated at least, see https://projects.blender.org/blender/blender/src/branch/main//intern/cycles/blender/session.cpp#L853
Harley marked this conversation as resolved
@ -5579,1 +5577,4 @@
RNA_def_property_array(prop, 1);
RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_zoom_get", nullptr, nullptr);
RNA_def_property_float_default(prop, 1.0);
RNA_def_property_range(prop, .125, 8);

The range here probably needs widened to allow the user to type in lower/higher values. e.g. I can zoom with the mouse to 0.1 but I'm not allowed to type that.

The range here probably needs widened to allow the user to type in lower/higher values. e.g. I can zoom with the mouse to 0.1 but I'm not allowed to type that.
Harley marked this conversation as resolved
Author
Member

@deadpin

Glad to see someone taking a stab at this feature

No idea if anyone wants this. I think I remember William wanting it. Is it useful for anyone who also has a middle mouse button?

I think I'd prefer to leave fit_view off and have this button snap back to a 1:1 zoom

I can see why you'd want a button to revert to 1:1. But I think I still like the "fit" one too. But I can't find a suitable icon for both. I've left it as you wanted, with one button for 1:1

This is technically a breaking change

Thanks for noticing this! I could not see why it is returning an array like that since the underlying value is a single float. I've just made a new property for this and left the existing one as is.

The range here probably needs widened

Makes sense. Done.

Also, there's some missing notifications that I also had to deal with in my attempt

Ah right. Looks like those other operators are just doing a redraw tag on the main region. Would need to tag the header as well, or just the area instead.

@deadpin > Glad to see someone taking a stab at this feature No idea if anyone wants this. I _think_ I remember William wanting it. Is it useful for anyone who also has a middle mouse button? > I think I'd prefer to leave fit_view off and have this button snap back to a 1:1 zoom I can see why you'd want a button to revert to 1:1. But I think I still like the "fit" one too. But I can't find a suitable icon for both. I've left it as you wanted, with one button for 1:1 > This is technically a breaking change Thanks for noticing this! I could not see why it is returning an array like that since the underlying value is a single float. I've just made a new property for this and left the existing one as is. > The range here probably needs widened Makes sense. Done. > Also, there's some missing notifications that I also had to deal with in my attempt Ah right. Looks like those other operators are just doing a redraw tag on the main region. Would need to tag the header as well, or just the area instead.
Author
Member

@deadpin

Notifications should be working properly now. So the value shown in the header will update correctly as a zoom with the middle mouse wheel, ctrl-middle mouse drag, changing zoom with numpad keys, or directly selecting items in the View menu.

@deadpin Notifications should be working properly now. So the value shown in the header will update correctly as a zoom with the middle mouse wheel, ctrl-middle mouse drag, changing zoom with numpad keys, or directly selecting items in the View menu.
First-time contributor

This is fantastic!
I just wish it also had the usual dropdown menu list with the handy zoom levels percentage, like :

image

This is fantastic! I just wish it also had the usual dropdown menu list with the handy zoom levels percentage, like : ![image](/attachments/ca8453d7-9f77-4b9d-8b1a-218a3c61fc64)
7.2 KiB
First-time contributor

This is fantastic!
I just wish it also had the usual dropdown menu list with the handy zoom levels percentage, like :

image

+1 the more standard blender becomes, the better ✌

Can we have that in the video sequencer editor too?

> This is fantastic! > I just wish it also had the usual dropdown menu list with the handy zoom levels percentage, like : > > ![image](/attachments/ca8453d7-9f77-4b9d-8b1a-218a3c61fc64) > **+1** the more standard blender becomes, the better ✌ Can we have that in the video sequencer editor too?
First-time contributor

Yes Harley, this is a very welcome addition. I mostly use integer multiples of zoom level (1:1, 2:1, etc) so that there is as few interpolation shenanigans as possible, so having the actual value readily available instead of having to fish out the presets in the "view" menu is valuable. This also serves as a display of the zoom value, which the image editor simply lacked until now. I second @TheRedWaxPolice in suggesting a dropdown with zoom presets. It's worth pondering whether the existing "Fractional Zoom" submenu from the "View" menu should be moved to top-level, right next to this slider.

Yes Harley, this is a very welcome addition. I mostly use integer multiples of zoom level (1:1, 2:1, etc) so that there is as few interpolation shenanigans as possible, so having the actual value readily available instead of having to fish out the presets in the "view" menu is valuable. This also serves as a display of the zoom value, which the image editor simply lacked until now. I second @TheRedWaxPolice in suggesting a dropdown with zoom presets. It's worth pondering whether the existing "Fractional Zoom" submenu from the "View" menu should be moved to top-level, right next to this slider.

Right, the idea that I explored 3 years ago was just to hoist the existing Fractional Zoom menu right along side it. Additionally, I wanted to use a PERCENTAGE sub-type instead of decimals and that's what tripped me up due to some ways that percentage widgets are drawn; it's related to the very wide range that this slider would have to represent.

Beyond that, aesthetically, I didn't have the energy to argue one way or another if that top-headerbar location... has enough space for another wide widget (If that came up during review; I didn't have a good answer myself). It kind of doesn't have room but many times it does, and you can scroll. There's no "footers" or status bar areas available anyways. Since then I just smash "numpad 1" anytime I'm viewing images to ensure I know where I'm at :)

Right, the idea that I explored 3 years ago was just to hoist the existing Fractional Zoom menu right along side it. Additionally, I wanted to use a PERCENTAGE sub-type instead of decimals and that's what tripped me up due to some ways that percentage widgets are drawn; it's related to the very wide range that this slider would have to represent. Beyond that, aesthetically, I didn't have the energy to argue one way or another if that top-headerbar location... has enough space for another wide widget (If that came up during review; I didn't have a good answer myself). It kind of doesn't have room but many times it does, and you can scroll. There's no "footers" or status bar areas available anyways. Since then I just smash "numpad 1" anytime I'm viewing images to ensure I know where I'm at :)
Author
Member
@deadpin ![image](/attachments/8c62e342-0a7c-40f9-8c27-c84365d29055)
Harley Acheson changed title from WIP: UI: Image Editor Interactive Zoom Control to UI: Image Editor Interactive Zoom Control 2024-01-12 23:57:02 +01:00
Harley Acheson added this to the User Interface project 2024-01-12 23:57:10 +01:00
Harley Acheson requested review from Pablo Vazquez 2024-01-12 23:57:17 +01:00
Author
Member

@deadpin

Looking into the issue of it showing the percentage. It isn't just that want the percent sign, and don't want the blue progress bar, but I also want to have the little side up/down buttons.

The only way I have found to do this nicely is to set the property subtype as PROP_PERCENTAGE, so it shows the percentage sign. Normally this results in a UI_BTYPE_NUM_SLIDER being made. But here I am checking the softmax settings. If over 100 I just make it create a UI_BTYPE_NUM instead.

Fairly simple and does exactly what I want. But not sure if there would be any negative consequences. Almost every single PROP_PERCENTAGE has a softmax of 100. For the ones are higher it should be equally nonsensical to show a full blue bar at that higher value.

@deadpin Looking into the issue of it showing the percentage. It isn't just that want the percent sign, and don't want the blue progress bar, but I also want to have the little side up/down buttons. The only way I have found to do this nicely is to set the property subtype as PROP_PERCENTAGE, so it shows the percentage sign. Normally this results in a UI_BTYPE_NUM_SLIDER being made. But here I am checking the `softmax` settings. If over 100 I just make it create a UI_BTYPE_NUM instead. Fairly simple and does exactly what I want. But not sure if there would be any negative consequences. Almost every single PROP_PERCENTAGE has a softmax of 100. For the ones are higher it should be equally nonsensical to show a full blue bar at that higher value.

Functions really nice now! Glad you got the percentage working :)

Functions really nice now! Glad you got the percentage working :)
First-time contributor

Shouldn't Zoom To Border be called Zoom Region like in the viewport? (for consistency's sake)..

Shouldn't `Zoom To Border` be called `Zoom Region` like in the viewport? _(for consistency's sake).._
First-time contributor

Shouldn't Zoom To Border be called Zoom Region like in the viewport? (for consistency's sake)..

of course it should
i dont know whats going on here 😕

> Shouldn't `Zoom To Border` be called `Zoom Region` like in the viewport? _(for consistency's sake).._ of course it should i dont know whats going on here 😕
Author
Member

@pablovazquez

I did find and fix the times where you could make a zoom change and not have it shown correctly in the header. It also now shows the percentage sign, but not the blue progress bar, and shows the side up/down buttons.

@pablovazquez I did find and fix the times where you could make a zoom change and not have it shown correctly in the header. It also now shows the percentage sign, but not the blue progress bar, and shows the side up/down buttons.
Pablo Vazquez approved these changes 2024-02-01 18:44:14 +01:00
Pablo Vazquez left a comment
Member

Works great!

Funnily enough this exposes an unrelated issue with the menu pulldown widget alignment, where even though it's aligned with the row, it doesn't get proper border radius. Will make a report.

Works great! Funnily enough this exposes an unrelated issue with the menu pulldown widget alignment, where even though it's aligned with the row, it doesn't get proper border radius. Will make a report.
Harley Acheson added this to the 4.2 LTS milestone 2024-02-05 19:29:19 +01:00

The decision in the UI meeting two weeks ago was to do this for other editors as well, so they are all consistent. I think that means the Sequencer and Movie Clip editors, maybe the Compositor if it has a backdrop. But no other editors I think.

The decision in the UI meeting two weeks ago was to do this for other editors as well, so they are all consistent. I think that means the Sequencer and Movie Clip editors, maybe the Compositor if it has a backdrop. But no other editors I think.
Harley Acheson changed title from UI: Image Editor Interactive Zoom Control to WIP: UI: Image Editor Interactive Zoom Control 2024-02-17 03:08:06 +01:00
Harley Acheson force-pushed ImageZoom from aff5eb5da0 to 319bb5baab 2024-03-02 01:02:41 +01:00 Compare
Harley Acheson added 1 commit 2024-03-02 01:22:25 +01:00
First-time contributor

any eta for this?

any eta for this?
Author
Member

any eta for this?

No. It isn't shelved, but we've put it on hold while we give it more thought.

I did make changes to the "zoom" menus so they are more consistent, shows percentage, and highlights the current level if matching: #121044

But weren't able to reach consensus on including the menu on the header. Not dead, but needs thought.

> any eta for this? No. It isn't shelved, but we've put it on hold while we give it more thought. I did make changes to the "zoom" menus so they are more consistent, shows percentage, and highlights the current level if matching: https://projects.blender.org/blender/blender/pulls/121044 But weren't able to reach consensus on including the menu on the header. Not dead, but needs thought.
First-time contributor

weren't able to reach consensus on including the menu on the header

thats quite concerning to be honest.
maybe a devtalk feedback thread would help?

> weren't able to reach consensus on including the menu on the header thats quite concerning to be honest. maybe a devtalk feedback thread would help?
First-time contributor

this is great! can we have a "zoom to fit" icon/button in the UI near the zoom too please?

this is great! can we have a "zoom to fit" icon/button in the UI near the zoom too please?
This pull request has changes conflicting with the target branch.
  • scripts/startup/bl_ui/space_clip.py
  • scripts/startup/bl_ui/space_image.py
  • scripts/startup/bl_ui/space_sequencer.py
  • source/blender/makesrna/intern/rna_space.cc

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u ImageZoom:Harley-ImageZoom
git checkout Harley-ImageZoom
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
8 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#117050
No description provided.