Changeset 11123

Show
Ignore:
Timestamp:
02/26/10 10:33:48 (5 years ago)
Author:
robert
Message:

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."

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgPlugins/3ds/WriterNodeVisitor.cpp

    r11056 r11123  
    9797    if (extendedFilePaths) return true;        // Extended paths are simply those that fits the 64 bytes buffer! 
    9898 
    99     unsigned int tokenBegin = 0; 
    100     for (unsigned int tokenEnd=0; tokenEnd != std::string::npos; tokenBegin = tokenEnd+1) { 
     99    // For each subdirectory 
     100    unsigned int tokenLen; 
     101    for (unsigned int tokenBegin=0, tokenEnd=0; tokenEnd == std::string::npos; tokenBegin = tokenEnd+1) 
     102    { 
    101103        tokenEnd = s.find_first_of("/\\", tokenBegin); 
    102         if ( !is83(s.substr(tokenBegin, tokenEnd-tokenBegin-1)) ) return false; 
     104        if (tokenEnd != std::string::npos) tokenLen = tokenEnd-tokenBegin-1;        // -1 to avoid reading the separator 
     105        else tokenLen = len-tokenBegin; 
     106        if ( tokenLen>0 && !is83(s.substr(tokenBegin, tokenLen)) ) return false; 
    103107    } 
    104108    return true;