Support theming for kart icons (#4395)
This commit is contained in:
parent
4b47cf3f24
commit
0274cd7bd8
@ -2897,7 +2897,8 @@ std::string Skin::getThemedIcon(const std::string& relative_path) const
|
|||||||
{
|
{
|
||||||
std::string relative_path2 = path_no_extension + s;
|
std::string relative_path2 = path_no_extension + s;
|
||||||
if (!SkinConfig::m_icon_theme ||
|
if (!SkinConfig::m_icon_theme ||
|
||||||
relative_path2.find("gui/icons/") == std::string::npos)
|
(relative_path2.find("karts/") == std::string::npos &&
|
||||||
|
relative_path2.find("gui/icons/") == std::string::npos))
|
||||||
{
|
{
|
||||||
std::string tmp_path = file_manager->getAsset(relative_path2);
|
std::string tmp_path = file_manager->getAsset(relative_path2);
|
||||||
if (file_manager->fileExists(tmp_path))
|
if (file_manager->fileExists(tmp_path))
|
||||||
|
@ -265,7 +265,16 @@ void KartProperties::load(const std::string &filename, const std::string &node)
|
|||||||
// addShared makes sure that these textures/material infos stay in memory
|
// addShared makes sure that these textures/material infos stay in memory
|
||||||
material_manager->addSharedMaterial(materials_file);
|
material_manager->addSharedMaterial(materials_file);
|
||||||
|
|
||||||
|
// load the kart icon file
|
||||||
|
if(Addon::isAddon(filename))
|
||||||
|
{ // load the icon directly if addon karts
|
||||||
m_icon_file = m_root+m_icon_file;
|
m_icon_file = m_root+m_icon_file;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // check the skin folder for icons first if official karts
|
||||||
|
m_icon_file = GUIEngine::getSkin()->getThemedIcon(std::string("karts/")
|
||||||
|
+m_ident+"/"+m_icon_file);
|
||||||
|
}
|
||||||
|
|
||||||
// Make permanent is important, since otherwise icons can get deleted
|
// Make permanent is important, since otherwise icons can get deleted
|
||||||
// (e.g. when freeing temp. materials from a track, the last icon
|
// (e.g. when freeing temp. materials from a track, the last icon
|
||||||
@ -277,8 +286,17 @@ void KartProperties::load(const std::string &filename, const std::string &node)
|
|||||||
/*strip_path*/false);
|
/*strip_path*/false);
|
||||||
if (m_minimap_icon_file!="")
|
if (m_minimap_icon_file!="")
|
||||||
{
|
{
|
||||||
m_minimap_icon = STKTexManager::getInstance()
|
// check if there is an icon in the skin folder first
|
||||||
->getTexture(m_root+m_minimap_icon_file);
|
if(Addon::isAddon(filename))
|
||||||
|
{
|
||||||
|
m_minimap_icon_file = m_root+m_minimap_icon_file;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_minimap_icon_file = GUIEngine::getSkin()->getThemedIcon(std::string("karts/")
|
||||||
|
+m_ident+"/"+m_minimap_icon_file);
|
||||||
|
}
|
||||||
|
m_minimap_icon = STKTexManager::getInstance()->getTexture(m_minimap_icon_file);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_minimap_icon = NULL;
|
m_minimap_icon = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user