SL-20173 show warning notification when trying to add invalid files as local texture
parent
b07a9cfec3
commit
0b6c9c50c3
|
|
@ -90,6 +90,7 @@ bool LLImageDimensionsInfo::getImageDimensionsBmp()
|
|||
if (signature[0] != 'B' || signature[1] != 'M')
|
||||
{
|
||||
LL_WARNS() << "Not a BMP" << LL_ENDL;
|
||||
mWarning = "IncorrectFormat";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -140,6 +141,7 @@ bool LLImageDimensionsInfo::getImageDimensionsPng()
|
|||
if (memcmp(signature, png_magic, PNG_MAGIC_SIZE) != 0)
|
||||
{
|
||||
LL_WARNS() << "Not a PNG" << LL_ENDL;
|
||||
mWarning = "IncorrectFormat";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -183,6 +185,7 @@ bool LLImageDimensionsInfo::getImageDimensionsJpeg()
|
|||
if (memcmp(signature, jpeg_magic, JPEG_MAGIC_SIZE) != 0)
|
||||
{
|
||||
LL_WARNS() << "Not a JPEG" << LL_ENDL;
|
||||
mWarning = "IncorrectFormat";
|
||||
return false;
|
||||
}
|
||||
fseek(fp, 0, SEEK_SET); // go back to start of the file
|
||||
|
|
|
|||
|
|
@ -55,6 +55,12 @@ public:
|
|||
{
|
||||
return mLastError;
|
||||
}
|
||||
|
||||
const std::string& getWarningName()
|
||||
{
|
||||
return mWarning;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
void clean()
|
||||
|
|
@ -129,6 +135,7 @@ protected:
|
|||
std::string mSrcFilename;
|
||||
|
||||
std::string mLastError;
|
||||
std::string mWarning;
|
||||
|
||||
U8* mData;
|
||||
|
||||
|
|
|
|||
|
|
@ -982,6 +982,9 @@ bool LLLocalBitmapMgr::checkTextureDimensions(std::string filename)
|
|||
LLImageDimensionsInfo image_info;
|
||||
if (!image_info.load(filename,codec))
|
||||
{
|
||||
LLSD args;
|
||||
args["NAME"] = gDirUtilp->getBaseFileName(filename);
|
||||
LLNotificationsUtil::add(image_info.getWarningName(), args);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11986,5 +11986,13 @@ Would you like to save them first?
|
|||
notext="No"
|
||||
yestext="Yes"/>
|
||||
</notification>
|
||||
|
||||
|
||||
<notification
|
||||
icon="notifytip.tga"
|
||||
name="IncorrectFormat"
|
||||
priority="high"
|
||||
type="notifytip">
|
||||
Unable to upload '[NAME]' due to the following reason: incorrect image format.
|
||||
</notification>
|
||||
|
||||
</notifications>
|
||||
|
|
|
|||
Loading…
Reference in New Issue