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

Can I move multiple nodes at once? #7

Open
plasticbox opened this issue Jan 30, 2024 · 6 comments
Open

Can I move multiple nodes at once? #7

plasticbox opened this issue Jan 30, 2024 · 6 comments

Comments

@plasticbox
Copy link

Hello. It's a good library.
I'm doing some testing and it would be nice to have the ability to drag and select multiple nodes to move them all at once.
I just want to make sure I'm not missing something.

@zakarumych
Copy link
Owner

Right, it'd be nice feature to have.

Do you have an idea how it can be controlled?

I also want to create control map to not make a mess of weird combinations which library user can't modify.

@plasticbox
Copy link
Author

I actually tried to use https://github.com/setzer22/egui_node_graph before using snarl.

The project doesn't seem to be active, and it's a bit difficult to use.

If you look at the egui_node_graph, you can select multiple nodes by dragging.
snarl can background drag, you can select a specific key and drag to specify an area to select a node, or on the contrary, you can select the default as a node selection drag and press a specific key to make it a background drag.
Then you can select the selected nodes and change the pos at once?

https://github.com/Sollimann/bonsai I'm trying to use this bt, but json edit is too hard, so I'm trying to make an internal tool with snarl.
I'm trying to read the bonsai bt json, draw the node, and then save the edited node according to the bonsai bt json.
This is a bit difficult, so the primary goal is to read and draw the nodes.

After reading from the json, I added the node and added the connection information, but it was harder than I thought because I tried to position the node beautifully. It would be nice to have a function that automatically aligns them, so I thought about it, but I didn't come up with a good idea.

@zakarumych
Copy link
Owner

By automatic aligning do you mean something like snapping to common coordinates?

@plasticbox
Copy link
Author

스크린샷 2024-01-31 오후 5 47 55

I've attached a screenshot of my implementation.

When nodes are added by reading them from BT JSON rather than adding them in the editor, it's hard to determine their location.
Certain nodes have multiple outputs and it's hard to see where the depth will go at first.
So I just put the node in with a slight change in position and it looks like the screenshot.
I was thinking that the nodes shouldn't be cluttered and the lines should look nice.

https://www.youtube.com/watch?v=JKk7LRGJrfQ
I was thinking something similar to unreal blueprint's quick align.

@zakarumych
Copy link
Owner

I see, so pick a few nodes and align them in certain way once. That seems doable when we have multi selection.

And your use case requires auto-layout to place nodes nicely after creating them from some description with no positions.

Maybe some iterative algorithm that would push nodes away from each other and attempt to keep them on the same height if connected.

@zakarumych
Copy link
Owner

Node selection feature added and moving selected node moves all selected nodes at once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants