Regression: Nodes: Background dots clipping is visible #114110

Open
opened 2023-10-24 16:29:53 +02:00 by Iliya Katueshenock · 10 comments

Background dots in node editor are clipped by borders.
But that clipping is not correct on too large zoom.

image

Fix: Deduce the reason of that behavior, and change iteration amount to +1 or add zoom factor multiplication in somethere.

Background dots in node editor are clipped by borders. But that clipping is not correct on too large zoom. ![image](/attachments/1f2c87fe-516e-4516-b95b-949795c6c5b5) Fix: Deduce the reason of that behavior, and change iteration amount to +1 or add zoom factor multiplication in somethere.
Iliya Katueshenock added the
Type
Bug
Meta
Good First Issue
Module
Nodes & Physics
labels 2023-10-24 16:29:54 +02:00
First-time contributor

@harley tiniest regression in the world in 04285c2d0e

@harley tiniest regression in the world in 04285c2d0e645470ece4f12169adbbc09ccef887
Author
Member

Oh..

Oh..
Iliya Katueshenock changed title from Nodes: Background dots clipping is visible to Regression: Nodes: Background dots clipping is visible 2023-10-25 20:51:07 +02:00
Iliya Katueshenock added the
Priority
High
Status
Confirmed
labels 2023-10-25 20:51:16 +02:00
Iliya Katueshenock added this to the 4.0 milestone 2023-10-25 20:51:28 +02:00
Iliya Katueshenock removed the
Meta
Good First Issue
label 2023-10-25 20:55:55 +02:00
Member

Yes, I struggled with clipping of those dots. Before my patch (which was more about the sizing and placement of them) there were many times that they would be shown on top of the scroll bar, which I really hated. Fairly certain (away from computer) that in the example above the next column of them would in the space used by the scroll bar. That the scroll bar is not currently show makes it look odd, but not as odd as having dots on the scroll bar. It’s a fun bit of code if you want to try to improve it.

Yes, I struggled with clipping of those dots. Before my patch (which was more about the sizing and placement of them) there were many times that they would be shown on top of the scroll bar, which I really hated. Fairly certain (away from computer) that in the example above the next column of them would in the space used by the scroll bar. That the scroll bar is not currently show makes it look odd, but not as odd as having dots on the scroll bar. It’s a fun bit of code if you want to try to improve it.
Hans Goudey added
Priority
Normal
and removed
Priority
High
labels 2023-10-25 21:24:11 +02:00
Contributor

Ah, yes, I know this struggle well from some web apps I've worked on in my day job. The dynamic-width translucent "floating" scrollbars are so pretty and modern, but quite a pain when they clash with the background content.

That said, the dots are definitely clipping farther from the scrollbars than they need to be. In this screenshot, I've panned so the dots near the scrollbars are as close as they can get before they clip (and both scrollbars are active and at full width):
Scaled Screenshot 2023-10-25 at 10.12.15 PM.png

Looks like there's an extra scrollbar width/height being added to the margin.

Anyway, I'll try taking a look at this while everyone else is busy with BCON 2023

Ah, yes, I know this struggle well from some web apps I've worked on in my day job. The dynamic-width translucent "floating" scrollbars are so pretty and modern, but quite a pain when they clash with the background content. That said, the dots are definitely clipping farther from the scrollbars than they need to be. In this screenshot, I've panned so the dots near the scrollbars are as close as they can get before they clip (and both scrollbars are active and at full width): ![Scaled Screenshot 2023-10-25 at 10.12.15 PM.png](/attachments/54b75d12-51aa-44c6-add6-50838e9a22e3) Looks like there's an extra scrollbar width/height being added to the margin. Anyway, I'll try taking a look at this while everyone else is busy with BCON 2023
Member

The link to my PR above should point you at the code nicely and you’ll probably find it fun to play with.

The complications here are how we want things to scale. Generally we want everything scaling linearly. But… we also have “line width” adjustment which we use like a “minimum feature size”, so small things like lines become thicker independent of interface scaling. In this case with the dot grid we want the line width to affect the size of each dot but only use ui scale for the dot placement.

For this particular issue, if we want to make sure the dots don’t show in the scroll bar space you need to make sure this applies when you change scale and when selecting “wide lines” because that makes those wider. There is probably a function somewhere that returns the current width of that region’s scroll bar so you can probably get as you accurate as you can stand. I think, but not sure, that those dots might be changing their opacity near that edge so they don’t just pop in and out abruptly.

Anyway, there’s lots in there to have fun with. Don’t hesitate to ask questions.

The link to my PR above should point you at the code nicely and you’ll probably find it fun to play with. The complications here are how we want things to scale. Generally we want everything scaling linearly. But… we also have “line width” adjustment which we use like a “minimum feature size”, so small things like lines become thicker independent of interface scaling. In this case with the dot grid we want the line width to affect the size of each dot but only use ui scale for the dot placement. For this particular issue, if we want to make sure the dots don’t show in the scroll bar space you need to make sure this applies when you change scale and when selecting “wide lines” because that makes those wider. There is probably a function somewhere that returns the current width of that region’s scroll bar so you can probably get as you accurate as you can stand. I think, but not sure, that those dots might be changing their opacity near that edge so they don’t just pop in and out abruptly. Anyway, there’s lots in there to have fun with. Don’t hesitate to ask questions.
Author
Member

In this case with the dot grid we want the line width to affect the size of each dot

Hm? No, i don't see the issues in the fact that dot's is drawn under scrollbar.
In the fact, i'd not like idea of changing grid density by hovering cursor over scrollbar.

> In this case with the dot grid we want the line width to affect the size of each dot Hm? No, i don't see the issues in the fact that dot's is drawn under scrollbar. In the fact, i'd not like idea of changing grid density by hovering cursor over scrollbar.
Contributor

Thanks, @Harley! I definitely respect the complexity here, and I appreciate you taking the time to explain it (in the midst of BCON 2023, no less!). If I'm able to make an improvement here, it will only be because I have the luxury of investing as much time as I choose—no pressure to move on to other priorities.

Thanks, @Harley! I definitely respect the complexity here, and I appreciate you taking the time to explain it (in the midst of BCON 2023, no less!). If I'm able to make an improvement here, it will only be because I have the luxury of investing as much time as I choose—no pressure to move on to other priorities.
Contributor

Looks like this is just a matter of needing to scale V2D_SCROLL_WIDTH and V2D_SCROLL_WIDTH based on the zoom factor.

I noticed that when I zoomed in the amount of empty space got even bigger, and that whan I zoomed out the amount of space got very small:
Scaled 114110_bad-margins-zoomed-in.png Scaled 114110_bad-margins-zoomed-out.png

If I divide V2D_SCROLL_WIDTH and V2D_SCROLL_WIDTH by zoom_x, then the amount of space looks correct at multiple zoom levels:
Scaled 114110_good-margins-zoomed-in.png Scaled 114110_good-margins-zoomed-out.png

I created #114219 with that fix, but there is maybe one more detail to work out...

The dots are clipped when their center would overlap with the scrollbar area, which means that a dot can still overlap the scrollbar by up to its radius:
Scaled 114110_dot-overlaps-scrollbar.png

I can fix that by also subtracting the dot radius from the rectangle's width/height, but there's a catch:

  • If I subtract the point radius for the current grid level, then we can get cases where larger dots clip, but the smaller dots underneath them are not clipped.
  • If I instead subtract max_point_size then I've made the margin a bit bigger than it needs to be in most cases.

So @Harley please let me know if you'd like me to add one of those two adjustments to my PR, or if it's fine to allow that little bit of overlap.

Looks like this is just a matter of needing to scale `V2D_SCROLL_WIDTH` and `V2D_SCROLL_WIDTH` based on the zoom factor. I noticed that when I zoomed in the amount of empty space got even bigger, and that whan I zoomed out the amount of space got very small: ![Scaled 114110_bad-margins-zoomed-in.png](/attachments/6d540767-8501-4ddd-a284-1cd076ca08b5) ![Scaled 114110_bad-margins-zoomed-out.png](/attachments/ff990b40-a5b1-4f02-8ce9-4c292e9d2957) If I divide `V2D_SCROLL_WIDTH` and `V2D_SCROLL_WIDTH` by `zoom_x`, then the amount of space looks correct at multiple zoom levels: ![Scaled 114110_good-margins-zoomed-in.png](/attachments/e436da04-a3cd-44b9-b31f-46b2380d9d1a) ![Scaled 114110_good-margins-zoomed-out.png](/attachments/3679f99d-faf6-4f64-bbf3-e4bbf06035dd) I created #114219 with that fix, but there is maybe one more detail to work out... The dots are clipped when their _center_ would overlap with the scrollbar area, which means that a dot can still overlap the scrollbar by up to its radius: ![Scaled 114110_dot-overlaps-scrollbar.png](/attachments/521d360d-ee7c-4c0e-96c9-8b49300c37d8) I can fix that by also subtracting the dot radius from the rectangle's width/height, but there's a catch: * If I subtract the point radius for the current grid level, then we can get cases where larger dots clip, but the smaller dots underneath them are _not_ clipped. * If I instead subtract `max_point_size` then I've made the margin a bit bigger than it needs to be in most cases. So @Harley please let me know if you'd like me to add one of those two adjustments to my PR, or if it's fine to allow that little bit of overlap.
Contributor

I'd also like to add that I personally don't think this clipping around the scrollbars is necessary at all. I think it looks perfectly fine for the grid dots to go underneath the scrollbars, just like it's fine for the nodes and noodles to be underneath them.

I'd also like to add that I personally don't think this clipping around the scrollbars is necessary at all. I think it looks perfectly fine for the grid dots to go underneath the scrollbars, just like it's fine for the nodes and noodles to be underneath them.
Contributor

@Harley I posted a question for you in one of my previous comments, but I suspect it may have slipped through the cracks as it was in the midst of the conference. Could you take a look when you get a chance?

@Harley I posted a question for you in one of my previous comments, but I suspect it may have slipped through the cracks as it was in the midst of the conference. Could you take a look when you get a chance?
Sign in to join this conversation.
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
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
4 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#114110
No description provided.