I/O connections disappear after restarting Rack when addInput called outside ModuleWidget constructor.
In the constructor of my ModuleWidget class, instead of adding inputs directly, I create instances of another Widget, pass a pointer to those instances…
Thanks a lot! I am now simply passing the future position of the child widget as a Vec parameter and add it to the individual offsets. Done!
I only fear that now the inputs are not part of the child widget any more. In my special case here it is not a problem but it might become a problem as soon as child widgets are layered on top of each other. Then I might need to have a look at your approach again.
For the sake of completeness: What is the best way to add ports to a child component? Is that possible/‘permittet’ at all? Some ports could be active but not visible… are cables only shown if both ports of the connection are visible and hidden otherwise?
Are there any modules yet in which the visibility of ports changes at runtime?