Fixed a texture pop-in problem for some bundled graphic files.

This commit is contained in:
Leon Styhre 2021-03-16 21:43:14 +01:00
parent c50a6f8cba
commit 320f81ab4f

View file

@ -158,6 +158,12 @@ void ImageComponent::setDefaultImage(std::string path)
void ImageComponent::setImage(std::string path, bool tile)
{
// Always load bundled graphic resources statically, unless mForceLoad has been set.
// This eliminates annoying texture pop-in problems that would otherwise occur.
if (!mForceLoad && (path[0] == ':') && (path[1] == '/')) {
mDynamic = false;
}
if (path.empty() || !ResourceManager::getInstance()->fileExists(path)) {
if (mDefaultPath.empty() || !ResourceManager::getInstance()->fileExists(mDefaultPath))
mTexture.reset();