void EditTextStateInfo::deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) { mShift = MyGUI::utility::parseBool(_node->findAttribute("shift")); std::string colour = _node->findAttribute("colour"); if (_version >= MyGUI::Version(1, 1)) { colour = MyGUI::LanguageManager::getInstance().replaceTags(colour); } mColour = MyGUI::Colour::parse(colour); }
void Framework::loadJoint( MyGUI::xml::ElementPtr node,RigidPtr parent ) { ObjectFactory& factory = ObjectFactory::getSingleton(); string typeName = node->findAttribute("type"); JointPtr jpt = boost::dynamic_pointer_cast<Joint>(factory.createObject(typeName)); if(jpt) { if( parent ) { jpt->mRigid[0] = parent; } addJoint(jpt); jpt->load(node); MyGUI::xml::ElementEnumerator ce = node->getElementEnumerator(); while(ce.next()) { MyGUI::xml::ElementPtr child = ce.current(); if( child->getName() == "rigid" ) { loadRigid(child, jpt); } break; } } else { WARNING_LOG("Factory can't make "<<typeName); } }
bool EditorState::isMetaSolution(const MyGUI::UString& _fileName) { MyGUI::xml::Document doc; if (!doc.open(_fileName)) { return false; } MyGUI::xml::ElementPtr root = doc.getRoot(); if (!root || (root->getName() != "MyGUI")) { return false; } std::string type; if (root->findAttribute("type", type)) { if (type == "MetaSolution") { return true; } } return false; }
void Rigid::load( MyGUI::xml::ElementPtr node ) { string ms; VisualObject::load(node); if(node->findAttribute("mass", ms)) { mMassDensity = toValue(ms,(dReal)1); } _init(); _visual2physic(); }
void Framework::load( MyGUI::xml::ElementPtr node ) { removeAllJoint(); mName = node->findAttribute("name"); MyGUI::xml::ElementEnumerator e=node->getElementEnumerator(); while(e.next()) { MyGUI::xml::ElementPtr node = e.current(); if( node->getName() == "body" ) { loadRigid(node, JointPtr()); } break; } }
MyGUI::UString EditorState::convertProjectName(const MyGUI::UString& _fileName) { size_t pos = mFileName.find_last_of("\\/"); MyGUI::UString shortName = pos == MyGUI::UString::npos ? mFileName : mFileName.substr(pos + 1); addUserTag("ResourceName", shortName); size_t index = _fileName.find("|"); if (index == MyGUI::UString::npos) return _fileName; MyGUI::UString fileName = _fileName.substr(0, index); MyGUI::UString itemIndexName = _fileName.substr(index + 1); size_t itemIndex = MyGUI::utility::parseValue<size_t>(itemIndexName); MyGUI::xml::Document doc; if (!doc.open(fileName)) return _fileName; MyGUI::xml::ElementPtr root = doc.getRoot(); if ((nullptr == root) || (root->getName() != "MyGUI")) return _fileName; if (root->findAttribute("type") == "Resource") { // берем детей и крутимся MyGUI::xml::ElementEnumerator element = root->getElementEnumerator(); while (element.next("Resource")) { if (element->findAttribute("type") == "ResourceLayout") { if (itemIndex == 0) { // поменять на теги std::string resourceName = element->findAttribute("name"); addUserTag("ResourceName", resourceName); return MyGUI::utility::toString(fileName, " [", resourceName, "]"); } else { itemIndex --; } } } } return _fileName; }
void SettingsManager::loadSettings(const MyGUI::UString& _fileName, bool _internal) { std::string _instance = "Editor"; MyGUI::xml::Document doc; if (_internal) { MyGUI::DataStreamHolder data = MyGUI::DataManager::getInstance().getData(_fileName); if (data.getData() != nullptr) { if (!doc.open(data.getData())) { MYGUI_LOGGING(LogSection, Error, _instance << " : " << doc.getLastError()); return; } } } else { if (!doc.open(_fileName)) { MYGUI_LOGGING(LogSection, Error, _instance << " : " << doc.getLastError()); return; } } MyGUI::xml::ElementPtr root = doc.getRoot(); if (!root || (root->getName() != "MyGUI")) { MYGUI_LOGGING(LogSection, Error, _instance << " : '" << _fileName << "', tag 'MyGUI' not found"); return; } std::string type; if (root->findAttribute("type", type)) { if (type == "Settings") { // берем детей и крутимся MyGUI::xml::ElementEnumerator field = root->getElementEnumerator(); while (field.next()) loadSector(field.current()); } } }
void MaskSetSubSkinState::deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) { std::string texture = _node->getParent()->findAttribute("texture"); if (texture.empty()) { texture = _node->getParent()->getParent()->findAttribute("texture"); } // tags replacement support for Skins if (_version >= MyGUI::Version(1, 1)) { texture = MyGUI::LanguageManager::getInstance().replaceTags(texture); } const MyGUI::IntSize& size = MyGUI::texture_utility::getTextureSize(texture); m_texture = MyGUI::RenderManager::getInstance().getTexture(texture); const MyGUI::IntCoord& coord = MyGUI::IntCoord::parse(_node->findAttribute("offset")); setRect(MyGUI::CoordConverter::convertTextureCoord(coord, size)); }
//=================================================================================== void EditorState::loadSettings(const MyGUI::UString& _fileName, bool _internal) { std::string _instance = "Editor"; MyGUI::xml::Document doc; if (_internal) { MyGUI::IDataStream* data = MyGUI::DataManager::getInstance().getData(_fileName); if (data) { PtrHolder<MyGUI::IDataStream> holder = PtrHolder<MyGUI::IDataStream>(data); if (!doc.open(data)) { MYGUI_LOGGING(LogSection, Error, _instance << " : " << doc.getLastError()); return; } } } else { if (!doc.open(_fileName)) { MYGUI_LOGGING(LogSection, Error, _instance << " : " << doc.getLastError()); return; } } MyGUI::xml::ElementPtr root = doc.getRoot(); if (!root || (root->getName() != "MyGUI")) { MYGUI_LOGGING(LogSection, Error, _instance << " : '" << _fileName << "', tag 'MyGUI' not found"); return; } std::string type; if (root->findAttribute("type", type)) { if (type == "Settings") { // берем детей и крутимс¤ MyGUI::xml::ElementEnumerator field = root->getElementEnumerator(); while (field.next()) { if (field->getName() == "PropertiesPanelView") mPropertiesPanelView->load(field); else if (field->getName() == "SettingsWindow") mSettingsWindow->load(field); else if (field->getName() == "WidgetsWindow") mWidgetsWindow->load(field); else if (field->getName() == "MetaSolutionWindow") { if (isNeedSolutionLoad(field)) { clearWidgetWindow(); mMetaSolutionWindow->load(field); } } else if (field->getName() == "RecentFile") { std::string name; if (!field->findAttribute("name", name)) continue; recentFiles.push_back(name); } else if (field->getName() == "AdditionalPath") { std::string name; if (!field->findAttribute("name", name)) continue; additionalPaths.push_back(name); } } } } }