Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-layout #7

Open
jansol opened this issue Nov 18, 2021 · 2 comments
Open

Auto-layout #7

jansol opened this issue Nov 18, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@jansol
Copy link
Contributor

jansol commented Nov 18, 2021

Did you have any plans regarding the layout algorithm yet? If so, feel free to just close this.

Overall I quite like the auto-layout and grouping features in patchage, although I wish it would also re-center the viewport when re-generating the layout. This is a feature I would love to see in pw-viz as well, or maybe even re-layout on the fly as nodes appear and disappear from the graph? Live re-layout should probably not touch the viewport and needs an option to toggle it on and off.

image

As for the algorithm itself a good start would probably be a basic mass-spring system where the nodes 1) have a "gravity" towards left/right based on their ports' directions to determine the rough initial position and 2) push each other away to avoid overlap. Links would act as springs pulling the connected nodes together. For things like effect chains I suppose it's a matter of complexity and preference whether a left-to-right or top-down flow would be preferrable. There is probably a decent heuristic to detect effect nodes (such as 'has "input" and "output" ports but no others' connected) and flip the direction in which the springs are pulling

To reduce clutter it would be handy to be able to collapse nodes into only the title and the layout algorithm could potentially collapse by default nodes that don't currently have any links. This would probably require keeping track of nodes that the user manually expands. Collapsed nodes should also probably have some indicator for what kind of ports they have, not sure what the best way to handle that would be.

@Ax9D
Copy link
Owner

Ax9D commented Nov 19, 2021

Some sort of an auto layout system would be nice, although I wouldn't want pw-viz to have live relayouting like Patchage or Carla, atleast not by default.

I don't like the jitter and nodes shifting randomly as demonstrated here:
patchage_jitter.

Also, I think respecting the user's placement of nodes, and laying out newly added nodes around them is a better idea, as it reduces visual noise.

Alternatively, having an "arrange" button which cleanly lays out nodes overriding the current layout seems like a good option to me. As for the implementation, I'll need to do some research into the algorithm you mentioned, I don't know much about mass spring simulations :(

I want to support collapsing of nodes,
Collapsed nodes could be displayed like how Blender does it:
image

@jansol
Copy link
Contributor Author

jansol commented Nov 19, 2021

Agreed, the jitter while dragging a node is distracting. I would still appreciate the graph fixing itself when nodes appear or disappear, but it certainly doesn't need to do that while a node is being dragged around. Adjusting the graph once the user lets go of a dragged node should be enough. "Stickying" manually dragged nodes to the user-defined position until a full recomputation is requested makes a lot of sense.

@Ax9D Ax9D added the enhancement New feature or request label Nov 21, 2021
Ax9D added a commit that referenced this issue Dec 19, 2021
- Pipewire Nodes with the same name are grouped together and rendered as a single node ( #1 ), in the debug view(on pressing Ctrl), the description and node id of the underlying pipewire node is shown

- Support cycles ( #5 ), graphs in cycles in them are a supported now

- Add support for customizing node background colors (with transparency)

- Add an Arrange button ( related to #7 ), which relayouts the nodes automatically when clicked, the layout algorithm (topological sort) is temporary, will be replaced in the future

- Updated README.md to include better build instructions
Ax9D added a commit that referenced this issue Nov 24, 2022
- Pipewire Nodes with the same name are grouped together and rendered as a single node ( #1 ), in the debug view(on pressing Ctrl), the description and node id of the underlying pipewire node is shown

- Support cycles ( #5 ), graphs in cycles in them are a supported now

- Add support for customizing node background colors (with transparency)

- Add an Arrange button ( related to #7 ), which relayouts the nodes automatically when clicked, the layout algorithm (topological sort) is temporary, will be replaced in the future

- Updated README.md to include better build instructions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants