From 0956f3cdb451e9df3556ee6b7decb990ad36108c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 28 Oct 2005 18:39:14 +0000 Subject: [PATCH] From Marco Jez, Fix for the class name lookup in osgDB::Registry::writeObject(), which can silently fail when a NodeKit's class (for example osgNVCg::Program) has the same name as that of an OSG's class (for example osg::Program). --- src/osgDB/Registry.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp index ca5291596..fceaf6638 100644 --- a/src/osgDB/Registry.cpp +++ b/src/osgDB/Registry.cpp @@ -1050,11 +1050,6 @@ bool Registry::writeObject(const osg::Object& obj,Output& fw) // try composite name first DotOsgWrapperMap::iterator itr = _classNameWrapperMap.find(compositeName); - // composite name not found, try simple class name - if (itr == _classNameWrapperMap.end()) { - itr = _classNameWrapperMap.find(classname); - } - if (itr==_classNameWrapperMap.end()) { // first try the standard nodekit library. @@ -1064,11 +1059,14 @@ bool Registry::writeObject(const osg::Object& obj,Output& fw) // otherwise try the osgdb_ plugin library. std::string pluginLibraryName = createLibraryNameForExtension(obj.libraryName()); if (loadLibrary(pluginLibraryName)) return writeObject(obj,fw); + + // otherwise try simple class name + if (itr == _classNameWrapperMap.end()) + itr = _classNameWrapperMap.find(classname); } - else - { - - + + if (itr!=_classNameWrapperMap.end()) + { DotOsgWrapper* wrapper = itr->second.get(); const DotOsgWrapper::Associates& assoc = wrapper->getAssociates();