From 4455dd7eff28f288a3563ea26d8790bf9cca7f1e Mon Sep 17 00:00:00 2001 From: Shyotl Date: Wed, 3 Jul 2013 17:13:11 -0500 Subject: [PATCH] When requesting an avatar reload, also reload all attachments (prior to this it was not possible to actually reload attachments on non-agent avatars) --- indra/newview/llviewermenu.cpp | 63 ++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 8df0599dd..64b4a0f35 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -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 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 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* object = (*iter)->getObject(); - object->markForUpdate(TRUE); + LLViewerObject::vobj_list_t object_list; - 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)); - } - } + for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin(); + iter != LLSelectMgr::getInstance()->getSelection()->end(); iter++) + { + object_list.push_back((*iter)->getObject()); } + + reload_objects(LLTextureReloader(),object_list,false); + return true; } };