From ac9a28051fc360a2949381e2f15c45165302e5a0 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 7 Nov 2006 17:00:29 +0000 Subject: [PATCH] Fixed the writeNode function so it was properly return FILE_NOT_HANDLED, fixing a big with it writing out an empty .flt file. --- src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp b/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp index bb26365e0..e3dc7bfb5 100644 --- a/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp +++ b/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp @@ -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 local_opt = options ? static_cast(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: