From cfb19182e6854a7745082909700dafde42c8dd0f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 19 Apr 2011 14:11:13 +0000 Subject: [PATCH] From Bradley Anderegg, "The first change just exposes the archive extension list so that external applications can determine if an archive extension is valid. The second change is a bug fix in Registry::read(const ReadFunctor&) where if you pass in valid options they get wiped out after the archive is loaded but before being passed along to the plugin." --- include/osgDB/Registry | 4 +++- src/osgDB/Registry.cpp | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/osgDB/Registry b/include/osgDB/Registry index 2a0858ac9..958791a7d 100644 --- a/include/osgDB/Registry +++ b/include/osgDB/Registry @@ -485,6 +485,9 @@ class OSGDB_EXPORT Registry : public osg::Referenced /** Get the ObjectWrapperManager that is used to store all the ObjectWrappers. */ DeprecatedDotOsgWrapperManager* getDeprecatedDotOsgObjectWrapperManager() { return _deprecatedDotOsgWrapperManager.get(); } + typedef std::vector< std::string> ArchiveExtensionList; + const ArchiveExtensionList& getArchiveExtensions() const { return _archiveExtList; } + protected: virtual ~Registry(); @@ -492,7 +495,6 @@ class OSGDB_EXPORT Registry : public osg::Referenced typedef std::vector< osg::ref_ptr > DynamicLibraryList; typedef std::map< std::string, std::string> ExtensionAliasMap; typedef std::map< std::string, std::string> MimeTypeExtensionMap; - typedef std::vector< std::string> ArchiveExtensionList; typedef std::pair, double > ObjectTimeStampPair; typedef std::map ObjectCache; diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp index 062f837a6..1bae8c593 100644 --- a/src/osgDB/Registry.cpp +++ b/src/osgDB/Registry.cpp @@ -1036,7 +1036,12 @@ ReaderWriter::ReadResult Registry::read(const ReadFunctor& readFunctor) osgDB::Archive* archive = result.getArchive(); - osg::ref_ptr options = new Options; + //if valid options were passed through the read functor clone them + //otherwise make new options + osg::ref_ptr options = readFunctor._options ? + readFunctor._options->cloneOptions() : + new osgDB::ReaderWriter::Options; + options->setDatabasePath(archiveName); return archive->readObject(fileName,options.get());