diff --git a/src/Application/SettingsLoader.cpp b/src/Application/SettingsLoader.cpp index 4a0cb46..aa62f84 100644 --- a/src/Application/SettingsLoader.cpp +++ b/src/Application/SettingsLoader.cpp @@ -236,53 +236,71 @@ BaseSurface * SettingsLoader::getTriangleSurface(ofxXmlSettings * xmlSettings){ BaseSurface * SettingsLoader::getQuadSurface(ofxXmlSettings * xmlSettings){ vector vertices; - xmlSettings->pushTag("vertex", 0); - vertices.push_back(ofVec2f(xmlSettings->getValue("x", 0.0f), - xmlSettings->getValue("y", 0.0f))); - xmlSettings->popTag(); - - xmlSettings->pushTag("vertex", 1); - vertices.push_back(ofVec2f(xmlSettings->getValue("x", 100.0f), - xmlSettings->getValue("y", 0.0f))); - xmlSettings->popTag(); - - xmlSettings->pushTag("vertex", 2); - vertices.push_back(ofVec2f(xmlSettings->getValue("x", 100.0f), - xmlSettings->getValue("y", 100.0f))); - xmlSettings->popTag(); - - xmlSettings->pushTag("vertex", 3); - vertices.push_back(ofVec2f(xmlSettings->getValue("x", 0.0f), - xmlSettings->getValue("y", 100.0f))); - xmlSettings->popTag(); + if(xmlSettings->tagExists("vertex", 0)){ + xmlSettings->pushTag("vertex", 0); + vertices.push_back(ofVec2f(xmlSettings->getValue("x", 0.0f), + xmlSettings->getValue("y", 0.0f))); + xmlSettings->popTag(); + } - xmlSettings->popTag(); // vertices + if(xmlSettings->tagExists("vertex", 1)){ + xmlSettings->pushTag("vertex", 1); + vertices.push_back(ofVec2f(xmlSettings->getValue("x", 100.0f), + xmlSettings->getValue("y", 0.0f))); + xmlSettings->popTag(); + } + + if(xmlSettings->tagExists("vertex", 2)){ + xmlSettings->pushTag("vertex", 2); + vertices.push_back(ofVec2f(xmlSettings->getValue("x", 100.0f), + xmlSettings->getValue("y", 100.0f))); + xmlSettings->popTag(); + } - xmlSettings->pushTag("texCoords"); + if(xmlSettings->tagExists("vertex", 3)){ + xmlSettings->pushTag("vertex", 3); + vertices.push_back(ofVec2f(xmlSettings->getValue("x", 0.0f), + xmlSettings->getValue("y", 100.0f))); + xmlSettings->popTag(); + } + xmlSettings->popTag(); // vertices + vector texCoords; - xmlSettings->pushTag("texCoord", 0); - texCoords.push_back(ofVec2f(xmlSettings->getValue("x", 0.0f), - xmlSettings->getValue("y", 0.0f))); - xmlSettings->popTag(); + if(xmlSettings->tagExists("texCoords")){ + xmlSettings->pushTag("texCoords"); - xmlSettings->pushTag("texCoord", 1); - texCoords.push_back(ofVec2f(xmlSettings->getValue("x", 1.0f), - xmlSettings->getValue("y", 0.0f))); - xmlSettings->popTag(); + if(xmlSettings->tagExists("texCoord", 0)){ + xmlSettings->pushTag("texCoord", 0); + texCoords.push_back(ofVec2f(xmlSettings->getValue("x", 0.0f), + xmlSettings->getValue("y", 0.0f))); + xmlSettings->popTag(); + } + + if(xmlSettings->tagExists("texCoord", 1)){ + xmlSettings->pushTag("texCoord", 1); + texCoords.push_back(ofVec2f(xmlSettings->getValue("x", 1.0f), + xmlSettings->getValue("y", 0.0f))); + xmlSettings->popTag(); + } - xmlSettings->pushTag("texCoord", 2); - texCoords.push_back(ofVec2f(xmlSettings->getValue("x", 1.0f), - xmlSettings->getValue("y", 1.0f))); - xmlSettings->popTag(); + if(xmlSettings->tagExists("texCoord", 2)){ + xmlSettings->pushTag("texCoord", 2); + texCoords.push_back(ofVec2f(xmlSettings->getValue("x", 1.0f), + xmlSettings->getValue("y", 1.0f))); + xmlSettings->popTag(); + } - xmlSettings->pushTag("texCoord", 3); - texCoords.push_back(ofVec2f(xmlSettings->getValue("x", 0.0f), - xmlSettings->getValue("y", 1.0f))); - xmlSettings->popTag(); + if(xmlSettings->tagExists("texCoord", 3)){ + xmlSettings->pushTag("texCoord", 3); + texCoords.push_back(ofVec2f(xmlSettings->getValue("x", 0.0f), + xmlSettings->getValue("y", 1.0f))); + xmlSettings->popTag(); + } - xmlSettings->popTag(); // texCoords + xmlSettings->popTag(); // texCoords + } // Create and add quad surface BaseSurface * quadSurface =