bool EditorWidgets::save(std::string _fileName) { std::string _instance = "Editor"; MyGUI::xml::xmlDocument doc; std::string file(MyGUI::helper::getResourcePath(_fileName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME)); if (file.empty()) { file = _fileName; } doc.createInfo(); MyGUI::xml::xmlNodePtr root = doc.createRoot("MyGUI"); root->addAttributes("type", "Layout"); for (std::vector<WidgetContainer*>::iterator iter = widgets.begin(); iter != widgets.end(); ++iter) { // в корень только сирот if (null == (*iter)->widget->getParent()) serialiseWidget(*iter, root); } if (false == doc.save(file)) { LOGGING(LogSection, Error, _instance << " : " << doc.getLastError()); return false; } return true; }
MyGUI::xml::xmlDocument * EditorWidgets::savexmlDocument() { MyGUI::xml::xmlDocument * doc = new MyGUI::xml::xmlDocument(); doc->createInfo(); MyGUI::xml::xmlNodePtr root = doc->createRoot("MyGUI"); root->addAttributes("type", "Layout"); for (std::vector<WidgetContainer*>::iterator iter = widgets.begin(); iter != widgets.end(); ++iter) { // в корень только сирот if (null == (*iter)->widget->getParent()) serialiseWidget(*iter, root); } return doc; }