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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user