Fix skin previews, allow using images from paths on disk

This commit is contained in:
Lirusaito
2019-01-28 20:46:47 -05:00
parent 0f96939828
commit 674abf478b
2 changed files with 11 additions and 4 deletions

View File

@@ -116,8 +116,7 @@ void LLPanelSkins::refresh()
LLButton* b = getChild<LLButton>("custom_skin_preview");
std::string imagename = data["preview_image"].asString();
if(imagename == "" || imagename == " " || !LLFile::isfile(imagename)) imagename = "preview.png";
std::string imageprev(".."+gDirUtilp->getDirDelimiter()+
".."+gDirUtilp->getDirDelimiter()+
std::string imageprev(path_name+
data["folder_name"].asString()+gDirUtilp->getDirDelimiter()+
"textures"+gDirUtilp->getDirDelimiter()+
imagename);

View File

@@ -383,8 +383,16 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string&
return NULL ;
}
std::string full_path = gDirUtilp->findSkinnedFilename("textures", filename);
if (full_path.empty())
// Singu Note: Detect if we were given a full path already, require being over a certain size, so we have more than just a path
bool full = filename.size() >
#ifdef LL_WINDOWS
3 && filename.substr(1, 2) == ":\\"; // Drive letter comes first
#else
1 && filename.front() == '/'; // delim is root
#endif
std::string full_path = full ? filename : gDirUtilp->findSkinnedFilename("textures", filename);
if (full_path.empty() || (full && !gDirUtilp->fileExists(full_path)))
{
LL_WARNS() << "Failed to find local image file: " << filename << LL_ENDL;
return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);