Page MenuHome

Nodes: match Multi-input socket activation distance to regular input sockets
ClosedPublic

Authored by Fabian Schempp (fabian_schempp) on Mar 24 2021, 8:28 PM.

Details

Summary

Activation distance for multi input sockets had different length dependend of dpi factor. that caused jumping when activation distance became shorter than snapping distance.

Fixed by removing activation distance and using same function which is used to evaluate snapping.

Diff Detail

Repository
rB Blender
Branch
fix_multi_input_socket_drag_distance (branched from master)
Build Status
Buildable 13710
Build 13710: arc lint + arc unit

Event Timeline

Fabian Schempp (fabian_schempp) requested review of this revision.Mar 24 2021, 8:28 PM
Fabian Schempp (fabian_schempp) created this revision.
Fabian Schempp (fabian_schempp) retitled this revision from Node: match multi-input socket drag distance to single-input sockets. to Nodes: match Multi-input socket activation distance to regular input sockets.Mar 24 2021, 8:30 PM

Hi @Fabian Schempp (fabian_schempp) It is certainly better, however this is still a bit more distant than the regular socket. Is this still intentional?

(could you also please add a comment in the code about what those parameters are? I get the trigger_drag_distance, but not the cursor_link_touch_distance one)

Hi @Fabian Schempp (fabian_schempp) It is certainly better, however this is still a bit more distant than the regular socket. Is this still intentional?

(could you also please add a comment in the code about what those parameters are? I get the trigger_drag_distance, but not the cursor_link_touch_distance one)

Yeah sure, the cursor_link_touch_distance is to test if the cursor intersects the noodle. Think of it as the width of the noodle to test against. It is wider than the noodle is displayed.

What you describe is interresting since even when zoomed very close its no difference anymore on my system. Could you please supply a screenshot with marks again?

Thats strange. It looks like nothing has changed for you.

  • Multiplied evaluation distances by UI_DPI_FAC

@Dalai Felinto (dfelinto) Since you got different behaviour in your video I assumed that the bug would be caused by some screen dependend factor. I tried it with different UI scales and found that it made a difference. So UI_DPI_FAC seems to be the answer.

@Dalai Felinto (dfelinto) ...but on ui scale 0.5 there is still something strange ...

  • Replaced activation distance by node_find_indicated_socket(), to remove

@Dalai Felinto (dfelinto) I replaced the activation distance with the function that is used to evaluate snapping. That should give much more predictable results, since the other method sometimes conflicted with the snapping distance.

The result is perfect now, great work @Fabian Schempp (fabian_schempp).

There is a warning now if I compile the patch. But besides that the code can go in.

//source/blender/editors/space_node/node_relationships.c: In function ‘pick_input_link_by_link_intersect’:
//source/blender/editors/space_node/node_relationships.c:304:60: warning: passing argument 4 of ‘node_find_indicated_socket’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  304 |     if (!node_find_indicated_socket(snode, &node, &socket, cursor, SOCK_IN)) {
      |                                                            ^~~~~~
In file included from //source/blender/editors/space_node/node_relationships.c:56:
//source/blender/editors/space_node/node_intern.h:263:38: note: expected ‘float *’ but argument is of type ‘const float *’
  263 |                                float cursor[2],
      |                                ~~~~~~^~~~~~~~~
//source/blender/editors/space_node/node_relationships.c:259:15: warning: unused variable ‘distance_from_socket’ [-Wunused-variable]
  259 |   const float distance_from_socket = len_v2(distance_from_socket_v2);
This revision is now accepted and ready to land.Mar 26 2021, 10:53 AM

It is approved already, just commit it :)

Hans Goudey (HooglyBoogly) added inline comments.
source/blender/editors/space_node/node_edit.c
1134–1135 ↗(On Diff #35627)

Comments shouldn't really be written in first person. Best to rephrase this like, "But keep it smaller..."

1136 ↗(On Diff #35627)

Extra "if" I think

Fabian Schempp (fabian_schempp) marked an inline comment as done.Mar 26 2021, 5:30 PM