mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
Merge branch 'DoNotSearchTwice' into 'master'
Search only in the niffilemanager for nif files See merge request OpenMW/openmw!823
This commit is contained in:
commit
d843ec321e
1 changed files with 4 additions and 7 deletions
|
@ -378,7 +378,7 @@ namespace Resource
|
||||||
Resource::ImageManager* mImageManager;
|
Resource::ImageManager* mImageManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> load (Files::IStreamPtr file, const std::string& normalizedFilename, Resource::ImageManager* imageManager, Resource::NifFileManager* nifFileManager)
|
osg::ref_ptr<osg::Node> load (const std::string& normalizedFilename, const VFS::Manager* vfs, Resource::ImageManager* imageManager, Resource::NifFileManager* nifFileManager)
|
||||||
{
|
{
|
||||||
std::string ext = Resource::getFileExtension(normalizedFilename);
|
std::string ext = Resource::getFileExtension(normalizedFilename);
|
||||||
if (ext == "nif")
|
if (ext == "nif")
|
||||||
|
@ -400,7 +400,7 @@ namespace Resource
|
||||||
options->setReadFileCallback(new ImageReadCallback(imageManager));
|
options->setReadFileCallback(new ImageReadCallback(imageManager));
|
||||||
if (ext == "dae") options->setOptionString("daeUseSequencedTextureUnits");
|
if (ext == "dae") options->setOptionString("daeUseSequencedTextureUnits");
|
||||||
|
|
||||||
osgDB::ReaderWriter::ReadResult result = reader->readNode(*file, options);
|
osgDB::ReaderWriter::ReadResult result = reader->readNode(*vfs->get(normalizedFilename), options);
|
||||||
if (!result.success())
|
if (!result.success())
|
||||||
{
|
{
|
||||||
std::stringstream errormsg;
|
std::stringstream errormsg;
|
||||||
|
@ -527,9 +527,7 @@ namespace Resource
|
||||||
osg::ref_ptr<osg::Node> loaded;
|
osg::ref_ptr<osg::Node> loaded;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Files::IStreamPtr file = mVFS->get(normalized);
|
loaded = load(normalized, mVFS, mImageManager, mNifFileManager);
|
||||||
|
|
||||||
loaded = load(file, normalized, mImageManager, mNifFileManager);
|
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
|
@ -541,8 +539,7 @@ namespace Resource
|
||||||
if (mVFS->exists(normalized))
|
if (mVFS->exists(normalized))
|
||||||
{
|
{
|
||||||
Log(Debug::Error) << "Failed to load '" << name << "': " << e.what() << ", using marker_error." << sMeshTypes[i] << " instead";
|
Log(Debug::Error) << "Failed to load '" << name << "': " << e.what() << ", using marker_error." << sMeshTypes[i] << " instead";
|
||||||
Files::IStreamPtr file = mVFS->get(normalized);
|
loaded = load(normalized, mVFS, mImageManager, mNifFileManager);
|
||||||
loaded = load(file, normalized, mImageManager, mNifFileManager);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue