From Sukender, "I tried a tiny change in is83() function and had no crash (under Windows). "osgconv cow.osg cow.3ds" exports a black cow and "osgconv lz.osg lz.3ds" exports tree(s) at (0,0,0)... I guess there are still things to do about non-zero-index textures and multiple instanciation of a node, but at least it doesn't crash."

This commit is contained in:
Robert Osfield 2010-02-26 09:33:48 +00:00
parent 2e154d5976
commit eb23514478

View File

@ -96,10 +96,14 @@ bool is3DSpath(const std::string & s, bool extendedFilePaths) {
if (len >= 64 || len == 0) return false;
if (extendedFilePaths) return true; // Extended paths are simply those that fits the 64 bytes buffer!
unsigned int tokenBegin = 0;
for (unsigned int tokenEnd=0; tokenEnd != std::string::npos; tokenBegin = tokenEnd+1) {
// For each subdirectory
unsigned int tokenLen;
for (unsigned int tokenBegin=0, tokenEnd=0; tokenEnd == std::string::npos; tokenBegin = tokenEnd+1)
{
tokenEnd = s.find_first_of("/\\", tokenBegin);
if ( !is83(s.substr(tokenBegin, tokenEnd-tokenBegin-1)) ) return false;
if (tokenEnd != std::string::npos) tokenLen = tokenEnd-tokenBegin-1; // -1 to avoid reading the separator
else tokenLen = len-tokenBegin;
if ( tokenLen>0 && !is83(s.substr(tokenBegin, tokenLen)) ) return false;
}
return true;
}