Merge pull request #3988 from RichardTea/collada_makehuman_issue_3984
Collada: Read <matrix> tags properly, assume <input set="0"/> when not presentpull/3993/head^2
commit
22099605e3
|
@ -626,8 +626,6 @@ void ColladaParser::ReadController(XmlNode &node, Collada::Controller &controlle
|
||||||
XmlNodeIterator xmlIt(node, XmlNodeIterator::PreOrderMode);
|
XmlNodeIterator xmlIt(node, XmlNodeIterator::PreOrderMode);
|
||||||
XmlNode currentNode;
|
XmlNode currentNode;
|
||||||
while (xmlIt.getNext(currentNode)) {
|
while (xmlIt.getNext(currentNode)) {
|
||||||
|
|
||||||
//for (XmlNode ¤tNode : node.children()) {
|
|
||||||
const std::string ¤tName = currentNode.name();
|
const std::string ¤tName = currentNode.name();
|
||||||
if (currentName == "morph") {
|
if (currentName == "morph") {
|
||||||
controller.mType = Morph;
|
controller.mType = Morph;
|
||||||
|
@ -1439,9 +1437,8 @@ void ColladaParser::ReadDataArray(XmlNode &node) {
|
||||||
throw DeadlyImportError("Expected more values while reading float_array contents.");
|
throw DeadlyImportError("Expected more values while reading float_array contents.");
|
||||||
}
|
}
|
||||||
|
|
||||||
ai_real value;
|
|
||||||
// read a number
|
// read a number
|
||||||
//SkipSpacesAndLineEnd(&content);
|
ai_real value;
|
||||||
content = fast_atoreal_move<ai_real>(content, value);
|
content = fast_atoreal_move<ai_real>(content, value);
|
||||||
data.mValues.push_back(value);
|
data.mValues.push_back(value);
|
||||||
// skip whitespace after it
|
// skip whitespace after it
|
||||||
|
@ -1489,11 +1486,10 @@ void ColladaParser::ReadAccessor(XmlNode &node, const std::string &pID) {
|
||||||
std::string name;
|
std::string name;
|
||||||
if (XmlParser::hasAttribute(currentNode, "name")) {
|
if (XmlParser::hasAttribute(currentNode, "name")) {
|
||||||
XmlParser::getStdStrAttribute(currentNode, "name", name);
|
XmlParser::getStdStrAttribute(currentNode, "name", name);
|
||||||
//name = mReader->getAttributeValue(attrName);
|
|
||||||
|
|
||||||
// analyse for common type components and store it's sub-offset in the corresponding field
|
// analyse for common type components and store it's sub-offset in the corresponding field
|
||||||
|
|
||||||
/* Cartesian coordinates */
|
// Cartesian coordinates
|
||||||
if (name == "X")
|
if (name == "X")
|
||||||
acc.mSubOffset[0] = acc.mParams.size();
|
acc.mSubOffset[0] = acc.mParams.size();
|
||||||
else if (name == "Y")
|
else if (name == "Y")
|
||||||
|
@ -1674,11 +1670,8 @@ void ColladaParser::ReadInputChannel(XmlNode &node, std::vector<InputChannel> &p
|
||||||
|
|
||||||
// read set if texture coordinates
|
// read set if texture coordinates
|
||||||
if (channel.mType == IT_Texcoord || channel.mType == IT_Color) {
|
if (channel.mType == IT_Texcoord || channel.mType == IT_Color) {
|
||||||
int attrSet = -1;
|
unsigned int attrSet = 0;
|
||||||
if (XmlParser::hasAttribute(node, "set")) {
|
if (XmlParser::getUIntAttribute(node, "set", attrSet))
|
||||||
XmlParser::getIntAttribute(node, "set", attrSet);
|
|
||||||
}
|
|
||||||
|
|
||||||
channel.mIndex = attrSet;
|
channel.mIndex = attrSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2170,10 +2163,10 @@ void ColladaParser::ReadNodeTransformation(XmlNode &node, Node *pNode, Transform
|
||||||
|
|
||||||
// read as many parameters and store in the transformation
|
// read as many parameters and store in the transformation
|
||||||
for (unsigned int a = 0; a < sNumParameters[pType]; a++) {
|
for (unsigned int a = 0; a < sNumParameters[pType]; a++) {
|
||||||
|
// skip whitespace before the number
|
||||||
|
SkipSpacesAndLineEnd(&content);
|
||||||
// read a number
|
// read a number
|
||||||
content = fast_atoreal_move<ai_real>(content, tf.f[a]);
|
content = fast_atoreal_move<ai_real>(content, tf.f[a]);
|
||||||
// skip whitespace after it
|
|
||||||
SkipSpacesAndLineEnd(&content);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// place the transformation at the queue of the node
|
// place the transformation at the queue of the node
|
||||||
|
|
Binary file not shown.
|
@ -382,3 +382,25 @@ public:
|
||||||
TEST_F(utColladaZaeImportExport, importBlenFromFileTest) {
|
TEST_F(utColladaZaeImportExport, importBlenFromFileTest) {
|
||||||
EXPECT_TRUE(importerTest());
|
EXPECT_TRUE(importerTest());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(utColladaZaeImportExport, importMakeHumanTest) {
|
||||||
|
Assimp::Importer importer;
|
||||||
|
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/Collada/human.zae", aiProcess_ValidateDataStructure);
|
||||||
|
ASSERT_NE(nullptr, scene);
|
||||||
|
|
||||||
|
// Expected number of items
|
||||||
|
EXPECT_EQ(scene->mNumMeshes, 2u);
|
||||||
|
EXPECT_EQ(scene->mNumMaterials, 2u);
|
||||||
|
EXPECT_EQ(scene->mNumAnimations, 0u);
|
||||||
|
EXPECT_EQ(scene->mNumTextures, 2u);
|
||||||
|
EXPECT_EQ(scene->mNumLights, 0u);
|
||||||
|
EXPECT_EQ(scene->mNumCameras, 0u);
|
||||||
|
|
||||||
|
// Expected common metadata
|
||||||
|
aiString value;
|
||||||
|
EXPECT_TRUE(scene->mMetaData->Get(AI_METADATA_SOURCE_FORMAT, value)) << "No importer format metadata";
|
||||||
|
EXPECT_STREQ("Collada Importer", value.C_Str());
|
||||||
|
|
||||||
|
EXPECT_TRUE(scene->mMetaData->Get(AI_METADATA_SOURCE_FORMAT_VERSION, value)) << "No format version metadata";
|
||||||
|
EXPECT_STREQ("1.4.1", value.C_Str());
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue