diff --git a/components/sceneutil/serialize.cpp b/components/sceneutil/serialize.cpp index 969fa6668..64094275c 100644 --- a/components/sceneutil/serialize.cpp +++ b/components/sceneutil/serialize.cpp @@ -78,18 +78,31 @@ osgDB::ObjectWrapper* makeDummySerializer(const std::string& classname) return new osgDB::ObjectWrapper(createInstanceFunc, classname, "osg::Object"); } +class GeometrySerializer : public osgDB::ObjectWrapper +{ +public: + GeometrySerializer() + : osgDB::ObjectWrapper(createInstanceFunc, "osg::Geometry", "osg::Object osg::Drawable osg::Geometry") + { + } +}; void registerSerializers() { static bool done = false; if (!done) { - osgDB::Registry::instance()->getObjectWrapperManager()->addWrapper(new PositionAttitudeTransformSerializer); - osgDB::Registry::instance()->getObjectWrapperManager()->addWrapper(new SkeletonSerializer); - osgDB::Registry::instance()->getObjectWrapperManager()->addWrapper(new FrameSwitchSerializer); - osgDB::Registry::instance()->getObjectWrapperManager()->addWrapper(new RigGeometrySerializer); - osgDB::Registry::instance()->getObjectWrapperManager()->addWrapper(new LightManagerSerializer); - osgDB::Registry::instance()->getObjectWrapperManager()->addWrapper(new CameraRelativeTransformSerializer); + osgDB::ObjectWrapperManager* mgr = osgDB::Registry::instance()->getObjectWrapperManager(); + mgr->addWrapper(new PositionAttitudeTransformSerializer); + mgr->addWrapper(new SkeletonSerializer); + mgr->addWrapper(new FrameSwitchSerializer); + mgr->addWrapper(new RigGeometrySerializer); + mgr->addWrapper(new LightManagerSerializer); + mgr->addWrapper(new CameraRelativeTransformSerializer); + + // Don't serialize Geometry data as we are more interested in the overall structure rather than tons of vertex data that would make the file large and hard to read. + mgr->removeWrapper(mgr->findWrapper("osg::Geometry")); + mgr->addWrapper(new GeometrySerializer); // ignore the below for now to avoid warning spam const char* ignore[] = { @@ -120,7 +133,7 @@ void registerSerializers() }; for (size_t i=0; igetObjectWrapperManager()->addWrapper(makeDummySerializer(ignore[i])); + mgr->addWrapper(makeDummySerializer(ignore[i])); }