Flix01 / imgui

Dear ImGui Addons Branch = plain unmodified dear imgui plus some extra addon.
https://github.com/Flix01/imgui/wiki/ImGui-Addons-Branch-Home
MIT License
396 stars 34 forks source link

NodeEditor Addon #53

Closed Fredkindings closed 4 years ago

Fredkindings commented 4 years ago

Hello, this is not really an issue just some questions.

Is there a way to add a HeightOverride so that we can have nodes which are with specific height? Also how to get inputs from the nodes? (for example add math calculations) Is it possible to save node graphs and then use them as a node in another graph?

Flix01 commented 4 years ago

Is there a way to add a HeightOverride so that we can have nodes which are with specific height?

No, but you can override Node::render and reimplement its default implementation Base::render(...), adding some vertical spacing, or simply just add some vertical spacing before or after the Base::render(...) call.

Also how to get inputs from the nodes? (for example add math calculations)

As far as I remember the methods are: getInputNodeForNodeAndSlot(...), when allowOnlyOneLinkPerInputSlot==true (the default), or getInputNodesForNodeAndSlot(...) in the general case (it should always work, but it's a bit more difficult to use). I've never used these methods, but I remember I've made some test code at the end of this issue; you might find it useful.

Is it possible to save node graphs and then use them as a node in another graph?

I don't think so... (node graphs cannot be loaded inside a node and grouping is not supported).

Beside that, all the code is very poorly tested, so I think that going beyond what is shown in the provided example needs a big user effort to make it work.

Flix01 commented 4 years ago

Closing this.