Added Tex Refresh functions to the pie menu for attachments, avatar skins and objects. Fixes/Addresses FIRE-2606 FIRE-454 FIRE-1106 FIRE-3575

ziree 2011-10-13 17:48:03 +02:00
parent 6c9948fc33
commit 29359b427d
6 changed files with 109 additions and 3 deletions

View File

@ -125,6 +125,11 @@
#include "fslslbridge.h"
//-TT
// ## Zi: Texture Refresh
#include "llavatarpropertiesprocessor.h"
#include "lltexturecache.h"
// ## Zi: Texture Refresh
using namespace LLVOAvatarDefines;
static boost::unordered_map<std::string, LLStringExplicit> sDefaultItemLabels;
@ -2582,6 +2587,71 @@ class LLObjectDerender : public view_listener_t
}
};
// ## Zi: Texture Refresh
void destroy_texture(LLUUID id) // will be used by the texture refresh functions below
{
LLViewerFetchedTexture* tx=LLViewerTextureManager::getFetchedTexture(id);
tx->destroyRawImage();
tx->destroySavedRawImage();
tx->destroyGLTexture();
tx->destroyTexture();
LLAppViewer::getTextureCache()->removeFromCache(id);
}
class LLObjectTexRefresh : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
// partly copied from the texture info code in handle_selected_texture_info()
for (LLObjectSelection::valid_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_begin();
iter != LLSelectMgr::getInstance()->getSelection()->valid_end(); iter++)
{
LLSelectNode* node = *iter;
U8 te_count = node->getObject()->getNumTEs();
// map from texture ID to list of faces using it
typedef std::map< LLUUID, std::vector<U8> > map_t;
map_t faces_per_texture;
for (U8 i = 0; i < te_count; i++)
{
if (!node->isTESelected(i)) continue;
LLViewerTexture* img = node->getObject()->getTEImage(i);
LLUUID image_id = img->getID();
faces_per_texture[image_id].push_back(i);
}
map_t::iterator it;
for (it = faces_per_texture.begin(); it != faces_per_texture.end(); ++it)
destroy_texture(it->first);
}
return true;
}
};
class LLAvatarTexRefresh : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
LLVOAvatar* avatar=find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
if(avatar)
{
// I bet this can be done more elegantly, but this is just straightforward
destroy_texture(avatar->getTE(TEX_HEAD_BAKED)->getID());
destroy_texture(avatar->getTE(TEX_UPPER_BAKED)->getID());
destroy_texture(avatar->getTE(TEX_LOWER_BAKED)->getID());
destroy_texture(avatar->getTE(TEX_EYES_BAKED)->getID());
destroy_texture(avatar->getTE(TEX_SKIRT_BAKED)->getID());
destroy_texture(avatar->getTE(TEX_HAIR_BAKED)->getID());
LLAvatarPropertiesProcessor::getInstance()->sendAvatarTexturesRequest(avatar->getID());
}
return true;
}
};
// ## Zi: Texture Refresh
class LLObjectReportAbuse : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
@ -9175,6 +9245,7 @@ void initialize_menus()
enable.add("Avatar.EnableCall", boost::bind(&enable_avatar_call));
// [/RLVa:KB]
view_listener_t::addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse");
view_listener_t::addMenu(new LLAvatarTexRefresh(), "Avatar.TexRefresh"); // ## Zi: Texture Refresh
view_listener_t::addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend");
enable.add("Avatar.EnableFreezeEject", boost::bind(&enable_freeze_eject, _2));
@ -9190,6 +9261,7 @@ void initialize_menus()
view_listener_t::addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse");
view_listener_t::addMenu(new LLObjectMute(), "Object.Mute");
view_listener_t::addMenu(new LLObjectDerender(), "Object.Derender");
view_listener_t::addMenu(new LLObjectTexRefresh(), "Object.TexRefresh"); // ## Zi: Texture Refresh
enable.add("Object.VisibleTake", boost::bind(&visible_take_object));
enable.add("Object.VisibleBuy", boost::bind(&visible_buy_object));

View File

@ -125,6 +125,13 @@
function="Tools.LookAtSelection"
parameter="zoom" />
</pie_slice>
<pie_slice
enabled="true"
label="Tex Refresh"
name="Texture Refresh">
<pie_slice.on_click
function="Object.TexRefresh" />
</pie_slice>
</pie_menu>

View File

@ -22,7 +22,13 @@
name="Attachment Pie More"
label="More &gt;">
<pie_separator />
<pie_slice
enabled="true"
label="Tex Refresh"
name="Texture Refresh">
<pie_slice.on_click
function="Object.TexRefresh" />
</pie_slice>
<pie_slice
enabled="true"
label="Script Info"

View File

@ -125,6 +125,13 @@
function="Tools.LookAtSelection"
parameter="zoom" />
</pie_slice>
<pie_slice
enabled="true"
label="Tex Refresh"
name="Texture Refresh">
<pie_slice.on_click
function="Avatar.TexRefresh" />
</pie_slice>
</pie_menu>

View File

@ -268,7 +268,15 @@
</pie_slice>
<pie_separator />
<pie_separator />
<pie_slice
enabled="true"
label="Tex Refresh"
name="Texture Refresh">
<pie_slice.on_click
function="Avatar.TexRefresh" />
</pie_slice>
<pie_separator />
<pie_slice label="Edit Outfit"

View File

@ -130,7 +130,13 @@
label="More >"
name="Object Pie More 2">
<pie_separator />
<pie_slice
enabled="true"
label="Tex Refresh"
name="Texture Refresh">
<pie_slice.on_click
function="Object.TexRefresh" />
</pie_slice>
<pie_slice
enabled="true"
label="Derender"