void SkinExportSerializer::writeSkin(pugi::xml_node _parent, DataPtr _data) { pugi::xml_node node = _parent.append_child("Resource"); node.append_attribute("type").set_value("ResourceSkin"); node.append_attribute("name").set_value(_data->getPropertyValue("Name").c_str()); node.append_attribute("size").set_value(MyGUI::IntCoord::parse(_data->getPropertyValue("Size")).size().print().c_str()); std::string textureName = _data->getPropertyValue("Texture"); if (!textureName.empty()) node.append_attribute("texture").set_value(textureName.c_str()); Data::VectorData childs = DataUtility::getChildsByType(_data, "Region", false); sortByAlign(childs); for (Data::VectorData::const_iterator child = childs.begin(); child != childs.end(); child ++) writeRegion(node, _data, (*child), false); childs = DataUtility::getChildsByType(_data, "RegionText", false); for (Data::VectorData::const_iterator child = childs.begin(); child != childs.end(); child ++) writeRegion(node, _data, (*child), true); }
void SkinExportSerializer::moveToEnd(Data::VectorData& childs, size_t _index) { DataPtr data = childs[_index]; childs.erase(childs.begin() + _index); childs.push_back(data); }