From 674abf478bf469ed18b0262e310015c1b147d4af Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Mon, 28 Jan 2019 20:46:47 -0500 Subject: [PATCH] Fix skin previews, allow using images from paths on disk --- indra/newview/llpanelskins.cpp | 3 +-- indra/newview/llviewertexturelist.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/indra/newview/llpanelskins.cpp b/indra/newview/llpanelskins.cpp index 53d5ce60f..834fd9832 100644 --- a/indra/newview/llpanelskins.cpp +++ b/indra/newview/llpanelskins.cpp @@ -116,8 +116,7 @@ void LLPanelSkins::refresh() LLButton* b = getChild("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); diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index f3e57ec72..90c684807 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -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);