Nodes: automatically move viewer node to current node #121951
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#121951
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "JacquesLucke/blender:viewer-node-position"
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?
This improves working with viewer nodes in geometry and compositor nodes. Previously, the viewer node would typically stay at the position where it was first inserted which leads to very long links in many cases. Now the viewer node automatically moves to the place where the user ctrl+shift+clicked to view data.
The viewer is placed slightly to the right and top of the current node. It is moved up a bit, so that it does not get in the way as quickly when the user wants to add another new node. Furthermore, the viewer node position is chosen so that it does not intersect with other nodes.
In the future we could implement animating the node position so that it slowly transitions to it's new places.
I didn't think too hard about the details of the algorithm. It didn't seem worth it since it works really nicely in my testing, like night and day with the crazy long links we had before.
The only think I can think of that would make this even cooler is if the viewer node animated to the new position. That might make things a little less disorienting? Actually seems pretty simple to do that by generalizing
NodeStackAnimationData
or so, but it's also not necessary.@ -590,0 +599,4 @@
* If possible, the viewer is aligned to another node that is close by to result in a better
* looking node position.
*/
static void position_viewer_node(bNodeTree &tree,
Looks like all the arguments could be const besides the viewer node
@ -590,0 +625,4 @@
BLI_rctf_pad(&main_candidate_rect, default_padding, default_padding);
const bNode *collided_node = nullptr;
LISTBASE_FOREACH (const bNode *, node, &tree.nodes) {
for (const bNode *node : tree.all_nodes())
@ -590,0 +661,4 @@
bool found_collision_for_aligned_rect = false;
LISTBASE_FOREACH (const bNode *, node, &tree.nodes) {
if (node->type == NODE_FRAME) {
node->is_frame()
?Animating the viewer movement seems nice, but won't do it as part of this patch, especially because it also requires this other refactor to be done first.
Sounds good. Maybe animation could be mentioned as future work in the description?
This feels quite good for a start 👍
I did run into some weird behavior here and there, particularly when there is no free space towards the top, where the viewer gets stacked quite far away from the target node.
Some ideas:
Right now it seems quite clear that the node checks incrementally upwards for free space. It would make sense to me to alternate between incrementing up and down to also catch free space just below, if there are a lot of nodes above. (Alternatively even searching in an arch pattern to include free spaces further to the right.)
I think a simple heuristic that would help would be to check if the new chosen location is further from the target node than the previous one and just leave it in place if so (probably only when the viewer is to the right of the target)
Another thought:
Could it make sense to make the viewer node active when using the CTRL+SHIFT+LMB functionality rather than the node that is clicked on? That would help highlighting it and make it easy to move manually right after.
I'm not sure what purpose the current functionality is serving regarding that, but it would feel pretty simple to me to just make the node active again that I just clicked on for the viewer and still have under my cursor.
But maybe I'm missing something.
I forgot one more small note:
When there is no near node found for horizontal alignment the distance should be more than it is now/potentially just the same as the margin for auto offset, where we just set the default to 40. Looks like right now it's 20.
The new search pattern works a lot better for me!
It's still trying quite hard not to put it below the target node. But that's probably fine to avoid putting it in the way of new nodes.
For my testing so far I only used it for inspecting existing node-trees rather than in an actual workflow. For the actual fine-tuning I have the feeling it might be easier to do when the initial version is in main.
2 points that I have left:
So I would propose to try two things:
I think that logic could work well. Not sure if you would try these things in a separate PR.
I implemented some of the suggested improvements. Please have another look.
I don't have a good example where I moved the viewer manually where I would want it to stay at a specific location when viewer another socket of the same node again. So I did not implement that part yet. The viewer generally shouldn't end up further than it was anymore though.
When not moving the viewer manually, cycling through the sockets of a single node should not move the viewer.
This is pretty good to me now!
If we identify certain cases where it doesn't perform we can still tweak that later, but this is good to go into main imo.
Looking into animating the position as a transition could still be interesting, but it's not required