UI: Allow Some Buttons to Scale Width With Text Style #119223

Merged
Harley Acheson merged 1 commits from Harley/blender:LayoutUiUnits into main 2024-03-08 21:50:07 +01:00
Member

Allow some View3D buttons to change their width according to content
and Text Styles, rather than be fixed amount of UI_UNIT_X. Examples
include "Object Mode", "Transform Orientation", "Grease Pencil Layers",
"Texture Slots", "Vertex Groups", "Attribute", etc.


It has been a long-standing complaint that some of our UI items are (seemingly) a fixed width. Our best examples are "Object Mode" and "Transform Orientations". These are always a fixed width that is only scaled by the Resolution Scale. These don't change width to match their content which is problematic for translations. Adding a custom transform orientation with a long name will cut it off. And it is also a problem for accessibility in that they do not change width with changes to Text Styles.

The root cause of this is that these items use layout->ui_units_x. This sets a fixed width in a number of UI_UNIT_X units. This is not changed with Text Styles.

Although the scaling set by layout->ui_units_x could be improved, this would still be a width that does not account for the string contents. This PR just removes the uses of layout->ui_units_x here. This results in these items scaling properly with contents, including with translations, custom items, and with changes to Text Styles.

For example, increase the Text Style font size for widgets. Above is current behavior, below is with this PR:

image

Allow some View3D buttons to change their width according to content and Text Styles, rather than be fixed amount of UI_UNIT_X. Examples include "Object Mode", "Transform Orientation", "Grease Pencil Layers", "Texture Slots", "Vertex Groups", "Attribute", etc. --- It has been a [long-standing complaint](https://projects.blender.org/blender/blender/issues/86974) that some of our UI items are (seemingly) a fixed width. Our best examples are "Object Mode" and "Transform Orientations". These are always a fixed width that is only scaled by the Resolution Scale. These don't change width to match their content which is problematic for translations. Adding a custom transform orientation with a long name will cut it off. And it is also a problem for accessibility in that they do not change width with changes to Text Styles. The root cause of this is that these items use layout->ui_units_x. This sets a fixed width in a number of UI_UNIT_X units. This is not changed with Text Styles. Although the scaling set by layout->ui_units_x could be improved, this would still be a width that does not account for the string contents. This PR just removes the uses of layout->ui_units_x here. This results in these items scaling properly with contents, including with translations, custom items, and with changes to Text Styles. For example, increase the Text Style font size for widgets. Above is current behavior, below is with this PR: ![image](/attachments/c16c7cff-b04d-4444-840a-c6fe09ebf912)
Harley Acheson added 1 commit 2024-03-08 20:59:49 +01:00
557735082a UI: Allow Some Buttons to Scale Width With Text Style
Allow some View3D buttons to change their width according to content
and Text Styles, rather than be fixed amount of UI_UNIT_X. Examples
include "Object Mode", "Transform Orientation", "Grease Pencil Layers",
"Texture Slots", "Vertex Groups", "Attribute", etc.
Harley Acheson added this to the User Interface project 2024-03-08 21:04:23 +01:00
Harley Acheson merged commit 85762d99ef into main 2024-03-08 21:50:07 +01:00
Harley Acheson deleted branch LayoutUiUnits 2024-03-08 21:50:09 +01:00
Sign in to join this conversation.
No reviewers
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
1 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#119223
No description provided.