zakarumych / egui-snarl

Customizable egui node-graph library
https://crates.io/crates/egui-snarl
MIT License
252 stars 25 forks source link

Demo project #2

Open attackgoat opened 9 months ago

attackgoat commented 9 months ago

👋 Hello! I saw this library on the egui discord and thought I would try it out with an idea I wanted to test.

I created an editor for node graphs used by the noise crate: image https://github.com/attackgoat/noise_gui (_web demo here_)

Overall the experience was fantastic and this crate made the whole thing possible. Thank you for creating it!

Here are some random feedback notes I gathered, if that helps, I can create individual issues or convert this to a discussion instead:

zakarumych commented 9 months ago

Thank you for you feedback. It is extremely valuable! First I'd need to ask if you used released version or HEAD from repo? From your description I guess you've used the repo version. Since release I changed approach a bit to use more indices instead of RefCells, since in complex scenario RefCells are harder to use then simply indexing nodes from Snarl on spot.

Using handle for node is possible, but no reason making it opaque, just transparent wrapper to not index Snarl by some unrelated usize accidentally.

The node will have 5 areas in the final design.

____________________________
|          HEADER          |
|--------------------------|
| IN     |  BODY  |    OUT |
| PINS   |        |   PINS |
|--------------------------|
|          FOOTER          |
|__________________________|

All will optional. Except, probably, HEADER.

The BODY part would be actually least used I guess. Some large part of the node UI could be placed in FOOTER, like images here.

Another option will be showing tooltip for pins. For example I'm making GPU WorkGraph editable with egui-snarl and want to show intermediate images in pin tooltips on hover.

If dragging new wire from pin drops it means that egui decided that dragging stopped, and maybe started again from graph background (which does panning). Personally had no such experience. You can try to log mouse button events to see if release event is fired when you have this issue.