fix collada data parsing.
parent
14d6141f69
commit
c4039d5cf0
|
@ -256,6 +256,7 @@ void ColladaParser::ReadContents(XmlNode &node) {
|
|||
void ColladaParser::ReadStructure(XmlNode &node) {
|
||||
for (XmlNode currentNode = node.first_child(); currentNode; currentNode = currentNode.next_sibling()) {
|
||||
const std::string name = std::string(currentNode.name());
|
||||
ASSIMP_LOG_DEBUG("last name" + name);
|
||||
if (name == "asset")
|
||||
ReadAssetInfo(currentNode);
|
||||
else if (name == "library_animations")
|
||||
|
@ -404,6 +405,9 @@ void ColladaParser::PostProcessControllers() {
|
|||
std::string meshId;
|
||||
for (ControllerLibrary::iterator it = mControllerLibrary.begin(); it != mControllerLibrary.end(); ++it) {
|
||||
meshId = it->second.mMeshId;
|
||||
if (meshId.empty()) {
|
||||
continue;
|
||||
}
|
||||
ControllerLibrary::iterator findItr = mControllerLibrary.find(meshId);
|
||||
while (findItr != mControllerLibrary.end()) {
|
||||
meshId = findItr->second.mMeshId;
|
||||
|
@ -1404,6 +1408,7 @@ void ColladaParser::ReadDataArray(XmlNode &node) {
|
|||
XmlParser::getUIntAttribute(node, "count", count);
|
||||
std::string v;
|
||||
XmlParser::getValueAsString(node, v);
|
||||
trim(v);
|
||||
const char *content = v.c_str();
|
||||
|
||||
// read values and store inside an array in the data library
|
||||
|
|
|
@ -162,4 +162,24 @@ AI_FORCE_INLINE std::string Rgba2Hex(int r, int g, int b, int a, bool with_head)
|
|||
return ss.str();
|
||||
}
|
||||
|
||||
// trim from start (in place)
|
||||
inline void ltrim(std::string &s) {
|
||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) {
|
||||
return !std::isspace(ch);
|
||||
}));
|
||||
}
|
||||
|
||||
// trim from end (in place)
|
||||
inline void rtrim(std::string &s) {
|
||||
s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) {
|
||||
return !std::isspace(ch);
|
||||
}).base(),s.end());
|
||||
}
|
||||
|
||||
// trim from both ends (in place)
|
||||
inline void trim(std::string &s) {
|
||||
ltrim(s);
|
||||
rtrim(s);
|
||||
}
|
||||
|
||||
#endif // INCLUDED_AI_STRINGUTILS_H
|
||||
|
|
Loading…
Reference in New Issue