I’m doing some cable manipulation on the gui thread, iterating the std::vector<Input> inputs array of the Module.
Is there a way, from that array (or from list of PortWidget, if any) to understand which kind of PortWidget class type is? Because I’m inherit some Port class from standard:
struct MyNicePort : SvgPort {
MyNicePort();
};
static_cast probably would work, since those objects won’t change at runtime.
I’m not finding a direct way to get from inputs to widgets that reference them, so you’re left with the methods I mentioned. Easiest to keep your own reference and not pay the cost of recursively iterating widget children. Plus you can keep the most-derived type pointer and not need to dynamic_cast.
/** Scans children widgets recursively for a ParamWidget with the given paramId. */
ParamWidget* getParam(int paramId);
PortWidget* getInput(int portId);
PortWidget* getOutput(int portId);
and you can see the core used to do the recursive scan if you want a more constrained type.