UI: Correct default width of toolbars #108292
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
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
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#108292
Loading…
Reference in New Issue
No description provided.
Delete Branch "lone_noel/blender:fix-toolbar-default-width"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Correct default initial widths of toolbars
The width of the toolbar adjusts incrementally to match the width of a
single or two columns of tool icons before allowing free width
adjustment once the region is wide enough to display labels.
The default width of the toolbar now matches the width it snaps when
displaying one column of icons.
This fixes an issue where the toolbar was slightly too wide when
opening a new editor or resetting to factory defaults.
Comparison
Issue
The issue can most easily be seen when loading the factory settings
and then adjusting the width of the toolbar in the 3D viewport. The
toolbar will immediately snap to a width slightly narrower than the
default.
Video demonstration by @pablovazquez :
>Alternative
The width of the toolbar for one column of icons works out to
exactly
56
, which is why the current default of58
is a bit toowide.
Simply changing all the hard-coded values from
56
to58
is enough tofix the issue, but I tried to make some additional changes to hopefully
avoid these values going out of sync with the actual toolbar width in
the future.
Thanks for working on this!
The changes in the editor region prefsizex assignments from "58" to your function returning 56 is an awesome fix.
But I worry about this new define UI_TOOLBAR_WIDTH being not the width of the toolbar, but also including the left margin. This could possibly lead to errors, and I think it does so in this PR:
Currently the snap_units are 56, 96, 124, so margin (16) plus a column (40), plus another column (40), then plus a bit more (28).
But since your UI_TOOLBAR_WIDTH includes the left margin, your snap_units are 56, 112, 151.191. The best way to see this is to drag the toolbar to two columns and then move your mouse until the cursor indicates the width of the region. Or turn off Region Overlap and you will see the region is wider than you intend.
I wonder if it might make sense to remove the UI_TOOLBAR_WIDTH define and use ED_region_toolbar_size_x() in its place. Then add a columns or column_number argument to that function. The regions would be initiated with 1 column but you could use the function in the calculation of snap positions.
Oh shoot. I missed that factoring out the column number changed the resulting width. Fixed it as suggested. thanks.
Now that I see it, I think this is indeed nicer without the macro. It also allows to easily and exlicitly set the width to two columns of icons with
ED_region_toolbar_size_x(2.0f)
in case we ever want that.Thanks for checking this out!
@lone_noel
Hey, I realize that I am the one who suggested trying it, but I keep staring at that
ED_region_toolbar_size_x
function and keep thinking it will confuse my "Future Self" no matter how well we document it.What do you think of something like the following? It seems to hit the points you want and looks straight-forward. And yes, does seem close to your first version. Although I should point out that the following contains both
(int)UI_TOOLBAR_WIDTH
andint(UI_TOOLBAR_WIDTH)
because of our differing style for casts between C and C++Fix: Correct default width of toolbarto UI: Correct default width of toolbars087a785ec0
to1c3dd7ebd8
I think I understand what you mean. It wasn't the most intuitive and making things more clear is great!
I like it a lot! Thanks for even providing the patch.
I pretty much kept it as is, but put the
aspect
back in the calculation of thesnap_units
since otherwise it created some issues when zooming the toolbar (see attached screenshot).Ouch, sorry about that mistake. Glad you tested it. LOL
@pablovazquez - Is this something we can put in 3.6 since it is a fix? It's not a very noticeable thing though, more like an "off by two pixels" issue, so we can put it only in main if you think that best.
3.6 being an LTS release I think it'd be great to get this fixed, or we will continue seeing screenshots with this issue for the next two years.