next steps.

pull/2966/head
Kim Kulling 2020-01-27 22:18:48 +01:00
parent 8ef106e185
commit 0cb236bae3
1 changed files with 24 additions and 9 deletions

View File

@ -443,7 +443,7 @@ void AMFImporter::ParseNode_Root(XmlNode *root) {
// 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 - <amf>.
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 <object>.
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;