Remove empty texture warning
This commit is contained in:
parent
8799369066
commit
04e552994d
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "guiengine/screen.hpp"
|
#include "guiengine/screen.hpp"
|
||||||
|
#include "io/file_manager.hpp"
|
||||||
#include "guiengine/engine.hpp"
|
#include "guiengine/engine.hpp"
|
||||||
#include "guiengine/widgets.hpp"
|
#include "guiengine/widgets.hpp"
|
||||||
#include "utils/string_utils.hpp"
|
#include "utils/string_utils.hpp"
|
||||||
@ -215,8 +216,22 @@ if(prop_name != NULL) widget.m_properties[prop_flag] = core::stringc(prop_name).
|
|||||||
READ_PROPERTY(custom_ratio, PROP_CUSTOM_RATIO);
|
READ_PROPERTY(custom_ratio, PROP_CUSTOM_RATIO);
|
||||||
READ_PROPERTY(icon_align, PROP_ICON_ALIGN);
|
READ_PROPERTY(icon_align, PROP_ICON_ALIGN);
|
||||||
|
|
||||||
|
READ_PROPERTY(alt_icon, PROP_ICON);
|
||||||
|
if (widget.m_properties[PROP_ICON].empty())
|
||||||
|
{
|
||||||
|
// No alternative icon
|
||||||
READ_PROPERTY(icon, PROP_ICON);
|
READ_PROPERTY(icon, PROP_ICON);
|
||||||
READ_PROPERTY(alt_icon, PROP_ALT_ICON);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Use alternative icon if default icon cannot be themed
|
||||||
|
const std::string alt_icon = widget.m_properties[PROP_ICON];
|
||||||
|
READ_PROPERTY(icon, PROP_ICON);
|
||||||
|
const std::string test_icon = GUIEngine::getSkin()
|
||||||
|
->getThemedIcon(widget.m_properties[PROP_ICON]);
|
||||||
|
if (!file_manager->fileExists(test_icon))
|
||||||
|
widget.m_properties[PROP_ICON] = alt_icon;
|
||||||
|
}
|
||||||
READ_PROPERTY(focus_icon, PROP_FOCUS_ICON);
|
READ_PROPERTY(focus_icon, PROP_FOCUS_ICON);
|
||||||
READ_PROPERTY(text_align, PROP_TEXT_ALIGN);
|
READ_PROPERTY(text_align, PROP_TEXT_ALIGN);
|
||||||
READ_PROPERTY(text_valign, PROP_TEXT_VALIGN);
|
READ_PROPERTY(text_valign, PROP_TEXT_VALIGN);
|
||||||
|
@ -99,7 +99,6 @@ namespace GUIEngine
|
|||||||
PROP_ALIGN,
|
PROP_ALIGN,
|
||||||
// PROP_TEXT, // this one is a bit special, can't go along others since it's wide strings
|
// PROP_TEXT, // this one is a bit special, can't go along others since it's wide strings
|
||||||
PROP_ICON,
|
PROP_ICON,
|
||||||
PROP_ALT_ICON,
|
|
||||||
PROP_FOCUS_ICON,
|
PROP_FOCUS_ICON,
|
||||||
PROP_TEXT_ALIGN,
|
PROP_TEXT_ALIGN,
|
||||||
PROP_TEXT_VALIGN,
|
PROP_TEXT_VALIGN,
|
||||||
|
@ -82,25 +82,6 @@ void IconButtonWidget::add()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Alternative icon
|
|
||||||
if (m_texture == NULL)
|
|
||||||
{
|
|
||||||
// Use the alternative icon in case of original icon not found
|
|
||||||
if (m_properties[PROP_ALT_ICON] != "")
|
|
||||||
{
|
|
||||||
if (m_icon_path_type == ICON_PATH_TYPE_ABSOLUTE)
|
|
||||||
{
|
|
||||||
setTexture(irr_driver->getTexture(m_properties[PROP_ALT_ICON]));
|
|
||||||
}
|
|
||||||
else if (m_icon_path_type == ICON_PATH_TYPE_RELATIVE)
|
|
||||||
{
|
|
||||||
std::string file =
|
|
||||||
GUIEngine::getSkin()->getThemedIcon(m_properties[PROP_ALT_ICON]);
|
|
||||||
setTexture(irr_driver->getTexture(file));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_texture == NULL)
|
if (m_texture == NULL)
|
||||||
{
|
{
|
||||||
if (m_properties[PROP_ICON].size() > 0)
|
if (m_properties[PROP_ICON].size() > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user