summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
-rw-r--r--indra/newview/llviewermenu.cpp79
1 files changed, 50 insertions, 29 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 0be0b56bc3..91d305bee7 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -5851,47 +5851,68 @@ void confirm_replace_attachment(S32 option, void* user_data)
}
}
-class LLAttachmentDrop : public view_listener_t
+bool callback_attachment_drop(const LLSD& notification, const LLSD& response)
{
- bool handleEvent(const LLSD& userdata)
+ // Called when the user clicked on an object attached to them
+ // and selected "Drop".
+ LLUUID object_id = notification["payload"]["object_id"].asUUID();
+ LLViewerObject *object = gObjectList.findObject(object_id);
+
+ if (!object)
{
- // Called when the user clicked on an object attached to them
- // and selected "Drop".
- LLViewerObject *object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (!object)
- {
- llwarns << "handle_drop_attachment() - no object to drop" << llendl;
- return true;
- }
+ llwarns << "handle_drop_attachment() - no object to drop" << llendl;
+ return true;
+ }
- LLViewerObject *parent = (LLViewerObject*)object->getParent();
- while (parent)
+ LLViewerObject *parent = (LLViewerObject*)object->getParent();
+ while (parent)
+ {
+ if(parent->isAvatar())
{
- if(parent->isAvatar())
- {
- break;
- }
- object = parent;
- parent = (LLViewerObject*)parent->getParent();
+ break;
}
+ object = parent;
+ parent = (LLViewerObject*)parent->getParent();
+ }
- if (!object)
+ if (!object)
+ {
+ llwarns << "handle_detach() - no object to detach" << llendl;
+ return true;
+ }
+
+ if (object->isAvatar())
+ {
+ llwarns << "Trying to detach avatar from avatar." << llendl;
+ return true;
+ }
+
+ // reselect the object
+ LLSelectMgr::getInstance()->selectObjectAndFamily(object);
+
+ LLSelectMgr::getInstance()->sendDropAttachment();
+
+ return true;
+}
+
+class LLAttachmentDrop : public view_listener_t
+{
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLSD payload;
+ LLViewerObject *object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+
+ if (object)
{
- llwarns << "handle_detach() - no object to detach" << llendl;
- return true;
+ payload["object_id"] = object->getID();
}
-
- if (object->isAvatar())
+ else
{
- llwarns << "Trying to detach avatar from avatar." << llendl;
+ llwarns << "Drop object not found" << llendl;
return true;
}
- // The sendDropAttachment() 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.
- LLSelectMgr::getInstance()->sendDropAttachment();
+ LLNotificationsUtil::add("AttachmentDrop", LLSD(), payload, &callback_attachment_drop);
return true;
}
};