Fixed the writeNode function so it was properly return FILE_NOT_HANDLED, fixing

a big with it writing out an empty .flt file.
This commit is contained in:
Robert Osfield
2006-11-07 17:00:29 +00:00
parent c607a6dd7f
commit ac9a28051f

View File

@@ -240,11 +240,19 @@ class FLTReaderWriter : public ReaderWriter
return WriteResult::FILE_NOT_HANDLED;
}
virtual WriteResult writeNode(const Node& node,const std::string& fileName, const osgDB::ReaderWriter::Options* options) const
virtual WriteResult writeNode(const Node& /*node*/,const std::string& /*fileName*/, const osgDB::ReaderWriter::Options* /*options*/) const
{
return WriteResult::FILE_NOT_HANDLED;
#if 0
// following code creates a blank file even though file write isn't supported, so have #if'd out implementation.
// can only presume the author implementated the following is with a final write flt support in mind.
// Robert Osfield, Novemeber 2006.
std::string ext = getFileExtension(fileName);
if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED;
// code for setting up the database path so that internally referenced file are searched for on relative paths.
osg::ref_ptr<Options> local_opt = options ? static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options;
if(local_opt->getDatabasePathList().empty())
@@ -253,7 +261,8 @@ class FLTReaderWriter : public ReaderWriter
std::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary);
WriteResult result = writeNode(node, fout, local_opt.get());
fout.close();
return result;
return result;
#endif
}
virtual WriteResult writeObject(const Object& object,std::ostream& fout, const osgDB::ReaderWriter::Options* options) const
@@ -266,7 +275,6 @@ class FLTReaderWriter : public ReaderWriter
virtual WriteResult writeNode(const Node& /*node*/,std::ostream& /*fout*/, const osgDB::ReaderWriter::Options* /*options*/) const
{
return WriteResult::FILE_NOT_HANDLED;
}
protected: