mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-23 11:54:58 -04:00
Use normalized path in LuaUi::TextureData
This commit is contained in:
parent
a79e121df6
commit
bc219b6a1e
@ -231,7 +231,7 @@ namespace MWLua
|
|||||||
LuaUi::TextureData data;
|
LuaUi::TextureData data;
|
||||||
sol::object path = LuaUtil::getFieldOrNil(options, "path");
|
sol::object path = LuaUtil::getFieldOrNil(options, "path");
|
||||||
if (path.is<std::string>())
|
if (path.is<std::string>())
|
||||||
data.mPath = path.as<std::string>();
|
data.mPath = VFS::Path::Normalized(path.as<std::string>());
|
||||||
if (data.mPath.empty())
|
if (data.mPath.empty())
|
||||||
throw std::logic_error("Invalid texture path");
|
throw std::logic_error("Invalid texture path");
|
||||||
sol::object offset = LuaUtil::getFieldOrNil(options, "offset");
|
sol::object offset = LuaUtil::getFieldOrNil(options, "offset");
|
||||||
|
@ -6,8 +6,6 @@ namespace LuaUi
|
|||||||
{
|
{
|
||||||
std::shared_ptr<TextureResource> ResourceManager::registerTexture(TextureData data)
|
std::shared_ptr<TextureResource> ResourceManager::registerTexture(TextureData data)
|
||||||
{
|
{
|
||||||
VFS::Path::normalizeFilenameInPlace(data.mPath);
|
|
||||||
|
|
||||||
TextureResources& list = mTextures[data.mPath];
|
TextureResources& list = mTextures[data.mPath];
|
||||||
list.push_back(std::make_shared<TextureResource>(data));
|
list.push_back(std::make_shared<TextureResource>(data));
|
||||||
return list.back();
|
return list.back();
|
||||||
|
@ -2,12 +2,13 @@
|
|||||||
#define OPENMW_LUAUI_RESOURCES
|
#define OPENMW_LUAUI_RESOURCES
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <osg/Vec2f>
|
#include <osg/Vec2f>
|
||||||
|
|
||||||
|
#include <components/vfs/pathutil.hpp>
|
||||||
|
|
||||||
namespace VFS
|
namespace VFS
|
||||||
{
|
{
|
||||||
class Manager;
|
class Manager;
|
||||||
@ -17,7 +18,7 @@ namespace LuaUi
|
|||||||
{
|
{
|
||||||
struct TextureData
|
struct TextureData
|
||||||
{
|
{
|
||||||
std::string mPath;
|
VFS::Path::Normalized mPath;
|
||||||
osg::Vec2f mOffset;
|
osg::Vec2f mOffset;
|
||||||
osg::Vec2f mSize;
|
osg::Vec2f mSize;
|
||||||
};
|
};
|
||||||
@ -33,7 +34,7 @@ namespace LuaUi
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
using TextureResources = std::vector<std::shared_ptr<TextureResource>>;
|
using TextureResources = std::vector<std::shared_ptr<TextureResource>>;
|
||||||
std::unordered_map<std::string, TextureResources> mTextures;
|
std::unordered_map<VFS::Path::Normalized, TextureResources, VFS::Path::Hash> mTextures;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user