setzer22 / egui_node_graph

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

Suggestion: add functional part to example #16

Closed trsh closed 2 years ago

trsh commented 2 years ago

For now as I understand the example is only for displaying the nodes visually. Would nice to have also demonstrated how to connect the functional part. Like doing the adding, substraction, etc.

setzer22 commented 2 years ago

You're right, this library is meant to be very general, and I'd like to stress there's many ways in which you could treat the graphs for more advanced use cases. But having a minimal evaluation example never hurts! I added code in the example to compute the result for the currently active node using a simple tree-walking strategy, the result is displayed in the top-left corner.

The new code is also commented in detail, let me know if you have any other suggestions about this, otherwise we can close :smile:

Here's an example of how it looks: image