void cApp::loadXml(){ fs::path p = "gui.xml"; if( !fs::is_empty( p ) ){ XmlTree xml( loadFile( p ) ); XmlTree mn = xml.getChild("gui_setting/main"); frame = (mn/"frame").getValue<int>(); bOrtho = (mn/"ortho").getValue<bool>(); Ramses::globalScale = (mn/"xyz_global_scale").getValue<float>(); //Ramses::boxelx = (mn/"r_resolution").getValue<float>(); //Ramses::boxely = (mn/"theta_resolution").getValue<float>(); XmlTree sim = xml.getChild( "gui_setting/simType_" + to_string(simType) ); for( int i=0; i<rms.size(); i++){ Ramses & r = rms[i]; string name = Ramses::prm[i]; XmlTree prm = sim.getChild(name); r.bShow = (prm/"show").getValue<bool>(); r.bPolar = (prm/"polar").getValue<bool>(true); r.bAutoMinMax = (prm/"Auto_Min_Max").getValue<bool>(); r.in_min = (prm/"in_min").getValue<float>(); r.in_max = (prm/"in_max").getValue<float>(); r.extrude = (prm/"z_extrude").getValue<float>(); r.xoffset = (prm/"x_offset").getValue<float>(); r.yoffset = (prm/"y_offset").getValue<float>(); r.zoffset = (prm/"z_offset").getValue<float>(); r.scale = (prm/"xy_scale").getValue<float>(); r.eStretch = (prm/"log").getValue<float>(); } } }
Checksum Scenario::load(const string &path) { Checksum scenarioChecksum; try { scenarioChecksum.addFile(path); checksumValue.addFile(path); string name= cutLastExt(lastDir(path)); Logger::getInstance().add("Scenario: " + formatString(name), true); //parse xml XmlTree xmlTree; xmlTree.load(path); const XmlNode *scenarioNode= xmlTree.getRootNode(); const XmlNode *scriptsNode= scenarioNode->getChild("scripts"); for(int i= 0; i<scriptsNode->getChildCount(); ++i){ const XmlNode *scriptNode = scriptsNode->getChild(i); scripts.push_back(Script(getFunctionName(scriptNode), scriptNode->getText())); } } //Exception handling (conversions and so on); catch(const exception &e) { SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what()); throw runtime_error("Error: " + path + "\n" + e.what()); } return scenarioChecksum; }
void AppModel::parseRecipes(XmlTree _root){ XmlTree t = _root.getChild("dict/dict"); for( XmlTree::Iter child = t.begin(); child != t.end(); ++child ){ if(child->getTag().compare("key")==0){ // use this value as the name for a new Recipe object RecipeModel rm; rm.name = child->getValue(); recipes.push_back(rm); } else { XmlTree t2 = *child; string whichKey; for( XmlTree::Iter grandchild = t2.begin(); grandchild != t2.end(); ++grandchild ){ if(grandchild->getTag().compare("key")==0){ whichKey = grandchild->getValue(); } else if(grandchild->getTag().compare("dict")==0){ if(whichKey.compare("Steps")==0){ XmlTree t3 = *grandchild; CookStepModel sm; for( XmlTree::Iter greatChild = t3.begin(); greatChild != t3.end(); ++greatChild ){ XmlTree t4 = *greatChild; string stepKey; if(greatChild->getTag().compare("dict")==0){ for( XmlTree::Iter baby = t4.begin(); baby != t4.end(); ++baby ){ if(baby->getTag().compare("key")==0){ stepKey = baby->getValue(); } else { if(stepKey.compare("img")==0){ sm.img = baby->getValue(); } else if(stepKey.compare("video")==0){ sm.video = baby->getValue(); } else { console() << "I got a property of a cookstep that was unexpected: " << stepKey << ", " << baby->getValue(); } } } } else if(greatChild->getTag().compare("key")==0){ if(recipes.size()>0 && sm.name.compare("")!=0){ recipes.at(recipes.size()-1).steps.push_back(sm); } sm.name = sm.video = sm.img = ""; sm.name = greatChild->getValue(); } } if(sm.name.compare("")!=0){ recipes.at(recipes.size()-1).steps.push_back(sm); } } } else { // do nothing? } } } } }
void QTimeline::load( fs::path filepath ) { clear(); XmlTree doc; try { doc = XmlTree( loadFile( filepath ) ); for( XmlTree::Iter nodeIt = doc.begin("QTimeline/tracks/track"); nodeIt != doc.end(); ++nodeIt ) { string trackName = nodeIt->getAttributeValue<string>("name"); QTimelineTrackRef trackRef = QTimelineTrackRef( new QTimelineTrack( trackName ) ); mTracks.push_back( trackRef ); trackRef->loadXmlNode( *nodeIt ); } mCueManager->loadXmlNode( doc.getChild( "qTimeline/cueList" ) ); } catch ( ... ) { console() << "Error > QTimeline::load(): " << filepath.filename().generic_string() << endl; return; } updateCurrentTime(); }
Object* ObjectLoader::loadObjectFromFile(const char* filename){ Object* object = NULL; //Leo el archivo y lo parseo en un arbol XmlTree* xmlTree = XmlParser::parse(string(WindowConnector::getBaseApplicationPath() + filename).c_str()); //***Transformo el arbol en un Object*** XmlTreeNode* root = xmlTree->getRootNode(); //Primiero busco la etiqueta de Object XmlTreeNode* objectNode = NULL; for(unsigned int i=0; i < root->getChildNodes().size(); i++){ objectNode = root->getChildNodes()[i]; if(objectNode->getName().compare("Object")==0){ //Cargo el mesh y le seteo los valores del xml object = initObject(objectNode); break; } } if(object == NULL){ if(xmlTree != NULL){ delete xmlTree; } return NULL; //Error } //Busco las etiquetas de Mesh y reemplazo los valores del xml Mesh* mesh = object->getMesh(); if(mesh->getChilds()->size() > 0){ loadMesh(mesh, objectNode); } //Busco las etiquetas de Light y las agrego a las luces del objeto loadLights(object, objectNode); //Guardo el path en el object object->setFilename(filename); delete xmlTree; return object; }
void UnitParticleSystemType::load(const XmlNode *particleFileNode, const string &dir, const string &path, RendererInterface *renderer, std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader, string techtreePath) { try{ XmlTree xmlTree; std::map<string,string> mapExtraTagReplacementValues; mapExtraTagReplacementValues["$COMMONDATAPATH"] = techtreePath + "/commondata/"; xmlTree.load(path, Properties::getTagReplacementValues(&mapExtraTagReplacementValues)); loadedFileList[path].push_back(make_pair(parentLoader,parentLoader)); const XmlNode *particleSystemNode= xmlTree.getRootNode(); if(particleFileNode){ // immediate children in the particleFileNode will override the particleSystemNode particleFileNode->setSuper(particleSystemNode); particleSystemNode= particleFileNode; } UnitParticleSystemType::load(particleSystemNode, dir, renderer, loadedFileList, parentLoader, techtreePath); } catch(const exception &e){ SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what()); throw megaglest_runtime_error("Error loading ParticleSystem: "+ path + "\n" +e.what()); } }
XmlTree* ScaenaAnimationWriter::animationsToXmlTree(list<AnimationDataTransfer*>* animations){ XmlTree* xmlTree = new XmlTree(); XmlTreeNode* rootNode = xmlTree->getRootNode(); // Agrego el tag inicial XmlTreeNode* safNode = new XmlTreeNode("ScaenaAnimationFile", rootNode); rootNode->addChild(safNode); // Agrego todas las animaciones list<AnimationDataTransfer*>::iterator animIt = animations->begin(); while( animIt != animations->end() ){ // Agrego el tag de animacion XmlTreeNode* animationNode = new XmlTreeNode("Animation", safNode); safNode->addChild(animationNode); // Agrego como atributo el nombre de la animacion AnimationDataTransfer* animationDataTransfer = *animIt; animationNode->addAttribute(new XmlNodeAttribute("Name", animationDataTransfer->name)); // Agrego cada uno de los keyframes list<KeyFrameDataTransfer*>::iterator keyIt = animationDataTransfer->keyframes->begin(); while(keyIt != animationDataTransfer->keyframes->end()){ keyFrameToXmlTree(animationNode, *keyIt); ++keyIt; } ++animIt; } return xmlTree; }
void Bundle::loadFromDisk() { std::ifstream file; GetBundleFileHandleForReading(this->bundleName, file); if (file.good()) { XmlParser* parser = new XmlParser(); parser->ParseXmlFile(file); XmlTree* tree = parser->GetXmlTree(); VERIFY(tree != nullptr, "Got xml tree for bundle data in bundle %s", this->bundleName.c_str()); XmlNode* rootNode = tree->GetRootNode(); VERIFY(rootNode != nullptr, "Got root node for bundle data in bundle %s", this->bundleName.c_str()); VERIFY(rootNode->GetName() == BUNDLE_TAG, "Got bundle node for bundle data in bundle %s", this->bundleName.c_str()); XmlNode* dataNode = rootNode->GetFirstChildByNodeName(DATA_TAG); while(dataNode != nullptr) { std::string key = dataNode->GetAttributeValueS(KEY_ATTRIBUTE); std::string value = dataNode->GetAttributeValueS(VALUE_ATTRIBUTE); this->PutString(key, value); // dataNode = dataNode->GetNextSiblingByNodeName(DATA_TAG); } delete parser; } }
XmlTree::ConstIter::ConstIter( const XmlTree &root, const string &filterPath, bool caseSensitive, char separator ) : mCaseSensitive( caseSensitive ) { mFilter = split( filterPath, separator ); // we ignore a leading separator so that "/one/two" is equivalent to "one/two" if( ( ! filterPath.empty() ) && ( filterPath[0] == separator ) && ( ! mFilter.empty() ) ) mFilter.erase( mFilter.begin() ); if( mFilter.empty() ) { // empty filter means nothing matches setToEnd( &root.getChildren() ); return; } for( vector<string>::const_iterator filterComp = mFilter.begin(); filterComp != mFilter.end(); ++filterComp ) { if( mIterStack.empty() ) // first item mSequenceStack.push_back( &root.getChildren() ); else mSequenceStack.push_back( &(*mIterStack.back())->getChildren() ); Container::const_iterator child = findNextChildNamed( *mSequenceStack.back(), mSequenceStack.back()->begin(), *filterComp, mCaseSensitive ); if( child != (mSequenceStack.back())->end() ) mIterStack.push_back( child ); else { // failed to find an item that matches this part of the filter; mark as finished and return setToEnd( &root.getChildren() ); return; } } }
XmlTree::ExcChildNotFound::ExcChildNotFound( const XmlTree &node, const string &childPath ) throw() { #if defined( CINDER_MSW ) sprintf_s( mMessage, "Could not find child: %s for node: %s", childPath.c_str(), node.getPath().c_str() ); #else sprintf( mMessage, "Could not find child: %s for node: %s", childPath.c_str(), node.getPath().c_str() ); #endif }
XmlTree::ExcAttrNotFound::ExcAttrNotFound( const XmlTree &node, const string &attrName ) throw() { #if defined( CINDER_MSW ) sprintf_s( mMessage, "Could not find attribute: %s for node: %s", attrName.c_str(), node.getPath().c_str() ); #else sprintf( mMessage, "Could not find attribute: %s for node: %s", attrName.c_str(), node.getPath().c_str() ); #endif }
bool ObjectRenderer::Load(string name){ char filename[256]; XmlTree tree; sprintf(filename,"Worlds/Objects/%s.xml",name.c_str()); if(FileFinder::Find(filename)){ tree.LoadFromFile(FileFinder::GetCStr()); } return Load(&tree); }
XmlTree::XmlTree( const XmlTree &rhs ) : mNodeType( rhs.mNodeType ), mTag( rhs.mTag ), mValue( rhs.mValue ), mDocType( rhs.mDocType ), mParent( 0 ), mAttributes( rhs.mAttributes ) { for( XmlTree::ConstIter childIt = rhs.begin(); childIt != rhs.end(); ++childIt ) { mChildren.push_back( unique_ptr<XmlTree>( new XmlTree( *childIt ) ) ); mChildren.back()->mParent = this; } }
void PlistReader::trace(XmlTree t){ for( XmlTree::Iter child = t.begin(); child != t.end(); ++child ){ console() << "Tag: " << child->getTag() << " Value: " << child->getValue() << endl; if(child->getTag().compare("dict")==0){ trace(*child); } } }
bool GenerationProcessor::processScaenaAnimationFile(string& inAnimationFile, string& outAnimationFile, string& keyFrameFBXFile, string& animationName, float keyDuration){ //Parseo el archivo de modelo FbxModelLoader* fbxLoader = new FbxModelLoader(); ModelDataTransfer* modelDataTransfer = fbxLoader->loadModel(keyFrameFBXFile.c_str()); KeyFrameDataTransfer* keyframe = getKeyFrameData(modelDataTransfer, 0); keyframe->animationTime = keyDuration; delete fbxLoader; // Si tengo SAF de entrada, lo cargo para agregarle la nueva animacion o keyframe if(!inAnimationFile.empty()){ Logger::getInstance()->logInfo(new Log("Procesando el SAF de salida...")); //Leo el archivo y lo parseo en un arbol XmlTree* xmlTree = XmlParser::parse(inAnimationFile.c_str()); XmlTreeNode* rootNode = xmlTree->getRootNode(); // Busco el nodo de archivo SAF XmlTreeNode* safNode = rootNode->searchDirectChild("ScaenaAnimationFile", 0); if(safNode != NULL){ // Busco si alguna animacion tiene el mismo nombre que la indicada, si no creo una nueva XmlTreeNode* animationNode = searchForAnimation(safNode, animationName); if(animationNode == NULL){ animationNode = new XmlTreeNode("Animation", safNode); animationNode->addAttribute(new XmlNodeAttribute("Name", animationName)); safNode->addChild(animationNode); } // Agrego el keyframe XmlTreeNode* keyFrameNode = new XmlTreeNode("KeyFrame", animationNode); keyFrameNode->addAttribute(new XmlNodeAttribute("DurationInSeconds", StringUtils::toString(keyframe->animationTime))); ScaenaAnimationWriter::skeletonToXmlTree(keyFrameNode, keyframe->getRootSkeleton()); animationNode->addChild(keyFrameNode); // Grabo en el archivo SAF (REVIEW: podria dejar de escribir cada cambio en disco) XmlParser::writeXmlToFile(outAnimationFile.c_str(), xmlTree); } else{ throw new AnimationLoadException("No se puede procesar el SAF de entrada"); } } // Si no tengo SAF de entrada, creo la estructura de cero else{ list<AnimationDataTransfer*> animations; AnimationDataTransfer* animation = new AnimationDataTransfer(); animation->name = animationName; animation->keyframes->push_back(keyframe); animations.push_back(animation); // Escribo el SAF e indico que ahora tengo archivo de entrada ScaenaAnimationWriter::writeAnimation(outAnimationFile, &animations); inAnimationFile = outAnimationFile; } delete modelDataTransfer; delete keyframe; return true; }
bool World::Load(string name){ char filename[256]; XmlTree tree; sprintf(filename,"Worlds/%s.xml",name.c_str()); if(FileFinder::Find(filename)){ if(tree.LoadFromFile(FileFinder::GetString())){ return Load(&tree); } } return false; }
PlistReader::PlistReader() { XmlTree plist = XmlTree(loadResource( "RECIPES.plist" ) ); console() << "this is the tag name... " << plist.getTag() << "IS THIS A DOC ELEMENT OR WAHAT???? " << plist.isDocument() << endl; try { root = plist.getChild("plist"); } catch(XmlTree::Exception e){ console() << "darn" << endl; } //trace(root); parseRecipes(); }
void FlickrTestApp::setup() { glEnable( GL_TEXTURE_2D ); const XmlTree xml( loadUrl( Url( "http://api.flickr.com/services/feeds/groups_pool.gne?id=1423039@N24&lang=en-us&format=rss_200" ) ) ); for( XmlTree::ConstIter item = xml.begin( "rss/channel/item" ); item != xml.end(); ++item ) { mUrls.push_back( item->getChild( "media:content" ).getAttributeValue<Url>( "url" ) ); } createTextureFromURL(); lastTime = getElapsedSeconds(); activeTex = 0; }
void UnitParticleSystemType::load(const string &dir, const string &path, RendererInterface *renderer){ try{ XmlTree xmlTree; xmlTree.load(path); const XmlNode *particleSystemNode= xmlTree.getRootNode(); UnitParticleSystemType::load(particleSystemNode, dir, renderer); } catch(const exception &e){ SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what()); throw runtime_error("Error loading ParticleSystem: "+ path + "\n" +e.what()); } }
XmlTree* ObjectLoader::objectToXlmTree(Object* object){ XmlTree* xmlTree = new XmlTree(); XmlTreeNode* node = xmlTree->getRootNode(); XmlTreeNode* objectNode = new XmlTreeNode("Object", node); node->addChild(objectNode); objectNode->createAttribute("id", object->getId()); objectNode->createAttribute("class", "Object"); objectNode->createAttribute("meshPath", object->getMesh()->getFilePath()); //Escribo el mesh asociado en nodos writeFullMeshToNodes(objectNode, object->getMesh()); //Escribo las luces asociadas al objeto writeAllLightsToNodes(objectNode, object->getAttachedLights()); return xmlTree; }
static void starttag ( void * userdata, const XML_Char * name, const XML_Char * attr[] ) { XmlTree ** curnode = (XmlTree **) userdata; XmlTree * node = new XmlTree (*curnode, name); (*curnode)->AddChild (node); *curnode = node; for (int i = 0 ; attr[i] != NULL && attr[i+1] != NULL ; i += 2) node->AddAttrib (attr[i], attr[i+1]); }
ci::ColorA QTimeline::getThemeColor( XmlTree tree, string tag ) { ColorA col; if ( tree.hasChild( tag ) ) { tree = tree.getChild(tag); col = ColorA( tree.getAttributeValue<float>("r"), tree.getAttributeValue<float>("g"), tree.getAttributeValue<float>("b"), tree.getAttributeValue<float>("a") ); } return col; }
void WarpPerspectiveBilinear::fromXml(const XmlTree &xml) { WarpBilinear::fromXml(xml); // get corners unsigned i = 0; for(XmlTree::ConstIter child=xml.begin("corner");child!=xml.end();++child) { float x = child->getAttributeValue<float>("x", 0.0f); float y = child->getAttributeValue<float>("y", 0.0f); mWarp->setControlPoint(i, Vec2f(x, y)); i++; } }
void XMLTestApp::mouseDown( MouseEvent event ) { XmlTree doc = XmlTree::createDoc(); XmlTree library( "library", "" ); XmlTree album( "album", "" ); album.setAttribute( "musician", "Sufjan Stevens" ); album.setAttribute( "year", "2004" ); album.push_back( XmlTree( "title", "Seven Swans" ) ); album.push_back( XmlTree( "track", "All the Trees of the Field Will Clap Their Hands" ) ); album.push_back( XmlTree( "track", "The Dress Looks Nice on You" ) ); album.push_back( XmlTree( "track", "In the Devil's Territory" ) ); album.push_back( XmlTree( "track", "To Be Alone With You" ) ); library.push_back( album ); doc.push_back( library ); console() << doc; doc.write( writeFile( getHomeDirectory() / "testoutput.xml" ), false ); }
XmlTree* XmlTree::getNodePtr( const string &relativePath, bool caseSensitive, char separator ) const { XmlTree *curNode = const_cast<XmlTree*>( this ); vector<string> pathComponents = split( relativePath, separator ); for( vector<string>::const_iterator pathIt = pathComponents.begin(); pathIt != pathComponents.end(); ++pathIt ) { if( pathIt->empty() ) continue; Container::const_iterator node = XmlTree::findNextChildNamed( curNode->getChildren(), curNode->getChildren().begin(), *pathIt, caseSensitive ) ; if( node != curNode->getChildren().end() ) curNode = const_cast<XmlTree*>( node->get() ); else return 0; } return curNode; }
UserArea::UserArea(XmlTree area, PhidgetConnector *pc_) { // okay so if theres attributes aren't here, it bugs out it would seem? pos = Vec2f(area.getAttributeValue<float>( "centerX" ), area.getAttributeValue<float>( "centerY" )); angle = area.getAttributeValue<float>( "angle" ); key = area.getAttributeValue<char>( "key" ); // this should be loading from the XML. background = "area_background.png"; // there is some serious abstracting to be done here string activeArea_str = "active_area.png"; bg_img.load(background); activeArea_img.load(activeArea_str); // really, still? hmmm // mTexture = gl::Texture( loadImage( loadResource( background ) ) ); vector<string> videos; for( XmlTree::Iter child = area.begin(); child != area.end(); ++child) { if ( child->getTag() == "video" ) videos.push_back(child->getValue()); else if ( child->getTag() == "button" ) { XmlTree b = *child; //buttons.push_back(Button::Button(b/*, &UserArea::nextMovie*/)); buttons.push_back(TwoStateButton(b)); buttonStates.push_back(false); // void (UserArea::*func)() = &UserArea::nextMovie; /* void (*func)() = &printTest; func(); */ } } player = VideoPlayer ( Rectf(0, 0, 640, 480), videos); frameCount = rand() % 628; pc = pc_; }
RobotInterface::Status ExampleOpenLoopPIDControlModule::RobotInit(){ // Sensors and actuators mSensorsGroup.SetSensorsList(mRobot->GetSensors()); mActuatorsGroup.SetActuatorsList(mRobot->GetActuators()); mJointTorques.Resize(mRobot->GetDOFCount()); mJointTarget.Resize(mRobot->GetDOFCount()); //mJointTorques.Print(); if(mInternalRobot.Load(mRobot->GetType(),mRobot->GetSubType(),"")){ cout << "Internal robot loaded as a copy of main robbot"<<endl; }else{ cout << "Failed loading internal robot"<<endl; exit(0); } mInternalSensorsGroup.SetSensorsList(mInternalRobot.GetSensors()); mInternalActuatorsGroup.SetActuatorsList(mInternalRobot.GetActuators()); // Inverse dynamics mInvDynamics.SetRobot(mRobot); mInvDynamics.Init(); mInvDynamics.SetGravityCompensationOnly(true); XmlTree tree; tree.LoadFromFile("./data/packages/WAMRobotModel/Misc/WAMDefaultPID.xml"); mPIDCtrl.Init(&tree); mState = 0; if(GetConsole()){ AddConsoleCommand("Rest"); AddConsoleCommand("Hit"); AddConsoleCommand("GComp"); GetConsole()->Print("Available commands are GComp Rest and Hit"); } return STATUS_OK; }
void Warp::fromXml( const XmlTree &xml ) { mControlsX = xml.getAttributeValue<int>( "width", 2 ); mControlsY = xml.getAttributeValue<int>( "height", 2 ); mBrightness = xml.getAttributeValue<float>( "brightness", 1.0f ); // load control points mPoints.clear(); for( auto child = xml.begin( "controlpoint" ); child != xml.end(); ++child ) { float x = child->getAttributeValue<float>( "x", 0.0f ); float y = child->getAttributeValue<float>( "y", 0.0f ); mPoints.push_back( vec2( x, y ) ); } // load blend params auto blend = xml.find( "blend" ); if( blend != xml.end() ) { mExponent = blend->getAttributeValue<float>( "exponent", mExponent ); auto edges = blend->find( "edges" ); if( edges != blend->end() ) { mEdges.x = edges->getAttributeValue<float>( "left", mEdges.x ); mEdges.y = edges->getAttributeValue<float>( "top", mEdges.y ); mEdges.z = edges->getAttributeValue<float>( "right", mEdges.z ); mEdges.w = edges->getAttributeValue<float>( "bottom", mEdges.w ); } auto gamma = blend->find( "gamma" ); if( gamma != blend->end() ) { mGamma.x = gamma->getAttributeValue<float>( "red", mGamma.x ); mGamma.y = gamma->getAttributeValue<float>( "green", mGamma.y ); mGamma.z = gamma->getAttributeValue<float>( "blue", mGamma.z ); } auto luminance = blend->find( "luminance" ); if( luminance != blend->end() ) { mLuminance.x = luminance->getAttributeValue<float>( "red", mLuminance.x ); mLuminance.y = luminance->getAttributeValue<float>( "green", mLuminance.y ); mLuminance.z = luminance->getAttributeValue<float>( "blue", mLuminance.z ); } } // reconstruct warp mIsDirty = true; }
XmlTree WarpPerspectiveBilinear::toXml() const { XmlTree xml = WarpBilinear::toXml(); // set corners for(unsigned i=0;i<4;++i) { Vec2f corner = mWarp->getControlPoint(i); XmlTree cp; cp.setTag("corner"); cp.setAttribute("x", corner.x); cp.setAttribute("y", corner.y); xml.push_back(cp); } return xml; }
void LevelLoader::LoadTutorialLevelNames(std::vector<std::string>* levelsWithTutorials) { FRAMEWORK->GetLogger()->dbglog("\nLoading tutorials from file: %s", tutorialXmlPath); XmlParser* parser = new XmlParser(); parser->ParseXmlFile(FRAMEWORK->GetFileSystemUtils()->GetDeviceBaseResourcesPath() + tutorialXmlPath); XmlTree* xmlTree = parser->GetXmlTree(); ASSERT(xmlTree != nullptr, "Got valid xmlTree from parser for level file %s", tutorialXmlPath); XmlNode* rootTutorialsNode = xmlTree->GetRootNode(); ASSERT(rootTutorialsNode != nullptr, "Got valid tutoral node from xml tree for tutorial file %s", tutorialXmlPath); for(XmlNode* tutorialNode : rootTutorialsNode->GetChildren()) { FRAMEWORK->GetLogger()->dbglog("\n Loaded tutorial data for level: %s", tutorialNode->GetAttributeValueS(NAME_ATTRIBUTE).c_str()); levelsWithTutorials->push_back(tutorialNode->GetAttributeValueS(NAME_ATTRIBUTE)); } delete parser; }