Page MenuHome

Nodes UI: Visual tweaks to node links
ClosedPublic

Authored by Leon Schittek (lone_noel) on May 26 2022, 7:10 PM.
Tags
Tokens
"Like" token, awarded by hadrien."Like" token, awarded by Endertainer007."Love" token, awarded by Draise."Love" token, awarded by Dangry."Like" token, awarded by Fracture128."Love" token, awarded by pablovazquez."Yellow Medal" token, awarded by rawalanche.

Details

Summary

This patch to tweaks the node links a bit to make them fit in
better with the overall look of the node editor:

  • Change the link thickness with the zoom level to a certain degree.
  • Remove the fuzziness of the node link and its shadow/outline.
  • Add circles at the end of dragged links when connecting to sockets.
  • Improve the banding of the color interpolation along the link.
  • Adjust the spacing of dashes along straight node links

Comparison

masterpatch
overview of different link types
color gradient
dash spacing on straight node links

Circles for dragged links
Other than most links, links that are currently dragged are drawn on top
of nodes. The clipped ends of the links drawn on top of the node socket
didn't look very polished.
Not having the shadow allows us to just cover the ends up with circles
that fit nicely into the sockets the link is dragged from/to giving
additional visual feedback when the link snaps into place.

Diff Detail

Repository
rB Blender
Branch
pretty-node-links (branched from master)
Build Status
Buildable 22286
Build 22286: arc lint + arc unit

Event Timeline

Leon Schittek (lone_noel) requested review of this revision.May 26 2022, 7:10 PM
Leon Schittek (lone_noel) created this revision.
Leon Schittek (lone_noel) added projects: User Interface, Restricted Project, Nodes & Physics.

At first I wasn't sure about the thickness of the wires when close up, but looking at the other zoom levels it's much better. A trade-off of adapting to zoom.

Such a nice improvement, love the styling when wires snap.

+1 from me (UI wise).

Leon Schittek (lone_noel) planned changes to this revision.May 30 2022, 12:08 PM

Now that the shadow is gone I noticed there are a few things that can be simplified.

I will do another pass, before anyone should take a closer look.

Leon Schittek (lone_noel) edited the summary of this revision. (Show Details)
  • Cleanup the changes in the shader.
  • Adjust the link thickness and its clamping a bit to work better with standard dpi screens.
  • Remove unnecessary geometry of the links that were used to draw the shadow.
  • Remove all uses of the shadow color.
  • Change naming of the "Wire" user preference since it now only changes the socket outline color.

Additionally to the updated patch, I tried how it would look with an outline:

outlineno outline (patch or transparent outline)master
dark theme
white theme

As mentioned in the patch description there are cases, where the link and background
color could be very similar (e.g the white theme without the outline and now color overlay).
This can be circumvented by choosing different theme colors but considering the
variety of colors the links can have depending on state or connected socket, that might
not always be feasible.
Also, accessibility had been brought up recently and the ability to make themes that
prevent situations of low contrast might be desirable.

With themes, where the outline color is similar to the background (like the default dark theme)
the only real difference is, that the outline is visible on the node sockets.
That's not nice, but allowing the outline color to have alpha would fix this, because the
outline could be disabled (made transparent) by the theme.


I guess my questions are:

  1. Outline: Yes or No?
  2. If "Yes", should we allow alpha for the outline color so it can be disabled depending on theme.
  • Fix missing highlight for "node drop" functionality.
  • Even out the dash spacing on straight node links.

Nice improvements!

About the outline question, why are the links so invisible for the white theme only at the high zoom level? At the medium and far zoom levels they look fine.

source/blender/editors/space_node/drawnode.cc
1982

Couldn't it be const float color[4]?

2104

Debug print should be removed

source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl
91–98

It looks like snake case is preferred for local variables here, it's a bit nicer anyway

source/blender/makesrna/intern/rna_userdef.c
2858 ↗(On Diff #52445)

What is this used for now?

Leon Schittek (lone_noel) marked 4 inline comments as done.
  • Update to current state off master.
  • Address comments.

About the outline question, why are the links so invisible for the white theme only at the high zoom level? At the medium and far zoom levels they look fine.

The viewport with the high zoom level is the only one where I disabled the node link color overlay to show the links "natural" coloring that happens to blend in quite a bit with the background.
In this instance it can be easily by just changing the link color to something else, but there certainly are (nice, background-worthy) shades of grey that also have bad contrast with the colors we use for the sockets, which I didn't consider in the original patch:

Turns out the shadow wasn't just there to be fancy!
Thinking forward it might be unfortunate to lock themes out of using certain colors to accommodate the hard coded socket colors.

source/blender/makesrna/intern/rna_userdef.c
2858 ↗(On Diff #52445)

In master this is used to color

  1. the node link shadow,
  2. the node socket outline and
  3. the line under the node header when the node is muted

Since the current patch (without the outline) removes point (1), I thought it would be nice to name it according to the most obvious use in the UI.

I see, thanks for the explanation. Though it does look good in the default theme, based on what you're saying it probably makes sense to add the outlines/shadow back and make sure they're theme-able. Do you agree?

Leon Schittek (lone_noel) planned changes to this revision.Jun 16 2022, 8:33 PM

Yes! I wasn't too sure at first, but at this point I believe keeping a theme-able outline will be better in the long run.

  • Add node link outline and adjust thickness a little more.
  • Cleanup: Use NodeLinkDrawConfig to pass around data.

The changes look good to me, thanks for working on this.

source/blender/editors/space_node/drawnode.cc
1941–1943

If you feel like going a little further, this is probably a situation to use ColorTheme4f

2023

This struct is large enough that it should probably be passed by reference

2183

What do you think about drawing the end markers using SpaceNode_Runtime::linkdrag rather than checking it for every link.
Doing that in a separate loop just feels a bit clearer conceptually. It's already in a separate loop anyway.

Leon Schittek (lone_noel) marked 2 inline comments as done.

Address comments:

  • Separate drawing of normal links and dragged links a bit more
  • Use ColorTheme4f
source/blender/editors/space_node/drawnode.cc
2183

I'm not sure I totally got what you mean, but I tried to disentangle the drawing of normal node links from the ones that are dragged.

This looks good to me now, thanks!

source/blender/editors/space_node/drawnode.cc
2008
This revision is now accepted and ready to land.Aug 29 2022, 11:43 PM
Leon Schittek (lone_noel) marked an inline comment as done.
  • Address final review comment
  • Fix an issue with the dragged link end marker placement on multi input sockets
This revision was automatically updated to reflect the committed changes.