Added creation of image directories when required
This commit is contained in:
parent
61c7ee76c5
commit
457d12d9b2
@ -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 )
|
||||
|
@ -447,9 +447,17 @@ OBJWriterNodeVisitor::OBJMaterial::OBJMaterial(osg::Material* mat, osg::Texture*
|
||||
{
|
||||
image = img->getFileName();
|
||||
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