Feedback wanted on node link swapping

Hey all,

I’ve been working on a patch to replace the current auto-swapping of node links and allow to explicitly swap node links by using the alt modifier key.

You can follow the patch here: ⚙ D16244 Node Editor: Controlled node link swapping
An experimental build for testing is available here: Blender Builds - blender.org

In this thread I’d like to gather feedback from users/artists who make regular use of the node editor.


Motivation
Link swapping can be handy. Switching the inputs of non-commutative math operations is a good example.

The current auto-swapping has some limitations though:

  1. The precise logic of the behavior is pretty intransparent and it’s not obvious, when a replaced link will automatically reconnect.
  2. It’s basically restricted to math nodes, even though there are other situations where it would be useful (e.g. the switch node)

Because of (1.) auto-swapping can get in the way about as often as it helps, so addressing (2.) inevitably comes with trade-offs currently.

Making link swapping explicitly controlled by the user will make it both more predictable and powerful, since it allows swapping between arbitrary sockets - including outputs and across nodes.

How it works

  • By default, when dragging a link into an already occupied (single) input socket, the existing links are always removed. (This is in line with the current behaviour, when sockets don’t support the auto swapping.)
  • Pressing alt while moving an existing node link from one socket to another, already occupied socket will swap the links.
  • Pressing alt while dragging a new node link into an already linked socket will try to reconnect the existing links into another matching socket or remove the links, if no matching socket is found. (This is similar to the old auto swap, but a bit more forgiving since it’s explicitly invoked)

Swapping from or to multi input sockets is not supported right now.


Your input
Any feedback regarding this patch is welcome. Here are some questions to get you started:

  1. Do we even need link swapping? Just getting rid of the swapping all together is an option after all.
  2. Do you prefer explicit or automatic swapping? Maybe we should improve the auto-swapping rather than replace it.
  3. Did the feature behave as you expected it to?
  4. Are there situations, where the old auto swapping was useful, that can’t be replicated with this patch?
11 Likes

Personally, this seems like a well-thought-out upgrade to what we have currently, and would make it feel polished and useful, rather than a half-baked and only useful half the time. I would love to see it implemented into future versions of Blender.
To give my answers to your questions:

  1. Yes, even the current implementation can be useful at times, and with some more polish it could be a great feature.
  2. I would prefer explicit swapping, as you will never be able to 100% tell what the user wants without first asking them. I think the current solution of holding alt is a good one.
  3. Yes, from what I can see, it looks pretty intuitive.
  4. Not that I can think of.

And thank you for addressing these issues, as the node editor becomes ever more important for Blender, these sorts of paper cuts can put a small but noticeable damper on how fun it is to use, so it’s great to see them getting fixed :slight_smile:

1 Like

Thank you for working on this!

I guess this is probably not a normal use case but found a possibility of making invalid node tree while playing around with this.

NodeLinkSwapInvalid

1 Like

@Strike_Digital Thanks for the nice words! :slight_smile:

@sunkper Thanks for testing. That’s exactly the kind of edge case I was afraid of missing. Will fix.

1 Like

Personally, I like autoswapping and if u make an alternative approach to it, can it be optional like a small preference or something ? because I really like the automatic one without clicking anything, so its better to put key fo activate new behavior than using key to activate old behavior.

So maybe instead of changing default, can we use a key press or holding down a key to prevent automatic swap and to make it behave differently as u show?
so people who just want automatic can continue workflows as they are and people who want to use advanced more controlled swapping can press/ hold down a key to make your alternative behavior to be activated or to prevent auto swap ?

Or as I said, the old and new behavior can be a preferences option like ‘‘Controlled swapping vs auto swapping’’ ?

We need auto link swapping because it has some side effect advantages like in a long node system, if node is disconnected, its hard to scrool back to start of node tree to connect it again to right place, so node swap give a temporarly location without disconnecting so we can fix easily and if someone know how it behaves, it can be used by predicting what it will do so it actually help u do things faster.and lack of key clicking make u focus better on complex node tree instead of thinking about clicking keys, thats why most things are made auto in node editor.

Too much key clicking also doesnt sound good for node editor. Change of muscle memory in node editor always slow down things when they are not optional,

Thats why node wrangler is optional, additional clicks or keys are mostly by using node wrangler because node editor should be key free on its actions with mostly by mouse.

I think we A. should be given option to choose which behavior to use from a preference at least if this change is really insisted or B. functionality should be reversed as this - alt key should be used to disable node swapping in situations where swapping can mess things up so users can hold alt when they dont want auto swap and wanna use new behavior

Thanks for your detailed response! :slight_smile:

I don’t think this is the type of behaviour that is usually put behind a preference in Blender - at least nothing similar comes to mind.
I think either it’s a meaningful enough improvement over the current behaviour to actually replace it or we can leave it as is and maybe just have a modifier key to simply disable the auto swapping.

I would argue, that it doesn’t increase the number of clicks you have to make, since you’ll eliminate all cases, where the automatic swapping kicks in and you have to remove the reconnected link.
And while I can emphasize a lot with the pain of changing muscle memory, having to unlearn old habits is an acceptable price to pay, as long as the bahaviour is meaningfully improved.

I don’t think mouse-only-interaction is actually a goal of the node editor.
The gestures for inserting reroute nodes, cutting node links or detaching nodes while transforming all use modifier keys and the link drag search also relies heavily on keyboard interaction.

1 Like

Its just my opinion because u ask for a feedback, I m not trying to convince or something. I just gave feedback , its obviously clear that we have different opinion because you proposed this change while I was really liking the old behavior and over the years found many advantages of it

But I think current behavior is good for me. I usually never remove the reconnected liking because output links that I try to connected are usually related to that node, Then I make many trials on which mask is better while linking so they keep auto swap and I can try it many times without going back in a long node network, so it ease the trial and testing of a masks or also other things for me without loosing the node, so it gives temporary location and ease my workflow and in some cases in my own group nodes, Also, it gives time to think while u r indecisive about which is the best place to connect, so It further benefit testing and trial of different masks on different sockets like roughness or metallic by giving me different results about material for example.
Also, when u make a mistake on connecting roughness texxture to specular and specular texture to roughness, it automatically swaps and put a temporary location instead of losing connection, so u can more easily fix wrong connections that u didnt notice or that are done because of far view of node, without going all the way back to the textures output and holding it to bring to the node u want to connect to
So auto swapping has benefits more than just guessing the place to swap, its about giving temporary location or giving u ease on fixing misconnections or helping u try and test better about surface imperfection mask or textures that u r not sure if it will look better or metallic or roughness or clearcoat if u have a custom node. So there are many ways to use use autoswap smartly I think

Yes I just said PREFERENCES, as an alternative solution to satisfy needs of different people with different opinion on what is best or no. So if it was possible it could be preference , I just said it as alternative solution to make 2 different group of people happy about the change

But the other solution I recommended is more easy to apply, using alt to disable autoswapping and (maybe preferences can have a keyboard shortcut added to decide which key to use for disabling it) or
it can have a long/permenant disable vs short/temporary disable , for example holding alt key can disable autoswap shortly //temporarily, and clickling alt key two times can disable for that session of using blender until its double clicked again?

@lone_noel It looks good, definitely something I missed in Blender’s node editors.

In Grasshopper (Visual programming) there is a similar functionality and it always explicitly swaps the links, regardless of whether it makes sense or not. By removing the link altogether, you will have to go back to the original output socket, which you may not be able to see from your current view. Keeping it, albeit in an invalid socket, allows you to later drag it into a correct position there.
But instead of creating invalid connections, maybe you could let the link end in a reroute with close proximity to the socket it would have otherwise swapped to. That may be the best of both worlds.

On a side node, can you drag a reroute into a socket as well to make it disappear? Because that would then be another welcome addition.

1 Like

Your input is definitely appreciated. I hope this kind of back and forth strengthens the reasoning before committing to a solution. :slight_smile:

Is this related to the reconnecting, when dragging new node links with alt?
For now I opted to keep the behaviour similar to the old auto swapping, but I can see how reconnecting to any available sockets even if they are incompatible could be preferable.

Adding a reroute to keep the old link feels a bit hacky, even though I understand the motivation. If that is something we want to address, the solution described here sounds better:

That is very general and would even allow consecutively swapping several links!
I didn’t implement it like this so far is, because currently dragging node links is done by holding the mouse button and releasing it confirms the action.

The behaviour described above would have to work a bit differently:

  • (A) Dragging the link into a socket while holding the modifier key automatically swaps the dragged link with the one currently occupying the socket (there is no confirming action for this).
  • (B) There could be a key you press to swap the currently dragged links with the ones in the socket that you are connecting to.
  • (C) Instead of pressing the mouse button, you could start the link dragging by clicking (press and release) on a socket. Clicking again while dragging the link would confirm the action (connect/swap the links, open search etc.)

(A) seems like it would lead to accidentally swapped links, (B) could be hard to discover (similar to setting snap points while tranfsforming), and (C) feels like a big departure from how we handle things right now.

Yes, that’s what this is all about.

  1. You asked if people use it and I will. I mention the reason why I am in favour of swapping instead of replacing.
  2. Automatically swapping it to a socket that is not suited for the link could lead to long computation times if you swap a node link that contains invalid or lots of data to a socket. In another software (Grasshopper) this has caused me some accidental crashes.
  3. So while I am in favour of keeping links on the canvas, I am convinced that there should be an alternative swapping mode with different modifier keys that allows you to replace the link and to then keep the old noodle, but attach it to a reroute instead, so you can avoid crashes if you are not sure which link you are replacing.

It is not necessarily better, I would use one (swapping links) or the other (swapping the link and add a reroute to the detached noodle) depending on the context.

(A) doesn’t lead to accidental swapping, never had any issues with modifier swapping links in Grasshopper. Confirm dialogues are a terrible workflow breaker, so don’t add them (unless it is a keymap checkbox that you can disable so you don’t get any prompts like you can for deleting objects in object mode).
(B) does not lend itself as well to rapid succession, you’d be using the modifiers often. If you go for keypresses, the other functionality tied to modifiers should be ported over to keypresses too. Otherwise I foresee this becomes inefficient,
(C) This would be very ergononic for longer distance dragging and I am a strong advocate for adding (C). To me (A) and (C) should both be added, whereas I am indecisive on (B).

My idea was simply to activate this only if the modifier key was pressed after the drag was initiated, not before, so it doesn’t conflict with anything. So only once the drag modal operator is active are the modifier key presses checked for.

This isn’t any new concept to blender. For example when using move tool gizmo, if you hold shift key before you click and drag the gizmo arrow, it will move the object on the plane perpendicular to the given axis, instead of along the given axis. If you hold the same key, shift, after you click and drag the gizmo, the key modifier the movement precision (makes the cursor to object transform sensitivity lower).

C seems like really bad option, I’d avoid that at all costs. It’s not the way Blender handles node interactions anywhere. There should never exist two competing interaction models in the same software. There should always be one, and only one right way to do things.

B seems a bit better, but also a bit alien concept. Basically pressing a key which does something only when you are holding LMB down and also are hovering your cursor over specific place. Discoverability of this would not be great.

A is what I proposed. The confirmation would work as follows. To “finish” the operation, you’d either release the modifier key, once you are ready to stop swapping, or you’d release LMB over empty node slot. If the node slot was empty, then it does not matter whether modifier key is held or not, as there’s nothing to swap with.

My idea was simply that if I LMB release a node link over already occupied socket without any modifier key held, it will simply replace the existing node link with the one I was dragging, without reconnecting the original one to another random slot.

If I LMB release a node link over already occupied socket while holding a modifier, let’s say Alt, then either I swap the dragged link with the occupied one, or I do the current legacy behavior or reconnecting the existing link to another random slot.

Honestly, I really don’t care about what happens with the modifier key, as in how the swapping is done, since I will probably never use this feature again given the years of trauma it’s forced behavior has caused me. All I care are two things:

  1. That the forced, mandatory automatic reconnection happening by default without any modifier key is removed.
  2. That the patch removing it makes into main branch ASAP, so it gets into 3.4 and the auto-reconnecting doesn’t cause suffering for the entire duration of yet another major release.

I personally would be completely happy about a patch that just literally deletes the automatic link swapping, instead of changing it to require modifier key and/or altering how it works. The only reason I mentioned the alternative/modifier key based solutions for the link swapping is that some other people may need it. But for me, the most important thing is to remove the frustration current behavior causes.

1 Like

I see - I think I can picture it better now. Thanks for clarifying!

Since 3.4 switches to Bcon3 today, I don’t think the next release will have any changes in this area.

As the current functionality has caused me many mis-swaps and time spent correcting them, I’m all in favor of the feature. That said, I agree with the idea of turning the requirement of the alt modifier into a Preferences option or some checkbox in the relevant editors’ UIs, as both the current behavior and the proposed one are valid depending on what one is most accustomed to.

Yes I agree, there can be a checkbox on the header of node editor like the 3d viewport has options to activvate or deactivate features that change behavior of things like proportional editing,
so if there is a checkbox on header, it will be good so people who like current behavior will appreciated

yeahh its hard and time consuming to keep old links by reroute and it adds so much time to do things or its even hard to use extra keys to activate auto swapping because for example I always have big node trees with many noise textures keep being added on top for good texturing or other textures that have less amount sockets, so like in noise texture or small nodes, swapping work perfect and i never worry about clicking keys to activate swapping when I wanna keep node links around or when I wanna swap when there are 2-3 input socket that usually swap automatically as what I want. So I cant imagine to live without that autoswap. I think using a extra key to deactivate swapping or having option on node editors header like changing how node editor behaves would be good so people who really feel like autoswap is bad can disable and the people who find its advantages more than its disadvantages can enable it while using node editor, similar to 3d viewport having options about how transformation will behave, node editor header can have same options,

New people always come up and critisize old features that are put into blender and try to remove or change but I think the old people who put that feature cannot be that unsmart person to implement a feature that cause more problem than benefits, so I believe auto swapping had a meaning when they put it and important for me, Only problem I faced with autoswap is the node groups cuz it mess up the inputs in process of making node groups, but other than node groups in regular nodes, auto swap always come in handy, I literally never noticed any bad side except that. So I really love it, I really need it that even I might compile blender myself again to use old code to have autoswap as before if its removed or made hard to use… So it really make me sad if it doesnt have flexbility for both sides to present both exact old behavior and new behavior by checkbox in header if its hard to do it in preferences. Actually its so logical to make it a preference option but also node editor viewport option would also be nice, similar to snapping option in 3d viewport or proportional editing for example