diff --git a/modules/client_skins/skins.lua b/modules/client_skins/skins.lua index 6e89bdd0..035dd4e5 100644 --- a/modules/client_skins/skins.lua +++ b/modules/client_skins/skins.lua @@ -10,6 +10,7 @@ local skinComboBox local function onSkinComboBoxOptionChange(self, optionText, optionData) if Skins.setSkin(optionText) then g_settings.set('skin', optionText) + g_textures.clearTexturesCache() g_modules.reloadModules() end end diff --git a/src/framework/graphics/texturemanager.cpp b/src/framework/graphics/texturemanager.cpp index 13bc7c9b..98796958 100644 --- a/src/framework/graphics/texturemanager.cpp +++ b/src/framework/graphics/texturemanager.cpp @@ -50,6 +50,11 @@ void TextureManager::terminate() m_emptyTexture = nullptr; } +void TextureManager::clearTexturesCache() +{ + m_textures.clear(); +} + TexturePtr TextureManager::getTexture(const std::string& fileName) { TexturePtr texture; diff --git a/src/framework/graphics/texturemanager.h b/src/framework/graphics/texturemanager.h index 268d7e34..e83d164c 100644 --- a/src/framework/graphics/texturemanager.h +++ b/src/framework/graphics/texturemanager.h @@ -31,6 +31,7 @@ public: void init(); void terminate(); + void clearTexturesCache(); TexturePtr getTexture(const std::string& fileName); const TexturePtr& getEmptyTexture() { return m_emptyTexture; } diff --git a/src/framework/luafunctions.cpp b/src/framework/luafunctions.cpp index 7863d4d1..29ec2739 100644 --- a/src/framework/luafunctions.cpp +++ b/src/framework/luafunctions.cpp @@ -36,6 +36,7 @@ #include #include #include +#include void Application::registerLuaFunctions() { @@ -225,6 +226,10 @@ void Application::registerLuaFunctions() g_lua.bindSingletonFunction("g_graphics", "getRenderer", &Graphics::getRenderer, &g_graphics); g_lua.bindSingletonFunction("g_graphics", "getVersion", &Graphics::getVersion, &g_graphics); + // Textures + g_lua.registerSingletonClass("g_textures"); + g_lua.bindSingletonFunction("g_textures", "clearTexturesCache", &TextureManager::clearTexturesCache, &g_textures); + // UI g_lua.registerSingletonClass("g_ui"); g_lua.bindSingletonFunction("g_ui", "clearStyles", &UIManager::clearStyles, &g_ui);