Fix parsing <instance_image> in <sampler2D>.
The regression was introduced in 904f17f
.
Since all the cases are now fully handled at the child level,
visiting the whole subtree is changed into iteration over the children.
pull/5305/head^2
parent
8648c2af45
commit
2235518b3c
|
@ -1274,9 +1274,7 @@ void ColladaParser::ReadEffectParam(XmlNode &node, Collada::EffectParam &pParam)
|
|||
return;
|
||||
}
|
||||
|
||||
XmlNodeIterator xmlIt(node, XmlNodeIterator::PreOrderMode);
|
||||
XmlNode currentNode;
|
||||
while (xmlIt.getNext(currentNode)) {
|
||||
for (XmlNode ¤tNode : node.children()) {
|
||||
const std::string ¤tName = currentNode.name();
|
||||
if (currentName == "surface") {
|
||||
// image ID given inside <init_from> tags
|
||||
|
@ -1289,22 +1287,24 @@ void ColladaParser::ReadEffectParam(XmlNode &node, Collada::EffectParam &pParam)
|
|||
}
|
||||
} else if (currentName == "sampler2D" && (FV_1_4_n == mFormat || FV_1_3_n == mFormat)) {
|
||||
// surface ID is given inside <source> tags
|
||||
const char *content = currentNode.value();
|
||||
pParam.mType = Param_Sampler;
|
||||
pParam.mReference = content;
|
||||
XmlNode source = currentNode.child("source");
|
||||
if (source) {
|
||||
std::string v;
|
||||
XmlParser::getValueAsString(source, v);
|
||||
pParam.mType = Param_Sampler;
|
||||
pParam.mReference = v.c_str();
|
||||
}
|
||||
} else if (currentName == "sampler2D") {
|
||||
// surface ID is given inside <instance_image> tags
|
||||
std::string url;
|
||||
XmlParser::getStdStrAttribute(currentNode, "url", url);
|
||||
if (url[0] != '#') {
|
||||
throw DeadlyImportError("Unsupported URL format in instance_image");
|
||||
}
|
||||
pParam.mType = Param_Sampler;
|
||||
pParam.mReference = url.c_str() + 1;
|
||||
} else if (currentName == "source") {
|
||||
const char *source = currentNode.child_value();
|
||||
if (nullptr != source) {
|
||||
pParam.mReference = source;
|
||||
XmlNode instance_image = currentNode.child("instance_image");
|
||||
if (instance_image) {
|
||||
std::string url;
|
||||
XmlParser::getStdStrAttribute(instance_image, "url", url);
|
||||
if (url[0] != '#') {
|
||||
throw DeadlyImportError("Unsupported URL format in instance_image");
|
||||
}
|
||||
pParam.mType = Param_Sampler;
|
||||
pParam.mReference = url.c_str() + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue