Get ofParameters from ofParameterGroup

Without knowing the type and names of parameters in a ofParameterGroup… how can i get all parameters from a ofParameterGroup¿¿¿

hey @pandereto ,

I think that you need to iterate each ofAbstractParameter item and then verify the type:

for (int i = 0; i < mParamsGroup.size(); i++)
		ofAbstractParameter &p = mParamsGroup[i];

		bool isFloat = p.type() == typeid(ofParameter<float>).name();
		bool isInt = p.type() == typeid(ofParameter<int>).name();

		if (isFloat)
			ofParameter<float> pr = p.cast<float>();
		else if (isInt)
			ofParameter<int> pr = p.cast<int>();

Also, you can look on the helpers of ofxImGui to learn how to filter ofParams or nested groups:

There’s other add-ons that iterate ofParams that can be good for “inspiration”:

If you need to handle all the ofParams types, then maybe you should go for C++ templates to minimize the code…