How to add slots to a Graph Node via Code and through Direct Child Count

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Rickers

I’m currently creating a custom GUI which will allow me to write dialogue and export it to JSON, I know there are other options but I would prefer to use my own due to needing some specific functionality which other dialogue tools currently lack.

However, I am having a problem with adding slots via-code.

The Documentation says

To create the slot, add a Control-derived child to the GraphNode.

However, do to that would require some alterations to my node structure, and before I go through the effort or redesigning the GUI i’d like to know if there is a way to add GraphNode Slots via code, rather than the method described above.

Specifically, the problem is that I am adding control some nodes dynamically into a HBox Container, and only some of these nodes in that HBOX require slots. However, as they are grandchildren and not children of the root GraphNode, the additional slots are not created automatically.

The current code I am using is add a slot is:

set_slot(choices_list.size()-1,false,0,Color(1,1,1,1),true,0,Color(1,1,1,1))

Which runs whenever I add another “choice” to the dialogue.

However, as the documentation states, this only edits the available 0 slot, but it does not add slots as I would like, and there seems to be no obvious way to add extra slots as needed via the code.

Could anyone help me out? Or do I just have to re-design the GUI in these GraphNodes with this limitation in mind?

Thanks.