Introduced the use of ref_ptr<> in read show methods
This commit is contained in:
parent
bff3fcbe72
commit
f27678dbb9
@ -176,7 +176,7 @@ osgDB::Options* createOptions(const osgDB::ReaderWriter::Options* options)
|
||||
return local_options.release();
|
||||
}
|
||||
|
||||
osg::Node* p3d::readHoldingSlide(const std::string& filename)
|
||||
osg::ref_ptr<osg::Node> p3d::readHoldingSlide(const std::string& filename)
|
||||
{
|
||||
std::string ext = osgDB::getFileExtension(filename);
|
||||
if (!osgDB::equalCaseInsensitive(ext,"xml") &&
|
||||
@ -186,10 +186,10 @@ osg::Node* p3d::readHoldingSlide(const std::string& filename)
|
||||
options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_NONE);
|
||||
options->setOptionString("preview");
|
||||
|
||||
return osgDB::readNodeFile(filename, options.get());
|
||||
return osgDB::readRefNodeFile(filename, options.get());
|
||||
}
|
||||
|
||||
osg::Node* p3d::readPresentation(const std::string& filename,const osgDB::ReaderWriter::Options* options)
|
||||
osg::ref_ptr<osg::Node> p3d::readPresentation(const std::string& filename,const osgDB::ReaderWriter::Options* options)
|
||||
{
|
||||
std::string ext = osgDB::getFileExtension(filename);
|
||||
if (!osgDB::equalCaseInsensitive(ext,"xml") &&
|
||||
@ -198,10 +198,10 @@ osg::Node* p3d::readPresentation(const std::string& filename,const osgDB::Reader
|
||||
osg::ref_ptr<osgDB::Options> local_options = createOptions(options);
|
||||
local_options->setOptionString("main");
|
||||
|
||||
return osgDB::readNodeFile(filename, local_options.get());
|
||||
return osgDB::readRefNodeFile(filename, local_options.get());
|
||||
}
|
||||
|
||||
osg::Node* p3d::readShowFiles(osg::ArgumentParser& arguments,const osgDB::ReaderWriter::Options* options)
|
||||
osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const osgDB::ReaderWriter::Options* options)
|
||||
{
|
||||
osg::ref_ptr<osgDB::Options> local_options = createOptions(options);
|
||||
local_options->setOptionString("main");
|
||||
@ -290,5 +290,5 @@ osg::Node* p3d::readShowFiles(osg::ArgumentParser& arguments,const osgDB::Reader
|
||||
root->accept(avecv);
|
||||
}
|
||||
|
||||
return root.release();
|
||||
return root;
|
||||
}
|
||||
|
@ -26,11 +26,11 @@ bool readEnvVars(osg::ArgumentParser& arguments);
|
||||
|
||||
bool readEnvVars(const std::string& filename);
|
||||
|
||||
osg::Node* readHoldingSlide(const std::string& filename);
|
||||
osg::ref_ptr<osg::Node> readHoldingSlide(const std::string& filename);
|
||||
|
||||
osg::Node* readPresentation(const std::string& filename,const osgDB::ReaderWriter::Options* options);
|
||||
osg::ref_ptr<osg::Node> readPresentation(const std::string& filename,const osgDB::ReaderWriter::Options* options);
|
||||
|
||||
osg::Node* readShowFiles(osg::ArgumentParser& arguments,const osgDB::ReaderWriter::Options* options);
|
||||
osg::ref_ptr<osg::Node> readShowFiles(osg::ArgumentParser& arguments,const osgDB::ReaderWriter::Options* options);
|
||||
|
||||
}
|
||||
|
||||
|
@ -682,7 +682,6 @@ int main( int argc, char **argv )
|
||||
|
||||
osg::ref_ptr<osgDB::ReaderWriter::Options> cacheAllOption = new osgDB::ReaderWriter::Options;
|
||||
cacheAllOption->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_ALL);
|
||||
|
||||
osgDB::Registry::instance()->setOptions(cacheAllOption.get());
|
||||
|
||||
// read the scene from the list of file specified commandline args.
|
||||
|
Loading…
Reference in New Issue
Block a user