Added support for "-O OutputTextureFiles" options string in .osg plugin to
allow texture files to be written out when writing out a .osg file.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
#include "osgDB/WriteFile"
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
@@ -61,9 +62,22 @@ bool TextureRectangle_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const TextureRectangle& texture = static_cast<const TextureRectangle&>(obj);
|
||||
|
||||
if (texture.getImage() && !(texture.getImage()->getFileName().empty()))
|
||||
if (texture.getImage())
|
||||
{
|
||||
fw.indent() << "file "<<fw.wrapString(fw.getFileNameForOutput(texture.getImage()->getFileName()))<< std::endl;
|
||||
std::string fileName = texture.getImage()->getFileName();
|
||||
if (fw.getOutputTextureFiles())
|
||||
{
|
||||
if (fileName.empty())
|
||||
{
|
||||
fileName = fw.getTextureFileNameForOutput();
|
||||
}
|
||||
osgDB::writeImageFile(*texture.getImage(), fileName);
|
||||
}
|
||||
|
||||
if (!fileName.empty())
|
||||
{
|
||||
fw.indent() << "file "<<fw.wrapString(fw.getFileNameForOutput(fileName))<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user