Added creation of image directories when required
This commit is contained in:
parent
7b5eac73c8
commit
fb1dff845f
@ -495,6 +495,12 @@ void OutputStream::writeImage( const osg::Image* img )
|
||||
imageFileName = "image.dds";
|
||||
}
|
||||
|
||||
std::string imagePath = osgDB::getFilePath(imageFileName);
|
||||
if (!imagePath.empty() && !osgDB::fileExists(imagePath))
|
||||
{
|
||||
osgDB::makeDirectory(imagePath);
|
||||
}
|
||||
|
||||
bool result = osgDB::writeImageFile( *img, imageFileName );
|
||||
OSG_NOTICE << "OutputStream::writeImage(): Write image data to external file " << imageFileName << std::endl;
|
||||
if ( !result )
|
||||
|
@ -445,8 +445,16 @@ OBJWriterNodeVisitor::OBJMaterial::OBJMaterial(osg::Material* mat, osg::Texture*
|
||||
if ((img) && (!img->getFileName().empty()))
|
||||
{
|
||||
image = img->getFileName();
|
||||
if(outputTextureFiles)
|
||||
if (outputTextureFiles)
|
||||
{
|
||||
std::string imagePath = osgDB::getFilePath(image);
|
||||
if (!imagePath.empty() && !osgDB::fileExists(imagePath))
|
||||
{
|
||||
osgDB::makeDirectory(imagePath);
|
||||
}
|
||||
|
||||
osgDB::writeImageFile(*img, image, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user