Hi Robert and John,

As Geode and Group serializers both contain only one user macro for storing 
children nodes, I think we can simply rewrite the Geode serializer like this:
REGISTER_OBJECT_WRAPPER( Geode,
                         new osg::Geode,
                         osg::Geode,
                         "osg::Object osg::Node osg::Geode" )
{
    ADD_USER_SERIALIZER( Drawables );  // _drawables‍

    {
        UPDATE_TO_VERSION_SCOPED( 115 )
        REMOVE_SERIALIZER( Drawables‍ );‍
        ADD_USER_SERIALIZER( Children );  // _children‍
    }
}


Similar work should be done on osg::Drawable serializers as well to support 
some important attributes like NodeMask and CullingActive. This is the fastest 
way to update serializers and keep back-compatibility in my opinion, without 
changes to the core modules.


An alternative way is to have a new REGISTER_VERSIONED_OBJECT_WRAPPER macro to 
submit a new ObjectWrapper to the registry, in which only wrapper with newer 
version number can be accepted, such like:‍
REGISTER_VERSIONED_OBJECT_WRAPPER( 115, Geode,
                         new osg::Geode,
                         osg::Geode,
                         "osg::Object osg::Group osg::Geode" )‍

{
    ...
}


The second way might be easier and more readable for further use.


Cheers,


Wang Rui


------------------ Original ------------------
From:  "Robert Osfield";<[email protected]>;
Date:  Tue, Mar 24, 2015 05:37 PM
To:  "OpenSceneGraph Users"<[email protected]>; "Wang 
Rui"<[email protected]>; 

Subject:  Re: [osg-users] Register object wrapper for osg::Geode



Hi John and Rui,


Well spotted.  I am not sure what to do about this one.  I think fixing the 
REGISTER_OBJECT_WRAPPER to include osg::Group may well break the parsing of 
.osgb files as the current serializers aren't versioned for the associates list.


Having two separate wrappers might be the way forward.  Or adding some for of 
versioning for the associate list.


Any thoughts Rui?



Cheers,

Robert.


On 24 March 2015 at 08:33, John Ivar Haugland <[email protected]> wrote:
Hi, 

I notice that osg::Geode now inherits osg::Group instead of osg::Node. 


However, in the corresponsing serializer osg::Group is not mentioned in 
REGISTER_OBJECT_WRAPPER( Geode,

                         new osg::Geode,
                         osg::Geode,
                         "osg::Object osg::Node osg::Geode" )





Is this correct ? or should it be changed to 


REGISTER_OBJECT_WRAPPER( Geode,

                         new osg::Geode,
                         osg::Geode,
                         "osg::Object osg::Node osg::Group osg::Geode" )






Kind regards
John Ivar Haugland





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

Reply via email to