Jean-Sébastien Guay schrieb:
Hi Ralf,

Please let me know what you think about such a feature - if it would be usefill and if there are any drawbacks or objections.

I think it's a great idea
Currently there are informations about protocol, extensions and command line options but there is no information about the type of the plugin and if a plugins supports reading and/or writing. These informations are for example required to check if one plugin is connectable to another plugin.

(not having looked at the implementation, just the concept).

After taking a deeper look into http://www.openscenegraph.org/projects/osg/wiki/Support/UserGuides/Plugins I splitted the "features" from the previous patch into the type of the plugin and a plugin direction attribute as shown below:

/// bit mask for setting up which plugin types are supported by a given plugin
       enum PluginTypes
       {
           PLUGIN_TYPE_NONE = 0,
           PLUGIN_TYPE_GENERIC = 1<<0,
           PLUGIN_TYPE_3D_DATABASE = 1<<1,
           PLUGIN_TYPE_MOVIE = 1<<2,
           PLUGIN_TYPE_IMAGE = 1<<3,
           PLUGIN_TYPE_ARCHIVE = 1<<4,
           PLUGIN_TYPE_NETWORK = 1<<5,
           PLUGIN_TYPE_FONT = 1<<6,
           PLUGIN_TYPE_PSEUDO_LOADER = 1<<7
};
       /** return plugin type */
virtual PluginTypes supportedPluginTypes() const { return PLUGIN_TYPE_GENERIC; }

       /// bit mask for setting up the available plugin data flow direction
       enum Directions
       {
           DIRECTION_NONE = 0,
           DIRECTION_READ = 1<< 0,
           DIRECTION_WRITE = 1<< 1,
           DIRECTION_READ_WRITE = DIRECTION_READ | DIRECTION_WRITE,
       };

       /** return available plugin data flow directions */
virtual Directions supportedDirections() const { return DIRECTION_READ_WRITE; }

There are also 2 static helper methods [2]

       /** return plugin type as string */
static std::list<std::string> getPluginTypesAsString(PluginTypes mode);

       /** return available directions as string */
       static std::list<std::string> getDirectionsAsString(Directions dir);



With this reworked the patch osgconv --formats prints now the following information (where [|] are meta characters describing that each item is optional)

Plugin E:\daten\osg\install-debug\bin\osgPlugins-2.9.0/osgdb_curld.dll
{
   ReaderWriter : ...
   {
plugin type : [3d database plugin|movie plugin|image plugin|archive plugin|network plugin|font plugin| pseudo loader plugin]
       directions   :                        [read ] [write]
protocol : http Read from http port using libcurl. extensions : .* Passes all read files to other plugins to handle actual model loading. extensions : .curl Psuedo file extension, used to select curl plugin.
       options    : OSG_CURL_PROXY        Specify the http proxy.
       options    : OSG_CURL_PROXYPORT    Specify the http proxy oirt.
   }
}

You've no doubt seen my attempt at automatic testing of plugins,
yes
and this would help a lot in that endeavor.
nice to hear


If this patch will go into svn, the next step would be to extend the osgdb related code to use the availables features.
securing related osg code could be done later

And adding the relevant overridden method(s) to all the other plugins :-)

A real plugin would then look like the example below:


class ReaderWriterBMP : public osgDB::ReaderWriter
{
   public:
   ...

PluginTypes supportedPluginTypes() const { return PLUGIN_TYPE_IMAGE; }
       Directions supportedDirections() const { return DIRECTION_READ; }
...
}

I can help there.
Thanks

Are there any objections on the implementation or is this okay for submitting ?

Ralf

Attachment: openscenegraph-readerwriter-direction-patch-2.tar.bz2
Description: Binary data

_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to