SH-3625 WIP - consolidated a couple of attachment removal paths
parent
40df1bba97
commit
01a229ecdf
|
|
@ -2765,6 +2765,10 @@ void LLAppearanceMgr::wearBaseOutfit()
|
|||
|
||||
void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove)
|
||||
{
|
||||
if (ids_to_remove.empty())
|
||||
{
|
||||
llwarns << "called with empty list, nothing to do" << llendl;
|
||||
}
|
||||
for (uuid_vec_t::const_iterator it = ids_to_remove.begin(); it != ids_to_remove.end(); ++it)
|
||||
{
|
||||
const LLUUID& id_to_remove = *it;
|
||||
|
|
|
|||
|
|
@ -6389,23 +6389,21 @@ class LLAttachmentDetachFromPoint : public view_listener_t
|
|||
{
|
||||
bool handleEvent(const LLSD& user_data)
|
||||
{
|
||||
uuid_vec_t ids_to_remove;
|
||||
const LLViewerJointAttachment *attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, user_data.asInteger(), (LLViewerJointAttachment*)NULL);
|
||||
if (attachment->getNumObjects() > 0)
|
||||
{
|
||||
gMessageSystem->newMessage("ObjectDetach");
|
||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
|
||||
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
|
||||
for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator iter = attachment->mAttachedObjects.begin();
|
||||
iter != attachment->mAttachedObjects.end();
|
||||
iter++)
|
||||
{
|
||||
LLViewerObject *attached_object = (*iter);
|
||||
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
|
||||
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, attached_object->getLocalID());
|
||||
ids_to_remove.push_back(attached_object->getAttachmentItemID());
|
||||
}
|
||||
gMessageSystem->sendReliable( gAgent.getRegionHost() );
|
||||
}
|
||||
if (!ids_to_remove.empty())
|
||||
{
|
||||
LLAppearanceMgr::instance().removeItemsFromAvatar(ids_to_remove);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -6478,17 +6476,8 @@ class LLAttachmentDetach : public view_listener_t
|
|||
return true;
|
||||
}
|
||||
|
||||
// The sendDetach() method works on the list of selected
|
||||
// objects. Thus we need to clear the list, make sure it only
|
||||
// contains the object the user clicked, send the message,
|
||||
// then clear the list.
|
||||
// We use deselectAll to update the simulator's notion of what's
|
||||
// selected, and removeAll just to change things locally.
|
||||
//RN: I thought it was more useful to detach everything that was selected
|
||||
if (LLSelectMgr::getInstance()->getSelection()->isAttachment())
|
||||
{
|
||||
LLSelectMgr::getInstance()->sendDetach();
|
||||
}
|
||||
LLAppearanceMgr::instance().removeItemFromAvatar(object->getAttachmentItemID());
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue