Refactored the DotOsgWrapper support in osgDB::Registry so it's now provided by the osgDB::DeprecatedDotOsgWrapperManager.
This commit is contained in:
parent
470abf4527
commit
27c99ff0c8
@ -79,7 +79,56 @@ class OSGDB_EXPORT DotOsgWrapper : public osg::Referenced
|
||||
ReadWriteMode _readWriteMode;
|
||||
};
|
||||
|
||||
/** Proxy class for automatic registration of DotOsgWrappers with the Registry.*/
|
||||
|
||||
class OSGDB_EXPORT DeprecatedDotOsgWrapperManager : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
|
||||
DeprecatedDotOsgWrapperManager() {}
|
||||
|
||||
void addDotOsgWrapper(DotOsgWrapper* wrapper);
|
||||
void removeDotOsgWrapper(DotOsgWrapper* wrapper);
|
||||
|
||||
osg::Object* readObjectOfType(const osg::Object& compObj,Input& fr);
|
||||
osg::Object* readObjectOfType(const basic_type_wrapper &btw, Input& fr);
|
||||
|
||||
osg::Object* readObject(Input& fr);
|
||||
osg::Image* readImage(Input& fr);
|
||||
osg::Drawable* readDrawable(Input& fr);
|
||||
osg::Uniform* readUniform(Input& fr);
|
||||
osg::StateAttribute* readStateAttribute(Input& fr);
|
||||
osg::Node* readNode(Input& fr);
|
||||
osg::Shader* readShader(Input& fr);
|
||||
|
||||
bool writeObject(const osg::Object& obj,Output& fw);
|
||||
|
||||
private:
|
||||
|
||||
virtual ~DeprecatedDotOsgWrapperManager() {}
|
||||
|
||||
typedef std::map< std::string, osg::ref_ptr<DotOsgWrapper> > DotOsgWrapperMap;
|
||||
|
||||
osg::Object* readObject(DotOsgWrapperMap& dowMap,Input& fr);
|
||||
void eraseWrapper(DotOsgWrapperMap& wrappermap,DotOsgWrapper* wrapper);
|
||||
|
||||
DotOsgWrapperMap _objectWrapperMap;
|
||||
DotOsgWrapperMap _imageWrapperMap;
|
||||
DotOsgWrapperMap _drawableWrapperMap;
|
||||
DotOsgWrapperMap _stateAttrWrapperMap;
|
||||
DotOsgWrapperMap _uniformWrapperMap;
|
||||
DotOsgWrapperMap _nodeWrapperMap;
|
||||
DotOsgWrapperMap _shaderWrapperMap;
|
||||
|
||||
DotOsgWrapperMap _classNameWrapperMap;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/** Proxy class for automatic registration of DotOsgWrappers with the Registry.
|
||||
The RegisterDotOsgWrapperProxy can be used to automatically register
|
||||
DotOsgWrappers, at runtime with the Registry. A DotOsgWrapper encapsulates
|
||||
the functions that can read and write to the .osg for each osg::Object.
|
||||
*/
|
||||
class OSGDB_EXPORT RegisterDotOsgWrapperProxy
|
||||
{
|
||||
public:
|
||||
|
@ -65,10 +65,6 @@ struct type_wrapper: basic_type_wrapper {
|
||||
the reader/writers which are linked in
|
||||
at runtime for reading non-native file formats.
|
||||
|
||||
The RegisterDotOsgWrapperProxy can be used to automatically register
|
||||
DotOsgWrappers, at runtime with the Registry. A DotOsgWrapper encapsulates
|
||||
the functions that can read and write to the .osg for each osg::Object.
|
||||
|
||||
The RegisterReaderWriterProxy can be used to automatically
|
||||
register at runtime a reader/writer with the Registry.
|
||||
*/
|
||||
@ -148,19 +144,6 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
/** get const list of all registered ReaderWriters.*/
|
||||
const ReaderWriterList& getReaderWriterList() const { return _rwList; }
|
||||
|
||||
osg::Object* readObjectOfType(const osg::Object& compObj,Input& fr);
|
||||
osg::Object* readObjectOfType(const basic_type_wrapper &btw, Input& fr);
|
||||
|
||||
osg::Object* readObject(Input& fr);
|
||||
osg::Image* readImage(Input& fr);
|
||||
osg::Drawable* readDrawable(Input& fr);
|
||||
osg::Uniform* readUniform(Input& fr);
|
||||
osg::StateAttribute* readStateAttribute(Input& fr);
|
||||
osg::Node* readNode(Input& fr);
|
||||
osg::Shader* readShader(Input& fr);
|
||||
|
||||
bool writeObject(const osg::Object& obj,Output& fw);
|
||||
|
||||
|
||||
typedef class osgDB::FindFileCallback FindFileCallback;
|
||||
typedef class osgDB::ReadFileCallback ReadFileCallback;
|
||||
@ -484,11 +467,13 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
/** Get the ObjectWrapperManager that is used to store all the ObjectWrappers. */
|
||||
ObjectWrapperManager* getObjectWrapperManager() { return _objectWrapperManager.get(); }
|
||||
|
||||
/** Get the ObjectWrapperManager that is used to store all the ObjectWrappers. */
|
||||
DeprecatedDotOsgWrapperManager* getDeprecatedDotOsgObjectWrapperManager() { return _deprecatedDotOsgWrapperManager.get(); }
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~Registry();
|
||||
|
||||
typedef std::map< std::string, osg::ref_ptr<DotOsgWrapper> > DotOsgWrapperMap;
|
||||
typedef std::vector< osg::ref_ptr<DynamicLibrary> > DynamicLibraryList;
|
||||
typedef std::map< std::string, std::string> ExtensionAliasMap;
|
||||
typedef std::map< std::string, std::string> MimeTypeExtensionMap;
|
||||
@ -519,10 +504,6 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
|
||||
RegisteredProtocolsSet _registeredProtocols;
|
||||
|
||||
osg::Object* readObject(DotOsgWrapperMap& dowMap,Input& fr);
|
||||
|
||||
void eraseWrapper(DotOsgWrapperMap& wrappermap,DotOsgWrapper* wrapper);
|
||||
|
||||
public:
|
||||
/** Functor used in internal implementations.*/
|
||||
struct ReadFunctor
|
||||
@ -575,16 +556,6 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
osg::ref_ptr<WriteFileCallback> _writeFileCallback;
|
||||
osg::ref_ptr<FileLocationCallback> _fileLocationCallback;
|
||||
|
||||
DotOsgWrapperMap _objectWrapperMap;
|
||||
DotOsgWrapperMap _imageWrapperMap;
|
||||
DotOsgWrapperMap _drawableWrapperMap;
|
||||
DotOsgWrapperMap _stateAttrWrapperMap;
|
||||
DotOsgWrapperMap _uniformWrapperMap;
|
||||
DotOsgWrapperMap _nodeWrapperMap;
|
||||
DotOsgWrapperMap _shaderWrapperMap;
|
||||
|
||||
DotOsgWrapperMap _classNameWrapperMap;
|
||||
|
||||
OpenThreads::ReentrantMutex _pluginMutex;
|
||||
ReaderWriterList _rwList;
|
||||
DynamicLibraryList _dlList;
|
||||
@ -618,7 +589,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
osg::ref_ptr<SharedStateManager> _sharedStateManager;
|
||||
|
||||
osg::ref_ptr<ObjectWrapperManager> _objectWrapperManager;
|
||||
|
||||
osg::ref_ptr<DeprecatedDotOsgWrapperManager> _deprecatedDotOsgWrapperManager;
|
||||
};
|
||||
|
||||
/** read the command line arguments.*/
|
||||
|
@ -63,7 +63,7 @@ RegisterDotOsgWrapperProxy::RegisterDotOsgWrapperProxy(osg::Object* proto,
|
||||
if (Registry::instance())
|
||||
{
|
||||
_wrapper = new DotOsgWrapper(proto,name,associates,readFunc,writeFunc,readWriteMode);
|
||||
Registry::instance()->addDotOsgWrapper(_wrapper.get());
|
||||
Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->addDotOsgWrapper(_wrapper.get());
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,6 +71,680 @@ RegisterDotOsgWrapperProxy::~RegisterDotOsgWrapperProxy()
|
||||
{
|
||||
if (Registry::instance())
|
||||
{
|
||||
Registry::instance()->removeDotOsgWrapper(_wrapper.get());
|
||||
Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->removeDotOsgWrapper(_wrapper.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DeprecatedDotOsgWrapperManager::addDotOsgWrapper(DotOsgWrapper* wrapper)
|
||||
{
|
||||
if (wrapper==0L) return;
|
||||
|
||||
//notify(INFO) << "osg::Registry::addDotOsgWrapper("<<wrapper->getName()<<")"<< std::endl;
|
||||
const DotOsgWrapper::Associates& assoc = wrapper->getAssociates();
|
||||
|
||||
for(DotOsgWrapper::Associates::const_iterator itr=assoc.begin();
|
||||
itr!=assoc.end();
|
||||
++itr)
|
||||
{
|
||||
//notify(INFO) << " ("<<*itr<<")"<< std::endl;
|
||||
}
|
||||
|
||||
const std::string& name = wrapper->getName();
|
||||
const osg::Object* proto = wrapper->getPrototype();
|
||||
|
||||
_objectWrapperMap[name] = wrapper;
|
||||
if (wrapper->getReadWriteMode()==DotOsgWrapper::READ_AND_WRITE) _classNameWrapperMap[name] = wrapper;
|
||||
|
||||
if (proto)
|
||||
{
|
||||
std::string libraryName = proto->libraryName();
|
||||
std::string compositeName = libraryName + "::" + name;
|
||||
|
||||
_objectWrapperMap[compositeName] = wrapper;
|
||||
if (wrapper->getReadWriteMode()==DotOsgWrapper::READ_AND_WRITE) _classNameWrapperMap[compositeName] = wrapper;
|
||||
|
||||
if (dynamic_cast<const osg::Image*>(proto))
|
||||
{
|
||||
_imageWrapperMap[name] = wrapper;
|
||||
_imageWrapperMap[compositeName] = wrapper;
|
||||
}
|
||||
if (dynamic_cast<const osg::Drawable*>(proto))
|
||||
{
|
||||
_drawableWrapperMap[name] = wrapper;
|
||||
_drawableWrapperMap[compositeName] = wrapper;
|
||||
}
|
||||
if (dynamic_cast<const osg::StateAttribute*>(proto))
|
||||
{
|
||||
_stateAttrWrapperMap[name] = wrapper;
|
||||
_stateAttrWrapperMap[compositeName] = wrapper;
|
||||
}
|
||||
if (dynamic_cast<const osg::Uniform*>(proto))
|
||||
{
|
||||
_uniformWrapperMap[name] = wrapper;
|
||||
_uniformWrapperMap[compositeName] = wrapper;
|
||||
}
|
||||
if (dynamic_cast<const osg::Node*>(proto))
|
||||
{
|
||||
_nodeWrapperMap[name] = wrapper;
|
||||
_nodeWrapperMap[compositeName] = wrapper;
|
||||
}
|
||||
if (dynamic_cast<const osg::Shader*>(proto))
|
||||
{
|
||||
_shaderWrapperMap[name] = wrapper;
|
||||
_shaderWrapperMap[compositeName] = wrapper;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// need to change to delete all instances of wrapper, since we
|
||||
// now can have a wrapper entered twice with the addition of the
|
||||
// library::class composite name.
|
||||
void DeprecatedDotOsgWrapperManager::eraseWrapper(DotOsgWrapperMap& wrappermap,DotOsgWrapper* wrapper)
|
||||
{
|
||||
typedef std::vector<DotOsgWrapperMap::iterator> EraseList;
|
||||
EraseList eraseList;
|
||||
for(DotOsgWrapperMap::iterator witr=wrappermap.begin();
|
||||
witr!=wrappermap.end();
|
||||
++witr)
|
||||
{
|
||||
if (witr->second==wrapper) eraseList.push_back(witr);
|
||||
}
|
||||
for(EraseList::iterator eitr=eraseList.begin();
|
||||
eitr!=eraseList.end();
|
||||
++eitr)
|
||||
{
|
||||
wrappermap.erase(*eitr);
|
||||
}
|
||||
}
|
||||
|
||||
void DeprecatedDotOsgWrapperManager::removeDotOsgWrapper(DotOsgWrapper* wrapper)
|
||||
{
|
||||
if (wrapper==0L) return;
|
||||
|
||||
eraseWrapper(_objectWrapperMap,wrapper);
|
||||
eraseWrapper(_classNameWrapperMap,wrapper);
|
||||
eraseWrapper(_imageWrapperMap,wrapper);
|
||||
eraseWrapper(_drawableWrapperMap,wrapper);
|
||||
eraseWrapper(_uniformWrapperMap,wrapper);
|
||||
eraseWrapper(_stateAttrWrapperMap,wrapper);
|
||||
eraseWrapper(_nodeWrapperMap,wrapper);
|
||||
eraseWrapper(_shaderWrapperMap,wrapper);
|
||||
}
|
||||
|
||||
struct concrete_wrapper: basic_type_wrapper
|
||||
{
|
||||
virtual ~concrete_wrapper() {}
|
||||
concrete_wrapper(const osg::Object *myobj) : myobj_(myobj) {}
|
||||
bool matches(const osg::Object *proto) const
|
||||
{
|
||||
return myobj_->isSameKindAs(proto);
|
||||
}
|
||||
const osg::Object *myobj_;
|
||||
};
|
||||
|
||||
|
||||
osg::Object* DeprecatedDotOsgWrapperManager::readObjectOfType(const osg::Object& compObj,Input& fr)
|
||||
{
|
||||
return readObjectOfType(concrete_wrapper(&compObj), fr);
|
||||
}
|
||||
|
||||
osg::Object* DeprecatedDotOsgWrapperManager::readObjectOfType(const basic_type_wrapper &btw,Input& fr)
|
||||
{
|
||||
const char *str = fr[0].getStr();
|
||||
if (str==NULL) return NULL;
|
||||
|
||||
if (fr[0].matchWord("Use"))
|
||||
{
|
||||
if (fr[1].isString())
|
||||
{
|
||||
osg::Object* obj = fr.getObjectForUniqueID(fr[1].getStr());
|
||||
if (obj && btw.matches(obj))
|
||||
{
|
||||
fr+=2;
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
}
|
||||
|
||||
std::string name = str;
|
||||
DotOsgWrapperMap::iterator itr = _objectWrapperMap.find(name);
|
||||
if (itr==_objectWrapperMap.end())
|
||||
{
|
||||
// not found so check if a library::class composite name.
|
||||
std::string token = fr[0].getStr();
|
||||
std::string::size_type posDoubleColon = token.rfind("::");
|
||||
if (posDoubleColon != std::string::npos)
|
||||
{
|
||||
// we have a composite name so now strip off the library name
|
||||
// are try to load it, and then retry the readObject to see
|
||||
// if we can recognize the objects.
|
||||
std::string libraryName = std::string(token,0,posDoubleColon);
|
||||
|
||||
// first try the standard nodekit library.
|
||||
std::string nodeKitLibraryName = osgDB::Registry::instance()->createLibraryNameForNodeKit(libraryName);
|
||||
if (osgDB::Registry::instance()->loadLibrary(nodeKitLibraryName)==osgDB::Registry::LOADED) return readObjectOfType(btw,fr);
|
||||
|
||||
// otherwise try the osgdb_ plugin library.
|
||||
std::string pluginLibraryName = osgDB::Registry::instance()->createLibraryNameForExtension(std::string("deprecated_")+libraryName);
|
||||
if (osgDB::Registry::instance()->loadLibrary(pluginLibraryName)==osgDB::Registry::LOADED) return readObjectOfType(btw,fr);
|
||||
|
||||
// otherwise try the osgdb_ plugin library.
|
||||
pluginLibraryName = osgDB::Registry::instance()->createLibraryNameForExtension(libraryName);
|
||||
if (osgDB::Registry::instance()->loadLibrary(pluginLibraryName)==osgDB::Registry::LOADED) return readObjectOfType(btw,fr);
|
||||
}
|
||||
}
|
||||
else if (fr[1].isOpenBracket())
|
||||
{
|
||||
DotOsgWrapper* wrapper = itr->second.get();
|
||||
const osg::Object* proto = wrapper->getPrototype();
|
||||
if (proto==NULL)
|
||||
{
|
||||
osg::notify(osg::WARN)<<"Token "<<fr[0].getStr()<<" read, but has no prototype, cannot load."<< std::endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!btw.matches(proto))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// record the number of nested brackets move the input iterator
|
||||
// over the name { tokens.
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
fr+=2;
|
||||
|
||||
const DotOsgWrapper::Associates& assoc = wrapper->getAssociates();
|
||||
osg::Object* obj = proto->cloneType();
|
||||
|
||||
while(!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
if (fr[0].matchWord("UniqueID") && fr[1].isString())
|
||||
{
|
||||
fr.registerUniqueIDForObject(fr[1].getStr(),obj);
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
// read the local data by iterating through the associate
|
||||
// list, mapping the associate names to DotOsgWrapper's which
|
||||
// in turn have the appropriate functions.
|
||||
for(DotOsgWrapper::Associates::const_iterator aitr=assoc.begin();
|
||||
aitr!=assoc.end();
|
||||
++aitr)
|
||||
{
|
||||
DotOsgWrapperMap::iterator mitr = _objectWrapperMap.find(*aitr);
|
||||
if (mitr==_objectWrapperMap.end())
|
||||
{
|
||||
// not found so check if a library::class composite name.
|
||||
std::string token = *aitr;
|
||||
std::string::size_type posDoubleColon = token.rfind("::");
|
||||
if (posDoubleColon != std::string::npos)
|
||||
{
|
||||
// we have a composite name so now strip off the library name
|
||||
// and try to load it, and then retry the find to see
|
||||
// if we can recognize the objects.
|
||||
std::string libraryName = std::string(token,0,posDoubleColon);
|
||||
|
||||
// first try the standard nodekit library.
|
||||
std::string nodeKitLibraryName = osgDB::Registry::instance()->createLibraryNameForNodeKit(libraryName);
|
||||
if (osgDB::Registry::instance()->loadLibrary(nodeKitLibraryName)==osgDB::Registry::LOADED)
|
||||
{
|
||||
mitr = _objectWrapperMap.find(*aitr);
|
||||
if (mitr==_objectWrapperMap.end())
|
||||
{
|
||||
// otherwise try the osgdb_ plugin library.
|
||||
std::string pluginLibraryName = osgDB::Registry::instance()->createLibraryNameForExtension(libraryName);
|
||||
if (osgDB::Registry::instance()->loadLibrary(pluginLibraryName)==osgDB::Registry::LOADED)
|
||||
{
|
||||
mitr = _objectWrapperMap.find(*aitr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mitr!=_objectWrapperMap.end())
|
||||
{
|
||||
// get the function to read the data...
|
||||
DotOsgWrapper::ReadFunc rf = mitr->second->getReadFunc();
|
||||
if (rf && (*rf)(*obj,fr)) iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!iteratorAdvanced) fr.advanceOverCurrentFieldOrBlock();
|
||||
}
|
||||
++fr; // step over trailing '}'
|
||||
|
||||
return obj;
|
||||
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
//
|
||||
// read object from input iterator.
|
||||
//
|
||||
osg::Object* DeprecatedDotOsgWrapperManager::readObject(DotOsgWrapperMap& dowMap,Input& fr)
|
||||
{
|
||||
const char *str = fr[0].getStr();
|
||||
if (str==NULL) return NULL;
|
||||
|
||||
std::string name = str;
|
||||
DotOsgWrapperMap::iterator itr = dowMap.find(name);
|
||||
if (itr==dowMap.end())
|
||||
{
|
||||
// not found so check if a library::class composite name.
|
||||
std::string token = fr[0].getStr();
|
||||
std::string::size_type posDoubleColon = token.rfind("::");
|
||||
if (posDoubleColon != std::string::npos)
|
||||
{
|
||||
// we have a composite name so now strip off the library name
|
||||
// are try to load it, and then retry the readObject to see
|
||||
// if we can recognize the objects.
|
||||
|
||||
std::string libraryName = std::string(token,0,posDoubleColon);
|
||||
|
||||
// first try the standard nodekit library.
|
||||
std::string nodeKitLibraryName = osgDB::Registry::instance()->createLibraryNameForNodeKit(libraryName);
|
||||
if (osgDB::Registry::instance()->loadLibrary(nodeKitLibraryName)==osgDB::Registry::LOADED) return readObject(dowMap,fr);
|
||||
|
||||
// otherwise try the osgdb_ plugin library.
|
||||
std::string pluginLibraryName = osgDB::Registry::instance()->createLibraryNameForExtension(libraryName);
|
||||
if (osgDB::Registry::instance()->loadLibrary(pluginLibraryName)==osgDB::Registry::LOADED) return readObject(dowMap,fr);
|
||||
}
|
||||
}
|
||||
else if (fr[1].isOpenBracket())
|
||||
{
|
||||
|
||||
DotOsgWrapper* wrapper = itr->second.get();
|
||||
const osg::Object* proto = wrapper->getPrototype();
|
||||
if (proto==NULL)
|
||||
{
|
||||
osg::notify(osg::WARN)<<"Token "<<fr[0].getStr()<<" read, but has no prototype, cannot load."<< std::endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// record the number of nested brackets move the input iterator
|
||||
// over the name { tokens.
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
fr+=2;
|
||||
|
||||
const DotOsgWrapper::Associates& assoc = wrapper->getAssociates();
|
||||
osg::Object* obj = proto->cloneType();
|
||||
|
||||
while(!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
if (fr[0].matchWord("UniqueID") && fr[1].isString())
|
||||
{
|
||||
fr.registerUniqueIDForObject(fr[1].getStr(),obj);
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
// read the local data by iterating through the associate
|
||||
// list, mapping the associate names to DotOsgWrapper's which
|
||||
// in turn have the appropriate functions.
|
||||
for(DotOsgWrapper::Associates::const_iterator aitr=assoc.begin();
|
||||
aitr!=assoc.end();
|
||||
++aitr)
|
||||
{
|
||||
DotOsgWrapperMap::iterator mitr = _objectWrapperMap.find(*aitr);
|
||||
if (mitr==_objectWrapperMap.end())
|
||||
{
|
||||
// not found so check if a library::class composite name.
|
||||
std::string token = *aitr;
|
||||
std::string::size_type posDoubleColon = token.rfind("::");
|
||||
if (posDoubleColon != std::string::npos)
|
||||
{
|
||||
|
||||
// we have a composite name so now strip off the library name
|
||||
// are try to load it, and then retry the find to see
|
||||
// if we can recognize the objects.
|
||||
|
||||
std::string libraryName = std::string(token,0,posDoubleColon);
|
||||
|
||||
// first try the standard nodekit library.
|
||||
std::string nodeKitLibraryName = osgDB::Registry::instance()->createLibraryNameForNodeKit(libraryName);
|
||||
if (osgDB::Registry::instance()->loadLibrary(nodeKitLibraryName)==osgDB::Registry::LOADED)
|
||||
{
|
||||
mitr = _objectWrapperMap.find(*aitr);
|
||||
}
|
||||
|
||||
if (mitr==_objectWrapperMap.end())
|
||||
{
|
||||
// otherwise try the osgdb_ plugin library.
|
||||
std::string pluginLibraryName = osgDB::Registry::instance()->createLibraryNameForExtension(libraryName);
|
||||
if (osgDB::Registry::instance()->loadLibrary(pluginLibraryName)==osgDB::Registry::LOADED)
|
||||
{
|
||||
mitr = _objectWrapperMap.find(*aitr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (mitr!=_objectWrapperMap.end())
|
||||
{
|
||||
// get the function to read the data...
|
||||
DotOsgWrapper::ReadFunc rf = mitr->second->getReadFunc();
|
||||
if (rf && (*rf)(*obj,fr)) iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!iteratorAdvanced) fr.advanceOverCurrentFieldOrBlock();
|
||||
}
|
||||
++fr; // step over trailing '}'
|
||||
|
||||
return obj;
|
||||
|
||||
}
|
||||
|
||||
return 0L;
|
||||
}
|
||||
|
||||
//
|
||||
// read object from input iterator.
|
||||
//
|
||||
osg::Object* DeprecatedDotOsgWrapperManager::readObject(Input& fr)
|
||||
{
|
||||
if (fr[0].matchWord("Use"))
|
||||
{
|
||||
if (fr[1].isString())
|
||||
{
|
||||
osg::Object* obj = fr.getObjectForUniqueID(fr[1].getStr());
|
||||
if (obj) fr+=2;
|
||||
return obj;
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
}
|
||||
|
||||
return readObject(_objectWrapperMap,fr);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// read image from input iterator.
|
||||
//
|
||||
osg::Image* DeprecatedDotOsgWrapperManager::readImage(Input& fr)
|
||||
{
|
||||
if (fr[0].matchWord("Use"))
|
||||
{
|
||||
if (fr[1].isString())
|
||||
{
|
||||
osg::Image* image = dynamic_cast<osg::Image*>(fr.getObjectForUniqueID(fr[1].getStr()));
|
||||
if (image) fr+=2;
|
||||
return image;
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
}
|
||||
|
||||
osg::Object* obj = readObject(_imageWrapperMap,fr);
|
||||
osg::Image* image = dynamic_cast<osg::Image*>(obj);
|
||||
if (image) return image;
|
||||
else if (obj) obj->unref();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// read drawable from input iterator.
|
||||
//
|
||||
osg::Drawable* DeprecatedDotOsgWrapperManager::readDrawable(Input& fr)
|
||||
{
|
||||
if (fr[0].matchWord("Use"))
|
||||
{
|
||||
if (fr[1].isString())
|
||||
{
|
||||
osg::Drawable* drawable = dynamic_cast<osg::Drawable*>(fr.getObjectForUniqueID(fr[1].getStr()));
|
||||
if (drawable) fr+=2;
|
||||
return drawable;
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
}
|
||||
|
||||
osg::Object* obj = readObject(_drawableWrapperMap,fr);
|
||||
osg::Drawable* drawable = dynamic_cast<osg::Drawable*>(obj);
|
||||
if (drawable) return drawable;
|
||||
else if (obj) obj->unref();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// read drawable from input iterator.
|
||||
//
|
||||
osg::StateAttribute* DeprecatedDotOsgWrapperManager::readStateAttribute(Input& fr)
|
||||
{
|
||||
|
||||
if (fr[0].matchWord("Use"))
|
||||
{
|
||||
if (fr[1].isString())
|
||||
{
|
||||
osg::StateAttribute* attribute = dynamic_cast<osg::StateAttribute*>(fr.getObjectForUniqueID(fr[1].getStr()));
|
||||
if (attribute) fr+=2;
|
||||
return attribute;
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
}
|
||||
|
||||
return dynamic_cast<osg::StateAttribute*>(readObject(_stateAttrWrapperMap,fr));
|
||||
}
|
||||
|
||||
//
|
||||
// read drawable from input iterator.
|
||||
//
|
||||
osg::Uniform* DeprecatedDotOsgWrapperManager::readUniform(Input& fr)
|
||||
{
|
||||
|
||||
if (fr[0].matchWord("Use"))
|
||||
{
|
||||
if (fr[1].isString())
|
||||
{
|
||||
osg::Uniform* attribute = dynamic_cast<osg::Uniform*>(fr.getObjectForUniqueID(fr[1].getStr()));
|
||||
if (attribute) fr+=2;
|
||||
return attribute;
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
}
|
||||
|
||||
return dynamic_cast<osg::Uniform*>(readObject(_uniformWrapperMap,fr));
|
||||
}
|
||||
|
||||
//
|
||||
// read node from input iterator.
|
||||
//
|
||||
osg::Node* DeprecatedDotOsgWrapperManager::readNode(Input& fr)
|
||||
{
|
||||
if (fr[0].matchWord("Use"))
|
||||
{
|
||||
if (fr[1].isString())
|
||||
{
|
||||
osg::Node* node = dynamic_cast<osg::Node*>(fr.getObjectForUniqueID(fr[1].getStr()));
|
||||
if (node) fr+=2;
|
||||
return node;
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
}
|
||||
|
||||
osg::Object* obj = readObject(_nodeWrapperMap,fr);
|
||||
osg::Node* node = dynamic_cast<osg::Node*>(obj);
|
||||
if (node) return node;
|
||||
else if (obj) obj->unref();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// read image from input iterator.
|
||||
//
|
||||
osg::Shader* DeprecatedDotOsgWrapperManager::readShader(Input& fr)
|
||||
{
|
||||
if (fr[0].matchWord("Use"))
|
||||
{
|
||||
if (fr[1].isString())
|
||||
{
|
||||
osg::Shader* shader = dynamic_cast<osg::Shader*>(fr.getObjectForUniqueID(fr[1].getStr()));
|
||||
if (shader) fr+=2;
|
||||
return shader;
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
}
|
||||
|
||||
osg::Object* obj = readObject(_shaderWrapperMap,fr);
|
||||
osg::Shader* shader = dynamic_cast<osg::Shader*>(obj);
|
||||
if (shader) return shader;
|
||||
else if (obj) obj->unref();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Write object to output
|
||||
//
|
||||
bool DeprecatedDotOsgWrapperManager::writeObject(const osg::Object& obj,Output& fw)
|
||||
{
|
||||
|
||||
if (obj.referenceCount()>1)
|
||||
{
|
||||
std::string uniqueID;
|
||||
if (fw.getUniqueIDForObject(&obj,uniqueID))
|
||||
{
|
||||
fw.writeUseID( uniqueID );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string classname( obj.className() );
|
||||
const std::string libraryName( obj.libraryName() );
|
||||
const std::string compositeName( libraryName + "::" + classname );
|
||||
|
||||
// try composite name first
|
||||
DotOsgWrapperMap::iterator itr = _classNameWrapperMap.find(compositeName);
|
||||
|
||||
if (itr==_classNameWrapperMap.end())
|
||||
{
|
||||
// first try the standard nodekit library.
|
||||
std::string nodeKitLibraryName = osgDB::Registry::instance()->createLibraryNameForNodeKit(libraryName);
|
||||
if (osgDB::Registry::instance()->loadLibrary(nodeKitLibraryName)==osgDB::Registry::LOADED) return writeObject(obj,fw);
|
||||
|
||||
// otherwise try the osgdb_ plugin library.
|
||||
std::string pluginLibraryName = osgDB::Registry::instance()->createLibraryNameForExtension(libraryName);
|
||||
if (osgDB::Registry::instance()->loadLibrary(pluginLibraryName)==osgDB::Registry::LOADED) return writeObject(obj,fw);
|
||||
|
||||
// otherwise try simple class name
|
||||
if (itr == _classNameWrapperMap.end())
|
||||
itr = _classNameWrapperMap.find(classname);
|
||||
}
|
||||
|
||||
if (itr!=_classNameWrapperMap.end())
|
||||
{
|
||||
DotOsgWrapper* wrapper = itr->second.get();
|
||||
const DotOsgWrapper::Associates& assoc = wrapper->getAssociates();
|
||||
|
||||
if (libraryName=="osg")
|
||||
{
|
||||
// member of the core osg, so no need to have composite library::class name.
|
||||
fw.writeBeginObject( wrapper->getName() );
|
||||
}
|
||||
else
|
||||
{
|
||||
// member of the node kit so must use composite library::class name.
|
||||
std::string::size_type posDoubleColon = wrapper->getName().find("::");
|
||||
if (posDoubleColon != std::string::npos)
|
||||
{
|
||||
fw.writeBeginObject( wrapper->getName() );
|
||||
}
|
||||
else
|
||||
{
|
||||
fw.writeBeginObject( libraryName + "::" + wrapper->getName() );
|
||||
}
|
||||
}
|
||||
fw.moveIn();
|
||||
|
||||
|
||||
// write out the unique ID if required.
|
||||
if (obj.referenceCount()>1)
|
||||
{
|
||||
std::string uniqueID;
|
||||
fw.createUniqueIDForObject(&obj,uniqueID);
|
||||
fw.registerUniqueIDForObject(&obj,uniqueID);
|
||||
fw.writeUniqueID( uniqueID );
|
||||
}
|
||||
|
||||
// read the local data by iterating through the associate
|
||||
// list, mapping the associate names to DotOsgWrapper's which
|
||||
// in turn have the appropriate functions.
|
||||
for(DotOsgWrapper::Associates::const_iterator aitr=assoc.begin();
|
||||
aitr!=assoc.end();
|
||||
++aitr)
|
||||
{
|
||||
DotOsgWrapperMap::iterator mitr = _objectWrapperMap.find(*aitr);
|
||||
if (mitr==_objectWrapperMap.end())
|
||||
{
|
||||
// not found so check if a library::class composite name.
|
||||
std::string token = *aitr;
|
||||
std::string::size_type posDoubleColon = token.rfind("::");
|
||||
if (posDoubleColon != std::string::npos)
|
||||
{
|
||||
|
||||
// we have a composite name so now strip off the library name
|
||||
// are try to load it, and then retry the find to see
|
||||
// if we can recognize the objects.
|
||||
|
||||
std::string libraryName = std::string(token,0,posDoubleColon);
|
||||
|
||||
// first try the standard nodekit library.
|
||||
std::string nodeKitLibraryName = osgDB::Registry::instance()->createLibraryNameForNodeKit(libraryName);
|
||||
if (osgDB::Registry::instance()->loadLibrary(nodeKitLibraryName)==osgDB::Registry::LOADED)
|
||||
{
|
||||
mitr = _objectWrapperMap.find(*aitr);
|
||||
}
|
||||
|
||||
if (mitr==_objectWrapperMap.end())
|
||||
{
|
||||
// otherwise try the osgdb_ plugin library.
|
||||
std::string pluginLibraryName = osgDB::Registry::instance()->createLibraryNameForExtension(libraryName);
|
||||
if (osgDB::Registry::instance()->loadLibrary(pluginLibraryName)==osgDB::Registry::LOADED)
|
||||
{
|
||||
mitr = _objectWrapperMap.find(*aitr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (mitr!=_objectWrapperMap.end())
|
||||
{
|
||||
// get the function to read the data...
|
||||
DotOsgWrapper::WriteFunc wf = mitr->second->getWriteFunc();
|
||||
if (wf) (*wf)(obj,fw);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fw.moveOut();
|
||||
fw.writeEndObject();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -44,42 +44,42 @@ void Input::registerUniqueIDForObject(const std::string& uniqueID,osg::Object* o
|
||||
|
||||
osg::Object* Input::readObjectOfType(const osg::Object& compObj)
|
||||
{
|
||||
return Registry::instance()->readObjectOfType(compObj,*this);
|
||||
return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readObjectOfType(compObj,*this);
|
||||
}
|
||||
|
||||
osg::Object* Input::readObjectOfType(const basic_type_wrapper &btw)
|
||||
{
|
||||
return Registry::instance()->readObjectOfType(btw,*this);
|
||||
return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readObjectOfType(btw,*this);
|
||||
}
|
||||
|
||||
osg::Object* Input::readObject()
|
||||
{
|
||||
return Registry::instance()->readObject(*this);
|
||||
return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readObject(*this);
|
||||
}
|
||||
|
||||
|
||||
osg::Image* Input::readImage()
|
||||
{
|
||||
return Registry::instance()->readImage(*this);
|
||||
return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readImage(*this);
|
||||
}
|
||||
|
||||
osg::Drawable* Input::readDrawable()
|
||||
{
|
||||
return Registry::instance()->readDrawable(*this);
|
||||
return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readDrawable(*this);
|
||||
}
|
||||
|
||||
osg::StateAttribute* Input::readStateAttribute()
|
||||
{
|
||||
return Registry::instance()->readStateAttribute(*this);
|
||||
return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readStateAttribute(*this);
|
||||
}
|
||||
osg::Uniform* Input::readUniform()
|
||||
{
|
||||
return Registry::instance()->readUniform(*this);
|
||||
return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readUniform(*this);
|
||||
}
|
||||
|
||||
osg::Node* Input::readNode()
|
||||
{
|
||||
return Registry::instance()->readNode(*this);
|
||||
return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readNode(*this);
|
||||
}
|
||||
|
||||
osg::Object* Input::readObject(const std::string& fileName)
|
||||
@ -89,7 +89,7 @@ osg::Object* Input::readObject(const std::string& fileName)
|
||||
|
||||
osg::Shader* Input::readShader()
|
||||
{
|
||||
return Registry::instance()->readShader(*this);
|
||||
return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readShader(*this);
|
||||
}
|
||||
|
||||
osg::Image* Input::readImage(const std::string& fileName)
|
||||
|
@ -136,7 +136,7 @@ std::string Output::wrapString(const std::string& str)
|
||||
|
||||
bool Output::writeObject(const osg::Object& obj)
|
||||
{
|
||||
return Registry::instance()->writeObject(obj,*this);
|
||||
return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->writeObject(obj,*this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -370,6 +370,7 @@ Registry::Registry()
|
||||
registerProtocol("http");
|
||||
|
||||
_objectWrapperManager = new ObjectWrapperManager;
|
||||
_deprecatedDotOsgWrapperManager = new DeprecatedDotOsgWrapperManager;
|
||||
}
|
||||
|
||||
|
||||
@ -490,104 +491,6 @@ void Registry::readCommandLine(osg::ArgumentParser& arguments)
|
||||
}
|
||||
}
|
||||
|
||||
void Registry::addDotOsgWrapper(DotOsgWrapper* wrapper)
|
||||
{
|
||||
if (wrapper==0L) return;
|
||||
|
||||
//notify(INFO) << "osg::Registry::addDotOsgWrapper("<<wrapper->getName()<<")"<< std::endl;
|
||||
const DotOsgWrapper::Associates& assoc = wrapper->getAssociates();
|
||||
|
||||
for(DotOsgWrapper::Associates::const_iterator itr=assoc.begin();
|
||||
itr!=assoc.end();
|
||||
++itr)
|
||||
{
|
||||
//notify(INFO) << " ("<<*itr<<")"<< std::endl;
|
||||
}
|
||||
|
||||
const std::string& name = wrapper->getName();
|
||||
const osg::Object* proto = wrapper->getPrototype();
|
||||
|
||||
_objectWrapperMap[name] = wrapper;
|
||||
if (wrapper->getReadWriteMode()==DotOsgWrapper::READ_AND_WRITE) _classNameWrapperMap[name] = wrapper;
|
||||
|
||||
if (proto)
|
||||
{
|
||||
std::string libraryName = proto->libraryName();
|
||||
std::string compositeName = libraryName + "::" + name;
|
||||
|
||||
_objectWrapperMap[compositeName] = wrapper;
|
||||
if (wrapper->getReadWriteMode()==DotOsgWrapper::READ_AND_WRITE) _classNameWrapperMap[compositeName] = wrapper;
|
||||
|
||||
if (dynamic_cast<const Image*>(proto))
|
||||
{
|
||||
_imageWrapperMap[name] = wrapper;
|
||||
_imageWrapperMap[compositeName] = wrapper;
|
||||
}
|
||||
if (dynamic_cast<const Drawable*>(proto))
|
||||
{
|
||||
_drawableWrapperMap[name] = wrapper;
|
||||
_drawableWrapperMap[compositeName] = wrapper;
|
||||
}
|
||||
if (dynamic_cast<const StateAttribute*>(proto))
|
||||
{
|
||||
_stateAttrWrapperMap[name] = wrapper;
|
||||
_stateAttrWrapperMap[compositeName] = wrapper;
|
||||
}
|
||||
if (dynamic_cast<const Uniform*>(proto))
|
||||
{
|
||||
_uniformWrapperMap[name] = wrapper;
|
||||
_uniformWrapperMap[compositeName] = wrapper;
|
||||
}
|
||||
if (dynamic_cast<const Node*>(proto))
|
||||
{
|
||||
_nodeWrapperMap[name] = wrapper;
|
||||
_nodeWrapperMap[compositeName] = wrapper;
|
||||
}
|
||||
if (dynamic_cast<const Shader*>(proto))
|
||||
{
|
||||
_shaderWrapperMap[name] = wrapper;
|
||||
_shaderWrapperMap[compositeName] = wrapper;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// need to change to delete all instances of wrapper, since we
|
||||
// now can have a wrapper entered twice with the addition of the
|
||||
// library::class composite name.
|
||||
void Registry::eraseWrapper(DotOsgWrapperMap& wrappermap,DotOsgWrapper* wrapper)
|
||||
{
|
||||
typedef std::vector<DotOsgWrapperMap::iterator> EraseList;
|
||||
EraseList eraseList;
|
||||
for(DotOsgWrapperMap::iterator witr=wrappermap.begin();
|
||||
witr!=wrappermap.end();
|
||||
++witr)
|
||||
{
|
||||
if (witr->second==wrapper) eraseList.push_back(witr);
|
||||
}
|
||||
for(EraseList::iterator eitr=eraseList.begin();
|
||||
eitr!=eraseList.end();
|
||||
++eitr)
|
||||
{
|
||||
wrappermap.erase(*eitr);
|
||||
}
|
||||
}
|
||||
|
||||
void Registry::removeDotOsgWrapper(DotOsgWrapper* wrapper)
|
||||
{
|
||||
if (wrapper==0L) return;
|
||||
|
||||
eraseWrapper(_objectWrapperMap,wrapper);
|
||||
eraseWrapper(_classNameWrapperMap,wrapper);
|
||||
eraseWrapper(_imageWrapperMap,wrapper);
|
||||
eraseWrapper(_drawableWrapperMap,wrapper);
|
||||
eraseWrapper(_uniformWrapperMap,wrapper);
|
||||
eraseWrapper(_stateAttrWrapperMap,wrapper);
|
||||
eraseWrapper(_nodeWrapperMap,wrapper);
|
||||
eraseWrapper(_shaderWrapperMap,wrapper);
|
||||
}
|
||||
|
||||
void Registry::addReaderWriter(ReaderWriter* rw)
|
||||
{
|
||||
if (rw==0L) return;
|
||||
@ -863,6 +766,7 @@ ReaderWriter* Registry::getReaderWriterForMimeType(const std::string& mimeType)
|
||||
NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
struct concrete_wrapper: basic_type_wrapper
|
||||
{
|
||||
virtual ~concrete_wrapper() {}
|
||||
@ -873,567 +777,7 @@ struct concrete_wrapper: basic_type_wrapper
|
||||
}
|
||||
const osg::Object *myobj_;
|
||||
};
|
||||
|
||||
osg::Object* Registry::readObjectOfType(const osg::Object& compObj,Input& fr)
|
||||
{
|
||||
return readObjectOfType(concrete_wrapper(&compObj), fr);
|
||||
}
|
||||
|
||||
osg::Object* Registry::readObjectOfType(const basic_type_wrapper &btw,Input& fr)
|
||||
{
|
||||
const char *str = fr[0].getStr();
|
||||
if (str==NULL) return NULL;
|
||||
|
||||
if (fr[0].matchWord("Use"))
|
||||
{
|
||||
if (fr[1].isString())
|
||||
{
|
||||
Object* obj = fr.getObjectForUniqueID(fr[1].getStr());
|
||||
if (obj && btw.matches(obj))
|
||||
{
|
||||
fr+=2;
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
}
|
||||
|
||||
std::string name = str;
|
||||
DotOsgWrapperMap::iterator itr = _objectWrapperMap.find(name);
|
||||
if (itr==_objectWrapperMap.end())
|
||||
{
|
||||
// not found so check if a library::class composite name.
|
||||
std::string token = fr[0].getStr();
|
||||
std::string::size_type posDoubleColon = token.rfind("::");
|
||||
if (posDoubleColon != std::string::npos)
|
||||
{
|
||||
// we have a composite name so now strip off the library name
|
||||
// are try to load it, and then retry the readObject to see
|
||||
// if we can recognize the objects.
|
||||
std::string libraryName = std::string(token,0,posDoubleColon);
|
||||
|
||||
// first try the standard nodekit library.
|
||||
std::string nodeKitLibraryName = createLibraryNameForNodeKit(libraryName);
|
||||
if (loadLibrary(nodeKitLibraryName)==LOADED) return readObjectOfType(btw,fr);
|
||||
|
||||
// otherwise try the osgdb_ plugin library.
|
||||
std::string pluginLibraryName = createLibraryNameForExtension(std::string("deprecated_")+libraryName);
|
||||
if (loadLibrary(pluginLibraryName)==LOADED) return readObjectOfType(btw,fr);
|
||||
|
||||
// otherwise try the osgdb_ plugin library.
|
||||
pluginLibraryName = createLibraryNameForExtension(libraryName);
|
||||
if (loadLibrary(pluginLibraryName)==LOADED) return readObjectOfType(btw,fr);
|
||||
}
|
||||
}
|
||||
else if (fr[1].isOpenBracket())
|
||||
{
|
||||
DotOsgWrapper* wrapper = itr->second.get();
|
||||
const osg::Object* proto = wrapper->getPrototype();
|
||||
if (proto==NULL)
|
||||
{
|
||||
osg::notify(osg::WARN)<<"Token "<<fr[0].getStr()<<" read, but has no prototype, cannot load."<< std::endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!btw.matches(proto))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// record the number of nested brackets move the input iterator
|
||||
// over the name { tokens.
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
fr+=2;
|
||||
|
||||
const DotOsgWrapper::Associates& assoc = wrapper->getAssociates();
|
||||
osg::Object* obj = proto->cloneType();
|
||||
|
||||
while(!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
if (fr[0].matchWord("UniqueID") && fr[1].isString())
|
||||
{
|
||||
fr.registerUniqueIDForObject(fr[1].getStr(),obj);
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
// read the local data by iterating through the associate
|
||||
// list, mapping the associate names to DotOsgWrapper's which
|
||||
// in turn have the appropriate functions.
|
||||
for(DotOsgWrapper::Associates::const_iterator aitr=assoc.begin();
|
||||
aitr!=assoc.end();
|
||||
++aitr)
|
||||
{
|
||||
DotOsgWrapperMap::iterator mitr = _objectWrapperMap.find(*aitr);
|
||||
if (mitr==_objectWrapperMap.end())
|
||||
{
|
||||
// not found so check if a library::class composite name.
|
||||
std::string token = *aitr;
|
||||
std::string::size_type posDoubleColon = token.rfind("::");
|
||||
if (posDoubleColon != std::string::npos)
|
||||
{
|
||||
// we have a composite name so now strip off the library name
|
||||
// and try to load it, and then retry the find to see
|
||||
// if we can recognize the objects.
|
||||
std::string libraryName = std::string(token,0,posDoubleColon);
|
||||
|
||||
// first try the standard nodekit library.
|
||||
std::string nodeKitLibraryName = createLibraryNameForNodeKit(libraryName);
|
||||
if (loadLibrary(nodeKitLibraryName)==LOADED)
|
||||
{
|
||||
mitr = _objectWrapperMap.find(*aitr);
|
||||
if (mitr==_objectWrapperMap.end())
|
||||
{
|
||||
// otherwise try the osgdb_ plugin library.
|
||||
std::string pluginLibraryName = createLibraryNameForExtension(libraryName);
|
||||
if (loadLibrary(pluginLibraryName)==LOADED)
|
||||
{
|
||||
mitr = _objectWrapperMap.find(*aitr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mitr!=_objectWrapperMap.end())
|
||||
{
|
||||
// get the function to read the data...
|
||||
DotOsgWrapper::ReadFunc rf = mitr->second->getReadFunc();
|
||||
if (rf && (*rf)(*obj,fr)) iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!iteratorAdvanced) fr.advanceOverCurrentFieldOrBlock();
|
||||
}
|
||||
++fr; // step over trailing '}'
|
||||
|
||||
return obj;
|
||||
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
//
|
||||
// read object from input iterator.
|
||||
//
|
||||
osg::Object* Registry::readObject(DotOsgWrapperMap& dowMap,Input& fr)
|
||||
{
|
||||
const char *str = fr[0].getStr();
|
||||
if (str==NULL) return NULL;
|
||||
|
||||
std::string name = str;
|
||||
DotOsgWrapperMap::iterator itr = dowMap.find(name);
|
||||
if (itr==dowMap.end())
|
||||
{
|
||||
// not found so check if a library::class composite name.
|
||||
std::string token = fr[0].getStr();
|
||||
std::string::size_type posDoubleColon = token.rfind("::");
|
||||
if (posDoubleColon != std::string::npos)
|
||||
{
|
||||
// we have a composite name so now strip off the library name
|
||||
// are try to load it, and then retry the readObject to see
|
||||
// if we can recognize the objects.
|
||||
|
||||
std::string libraryName = std::string(token,0,posDoubleColon);
|
||||
|
||||
// first try the standard nodekit library.
|
||||
std::string nodeKitLibraryName = createLibraryNameForNodeKit(libraryName);
|
||||
if (loadLibrary(nodeKitLibraryName)==LOADED) return readObject(dowMap,fr);
|
||||
|
||||
// otherwise try the osgdb_ plugin library.
|
||||
std::string pluginLibraryName = createLibraryNameForExtension(libraryName);
|
||||
if (loadLibrary(pluginLibraryName)==LOADED) return readObject(dowMap,fr);
|
||||
}
|
||||
}
|
||||
else if (fr[1].isOpenBracket())
|
||||
{
|
||||
|
||||
DotOsgWrapper* wrapper = itr->second.get();
|
||||
const osg::Object* proto = wrapper->getPrototype();
|
||||
if (proto==NULL)
|
||||
{
|
||||
osg::notify(osg::WARN)<<"Token "<<fr[0].getStr()<<" read, but has no prototype, cannot load."<< std::endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// record the number of nested brackets move the input iterator
|
||||
// over the name { tokens.
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
fr+=2;
|
||||
|
||||
const DotOsgWrapper::Associates& assoc = wrapper->getAssociates();
|
||||
osg::Object* obj = proto->cloneType();
|
||||
|
||||
while(!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
if (fr[0].matchWord("UniqueID") && fr[1].isString())
|
||||
{
|
||||
fr.registerUniqueIDForObject(fr[1].getStr(),obj);
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
// read the local data by iterating through the associate
|
||||
// list, mapping the associate names to DotOsgWrapper's which
|
||||
// in turn have the appropriate functions.
|
||||
for(DotOsgWrapper::Associates::const_iterator aitr=assoc.begin();
|
||||
aitr!=assoc.end();
|
||||
++aitr)
|
||||
{
|
||||
DotOsgWrapperMap::iterator mitr = _objectWrapperMap.find(*aitr);
|
||||
if (mitr==_objectWrapperMap.end())
|
||||
{
|
||||
// not found so check if a library::class composite name.
|
||||
std::string token = *aitr;
|
||||
std::string::size_type posDoubleColon = token.rfind("::");
|
||||
if (posDoubleColon != std::string::npos)
|
||||
{
|
||||
|
||||
// we have a composite name so now strip off the library name
|
||||
// are try to load it, and then retry the find to see
|
||||
// if we can recognize the objects.
|
||||
|
||||
std::string libraryName = std::string(token,0,posDoubleColon);
|
||||
|
||||
// first try the standard nodekit library.
|
||||
std::string nodeKitLibraryName = createLibraryNameForNodeKit(libraryName);
|
||||
if (loadLibrary(nodeKitLibraryName)==LOADED)
|
||||
{
|
||||
mitr = _objectWrapperMap.find(*aitr);
|
||||
}
|
||||
|
||||
if (mitr==_objectWrapperMap.end())
|
||||
{
|
||||
// otherwise try the osgdb_ plugin library.
|
||||
std::string pluginLibraryName = createLibraryNameForExtension(libraryName);
|
||||
if (loadLibrary(pluginLibraryName)==LOADED)
|
||||
{
|
||||
mitr = _objectWrapperMap.find(*aitr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (mitr!=_objectWrapperMap.end())
|
||||
{
|
||||
// get the function to read the data...
|
||||
DotOsgWrapper::ReadFunc rf = mitr->second->getReadFunc();
|
||||
if (rf && (*rf)(*obj,fr)) iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!iteratorAdvanced) fr.advanceOverCurrentFieldOrBlock();
|
||||
}
|
||||
++fr; // step over trailing '}'
|
||||
|
||||
return obj;
|
||||
|
||||
}
|
||||
|
||||
return 0L;
|
||||
}
|
||||
|
||||
//
|
||||
// read object from input iterator.
|
||||
//
|
||||
Object* Registry::readObject(Input& fr)
|
||||
{
|
||||
if (fr[0].matchWord("Use"))
|
||||
{
|
||||
if (fr[1].isString())
|
||||
{
|
||||
Object* obj = fr.getObjectForUniqueID(fr[1].getStr());
|
||||
if (obj) fr+=2;
|
||||
return obj;
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
}
|
||||
|
||||
return readObject(_objectWrapperMap,fr);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// read image from input iterator.
|
||||
//
|
||||
Image* Registry::readImage(Input& fr)
|
||||
{
|
||||
if (fr[0].matchWord("Use"))
|
||||
{
|
||||
if (fr[1].isString())
|
||||
{
|
||||
Image* image = dynamic_cast<Image*>(fr.getObjectForUniqueID(fr[1].getStr()));
|
||||
if (image) fr+=2;
|
||||
return image;
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
}
|
||||
|
||||
osg::Object* obj = readObject(_imageWrapperMap,fr);
|
||||
osg::Image* image = dynamic_cast<Image*>(obj);
|
||||
if (image) return image;
|
||||
else if (obj) obj->unref();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// read drawable from input iterator.
|
||||
//
|
||||
Drawable* Registry::readDrawable(Input& fr)
|
||||
{
|
||||
if (fr[0].matchWord("Use"))
|
||||
{
|
||||
if (fr[1].isString())
|
||||
{
|
||||
Drawable* drawable = dynamic_cast<Drawable*>(fr.getObjectForUniqueID(fr[1].getStr()));
|
||||
if (drawable) fr+=2;
|
||||
return drawable;
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
}
|
||||
|
||||
osg::Object* obj = readObject(_drawableWrapperMap,fr);
|
||||
osg::Drawable* drawable = dynamic_cast<Drawable*>(obj);
|
||||
if (drawable) return drawable;
|
||||
else if (obj) obj->unref();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// read drawable from input iterator.
|
||||
//
|
||||
StateAttribute* Registry::readStateAttribute(Input& fr)
|
||||
{
|
||||
|
||||
if (fr[0].matchWord("Use"))
|
||||
{
|
||||
if (fr[1].isString())
|
||||
{
|
||||
StateAttribute* attribute = dynamic_cast<StateAttribute*>(fr.getObjectForUniqueID(fr[1].getStr()));
|
||||
if (attribute) fr+=2;
|
||||
return attribute;
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
}
|
||||
|
||||
return dynamic_cast<StateAttribute*>(readObject(_stateAttrWrapperMap,fr));
|
||||
}
|
||||
|
||||
//
|
||||
// read drawable from input iterator.
|
||||
//
|
||||
Uniform* Registry::readUniform(Input& fr)
|
||||
{
|
||||
|
||||
if (fr[0].matchWord("Use"))
|
||||
{
|
||||
if (fr[1].isString())
|
||||
{
|
||||
Uniform* attribute = dynamic_cast<Uniform*>(fr.getObjectForUniqueID(fr[1].getStr()));
|
||||
if (attribute) fr+=2;
|
||||
return attribute;
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
}
|
||||
|
||||
return dynamic_cast<Uniform*>(readObject(_uniformWrapperMap,fr));
|
||||
}
|
||||
|
||||
//
|
||||
// read node from input iterator.
|
||||
//
|
||||
Node* Registry::readNode(Input& fr)
|
||||
{
|
||||
if (fr[0].matchWord("Use"))
|
||||
{
|
||||
if (fr[1].isString())
|
||||
{
|
||||
Node* node = dynamic_cast<Node*>(fr.getObjectForUniqueID(fr[1].getStr()));
|
||||
if (node) fr+=2;
|
||||
return node;
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
}
|
||||
|
||||
osg::Object* obj = readObject(_nodeWrapperMap,fr);
|
||||
osg::Node* node = dynamic_cast<Node*>(obj);
|
||||
if (node) return node;
|
||||
else if (obj) obj->unref();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// read image from input iterator.
|
||||
//
|
||||
Shader* Registry::readShader(Input& fr)
|
||||
{
|
||||
if (fr[0].matchWord("Use"))
|
||||
{
|
||||
if (fr[1].isString())
|
||||
{
|
||||
Shader* shader = dynamic_cast<Shader*>(fr.getObjectForUniqueID(fr[1].getStr()));
|
||||
if (shader) fr+=2;
|
||||
return shader;
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
}
|
||||
|
||||
osg::Object* obj = readObject(_shaderWrapperMap,fr);
|
||||
osg::Shader* shader = dynamic_cast<Shader*>(obj);
|
||||
if (shader) return shader;
|
||||
else if (obj) obj->unref();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Write object to output
|
||||
//
|
||||
bool Registry::writeObject(const osg::Object& obj,Output& fw)
|
||||
{
|
||||
|
||||
if (obj.referenceCount()>1)
|
||||
{
|
||||
std::string uniqueID;
|
||||
if (fw.getUniqueIDForObject(&obj,uniqueID))
|
||||
{
|
||||
fw.writeUseID( uniqueID );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string classname( obj.className() );
|
||||
const std::string libraryName( obj.libraryName() );
|
||||
const std::string compositeName( libraryName + "::" + classname );
|
||||
|
||||
// try composite name first
|
||||
DotOsgWrapperMap::iterator itr = _classNameWrapperMap.find(compositeName);
|
||||
|
||||
if (itr==_classNameWrapperMap.end())
|
||||
{
|
||||
// first try the standard nodekit library.
|
||||
std::string nodeKitLibraryName = createLibraryNameForNodeKit(libraryName);
|
||||
if (loadLibrary(nodeKitLibraryName)==LOADED) return writeObject(obj,fw);
|
||||
|
||||
// otherwise try the osgdb_ plugin library.
|
||||
std::string pluginLibraryName = createLibraryNameForExtension(libraryName);
|
||||
if (loadLibrary(pluginLibraryName)==LOADED) return writeObject(obj,fw);
|
||||
|
||||
// otherwise try simple class name
|
||||
if (itr == _classNameWrapperMap.end())
|
||||
itr = _classNameWrapperMap.find(classname);
|
||||
}
|
||||
|
||||
if (itr!=_classNameWrapperMap.end())
|
||||
{
|
||||
DotOsgWrapper* wrapper = itr->second.get();
|
||||
const DotOsgWrapper::Associates& assoc = wrapper->getAssociates();
|
||||
|
||||
if (libraryName=="osg")
|
||||
{
|
||||
// member of the core osg, so no need to have composite library::class name.
|
||||
fw.writeBeginObject( wrapper->getName() );
|
||||
}
|
||||
else
|
||||
{
|
||||
// member of the node kit so must use composite library::class name.
|
||||
std::string::size_type posDoubleColon = wrapper->getName().find("::");
|
||||
if (posDoubleColon != std::string::npos)
|
||||
{
|
||||
fw.writeBeginObject( wrapper->getName() );
|
||||
}
|
||||
else
|
||||
{
|
||||
fw.writeBeginObject( libraryName + "::" + wrapper->getName() );
|
||||
}
|
||||
}
|
||||
fw.moveIn();
|
||||
|
||||
|
||||
// write out the unique ID if required.
|
||||
if (obj.referenceCount()>1)
|
||||
{
|
||||
std::string uniqueID;
|
||||
fw.createUniqueIDForObject(&obj,uniqueID);
|
||||
fw.registerUniqueIDForObject(&obj,uniqueID);
|
||||
fw.writeUniqueID( uniqueID );
|
||||
}
|
||||
|
||||
// read the local data by iterating through the associate
|
||||
// list, mapping the associate names to DotOsgWrapper's which
|
||||
// in turn have the appropriate functions.
|
||||
for(DotOsgWrapper::Associates::const_iterator aitr=assoc.begin();
|
||||
aitr!=assoc.end();
|
||||
++aitr)
|
||||
{
|
||||
DotOsgWrapperMap::iterator mitr = _objectWrapperMap.find(*aitr);
|
||||
if (mitr==_objectWrapperMap.end())
|
||||
{
|
||||
// not found so check if a library::class composite name.
|
||||
std::string token = *aitr;
|
||||
std::string::size_type posDoubleColon = token.rfind("::");
|
||||
if (posDoubleColon != std::string::npos)
|
||||
{
|
||||
|
||||
// we have a composite name so now strip off the library name
|
||||
// are try to load it, and then retry the find to see
|
||||
// if we can recognize the objects.
|
||||
|
||||
std::string libraryName = std::string(token,0,posDoubleColon);
|
||||
|
||||
// first try the standard nodekit library.
|
||||
std::string nodeKitLibraryName = createLibraryNameForNodeKit(libraryName);
|
||||
if (loadLibrary(nodeKitLibraryName)==LOADED)
|
||||
{
|
||||
mitr = _objectWrapperMap.find(*aitr);
|
||||
}
|
||||
|
||||
if (mitr==_objectWrapperMap.end())
|
||||
{
|
||||
// otherwise try the osgdb_ plugin library.
|
||||
std::string pluginLibraryName = createLibraryNameForExtension(libraryName);
|
||||
if (loadLibrary(pluginLibraryName)==LOADED)
|
||||
{
|
||||
mitr = _objectWrapperMap.find(*aitr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (mitr!=_objectWrapperMap.end())
|
||||
{
|
||||
// get the function to read the data...
|
||||
DotOsgWrapper::WriteFunc wf = mitr->second->getWriteFunc();
|
||||
if (wf) (*wf)(obj,fw);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fw.moveOut();
|
||||
fw.writeEndObject();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -10,8 +10,17 @@
|
||||
#include <osgIntrospection/StaticMethodInfo>
|
||||
#include <osgIntrospection/Attributes>
|
||||
|
||||
#include <osg/Drawable>
|
||||
#include <osg/Image>
|
||||
#include <osg/Node>
|
||||
#include <osg/Object>
|
||||
#include <osg/Shader>
|
||||
#include <osg/StateAttribute>
|
||||
#include <osg/Uniform>
|
||||
#include <osgDB/DotOsgWrapper>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/Registry>
|
||||
|
||||
// Must undefine IN and OUT macros defined in Windows headers
|
||||
#ifdef IN
|
||||
@ -21,6 +30,74 @@
|
||||
#undef OUT
|
||||
#endif
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgDB::DeprecatedDotOsgWrapperManager)
|
||||
I_DeclaringFile("osgDB/DotOsgWrapper");
|
||||
I_BaseType(osg::Referenced);
|
||||
I_Constructor0(____DeprecatedDotOsgWrapperManager,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, addDotOsgWrapper, IN, osgDB::DotOsgWrapper *, wrapper,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__addDotOsgWrapper__DotOsgWrapper_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, removeDotOsgWrapper, IN, osgDB::DotOsgWrapper *, wrapper,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__removeDotOsgWrapper__DotOsgWrapper_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method2(osg::Object *, readObjectOfType, IN, const osg::Object &, compObj, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Object_P1__readObjectOfType__C5_osg_Object_R1__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method2(osg::Object *, readObjectOfType, IN, const osgDB::basic_type_wrapper &, btw, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Object_P1__readObjectOfType__C5_basic_type_wrapper_R1__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::Object *, readObject, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Object_P1__readObject__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::Image *, readImage, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Image_P1__readImage__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::Drawable *, readDrawable, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Drawable_P1__readDrawable__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::Uniform *, readUniform, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Uniform_P1__readUniform__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::StateAttribute *, readStateAttribute, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_StateAttribute_P1__readStateAttribute__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::Node *, readNode, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Node_P1__readNode__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::Shader *, readShader, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Shader_P1__readShader__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method2(bool, writeObject, IN, const osg::Object &, obj, IN, osgDB::Output &, fw,
|
||||
Properties::NON_VIRTUAL,
|
||||
__bool__writeObject__C5_osg_Object_R1__Output_R1,
|
||||
"",
|
||||
"");
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_ENUM_REFLECTOR(osgDB::DotOsgWrapper::ReadWriteMode)
|
||||
I_DeclaringFile("osgDB/DotOsgWrapper");
|
||||
I_EnumLabel(osgDB::DotOsgWrapper::READ_AND_WRITE);
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <osgIntrospection/Attributes>
|
||||
|
||||
#include <osg/ArgumentParser>
|
||||
#include <osg/Drawable>
|
||||
#include <osg/FrameStamp>
|
||||
#include <osg/Image>
|
||||
#include <osg/KdTree>
|
||||
@ -20,17 +19,13 @@
|
||||
#include <osg/Shader>
|
||||
#include <osg/Shape>
|
||||
#include <osg/State>
|
||||
#include <osg/StateAttribute>
|
||||
#include <osg/Uniform>
|
||||
#include <osgDB/Archive>
|
||||
#include <osgDB/AuthenticationMap>
|
||||
#include <osgDB/Callbacks>
|
||||
#include <osgDB/DotOsgWrapper>
|
||||
#include <osgDB/DynamicLibrary>
|
||||
#include <osgDB/FileCache>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Options>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ReaderWriter>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/SharedStateManager>
|
||||
@ -178,56 +173,6 @@ BEGIN_OBJECT_REFLECTOR(osgDB::Registry)
|
||||
__C5_ReaderWriterList_R1__getReaderWriterList,
|
||||
"get const list of all registered ReaderWriters. ",
|
||||
"");
|
||||
I_Method2(osg::Object *, readObjectOfType, IN, const osg::Object &, compObj, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Object_P1__readObjectOfType__C5_osg_Object_R1__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method2(osg::Object *, readObjectOfType, IN, const osgDB::basic_type_wrapper &, btw, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Object_P1__readObjectOfType__C5_basic_type_wrapper_R1__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::Object *, readObject, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Object_P1__readObject__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::Image *, readImage, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Image_P1__readImage__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::Drawable *, readDrawable, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Drawable_P1__readDrawable__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::Uniform *, readUniform, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Uniform_P1__readUniform__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::StateAttribute *, readStateAttribute, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_StateAttribute_P1__readStateAttribute__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::Node *, readNode, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Node_P1__readNode__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::Shader *, readShader, IN, osgDB::Input &, fr,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Shader_P1__readShader__Input_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method2(bool, writeObject, IN, const osg::Object &, obj, IN, osgDB::Output &, fw,
|
||||
Properties::NON_VIRTUAL,
|
||||
__bool__writeObject__C5_osg_Object_R1__Output_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setFindFileCallback, IN, osgDB::Registry::FindFileCallback *, cb,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setFindFileCallback__FindFileCallback_P1,
|
||||
@ -643,12 +588,15 @@ BEGIN_OBJECT_REFLECTOR(osgDB::Registry)
|
||||
__bool__isProtocolRegistered__C5_std_string_R1,
|
||||
"returns true, if named protocol is registered ",
|
||||
"");
|
||||
I_Method0(osgDB::DeprecatedDotOsgWrapperManager *, getDeprecatedDotOsgObjectWrapperManager,
|
||||
Properties::NON_VIRTUAL,
|
||||
__DeprecatedDotOsgWrapperManager_P1__getDeprecatedDotOsgObjectWrapperManager,
|
||||
"Get the ObjectWrapperManager that is used to store all the ObjectWrappers. ",
|
||||
"");
|
||||
I_ProtectedConstructor0(____Registry,
|
||||
"constructor is private, as its a singleton, preventing construction other than via the instance() method and therefore ensuring only one copy is ever constructed ",
|
||||
"");
|
||||
|
||||
|
||||
|
||||
I_ProtectedMethod0(void, destruct,
|
||||
Properties::NON_VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
@ -679,6 +627,9 @@ BEGIN_OBJECT_REFLECTOR(osgDB::Registry)
|
||||
I_SimpleProperty(const osgDB::FilePathList &, DataFilePathList,
|
||||
__C5_FilePathList_R1__getDataFilePathList,
|
||||
__void__setDataFilePathList__C5_FilePathList_R1);
|
||||
I_SimpleProperty(osgDB::DeprecatedDotOsgWrapperManager *, DeprecatedDotOsgObjectWrapperManager,
|
||||
__DeprecatedDotOsgWrapperManager_P1__getDeprecatedDotOsgObjectWrapperManager,
|
||||
0);
|
||||
I_SimpleProperty(double, ExpiryDelay,
|
||||
__double__getExpiryDelay,
|
||||
__void__setExpiryDelay__double);
|
||||
|
Loading…
Reference in New Issue
Block a user