void ofSerialize(ofXml & xml, const ofAbstractParameter & parameter){ if(!parameter.isSerializable()){ return; } string name = parameter.getEscapedName(); if(name == ""){ name = "UnknownName"; } ofXml child = xml.findFirst(name); if(!child){ child = xml.appendChild(name); ofLogVerbose("ofXml") << "creating group " << name; } if(parameter.type() == typeid(ofParameterGroup).name()){ const ofParameterGroup & group = static_cast <const ofParameterGroup &>(parameter); ofLogVerbose("ofXml") << "group " << name; for(auto & p: group){ ofSerialize(child, *p); } ofLogVerbose("ofXml") << "end group " << name; }else{ string value = parameter.toString(); child.set(value); } }
//-------------------------------------------------------------- void ofxGLWarper::saveToXml(ofXml &XML, const string& warperID){ XML.removeChild(warperID);//if child doesn't exist yet, it's ok. auto c = XML.appendChild(warperID); for(int i =0; i<4; i++){ auto nc = c.appendChild("corner"); nc.appendChild("x").set(corners[i]->x); nc.appendChild("y").set(corners[i]->y); } c.appendChild("active").set(active); }