You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add an attribute flag to create/destroy links when visually snapping #41
When creating a link the bezier curve visually snaps to nearby attributes, IsLinkedCreated/Destroyed could be based on this visual snapping instead of the mouse click. It would show the effects of the link you are creating as you drag it over different attributes, which is good feedback for the user.
Hopefully you understand what I'm envisioning, I think this would work well alongside the AttributeFlags_EnableLinkDetachWithDragClick flag. Thanks for this great node graph editor!
I guess the gist of the idea is to create the link on snap, so that there is a way to alter the link to show the user when a link would be created. I suppose that would be a useful addition, since the visual snap is the only thing currently indicating that a link could be created 🤔 I like being able to adjust the link target after the visual snap, just in case I got the pin wrong. So either it would have to be configurable, like you mentioned, or it could be signalled via separate event functions. I'll have to play around with the code and see what works!
I think you mostly have the right idea, except that when the link snaps to a pin you would still be able to break it by moving the mouse back, and reattach to another node without ever having to let go of the mouse button.
Imagine this above situation but with the output updating as I drag the link over the various pins.
It shouldn't require any extra event functions, just an attribute flag to enable the feature. I'm going to have a go at implementing it, I've mostly figured out how linking works in imnodes
It just uses the IsLinkCreated & IsLinkDestroyed events.
I did add an extra argument to IsLinkCreated(int* started_at_attribute_id, int* ended_at_attribute_id, bool* created_from_snap = 0);
I'm using this to not destroy existing links just by hovering over them, so the developer can decide if that's the behaviour they want.
After cleaning up the code a bit I can make a PR for it
Right, snapping to the next pin would just trigger the IsLinkDestroyed event again 👍
Sounds like you have a good idea of how this would work, so feel free to open a pr. I guess placing the feature behind a feature flag means that it's not a breaking change either?
Activity
Nelarius commentedon Jun 21, 2020
Hi @Auburns !
I guess the gist of the idea is to create the link on snap, so that there is a way to alter the link to show the user when a link would be created. I suppose that would be a useful addition, since the visual snap is the only thing currently indicating that a link could be created 🤔 I like being able to adjust the link target after the visual snap, just in case I got the pin wrong. So either it would have to be configurable, like you mentioned, or it could be signalled via separate event functions. I'll have to play around with the code and see what works!
Auburn commentedon Jun 21, 2020
I think you mostly have the right idea, except that when the link snaps to a pin you would still be able to break it by moving the mouse back, and reattach to another node without ever having to let go of the mouse button.

Imagine this above situation but with the output updating as I drag the link over the various pins.
It shouldn't require any extra event functions, just an attribute flag to enable the feature. I'm going to have a go at implementing it, I've mostly figured out how linking works in imnodes
Auburn commentedon Jun 21, 2020
Got it working quite nicely

It just uses the
IsLinkCreated&IsLinkDestroyedevents.I did add an extra argument to
IsLinkCreated(int* started_at_attribute_id, int* ended_at_attribute_id, bool* created_from_snap = 0);I'm using this to not destroy existing links just by hovering over them, so the developer can decide if that's the behaviour they want.
After cleaning up the code a bit I can make a PR for it
Nelarius commentedon Jun 22, 2020
Right, snapping to the next pin would just trigger the IsLinkDestroyed event again 👍
Sounds like you have a good idea of how this would work, so feel free to open a pr. I guess placing the feature behind a feature flag means that it's not a breaking change either?