From 0cb236bae328a97f0e37f7ceb1093299f0f594d0 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 27 Jan 2020 22:18:48 +0100 Subject: [PATCH] next steps. --- code/AMF/AMFImporter.cpp | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/code/AMF/AMFImporter.cpp b/code/AMF/AMFImporter.cpp index b261af979..f52aa67bc 100644 --- a/code/AMF/AMFImporter.cpp +++ b/code/AMF/AMFImporter.cpp @@ -433,17 +433,17 @@ void AMFImporter::ParseNode_Root(XmlNode *root) { // create root node element. ne = new CAMFImporter_NodeElement_Root(nullptr); - // set first "current" element - mNodeElement_Cur = ne; + // set first "current" element + mNodeElement_Cur = ne; - // and assign attributes values + // and assign attributes values ((CAMFImporter_NodeElement_Root *)ne)->Unit = unit; ((CAMFImporter_NodeElement_Root *)ne)->Version = version; // Check for child nodes for (pugi::xml_node child : node->children()) { if (child.name() == "object") { - ParseNode_Object(); + ParseNode_Object(&child); } else if (child.name() == "material") { ParseNode_Material(); } else if (child.name() == "texture") { @@ -587,22 +587,37 @@ void AMFImporter::ParseNode_Instance() { // An object definition. // Multi elements - Yes. // Parent element - . -void AMFImporter::ParseNode_Object() { +void AMFImporter::ParseNode_Object(XmlNode *nodeInst) { std::string id; CAMFImporter_NodeElement *ne(nullptr); - + pugi::xml_node *node = nodeInst->getNode(); + for (pugi::xml_attribute_iterator ait = node->attributes_begin(); ait != node->attributes_end(); ++ait) { + if (ait->name() == "id") { + id = ait->as_string(); + } + } // Read attributes for node . - MACRO_ATTRREAD_LOOPBEG; + /*MACRO_ATTRREAD_LOOPBEG; MACRO_ATTRREAD_CHECK_RET("id", id, mReader->getAttributeValue); - MACRO_ATTRREAD_LOOPEND; + MACRO_ATTRREAD_LOOPEND;*/ // create and if needed - define new geometry object. ne = new CAMFImporter_NodeElement_Object(mNodeElement_Cur); CAMFImporter_NodeElement_Object &als = *((CAMFImporter_NodeElement_Object *)ne); // alias for convenience - if (!id.empty()) als.ID = id; + if (!id.empty()) { + als.ID = id; + } + // Check for child nodes + + for (pugi::xml_node_iterator it = node->children().begin(); it != node->children->end(); ++it) { + bool col_read = false; + if (it->name() == "mesh") { + ParseNode_Mesh( it ); + } + } if (!mReader->isEmptyElement()) { bool col_read = false;