Fattorino / ImNodeFlow

Node based editor/blueprints for ImGui
MIT License
119 stars 15 forks source link

Documentation/sample about linking nodes programmatically #21

Closed Paolo-Oliverio closed 4 weeks ago

Paolo-Oliverio commented 2 months ago

Some things seems to be missing from the actual documentation like the possibility to add links programmatically to nodes. I need to serialize and deserialize nodegraphs so I need to recreate connections programmatically.

It would be great to have a more complex example that show off the entire api some kind of imgui demo but for imNodeFlow.

Fattorino commented 2 months ago

It is possible to create links, this was also visible in the old demo video. It's indeed not very well documented and I'll fix that.

auto n = INF.placeNode<DemoNode7>();
auto m = INF.placeNode<DemoNode3>();
n->inPin("Val")->createLink(m->inPin("X"));

this is a little snapshot from my testing code, I hope this helps.

One day I'll take the time and build a complete example with a bit of everything. Also as part of the to-do list of this project, there is the goal of creating helpers to export everything as some sort of JSON and the respective import helper. But I don't have the time to work on it now. So if you have to create such methods for your code consider opening a PR if you are interested.

Fattorino commented 2 months ago

Did the code snippet work for you? Also, how is it going with the nodes serialization and deserialization?

Paolo-Oliverio commented 2 months ago

Code worked great , serialization is on backlog I don't think it will be an issue. I'm pretty busy at the moment with business logic so frontend is on pause. A major pain point is the issue about rendering many nodes , it shouldn't be hard to fix but I touched imgui rendering too long ago to find a quick solution.

Fattorino commented 4 weeks ago

Will be added in future example folder