Nelarius / imnodes

A small, dependency-free node editor for dear imgui
MIT License
1.97k stars 241 forks source link

struggeling with something #116

Closed Jaumeavinyo closed 2 years ago

Jaumeavinyo commented 2 years ago

Hi, I'm new using this cool library and there is something I really don't know how to do.

I have a class called "B" that displays 1 single node, this way, the class called "A" just calls all "B" clases stored in a list and tells them to display their node. I see my nodes as a double linked list, all nodes should know wich is the next and the past node.

How can I know using links wich are the nodes this link is conecting? How can I relate link input_attr with input pin from the node the link is starting? There is a way to know node id from the input_attr and output_attr of a link?

Thanks for your time!

brukted commented 2 years ago

So basically you have a list of linearly connected nodes and you want to know which nodes a given link is connecting? If that is the case as far as i know there is no way of querying link info from imnodes other than when it is created or destroyed. As a suggestion you can use the index of the node as the link id then the node id would tell you from which node it starts.

Nelarius commented 2 years ago

Hi @Jaumeavinyo !

As brukted already commented, ImNodes doesn't provide a way to query which nodes a specific link connects. Information about how the nodes, links, pins are connected to each other are left to the user to handle, since this information is used anyway to build the node graph.

I like to store my nodes and links explicitly in a container, like a vector or map. That way, it should always be possible to figure out which nodes and links are connected in user code.