Fix material-base AMF-unittest.

pull/2966/head
kimkulling 2020-09-10 13:56:04 +02:00
parent c2f0bf68af
commit cca9eddb1c
2 changed files with 15 additions and 9 deletions

View File

@ -86,8 +86,13 @@ void AMFImporter::Clear() {
}
}
AMFImporter::AMFImporter() AI_NO_EXCEPT : mNodeElement_Cur(nullptr),
mXmlParser(nullptr) {
AMFImporter::AMFImporter() AI_NO_EXCEPT :
mNodeElement_Cur(nullptr),
mXmlParser(nullptr),
mUnit(),
mVersion(),
mMaterial_Converted(),
mTexture_Converted() {
// empty
}
@ -295,15 +300,14 @@ void AMFImporter::ParseHelper_Node_Exit() {
// Root XML element.
// Multi elements - No.
void AMFImporter::ParseNode_Root() {
std::string unit, version;
AMFNodeElementBase *ne(nullptr);
AMFNodeElementBase *ne = nullptr;
XmlNode *root = mXmlParser->findNode("amf");
if (nullptr == root) {
throw DeadlyImportError("Root node \"amf\" not found.");
}
XmlNode node = *root;
unit = node.attribute("unit").as_string();
version = node.attribute("version").as_string();
mUnit = node.attribute("unit").as_string();
mVersion = node.attribute("version").as_string();
// Read attributes for node <amf>.
// Check attributes
@ -318,11 +322,11 @@ void AMFImporter::ParseNode_Root() {
mNodeElement_Cur = ne; // set first "current" element
// and assign attribute's values
((AMFRoot *)ne)->Unit = unit;
((AMFRoot *)ne)->Version = version;
((AMFRoot *)ne)->Unit = mUnit;
((AMFRoot *)ne)->Version = mVersion;
// Check for child nodes
for (XmlNode currentNode = node.first_child(); currentNode; currentNode = currentNode.next_sibling()) {
for (XmlNode &currentNode : node.children() ) {
const std::string currentName = currentNode.name();
if (currentName == "object") {
ParseNode_Object(currentNode);
@ -335,6 +339,7 @@ void AMFImporter::ParseNode_Root() {
} else if (currentName == "metadata") {
ParseNode_Metadata(currentNode);
}
mNodeElement_Cur = ne;
}
mNodeElement_Cur = ne; // force restore "current" element
mNodeElement_List.push_back(ne); // add to node element list because its a new object in graph.

View File

@ -301,6 +301,7 @@ private:
std::list<AMFNodeElementBase *> mNodeElement_List; ///< All elements of scene graph.
XmlParser *mXmlParser;
std::string mUnit;
std::string mVersion;
std::list<SPP_Material> mMaterial_Converted; ///< List of converted materials for postprocessing step.
std::list<SPP_Texture> mTexture_Converted; ///< List of converted textures for postprocessing step.
};