ofParameter copy constructor

Hi there, I need to create ofParameter instances on the fly and add them to an ofParameterGroup

Because of the way I declare ofParameter variables in the code below I’m obviously always referencing the same ones during iteration. How can I create NEW ofParameter for each loop iteration before adding it to the ofParameterGroup ?

Thanks in advance…

settings.pushTag("params"); int numParams = settings.getNumTags("param"); for (int i = 0; i < numParams; i++) { string name = settings.getAttribute("param", "name", "", i); ofParameter <float> fparam; ofParameter<int> iparam; ofParameter<string> sparam; switch (Action::paramToken(name)) { case tokens::hue: fparam.setName("hue"); fparam = settings.getValue("param", 0.0f, i); paramGroup.add(fparam); break; /* Other similar switch cases */ } cout << std::hex << &fparam << " " << std::hex << &iparam << " " << std::hex << &sparam; } settings.popTag(); // params

Did you try using a vector of ofParameters? then pushing only a vector element each for iteration… I haven’t tried it but I guess it will work.

In fact I pushed them in an ofParameterGroup, which I supposed to be a kind of sophisticated vector or map. I didn’t found the right syntax with references and ended hacking my own poor’s man parameter class, pointer allocated and indeed pushed in a map<string, parameter*>

ofParameter is the only part of oF I always struggled with, and that seems to be very coupled with ofxGui

But, but, being a new ImGui FANATIC I found my own way and combine my hackish Parameter like

if (ImGui::InputInt(“Kelvin”, &current_action->params[“kelvin”]->iv, 100, 500)) {
if (preview) {

No getter, no setter, but who cares ? The action parameter is displayed by the UI and IF the UI widget is changed the action parameter value changes also… A dream !

Ok, I loose the parameter change listening events, but I don’t need them…