From 8f3ee7c64903715ead4d8f1a2c34da7cba7bb878 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 20 Sep 2013 10:44:24 +0000 Subject: [PATCH] Added initial cut of white and black lists --- examples/osgpresentation/osgpresentation.cpp | 11 +++++++++-- src/osgDB/PropertyInterface.cpp | 20 ++++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/examples/osgpresentation/osgpresentation.cpp b/examples/osgpresentation/osgpresentation.cpp index cba25a9cc..3104f8810 100644 --- a/examples/osgpresentation/osgpresentation.cpp +++ b/examples/osgpresentation/osgpresentation.cpp @@ -163,7 +163,14 @@ int main(int argc, char** argv) osgDB::PropertyInterface pi; -#if 1 + pi.getWhiteList()["osgPresentation::Presentation"]["filename"]=osgDB::BaseSerializer::RW_STRING; + pi.getBlackList()["osgPresentation::Presentation"]["Children"]; + pi.getBlackList()["osgPresentation::Presentation"]["UserDataContainer"]; + pi.getBlackList()["osgPresentation::Presentation"]["UserData"]; + pi.getBlackList()["osgPresentation::Presentation"]["CullCallback"]; + pi.getBlackList()["osgPresentation::Presentation"]["ComputeBoundingSphereCallback"]; + +#if 0 osgDB::ObjectWrapperManager* owm = osgDB::Registry::instance()->getObjectWrapperManager(); if (owm) { @@ -309,7 +316,7 @@ int main(int argc, char** argv) itr != properties.end(); ++itr) { - OSG_NOTICE<<"Property "<first<<", "<second<first<<", "<second)<libraryName()) + std::string("::") + std::string(object->className()); - return osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper(compoundClassName); + return osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper(object->getCompoundClassName()); } osgDB::BaseSerializer* PropertyInterface::getSerializer(const osg::Object* object, const std::string& propertyName, osgDB::BaseSerializer::Type& type) const @@ -394,6 +393,15 @@ bool PropertyInterface::getSupportedProperties(const osg::Object* object, Proper return false; } + std::string compoundClassName = object->getCompoundClassName(); + ObjectPropertyMap::const_iterator wl_itr = _whiteList.find(compoundClassName); + if (wl_itr != _whiteList.end()) + { + properties = wl_itr->second; + } + + ObjectPropertyMap::const_iterator bl_itr = _blackList.find(compoundClassName); + if (searchAssociates) { const osgDB::StringList& associates = ow->getAssociates(); @@ -410,7 +418,9 @@ bool PropertyInterface::getSupportedProperties(const osg::Object* object, Proper sitr != associate_serializers.end(); ++sitr, ++i) { - properties[(*sitr)->getName()] = associate_wrapper->getTypeList()[i]; + const std::string& propertyName = (*sitr)->getName(); + bool notBlackListed = (bl_itr == _blackList.end()) || (bl_itr->second.count(propertyName)==0); + if (notBlackListed) properties[propertyName] = associate_wrapper->getTypeList()[i]; } } } @@ -423,7 +433,9 @@ bool PropertyInterface::getSupportedProperties(const osg::Object* object, Proper itr != serializers.end(); ++itr) { - properties[(*itr)->getName()] = ow->getTypeList()[i]; + const std::string& propertyName = (*itr)->getName(); + bool notBlackListed = (bl_itr == _blackList.end()) || (bl_itr->second.count(propertyName)==0); + if (notBlackListed) properties[propertyName] = ow->getTypeList()[i]; } }