This looks like it was a pain in the butt. Thanks for adding this interface.
Is there any way we can get the supported entry point info that osgio -csv
was capable of displaying? (You know, a plugin says it supports format ABC,
but does that mean it can read ABC as a Node? Or write it as an Image? An
Object? Etc.)
-Paul
Hi All,
Yesterday I did a review of Paul Mart'z little osgio app that
queried the OSG plugins for what facilities they had. I
haven't merged Paul's changes as I feel they tackle the task
of querying plugins in a way that can be bettered if we just
refactor the OSG's plugin API a little. So... rather than
dally around I just go the bit between my teeth and
implemented this extra API. This API is then implemented in
the plugins to allow more information to be externally querried, and
extra options in osgconv compliment this. The new API is in
osgDB::ReaderWriter in the form a a few new methods:
class osgDB::ReaderWriter {
public:
...
typedef std::mapstd::string, std::string
FormatDescriptionMap;
/** return which protocols are supported by ReaderWriter. */
virtual const FormatDescriptionMap
supportedProtocols() const { return _supportedProtocols; }
/** return which list of file extensions supported by
ReaderWriter. */
virtual const FormatDescriptionMap
supportedExtensions() const { return _supportedExtensions; }
/** return which list of file extensions supported by
ReaderWriter. */
virtual const FormatDescriptionMap
supportedOptions() const { return _supportedOptions; }
And a couple of continence methods for populating these maps:
protected:
void supportsProtocol(const std::string fmt, const
std::string description);
void supportsExtension(const std::string fmt, const
std::string description);
void supportsOption(const std::string fmt, const
std::string description);
The plugin now have calls to supports*() in their constructors like:
FLTReaderWriter()
: _implicitPath( . )
{
supportsExtension(flt,OpenFlight format);
supportsOption(clampToEdge,);
supportsOption(keepExternalReferences,);
supportsOption(preserveFace,);
supportsOption(preserveObject,);
supportsOption(dofAnimation,);
supportsOption(billboardCenter,);
supportsOption(noTextureAlphaForTransparancyBinning,);
supportsOption(readObjectRecordData,);
supportsOption(noUnitsConversion,);
supportsOption(convertToFeet,);
supportsOption(convertToInches,);
supportsOption(convertToMeters,);
supportsOption(convertToKilometers,);
supportsOption(convertToNauticalMiles,);
}
This is what I've added into the OpenFlight loaders one, You
can have multiple formats supported by one plugin of course
so this then looks like (From the xine plugin):
ReaderWriterXine()
{
supportsExtension(avi,);
supportsExtension(db,);
supportsExtension(flv,);
supportsExtension(mov,);
supportsExtension(mpg,Mpeg movie format);
supportsExtension(mpv,Mpeg movie format);
supportsExtension(wmv,);
supportsExtension(xine,Xine plugin Pseduo plugin);
Now there are quite a few description fields left as , but
this is something the community can help fill out - there is
only so much much RSI can take with this type of stuff
(yesterday I updated all 58
plugins with this stuff, ack what an awful job...)Anyway the
result of this effort is that you can now go query the
plugins, and to do this I've added two new parameters to
osgconv, --plugins lists the path to all the plugins, and
--formats lists all the supported protocols, formats and
options. What the results look like on my system is appended
below as an appendix :-)
This is just a first step, others are welcome to dive in add better
descriptions, more query options in osgconv. We could possibly also
move the functions used into osgDB, as well as move the
command line query support into a osginfo or osg-config
application. However, we are really close to 2.6 so my main
interest is stability right now,
rather than introducing lots of new tools etc. I'd be happy to see
all this functionality mature fully once 2.6 is out.
Cheers,
Robert.
osgconv --plugins
Plugin /home/robert/OpenSceneGraph/lib/osgPlugins-2.5.4/osgdb_bmp.so
Plugin /home/robert/OpenSceneGraph/lib/osgPlugins-2.5.4/osgdb_cfg.so
Plugin /home/robert/OpenSceneGraph/lib/osgPlugins-2.5.4/osgdb_dae.so
Plugin /home/robert/OpenSceneGraph/lib/osgPlugins-2.5.4/osgdb_dds.so
Plugin /home/robert/OpenSceneGraph/lib/osgPlugins-2.5.4/osgdb_dxf.so
Plugin