Fix Colladat import.

pull/2966/head
Kim Kulling 2020-09-04 07:33:10 +02:00
parent be5089ae40
commit 689406fbda
4 changed files with 14 additions and 7 deletions

View File

@ -327,9 +327,8 @@ void AMFImporter::ParseNode_Root() {
} else if (currentName == "metadata") {
ParseNode_Metadata(currentNode);
}
mNodeElement_Cur = ne; // force restore "current" element
}
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

@ -134,7 +134,7 @@ void AMFImporter::ParseNode_Vertex(XmlNode &node) {
ParseNode_Coordinates(coordNode);
coord_read = true;
}
if (!coord_read && !coord_read) {
if (!coord_read && !col_read) {
mNodeElement_Cur->Child.push_back(ne); // Add element to child list of current element
}

View File

@ -739,7 +739,9 @@ void AMFImporter::Postprocess_BuildScene(aiScene *pScene) {
} // for(const CAMFImporter_NodeElement* ne: mNodeElement_List)
// Check if root element are found.
if (root_el == nullptr) throw DeadlyImportError("Root(<amf>) element not found.");
if (root_el == nullptr) {
throw DeadlyImportError("Root(<amf>) element not found.");
}
// after that walk through children of root and collect data. Five types of nodes can be placed at top level - in <amf>: <object>, <material>, <texture>,
// <constellation> and <metadata>. But at first we must read <material> and <texture> because they will be used in <object>. <metadata> can be read
@ -748,7 +750,9 @@ void AMFImporter::Postprocess_BuildScene(aiScene *pScene) {
// 1. <material>
// 2. <texture> will be converted later when processing triangles list. \sa Postprocess_BuildMeshSet
for (const AMFNodeElementBase *root_child : root_el->Child) {
if (root_child->Type == AMFNodeElementBase::ENET_Material) Postprocess_BuildMaterial(*((AMFMaterial *)root_child));
if (root_child->Type == AMFNodeElementBase::ENET_Material) {
Postprocess_BuildMaterial(*((AMFMaterial *)root_child));
}
}
// After "appearance" nodes we must read <object> because it will be used in <constellation> -> <instance>.

View File

@ -621,7 +621,9 @@ void ColladaParser::ReadController(XmlNode &node, Collada::Controller &pControll
} else if (currentName == "skin") {
pController.mMeshId = currentNode.attribute("source").as_string();
} else if (currentName == "bind_shape_matrix") {
const char *content = currentNode.value();
std::string v;
XmlParser::getValueAsString(currentNode, v);
const char *content = v.c_str();
for (unsigned int a = 0; a < 16; a++) {
// read a number
content = fast_atoreal_move<ai_real>(content, pController.mBindShapeMatrix[a]);
@ -2163,7 +2165,9 @@ void ColladaParser::ReadNodeTransformation(XmlNode &node, Node *pNode, Transform
// how many parameters to read per transformation type
static const unsigned int sNumParameters[] = { 9, 4, 3, 3, 7, 16 };
const char *content = node.value();
std::string value;
XmlParser::getValueAsString(node, value);
const char *content = value.c_str();
// read as many parameters and store in the transformation
for (unsigned int a = 0; a < sNumParameters[pType]; a++) {