1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-05 15:55:45 +00:00

Lua UI API: Let image manager handle missing textures

This commit is contained in:
Cody Glassman 2022-03-22 05:41:26 +00:00 committed by uramer
parent eb46bde75e
commit b3e0275e89

View File

@ -7,15 +7,9 @@ namespace LuaUi
{
std::shared_ptr<TextureResource> ResourceManager::registerTexture(TextureData data)
{
std::string normalizedPath = mVfs->normalizeFilename(data.mPath);
if (!mVfs->exists(normalizedPath))
{
auto error = Misc::StringUtils::format("Texture with path \"%s\" doesn't exist", data.mPath);
throw std::logic_error(error);
}
data.mPath = normalizedPath;
TextureResources& list = mTextures[normalizedPath];
data.mPath = mVfs->normalizeFilename(data.mPath);
TextureResources& list = mTextures[data.mPath];
list.push_back(std::make_shared<TextureResource>(data));
return list.back();
}