setzer22 / egui_node_graph

Build your node graph applications in Rust, using egui
MIT License
711 stars 132 forks source link

Right click output - create node and connect #70

Open edeetee opened 1 year ago

edeetee commented 1 year ago

If you right click a node output, it should show the add node ui, then automatically connect the added node to the clicked output if compatible.

I'm happy to pick up this work.

setzer22 commented 1 year ago

Sounds like a good UX improvement :smile:. If you want to pick this up, please feel free to go ahead and ask any questions you have here!

While we're at it, I've also been meaning to add this related improvement for a while, so let's use this issue to track both features:

If you drag a connection into an empty space, also show the node finder (a.k.a. add node UI) and allow selecting a node that would be compatible with that output.

There are some things to keep in mind: For instance, we need to filter out the nodes based on the available input datatypes, because not all nodes will have an input parameter to take that connection. When there are multiple input parameters that could hold the connection, I would add some simply heuristic like always picking the first.

This will require extending the NodeTemplate trait, adding an additional method that lists the accepted input datatypes for each node.