Skip to content

Instantly share code, notes, and snippets.

@moebiussurfing
Last active August 4, 2020 10:55
Show Gist options
  • Save moebiussurfing/c3bc5d54d658d9b8375e7c964f8bcd6c to your computer and use it in GitHub Desktop.
Save moebiussurfing/c3bc5d54d658d9b8375e7c964f8bcd6c to your computer and use it in GitHub Desktop.
openFrameworks / ofParameterGroup save/load parameters settings to xml
//h
void loadGroup(ofParameterGroup &g, string path);
void saveGroup(ofParameterGroup &g, string path);
//cpp
//--------------------------------------------------------------
void ofApp::loadGroup(ofParameterGroup &g, string path)
{
ofLogNotice(__FUNCTION__)<< g.getName() << " to " << path;
ofLogVerbose(__FUNCTION__) << "parameters: \n" << g.toString();
ofXml settings;
settings.load(path);
ofDeserialize(settings, g);
}
//--------------------------------------------------------------
void ofApp::saveGroup(ofParameterGroup &g, string path)
{
ofLogNotice(__FUNCTION__) << g.getName() << " to " << path;
ofLogVerbose(__FUNCTION__) << "parameters: \n" << g.toString();
ofXml settings;
ofSerialize(settings, g);
settings.save(path);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment