diff --git a/include/osgDB/ReaderWriter b/include/osgDB/ReaderWriter index 1574cffc1..41f8eb390 100644 --- a/include/osgDB/ReaderWriter +++ b/include/osgDB/ReaderWriter @@ -110,7 +110,8 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object FILE_LOADED, //!< File successfully found, loaded, and converted into osg. FILE_LOADED_FROM_CACHE, //!< File found in cache and returned. ERROR_IN_READING_FILE, //!< File found, loaded, but an error was encountered during processing. - FILE_REQUESTED //!< Asyncronous file read has been requested, but returning immediatiely, keep polling plugin till file read has been completed. + FILE_REQUESTED, //!< Asyncronous file read has been requested, but returning immediatiely, keep polling plugin till file read has been completed. + INSUFFICIENT_MEMORY_TO_LOAD //!< File found but not loaded because estimated memory usage is not enought }; ReadResult(ReadStatus status=FILE_NOT_HANDLED):_status(status) {} @@ -150,6 +151,7 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object bool error() const { return _status==ERROR_IN_READING_FILE; } bool notHandled() const { return _status==FILE_NOT_HANDLED || _status==NOT_IMPLEMENTED; } bool notFound() const { return _status==FILE_NOT_FOUND; } + bool notEnoughMemory() const { return _status==INSUFFICIENT_MEMORY_TO_LOAD; } protected: diff --git a/src/osgDB/DatabasePager.cpp b/src/osgDB/DatabasePager.cpp index 842aed80a..93eb72817 100644 --- a/src/osgDB/DatabasePager.cpp +++ b/src/osgDB/DatabasePager.cpp @@ -619,6 +619,7 @@ void DatabasePager::DatabaseThread::run() if (rr.validNode()) databaseRequest->_loadedModel = rr.getNode(); if (rr.error()) OSG_NOTIFY(osg::WARN)<<"Error in reading file "<_fileName<<" : "<_fileName << std::endl; if (databaseRequest->_loadedModel.valid() && fileCache.valid() && diff --git a/src/osgDB/ReadFile.cpp b/src/osgDB/ReadFile.cpp index 6fda6f40d..043c2d8ce 100644 --- a/src/osgDB/ReadFile.cpp +++ b/src/osgDB/ReadFile.cpp @@ -68,7 +68,8 @@ Node* osgDB::readNodeFile(const std::string& filename,const Options* options) { ReaderWriter::ReadResult rr = Registry::instance()->readNode(filename,options); if (rr.validNode()) return rr.takeNode(); - if (rr.error()) notify(WARN) << rr.message() << std::endl; + if (rr.error()) OSG_WARN << rr.message() << std::endl; + if (rr.notEnoughMemory()) OSG_INFO << "Not enought memory to load file "<