Closed DrRuhe closed 2 years ago
That's really great! I was thinking I would need to implement bezier curves myself. Very glad to know egui is adding support for them :)
You already seem to have most of it figured out, so a PR would be very much welcome! We can keep a "bezier" branch with a git dependency on egui.
If you don't have time for it, no worries! I will get around to doing this eventually 👍
I've implemented this in this commit: https://github.com/setzer22/egui_node_graph/commit/572c999c6465efea1869d63e948a61bd3b55cbf4.
Merging back to main is blocked on updating egui (#23).
Hi, many thanks for your work! I haven't had a lot of time to put into my open source work lately. I'll check this out as soon as I can :smile:
Hi again @gmorenz! Your changes look good. I took care of merging all the open PRs, including #23. Would you like to submit a PR for this? I can take your commit as a patch but I'd rather have you listed as the author of the commit :+1:
Opened a PR, fwiw I'm pretty sure if you just take a commit and merge it with git it will properly attribute authorship, but it's probably cleaner to do it via github anyways
Hi,
first of all, this library is a great starting point for anyone wanting to do nodegraphs. So thanks for releasing it!
The Editor currently uses straight lines to connect the nodes. But Bezier Curves look so much nicer :)
Luckily egui is adding support for cubic bezier curves. But since this is sadly only in their git, I am doing this writeup so once it ships, the implementation is straightforward.
Here I have linked a demo on how bezier curves can be set up to look like they do in other editors. You can move the endpoints to see how it feels. Notably, the control points are half the distance (
s
in the demo) away from the endpoints, but on the samey
coordinate.So, what has to be done here in the node graph?
In
egui_node_graph/src/editor_ui.rs
; Instead of:Something like: