Add refresh texture button to profile picture popup view

meow-7.2.2
Ansariel 2022-07-30 13:19:35 +02:00
parent d57c1e1d54
commit e093408109
3 changed files with 44 additions and 2 deletions

View File

@ -36,6 +36,7 @@
#include "lltextureview.h"
#include "llviewertexture.h"
#include "llviewertexturelist.h"
#include "llviewermenu.h"
@ -68,6 +69,9 @@ BOOL LLFloaterProfileTexture::postBuild()
mCloseButton = getChild<LLButton>("close_btn");
mCloseButton->setCommitCallback([this](LLUICtrl*, void*) { closeFloater(); }, nullptr);
// <FS:Ansariel> Add refresh function
getChild<LLButton>("btn_refresh")->setCommitCallback([this](LLUICtrl*, void*) { refresh(); }, nullptr);
return TRUE;
}
@ -174,8 +178,12 @@ void LLFloaterProfileTexture::loadAsset(const LLUUID &image_id)
mProfileIcon->setValue(image_id);
mImageID = image_id;
mImage = LLViewerTextureManager::getFetchedTexture(mImageID, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
mImageOldBoostLevel = mImage->getBoostLevel();
// <FS:Ansariel> Loading speed up fix
//mImage = LLViewerTextureManager::getFetchedTexture(mImageID, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
//mImageOldBoostLevel = mImage->getBoostLevel();
mImage = LLViewerTextureManager::getFetchedTexture(mImageID, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_PREVIEW, LLViewerTexture::LOD_TEXTURE);
mImageOldBoostLevel = LLGLTexture::BOOST_NONE;
// </FS:Ansariel>
if ((mImage->getFullWidth() * mImage->getFullHeight()) == 0)
{
@ -221,3 +229,11 @@ void LLFloaterProfileTexture::onTextureLoaded(
delete handle;
}
}
// <FS:Ansariel> Add refresh function
void LLFloaterProfileTexture::refresh()
{
destroy_texture(mImageID);
mImage->forceToRefetchTexture();
}
// </FS:Ansariel>

View File

@ -46,6 +46,9 @@ public:
void resetAsset();
void loadAsset(const LLUUID &image_id);
// <FS:Ansariel> Add refresh function
void refresh();
static void onTextureLoaded(
BOOL success,

View File

@ -52,6 +52,22 @@
orientation="horizontal"
layout="topleft"
animate="false">
<layout_panel
follows="all"
layout="topleft"
name="refresh_panel"
auto_resize="false"
width="27">
<button
follows="top|left"
height="22"
image_overlay="Refresh_Off"
layout="topleft"
left="5"
top="0"
name="btn_refresh"
width="22" />
</layout_panel>
<layout_panel
follows="all"
layout="topleft"
@ -82,6 +98,13 @@
auto_resize="true"
width="1">
</layout_panel>
<layout_panel
follows="all"
layout="topleft"
name="refresh_counter_panel"
auto_resize="false"
width="27">
</layout_panel>
</layout_stack>
</layout_panel>
</layout_stack>