Added --plugins and --formats query support into osgconv to help with querying the

available plugins and the file formats/protocols they support
This commit is contained in:
Robert Osfield
2008-07-14 20:22:38 +00:00
parent 5ab4af80c5
commit f22c06acbe
3 changed files with 96 additions and 3 deletions

View File

@@ -39,3 +39,33 @@ FileNameList osgDB::listAllAvailablePlugins()
return pluginFiles;
}
bool osgDB::queryPlugin(const std::string& fileName, ReaderWriterInfoList& infoList)
{
if (osgDB::Registry::instance()->loadLibrary(fileName))
{
const Registry::ReaderWriterList& rwList = osgDB::Registry::instance()->getReaderWriterList();
for(Registry::ReaderWriterList::const_iterator itr = rwList.begin();
itr != rwList.end();
++itr)
{
const ReaderWriter* rw = itr->get();
osg::ref_ptr<ReaderWriterInfo> rwi = new ReaderWriterInfo;
rwi->plugin = fileName;
rwi->description = rw->className();
rwi->protocols = rw->supportedProtocols();
rwi->extensions = rw->supportedExtensions();
rwi->options = rw->supportedOptions();
infoList.push_back(rwi.get());
}
osgDB::Registry::instance()->closeLibrary(fileName);
return true;
}
else
{
return false;
}
}