When requesting an avatar reload, also reload all attachments (prior to this it was not possible to actually reload attachments on non-agent avatars)

This commit is contained in:
Shyotl
2013-07-03 17:13:11 -05:00
parent b3d97b0860
commit 4455dd7eff

View File

@@ -2186,6 +2186,38 @@ public:
private:
std::set< LLViewerFetchedTexture*> mTextures;
};
void reload_objects(LLTextureReloader& texture_list, LLViewerObject::const_child_list_t& object_list, bool recurse)
{
for(LLViewerObject::const_child_list_t::const_iterator it = object_list.begin(); it!=object_list.end(); ++it)
{
if(it->isNull())
continue;
LLViewerObject* object = it->get();
object->markForUpdate(TRUE);
if(object->isSculpted() && !object->isMesh())
{
LLSculptParams *sculpt_params = (LLSculptParams *)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
if(sculpt_params)
{
texture_list.addTexture(LLViewerTextureManager::getFetchedTexture(sculpt_params->getSculptTexture()));
}
}
for (U8 i = 0; i < object->getNumTEs(); i++)
{
texture_list.addTexture(object->getTEImage(i));
}
if(recurse)
{
reload_objects(texture_list,object->getChildren(), true);
}
}
}
class LLAvatarReloadTextures : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
@@ -2214,6 +2246,7 @@ class LLAvatarReloadTextures : public view_listener_t
texture_list.addTexture(avatar->getTEImage((ETextureIndex)i));
}
}
reload_objects(texture_list,avatar->getChildren(),true);
}
return true;
}
@@ -2222,30 +2255,16 @@ class LLObjectReloadTextures : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLTextureReloader texture_list;
for (LLObjectSelection::valid_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_begin();
iter != LLSelectMgr::getInstance()->getSelection()->valid_end(); iter++)
LLViewerObject::vobj_list_t object_list;
for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin();
iter != LLSelectMgr::getInstance()->getSelection()->end(); iter++)
{
LLViewerObject* object = (*iter)->getObject();
object->markForUpdate(TRUE);
if(object->isSculpted() && !object->isMesh())
{
LLSculptParams *sculpt_params = (LLSculptParams *)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
if(sculpt_params)
{
texture_list.addTexture(LLViewerTextureManager::getFetchedTexture(sculpt_params->getSculptTexture()));
}
}
for (U8 i = 0; i < object->getNumTEs(); i++)
{
if((*iter)->isTESelected(i))
{
texture_list.addTexture(object->getTEImage(i));
}
}
object_list.push_back((*iter)->getObject());
}
reload_objects(LLTextureReloader(),object_list,false);
return true;
}
};