[osg-users] Serialization with virtual base classes

Julien Valentin julienvalentin51 at gmail.com
Sun Dec 24 12:03:20 PST 2017


Hi Hartwig
I believe the best way to understand osg metamodel is study existing serializers in src/osgWrappers/serializers/osg/
In the case of virtual base class you'll have to set OBJECT_CAST macro to dynamic_cast
see https://github.com/openscenegraph/OpenSceneGraph/blob/master/src/osgWrappers/serializers/osg/Callback.cpp for an example
The string in serializer with multiple class name is called the associate list:
it refers to all other serializers that should be invoked (basically all base serializers must be mentionned)
Hope it helps

Happy Xmas


hartwigw wrote:
> Hi,
> 
> I already asked a similar question a few days ago but did not get an answer. I try to be a bit more specific. Assume I have the following definitions:
> 
> 
> Code:
> 
> class VirtualBaseClass : public osg::Object
> {
> };
> 
> class A : virtual public VirtualBaseClass
> {
> };
> 
> class B : virtual public VirtualBaseClass
> {
> };
> 
> class Final : public A, public B
> {
> };
> 
> 
> 
> 
> Now I have to register a wrapper for class Final. How do I do this?
> 
> 
> Code:
> 
> REGISTER_OBJECT_WRAPPER(Final,
>                                              new Final,
>                                              Final,
>                                              "???????") // What do I have to mention here?
> {
> }
> 
> 
> 
> 
> 
> Thank you!
> 
> Cheers,
> Hartwig


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72636#72636







More information about the osg-users mailing list