UI: Node Grid Adjustments for Line Width #111640

Merged
Harley Acheson merged 2 commits from Harley/blender:NodeGrid into main 2023-08-29 06:33:30 +02:00
Member

Have Line Width change Node Grid point size but NOT grid spacing.


This fixes some complaints in #109572, but not other unrelated issues.

The Node Snapping Grid currently has spacing that is related to U.widget_unit. Unfortunately this value changes not only with Resolution scale but also with line width. It isn't just that changing to "Wide Lines" will make the grid wider, but linear changes in Resolution scale do not result in linear changes in U.widget_unit. @lone_noel made this nice graph to illustrate that this measure is not linear:

image

Conversely, changing from Thin Lines to Wide Lines does not change the size of the individual dots of the grid. This is needed for accessibility reasons so that users with vision issues can make the dots more visible.

This PR changes the grid spacing to use a value that changes only with UI_SCALE_FAC. Using a multiple of this that will be exactly equal the current spacing at 1X, 2X, etc.

It also makes the grid dot size change with U.pixelsize (line width). It slightly offsets the dot position by half of its width to keep them centered as the dot size changes.

It also makes trivial changes to the calculation of the number of dots on the screen so that they can no longer overlap the scrollbars.

Have Line Width change Node Grid point size but NOT grid spacing. --- This fixes some complaints in #109572, but not other unrelated issues. The Node Snapping Grid currently has **spacing** that is related to `U.widget_unit`. Unfortunately this value changes not only with Resolution scale but also with line width. It isn't _just_ that changing to "Wide Lines" will make the grid wider, but linear changes in Resolution scale do not result in linear changes in `U.widget_unit`. @lone_noel made this nice graph to illustrate that this measure is not linear: ![image](/attachments/1554b0c5-016d-40c7-8fd9-4aa48fd2a896) Conversely, changing from Thin Lines to Wide Lines does not change the size of the individual dots of the grid. This is needed for accessibility reasons so that users with vision issues can make the dots more visible. This PR changes the grid spacing to use a value that changes only with UI_SCALE_FAC. Using a multiple of this that will be exactly equal the current spacing at 1X, 2X, etc. It also makes the grid dot size change with U.pixelsize (line width). It slightly offsets the dot position by half of its width to keep them centered as the dot size changes. It also makes trivial changes to the calculation of the number of dots on the screen so that they can no longer overlap the scrollbars.
157 KiB
Harley Acheson added 1 commit 2023-08-29 02:32:32 +02:00
e0d9621d3e UI: Node Grid Adjustments for Line Width
Have Line Width change Node Grid point size but NOT grid spacing.
Harley Acheson added this to the User Interface project 2023-08-29 02:33:02 +02:00
Harley Acheson requested review from Hans Goudey 2023-08-29 02:33:09 +02:00
Hans Goudey approved these changes 2023-08-29 02:56:26 +02:00
@ -1355,2 +1358,3 @@
float start_x;
grid_axis_start_and_count(step, v2d->cur.xmin, v2d->cur.xmax, &start_x, &count_x);
/* Count points that fit in viewport minus space for the scrollbars. */
grid_axis_start_and_count(
Member

Could you split the 1.5 and 1.2 values to separate const float variables with descriptive names (if possible!) :)

Also, the parentheses are necessary, order of operations makes multiplication happen first.

Could you split the 1.5 and 1.2 values to separate `const float` variables with descriptive names (if possible!) :) Also, the parentheses are necessary, order of operations makes multiplication happen first.
Author
Member

It got much nicer when I found some scrollbar size defines that work better and are self-explanatory.

It got much nicer when I found some scrollbar size defines that work better and are self-explanatory.
Harley marked this conversation as resolved
Harley Acheson added 1 commit 2023-08-29 05:48:08 +02:00
Author
Member

@blender-bot build

@blender-bot build
Harley Acheson merged commit 04285c2d0e into main 2023-08-29 06:33:30 +02:00
Harley Acheson deleted branch NodeGrid 2023-08-29 06:33:31 +02:00
First-time contributor

Thank you so much :)

Thank you so much :)
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
3 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#111640
No description provided.