Node Editor: Move All Selected Nodes when dragging #63994
Labels
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
11 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#63994
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In the Node Editor, it should be possible to move more than just one node by dragging, if more are selected.
Just like files on a desktop, all selected items should move along when dragging on one of them.
Added subscriber: @WilliamReynish
Added subscriber: @DuarteRamos
Added subscriber: @ideasman42
Problem here is that the 'click' PRESS event will always be caught before the TWEAK one, so selection will always happen before we start translation.
Only simple solution I can see so far is to trigger selection on RELEASE (or CLICK), not on PRESS (tried, seems to work fine, but gives an annoying delay between click and actual selection, especially on laptops with touchpad fancy 'click' handling :( ).
Other possibility, much more radical, would be to 'eat' the click event altogether when we detect a tweak one. Am quiet unsure that is even possible though, at the very least not without a noticeable delay for the user.
Need some thoughts, also probably inputs from @ideasman42 on that one.
Would be interested to first consider where else this logic would apply
(where LMB tweak is used too).
If we want this to work as many file-selectors do, we'd need to do as @mont29 suggests and run this on click instead of press.
We could make it feel more responsive we could.
... Even this could back-fire (with undo steps and having a click sometimes performing two operations, and the first press event having to pass-through so the click event is registered).
All things considered we're probably best off making select happen on release (exactly like how a file manager works), because supporting press events which pass-through complicates event handling.
Not sure what's meant here., when a tweak event is registered a click event wont be sent.
Testing how it works with something like document files in the Mac Finder:
file_selecting.mov
As you can see, when you click on an item that is already selected, it doesn't deselect other selections. This way they are still able to register the click event immediately (mousedown) and don't have to wait for the mouseup event.
@WilliamReynish it does not really help to compare a filebrowser with a node editor (and Blender in general), the later is much more complex and allows for many different actions…
I’d agree with @ideasman42 here then, if we want that behavior then we just select on CLICK (or RELEASE) event.
Would not go into handling two different kind of events, this would make code even more tricky to follow, and more fragile too. Unless maybe we had a specific 'set active' operator for the 'PRESS' event, that would not register any undo steps? Still sounds cumbersome for little gain… :/
Btw, just realized that in 3DView at least, we do select on click, and not on PRESS event…
Added subscriber: @brecht
It actually depends if you use left or right click select. On press it feels more responsive so we kept it for right click, but it's incompatible with tools on left click select.
I'm not sure how we can put select on click instead of press for the node editor though? You want to be able to press to select and drag on a node immediately to move it?
@mont29: Well, the issue is identical: How can we handle click input so that you can both select and drag the selected items, without having to use slower mouse-up events? It's the exact same thing as selecting and moving files on your desktop.
They solve it that way, by making it not deselect others if you click on an item that was already selected. The same solution could work in Blender too.
@brecht You want to be able to press to select and drag on a node immediately to move it? that’s kind of incompatible with behavior described in that task? Either we select, and then move on drag (what happens currently), or we give priority to drag, and only select on CLICK (i.e. when there was no drag detected).
Or we try to implement what @ideasman42 described (some kind of two-steps selection, with PRESS adding to current selection, and then RELEASE removing all selected items and selecting again the active one). With all the PASSTHROUGH and double-undo history issues… yuck. :/
Btw, #63996 looks like a very similar can of worms.
@WilliamReynish Sure thing, all problems can be solved. But if we have to rethink/rewrite half of our event/operator handling code to support that, this is not a task for me, and this is not a task for 2.80. I (again) have the feeling that a tremendous amount of time and energy needs to be put to fix that kind of issues (and am sorry, but those still look pretty low-priority to me, things that are 'nice to have', but by no mean critical issues). Nice if we can fix them simply and quickly, but otherwise I would not really bother too much.
And as a reminder, I was not even involved in that left-click-select project/decision, not at all. So I do not really feel like spending too much of my time trying to fix the cans of worms it unveils. I have other priorities and projects to tackle too. For me, either we go with the cheap 'CLICK' to select things, or we live with current behavior.
Added subscriber: @Harley
The trick with our desktops: The timing of the deselection of other items changes depending on whether the new item is selected or not.
If the new item is not already selected then the other items are deselected on mouse-down. But if the item is already selected then peers are only unselected on mouse-up. This is what allows selecting and dragging singles or groups without having to wait for mouse up.
Ok, sure, it may be a bigger project to make selection more fundamentally different. I'm fine with any solution that works, even if it means using mouse-up events, if it makes it possible to move multiple nodes easily by simply dragging on your selection.
I think the way to solve it is actually to make changes to the select operator, so that clicking on selected items doesn't deselect others. Moving all selected items already works, so the issue is only that the select operator is first deselecting everything each time you click and drag.
It still needs to deselect others when releasing the mouse button, if you haven't started dragging already. One way of doing that would be to make the select operator a modal operator that finishes as soon as you release the mouse button (deselecting others), or a tweak event is started (doing nothing).
To me this seems possible in a way that's isolated to the select operator and not interfering with other operators that need to run right after. But I'm not sure how much work it would be.
@brecht Yes, that would be idea' - that it deselects others on mouse-up if the user didn't drag.
But IMO it would also be acceptable to do it in a simpler way so it just doesn't deselect others if you click on a selected item. Then you would have to click away to deselect first, or use the deselect operator. Not as nice, but eg the macOS Finder works this way and I never noticed it as being an issue.
Whats the advantage of this compared to having click for select, tweak for border select?
Both use the same threshold so it shouldn't be possible to move the cursor so it's moved too much for a click but not enough for a drag.
The advantage is that you select and transform the node immediately. Otherwise you would have to click once to select, and then click again to transform the node.
P966 Is an attempt to implement @brecht's suggestion, seems to work OK-ish.
Note that it relies on press/release events being the two triggers, think we can accept that hard-coded behavior here?
I remain pretty unhappy about that hack though. To have to add such complexity to a simple operator, just to work around (imho very bad) design decision to merge action and select buttons together… :(
@mont29 Maybe I should have asked in here and not in the diff snippet:
This seems to work well!
Question: How generic is it? Could we re-use same logic for sequencer strips or NLA clips etc?
Lol… copy-pasting my answer from P966 here then. :P
Copy-pasting similar logic should work, yes, at least for similar selection (like in most 2D editors), would expect some complications if we tried to do so with e.g. 3DView selection (also we might have to do similar things there, cf. can of worms II, #63996). This is not a small change though, as pretty much all select ops do things a bit differently. Kind of like what I did for the 'deselect on nothing' change, but several times bigger every time…
My concern with that change is that it adds a whole other level of complexity over selection logic, which already has to deal with extend, select_all, etc. It also makes behavior in different kind of scenarii more complicated to predict (like, what if user adds a keymap using a totally different shortcut to select nodes? What about macros [e.g. just realized that current patch breaks the 'link to viewer node' macro, the one using sockets selection]? etc. etc.). That code can probably be refactored further to make it more easy to follow, but still… am not so happy with it. This adds technical debt for a bad reason imho. :|
@mont29
Well, obviously I don't agree with*"for a bad reason"*. So many users are already finding Blender 2.8 much easier to use, and the ability to select and manipulate things more easily is a core reason why.
As for code complexity, I guess ideally we could somehow share this logic so it's not duplicated several places. We could also just start by adding this to the Node Editor only for 2.80, and then later we could refactor and generalize the logic to make it easier to re-use in other places.
Added subscriber: @BartekMoniewski
Added subscriber: @SpectralVectors
Hello, I'm new here, but I wonder if this might be a helpful way to approach this:
Since dragging multiple nodes works as expected when they are contained within a frame, would it be possible to create an invisible frame around all selected nodes on mouse press, tweak to move it, then mouse release destroys the frame? (which the user never saw to begin with)
I did an experiment and replaced the Join Nodes - Keymapping (Alt+J by default, I think, I'm using my own keymap) with a Left Click, and while it didn't work if you selected a bunch of nodes and then clicked on one of them to drag, it DID work when you selected a bunch of nodes and clicked anywhere OTHER than a node.
So any misclicks ended up creating empty frames, perhaps that could be fixed with a check on mouse press, but that might then be back in the problem of adding latency.
Or, if they're invisible, creating a million nodes in the background that you never see.
Then again, maybe you could map a function that deletes all empty frames in addition to the select box frame on mouse release?
Just a thought.
@SpectralVectors That sounds even more complicated than the modal selection op solution?
@brecht @ideasman42 We should decide now what we do here. Afaics, we have two options:
RELEASE
, which solves present issue, is simple and safe, but makes selection experience a tad less nice for user, and prevents the 'click-drag' behavior to click on a node and move it in a single action.I am a bit torn here, for me solution 1 is far better from a safety/'code quality'/maintainability point of view, while solution 2 is ideal from user point of view.
If we decide to take the risk of modal op solution, I would then like to do it as a separate operator, explicitly only modal, and explicitly not handling all extra cases (like extend selection, selection of sockets, etc.). That should keep code complexity to a more reasonable/maintainable level.
I think we should do 2), it's a nice improvement.
But there are some issues with the implementation that I found:
EVT_TWEAK_L/M/R
events instead of doing our own distance calculation with mouse events.I'm not entirely sure making it a separate operator will reduce code complexity? We would have to see how that works out, but I fear it would complicate the keymaps. I do think that the socket selection should be handled separately, that could be in its own function, and if a socket is found it can skip running modal and finish immediately.
For the implementation, I guess storing
active_item
is not actually needed? As far as I can tell it's only used for asserts, so removing it could simplify the implementation.OK… Still not totally happy with it, but am happier with new version of patch (P966), so guess it’s OK. ;)
Good point, fixed in new patch.
Threshold is the same as starting tweak (see
WM_EVENT_CLICK_TWEAK_THRESHOLD
inwm_event_system.c
). Also,EVT_TWEAK_L/M/R
never reach our modal handler, not sure why (would assume WM event code does not always trigger them?). But previous code was buggy (using wrong coordinate values), new version of patch seems to work as expected here as well.Good points, new patch is much more satisfying on simplicity side imho (also made it more strict to only accept regular selection in modal 'two steps' mode, other options just get always executed in basic
exec
mode.P966: (An Untitled Masterwork)
I think the patch works very well.
The code can be simplified further:
node-move.patch
Seems ok to commit.
Ah yes, nice improvements, thanks.
This issue was referenced by
af088c2640
Changed status from 'Open' to: 'Resolved'
Added subscriber: @JulianEisel
Digged into this today for #57918, but wondered if we wouldn't simplify this a lot by doing things the other way around:
This seemed almost too simple to be true, so I gave it a go. And: It appears to work just fine, with little changes in total, and the select operator changes are tiny.
P1121 adds drag-all-selected support to the sequencer. Note how few changes were needed in the select operator.
There a some small glitches to fix still (e.g. cursor changing on select), and we may dig deeper to make sure the transform code stays in valid states. But it seems like a very promising direction.
Am I missing something?
A problem in this patch is that the select operator is registered twice and there are two undo pushes.
Ideally we would also not complicate the keymap with this, since editing keymaps is already complicated enough and this adds more obscure properties. The way it works in the node editor requires no keymap changes,
It also now actually starts the transform whenever you click to select. This shows up in the status bar, is potentially slow or might report some kind of warning. In the sequence editor, it's now clearing the sequencer cache when just selecting strips.
So I'm not sure about this approach, is it not possible to make the modal select thing more generic and reusable?
Checking again on this, these issues seem to be solvable without too much hassle.
This can be addressed by making sure the operator returns
OPERATOR_CANCELLED
when it doesn't perform any operation. I think we'd have to do that with the modal select operators too.Agree it's nice to avoid changes to the keymap for such things. But in the node editor implementation, there are hardcoded event checks, which are nice to avoid too.
I think we could also trigger the potential deselecting on release by making transform + deselecting a macro operator. Alternatively it might be a good idea to optionally let the transform operator trigger item deselection if it cancels before having applied any transformation. Again, not the nicest solution but solves this with less tweaks hacks in the keymap.
Although I'm not sure how well my previous patch handled this, the idea is that exactly this is prevented. The transform operator should just return
OPERATOR_PASS_THROUGH
until a tweak event it detected, without applying any change.Well, the complaints about this approach from Bastien are still valid. The modal selection stuff makes selection even more complicated and contains hard coded event checks. I'm not sure if we can make this generic/reusable enough to work well. There's quite a difference between select operators.
This new (experimental!) patch fixes the issues mentioned: P1123: Sequencer: Drag-all-selected experiment (V2)
This issue was referenced by
3b23685c7d
There are no hardcoded event checks, it just checks the original event release + mouse move.
Here I did some refactoring to demonstrate what I mean.
3b23685c7d
Note how
node_select_exec
,node_select_modal
,node_select_invoke
no longer contain any node specific logic, which is all left tonode_mouse_select
.Note that if
wait_to_deselect_others
is made a hidden operator property, all that logic can be put in theexec
function.And then node definition looks something like this:
Which is consistent with the way we do box select operators for example.
Added subscriber: @Mets
This issue was referenced by
926f7612fd