zakarumych / egui-snarl

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

Feature request: dynamic edge/wire #14

Open hyumo opened 8 months ago

hyumo commented 8 months ago

Thanks a lot for this great node editor lib, I have been exploring it for a few days and trying to create my own tool based on it.

A feature request: I am not sure if it is possible to add a Dynamic Edge feature (see the snapshot below I took from Svelvet), it would be great if there's an interface to update the style and also add text (or widget) overlays onto the connection wires.

image

zakarumych commented 8 months ago

Hi!

It should be straightforward to add widget overlays for wires.

However I'm not sure what dynamic edge is. It's not obvious from screenshot

hyumo commented 8 months ago

Hi,

Thanks for the quick reply, adding widget overlays is basically what I want.

I am not an active user of Svelvet, this is just the example I found. I think the dynamic edge in Svelvet means the edge/wire style changes based on node values, for example, if you take a closer look, the color of the Dynamic Edge wire is actually from the color picker node. I have seen some other applications that can do dashed lines etc. Style change is not important for me tho, might be good to have for others if it is simple enough and is not taking too much of your valueable time.

zakarumych commented 8 months ago

I see.

If you want, you may add a method to SnarlViewer to draw widgets on top of wires.

Lib should provide this method with correctly positioned and clipped Ui

zakarumych commented 7 months ago

What you can do already is control color of the pin and wire (wire color is mix of connected pin colors). Node can output any pin color it wants and the other end can look into connected pin to chose same color to have wire of the same color.

hyumo commented 7 months ago

Thanks for your reply, yes I can give it a go. Feel free to close the issue if you think this is already doable, I'm just trying to avoid hand-rolling anything on my own. Looking forward to the next release!