Setting opParameters in ofParameterGroup

I want to pass an ofParameterGroup for storage of app settings around objects not only for read but also for writing to it - how can I write to a ofParameter that’s stored in a ofParameterGroup?

you need to know it’s type and name and cast it like:


or if the type is not one of the directly supported:


Thanks, this did the trick.

One more thing, how can I add an ofParameter from a ofParameterGroup to an ofxDatGuiSlider?

haven’t used ofxDatGui but ofParameter has shallow copy semantics so making a copy of it is just a reference which means that if you do:

ofParameter<float> p = group.getFloat("floatParameter");

p will be a reference to the parameter in the group and if you modify it it’ll modify the original too so you can pass it like that to ofxDatGui or simly just pass the return of group.get*()

Thanks @arturo, it works

Is it possible to add int values or strings to an ofParameterGroup?

you can add any type of ofParameter or other ofParameterGroups but not raw values