diff --git a/include/osgDB/Serializer b/include/osgDB/Serializer index 5838f7bc3..288eeaca6 100644 --- a/include/osgDB/Serializer +++ b/include/osgDB/Serializer @@ -138,6 +138,9 @@ public: BaseSerializer() : _firstVersion(0), _lastVersion(INT_MAX) {} + virtual bool set(osg::Object& /*object*/, void* /*value*/) { return false; } + virtual bool get(const osg::Object& /*object*/, void* /*value*/) { return false; } + virtual bool read( InputStream&, osg::Object& ) = 0; virtual bool write( OutputStream&, const osg::Object& ) = 0; virtual const std::string& getName() const = 0; @@ -507,6 +510,9 @@ public: ObjectSerializer( const char* name, P* def, Getter gf, Setter sf ) : ParentType(name, def), _getter(gf), _setter(sf) {} + virtual bool set(osg::Object& obj, void* value) { C& object = OBJECT_CAST(obj); (object.*_setter)( *(reinterpret_cast(value)) ); return true; } + virtual bool get(const osg::Object& obj, void* value) { const C& object = OBJECT_CAST(obj);*(reinterpret_cast(value )) = (object.*_getter)(); return true; } + virtual bool read( InputStream& is, osg::Object& obj ) { C& object = OBJECT_CAST(obj); diff --git a/src/osgDB/PropertyInterface.cpp b/src/osgDB/PropertyInterface.cpp index eae1a8afc..4003bb2fd 100644 --- a/src/osgDB/PropertyInterface.cpp +++ b/src/osgDB/PropertyInterface.cpp @@ -367,13 +367,51 @@ bool PropertyInterface::copyPropertyDataToObject(osg::Object* object, const std: bool PropertyInterface::copyPropertyObjectFromObject(const osg::Object* object, const std::string& propertyName, void* valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType) { OSG_NOTICE<<"PropertyInterface::copyPropertyObjectFromObject() Not Supported yet."<get(*object, valuePtr); + } + else + { + OSG_NOTICE<<"PropertyInterface::copyPropertyObjectFromObject() Types are not compatible, valueType = "<set(*object, const_cast(valuePtr)); + } + else + { + OSG_NOTICE<<"PropertyInterface::copyPropertyObjectToObject() Types are not compatible, valueType = "<