fix duplicated node parsing.

pull/2966/head
kimkulling 2020-09-11 15:46:46 +02:00
parent c1f50e116a
commit d0932c405f
2 changed files with 5 additions and 14 deletions

View File

@ -84,7 +84,6 @@ ColladaParser::ColladaParser(IOSystem *pIOHandler, const std::string &pFile) :
mUnitSize(1.0f), mUnitSize(1.0f),
mUpDirection(UP_Y), mUpDirection(UP_Y),
mFormat(FV_1_5_n) { mFormat(FV_1_5_n) {
// validate io-handler instance
if (nullptr == pIOHandler) { if (nullptr == pIOHandler) {
throw DeadlyImportError("IOSystem is nullptr."); throw DeadlyImportError("IOSystem is nullptr.");
} }
@ -588,11 +587,11 @@ void ColladaParser::ReadControllerLibrary(XmlNode &node) {
return; return;
} }
for (XmlNode &currentNode : node.children()) { for (XmlNode &currentNode : node.children()) {
const std::string &currentName = currentNode.name(); const std::string &currentName = currentNode.name();
if (currentName != "controller") { if (currentName != "controller") {
continue;; continue;
;
} }
std::string id = node.attribute("id").as_string(); std::string id = node.attribute("id").as_string();
mControllerLibrary[id] = Controller(); mControllerLibrary[id] = Controller();
@ -1057,8 +1056,6 @@ void ColladaParser::ReadEffectProfileCommon(XmlNode &node, Collada::Effect &pEff
if (currentName == "newparam") { if (currentName == "newparam") {
// save ID // save ID
std::string sid = currentNode.attribute("sid").as_string(); std::string sid = currentNode.attribute("sid").as_string();
//std::string sid = GetAttribute("sid");
//= mReader->getAttributeValue(attrSID);
pEffect.mParams[sid] = EffectParam(); pEffect.mParams[sid] = EffectParam();
ReadEffectParam(currentNode, pEffect.mParams[sid]); ReadEffectParam(currentNode, pEffect.mParams[sid]);
} else if (currentName == "technique" || currentName == "extra") { } else if (currentName == "technique" || currentName == "extra") {
@ -1067,9 +1064,6 @@ void ColladaParser::ReadEffectProfileCommon(XmlNode &node, Collada::Effect &pEff
// read ID. Another entry which is "optional" by design but obligatory in reality // read ID. Another entry which is "optional" by design but obligatory in reality
std::string id = currentNode.attribute("id").as_string(); std::string id = currentNode.attribute("id").as_string();
//int attrID = GetAttribute("id");
//std::string id = mReader->getAttributeValue(attrID);
// create an entry and store it in the library under its ID // create an entry and store it in the library under its ID
mImageLibrary[id] = Image(); mImageLibrary[id] = Image();
@ -2010,10 +2004,7 @@ void ColladaParser::ReadSceneLibrary(XmlNode &node) {
return; return;
} }
XmlNodeIterator xmlIt(node); for (XmlNode currentNode : node.children()) {
xmlIt.collectChildrenPreOrder(node);
XmlNode currentNode;
while (xmlIt.getNext(currentNode)) {
const std::string &currentName = currentNode.name(); const std::string &currentName = currentNode.name();
if (currentName == "visual_scene") { if (currentName == "visual_scene") {
// read ID. Is optional according to the spec, but how on earth should a scene_instance refer to it then? // read ID. Is optional according to the spec, but how on earth should a scene_instance refer to it then?
@ -2032,7 +2023,7 @@ void ColladaParser::ReadSceneLibrary(XmlNode &node) {
sceneNode->mName = attrName; sceneNode->mName = attrName;
mNodeLibrary[sceneNode->mID] = sceneNode; mNodeLibrary[sceneNode->mID] = sceneNode;
ReadSceneNode(node, sceneNode); ReadSceneNode(currentNode, sceneNode);
} }
} }
} }

View File

@ -271,7 +271,7 @@ AI_FORCE_INLINE unsigned int tokenize(const string_type &str, std::vector<string
inline std::string ai_stdStrToLower(const std::string &str) { inline std::string ai_stdStrToLower(const std::string &str) {
std::string out(str); std::string out(str);
for (size_t i = 0; i < str.size(); ++i) { for (size_t i = 0; i < str.size(); ++i) {
out[i] =(char) tolower(out[i]); out[i] = (char) tolower(out[i]);
} }
return out; return out;
} }