Refactor: U.dpi_fac -> U.scale_factor #105750
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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#105750
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Harley/blender:DpiFac"
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?
A renaming of UI scale factors from names that imply a relationship to
monitor DPI to names that imply that they simply change "scale"
This is a disruptive change request that should be considered carefully. When posted on Phab Brecht approved it, but I still worry that this is a big change just because "Harley doesn't like a word".
With the last release we changed U.dpi so that it contains actual monitor DPI and is no longer scaled by line width. This might be a time to consider changing other UI variable names to be less confusing as well. The term "dpi_fac" has always seemed a bit odd to me as its not really related to DPI and "fac" is a clumsy shortening of factor. My hope is the following makes it all a bit less confusing for new developers.
This PR first renames the following:
Then ALL current uses of U.scale_factor are changed to instead use the macro UI_SCALE_FAC, making it easier to move or change this later. And all uses of U.inv_scale_factor use macro UI_INV_SCALE_FAC. Our current code contains a mixture of U.dpi_fac and UI_DPI_FAC, often in the same file.
A review item that was previously "Not Done" is completed here. Campbell wanted a doc-string on UI_SCALE_FAC and it is now in DNA_userdef_types.h as "Scaling factor for all UI elements, based on the "Resolution Scale" user preference and the DPI/OS Scale of each monitor. This is a read-only, run-time value calculated by
WM_window_set_dpi
at various times, including between the drawing of each window and so can vary between monitors."Refactor: .dpi_fac -> U.scale_factorto Refactor: U.dpi_fac -> U.scale_factor@ -18,0 +21,4 @@
* `WM_window_set_dpi` at various times, including between the drawing of each window and so can
* vary between monitors.
*/
#define UI_SCALE_FAC ((void)0, U.scale_factor)
Why is
(void)0
used here, I don't think it's necessary?Since
dpi_fac
does not represent nor DPI, it seems convenient to rename it toscale_factor
IMHO.Perhaps we don't even need the
_factor
suffix.However, I noticed that you already have a member with a similar name. The
U.ui_scale
. Not sure if it's something to be concerned about.@blender-bot build
I did that based on Campbell's suggestion that this would "avoid accidental assignment", unless I am misunderstanding. https://archive.blender.org/developer/differential/0016/0016807/#461990
Ok, that's fine then.
30fb5ea3d7
to5e6ec529c4
@blender-bot build