diff options
-rwxr-xr-x | indra/newview/llappearancemgr.cpp | 4 | ||||
-rwxr-xr-x | indra/newview/llviewermenu.cpp | 27 |
2 files changed, 12 insertions, 19 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 71b7298f5c..2ad6f50ba9 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -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; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 9001c79a4d..24bed93f04 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -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; } }; |