mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 03:35:27 +00:00
Improve checks for texture resource names that include the "textures\" prefix
This commit is contained in:
parent
ae5c0663f5
commit
2c05a7477c
@ -605,7 +605,12 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String
|
|||||||
*/
|
*/
|
||||||
static const char path[] = "textures\\";
|
static const char path[] = "textures\\";
|
||||||
|
|
||||||
texName = path + st->filename;
|
texName = st->filename;
|
||||||
|
Misc::StringUtils::toLower(texName);
|
||||||
|
|
||||||
|
if(texName.compare(0, sizeof(path)-1, path) != 0)
|
||||||
|
texName = path + texName;
|
||||||
|
|
||||||
Ogre::String::size_type pos = texName.rfind('.');
|
Ogre::String::size_type pos = texName.rfind('.');
|
||||||
if(pos != Ogre::String::npos && texName.compare(pos, texName.length() - pos, ".dds") != 0)
|
if(pos != Ogre::String::npos && texName.compare(pos, texName.length() - pos, ".dds") != 0)
|
||||||
{
|
{
|
||||||
@ -616,18 +621,7 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String
|
|||||||
// if it turns out that the above wasn't true in all cases (not for vanilla, but maybe mods)
|
// if it turns out that the above wasn't true in all cases (not for vanilla, but maybe mods)
|
||||||
// verify, and revert if false (this call succeeds quickly, but fails slowly)
|
// verify, and revert if false (this call succeeds quickly, but fails slowly)
|
||||||
if(!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(texName))
|
if(!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(texName))
|
||||||
texName = path + st->filename;
|
texName = path + Misc::StringUtils::lowerCase(texName);
|
||||||
}
|
|
||||||
else if (!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(texName))
|
|
||||||
{
|
|
||||||
// workaround for Better Heads addon
|
|
||||||
size_t lastSlash = st->filename.rfind('\\');
|
|
||||||
if (lastSlash != std::string::npos && lastSlash + 1 != st->filename.size()) {
|
|
||||||
texName = path + st->filename.substr(lastSlash + 1);
|
|
||||||
// workaround for Better Bodies addon
|
|
||||||
if (!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(texName))
|
|
||||||
texName = st->filename;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else warn("Found internal texture, ignoring.");
|
else warn("Found internal texture, ignoring.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user