Skip to content
This repository
Browse code

Added initial cut of white and black lists

  • Loading branch information...
commit 5350afd6e0e248e0b96203a040bd5e24de038e0d 1 parent e2bc39d
authored September 20, 2013
11  examples/osgpresentation/osgpresentation.cpp
@@ -163,7 +163,14 @@ int main(int argc, char** argv)
163 163
 
164 164
     osgDB::PropertyInterface pi;
165 165
 
166  
-#if 1
  166
+    pi.getWhiteList()["osgPresentation::Presentation"]["filename"]=osgDB::BaseSerializer::RW_STRING;
  167
+    pi.getBlackList()["osgPresentation::Presentation"]["Children"];
  168
+    pi.getBlackList()["osgPresentation::Presentation"]["UserDataContainer"];
  169
+    pi.getBlackList()["osgPresentation::Presentation"]["UserData"];
  170
+    pi.getBlackList()["osgPresentation::Presentation"]["CullCallback"];
  171
+    pi.getBlackList()["osgPresentation::Presentation"]["ComputeBoundingSphereCallback"];
  172
+
  173
+#if 0
167 174
     osgDB::ObjectWrapperManager* owm = osgDB::Registry::instance()->getObjectWrapperManager();
168 175
     if (owm)
169 176
     {
@@ -309,7 +316,7 @@ int main(int argc, char** argv)
309 316
             itr != properties.end();
310 317
             ++itr)
311 318
         {
312  
-            OSG_NOTICE<<"Property "<<itr->first<<", "<<itr->second<<std::endl;
  319
+            OSG_NOTICE<<"   Property "<<itr->first<<", "<<pi.getTypeName(itr->second)<<std::endl;
313 320
         }
314 321
     }
315 322
     else
20  src/osgDB/PropertyInterface.cpp
@@ -273,8 +273,7 @@ osgDB::BaseSerializer::Type PropertyInterface::getType(const std::string& typeNa
273 273
 
274 274
 osgDB::ObjectWrapper* PropertyInterface::getObjectWrapper(const osg::Object* object) const
275 275
 {
276  
-    std::string compoundClassName = std::string(object->libraryName()) + std::string("::") + std::string(object->className());
277  
-    return osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper(compoundClassName);
  276
+    return osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper(object->getCompoundClassName());
278 277
 }
279 278
 
280 279
 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
394 393
         return false;
395 394
     }
396 395
 
  396
+    std::string compoundClassName = object->getCompoundClassName();
  397
+    ObjectPropertyMap::const_iterator wl_itr = _whiteList.find(compoundClassName);
  398
+    if (wl_itr != _whiteList.end())
  399
+    {
  400
+        properties = wl_itr->second;
  401
+    }
  402
+
  403
+    ObjectPropertyMap::const_iterator bl_itr = _blackList.find(compoundClassName);
  404
+
397 405
     if (searchAssociates)
398 406
     {
399 407
         const osgDB::StringList& associates = ow->getAssociates();
@@ -410,7 +418,9 @@ bool PropertyInterface::getSupportedProperties(const osg::Object* object, Proper
410 418
                     sitr != associate_serializers.end();
411 419
                     ++sitr, ++i)
412 420
                 {
413  
-                    properties[(*sitr)->getName()] = associate_wrapper->getTypeList()[i];
  421
+                    const std::string& propertyName = (*sitr)->getName();
  422
+                    bool notBlackListed = (bl_itr == _blackList.end()) || (bl_itr->second.count(propertyName)==0);
  423
+                    if (notBlackListed) properties[propertyName] = associate_wrapper->getTypeList()[i];
414 424
                 }
415 425
             }
416 426
         }
@@ -423,7 +433,9 @@ bool PropertyInterface::getSupportedProperties(const osg::Object* object, Proper
423 433
             itr != serializers.end();
424 434
             ++itr)
425 435
         {
426  
-            properties[(*itr)->getName()] = ow->getTypeList()[i];
  436
+            const std::string& propertyName = (*itr)->getName();
  437
+            bool notBlackListed = (bl_itr == _blackList.end()) || (bl_itr->second.count(propertyName)==0);
  438
+            if (notBlackListed) properties[propertyName] = ow->getTypeList()[i];
427 439
         }
428 440
     }
429 441
 

0 notes on commit 5350afd

Please sign in to comment.
Something went wrong with that request. Please try again.