Changeset 10938

Show
Ignore:
Timestamp:
01/11/10 15:04:55 (5 years ago)
Author:
robert
Message:

From Sukender, "a small fix about using non 3-charcacters long file extensions (such as "jpeg", to be converted to "jpg")."

Files:
1 modified

Legend:

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

    r10932 r10938  
    426426} 
    427427 
     428/// Converts an extension to a 3-letters long one equivalent. 
     429std::string convertExt(const std::string & path) 
     430{ 
     431    std::string ext = osgDB::getFileExtensionIncludingDot(path); 
     432    if (ext == ".tiff") ext = ".tif"; 
     433    else if (ext == ".jpeg") ext = ".jpg"; 
     434    else if (ext == ".jpeg2000" || ext == ".jpg2000") ext = ".jpc"; 
     435    return osgDB::getNameLessExtension(path) + ext; 
     436} 
     437 
    428438void WriterNodeVisitor::writeMaterials() 
    429439{ 
     
    461471                    path = getPathRelative(_srcDirectory, mat.image->getFileName()); 
    462472                } 
     473                path = convertExt(path); 
     474 
    463475                if(!is3DSpath(path)) { 
    464476                    path = getUniqueName(path, "", true);