summaryrefslogtreecommitdiff
path: root/indra/newview/llselectmgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llselectmgr.cpp')
-rwxr-xr-xindra/newview/llselectmgr.cpp91
1 files changed, 77 insertions, 14 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index fdc95c7784..4fafbf917b 100755
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -52,6 +52,7 @@
// viewer includes
#include "llagent.h"
#include "llagentcamera.h"
+#include "llattachmentsmgr.h"
#include "llviewerwindow.h"
#include "lldrawable.h"
#include "llfloaterinspect.h"
@@ -619,10 +620,33 @@ bool LLSelectMgr::linkObjects()
bool LLSelectMgr::unlinkObjects()
{
+ S32 min_objects_for_confirm = gSavedSettings.getS32("MinObjectsForUnlinkConfirm");
+ S32 unlink_object_count = mSelectedObjects->getObjectCount(); // clears out nodes with NULL objects
+ if (unlink_object_count >= min_objects_for_confirm
+ && unlink_object_count > mSelectedObjects->getRootObjectCount())
+ {
+ // total count > root count means that there are childer inside and that there are linksets that will be unlinked
+ LLNotificationsUtil::add("ConfirmUnlink", LLSD(), LLSD(), boost::bind(&LLSelectMgr::confirmUnlinkObjects, this, _1, _2));
+ return true;
+ }
+
LLSelectMgr::getInstance()->sendDelink();
return true;
}
+void LLSelectMgr::confirmUnlinkObjects(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ // if Cancel pressed
+ if (option == 1)
+ {
+ return;
+ }
+
+ LLSelectMgr::getInstance()->sendDelink();
+ return;
+}
+
// in order to link, all objects must have the same owner, and the
// agent must have the ability to modify all of the objects. However,
// we're not answering that question with this method. The question
@@ -2343,6 +2367,7 @@ void LLSelectMgr::selectionSetIncludeInSearch(bool include_in_search)
"ObjectIncludeInSearch",
packAgentAndSessionID,
packObjectIncludeInSearch,
+ logNoOp,
&include_in_search,
SEND_ONLY_ROOTS);
}
@@ -2392,6 +2417,7 @@ void LLSelectMgr::selectionSetClickAction(U8 action)
sendListToRegions("ObjectClickAction",
packAgentAndSessionID,
packObjectClickAction,
+ logNoOp,
&action,
SEND_INDIVIDUALS);
}
@@ -2427,7 +2453,7 @@ void LLSelectMgr::sendGodlikeRequest(const std::string& request, const std::stri
}
else
{
- sendListToRegions(message_type, packGodlikeHead, packObjectIDAsParam, &data, SEND_ONLY_ROOTS);
+ sendListToRegions(message_type, packGodlikeHead, packObjectIDAsParam, logNoOp, &data, SEND_ONLY_ROOTS);
}
}
@@ -2456,6 +2482,23 @@ void LLSelectMgr::packGodlikeHead(void* user_data)
}
// static
+void LLSelectMgr::logNoOp(LLSelectNode* node, void *)
+{
+}
+
+// static
+void LLSelectMgr::logAttachmentRequest(LLSelectNode* node, void *)
+{
+ LLAttachmentsMgr::instance().onAttachmentRequested(node->mItemID);
+}
+
+// static
+void LLSelectMgr::logDetachRequest(LLSelectNode* node, void *)
+{
+ LLAttachmentsMgr::instance().onDetachRequested(node->mItemID);
+}
+
+// static
void LLSelectMgr::packObjectIDAsParam(LLSelectNode* node, void *)
{
std::string buf = llformat("%u", node->getObject()->getLocalID());
@@ -3561,10 +3604,11 @@ bool LLSelectMgr::confirmDelete(const LLSD& notification, const LLSD& response,
// attempt to derez into the trash.
LLDeRezInfo info(DRD_TRASH, trash_id);
LLSelectMgr::getInstance()->sendListToRegions("DeRezObject",
- packDeRezHeader,
- packObjectLocalID,
- (void*) &info,
- SEND_ONLY_ROOTS);
+ packDeRezHeader,
+ packObjectLocalID,
+ logNoOp,
+ (void*) &info,
+ SEND_ONLY_ROOTS);
// VEFFECT: Delete Object - one effect for all deletes
if (LLSelectMgr::getInstance()->mSelectedObjects->mSelectType != SELECT_TYPE_HUD)
{
@@ -3596,6 +3640,7 @@ void LLSelectMgr::selectForceDelete()
"ObjectDelete",
packDeleteHeader,
packObjectLocalID,
+ logNoOp,
(void*)TRUE,
SEND_ONLY_ROOTS);
}
@@ -3766,7 +3811,7 @@ void LLSelectMgr::selectDuplicate(const LLVector3& offset, BOOL select_copy)
data.offset = offset;
data.flags = (select_copy ? FLAGS_CREATE_SELECTED : 0x0);
- sendListToRegions("ObjectDuplicate", packDuplicateHeader, packDuplicate, &data, SEND_ONLY_ROOTS);
+ sendListToRegions("ObjectDuplicate", packDuplicateHeader, packDuplicate, logNoOp, &data, SEND_ONLY_ROOTS);
if (select_copy)
{
@@ -3821,7 +3866,7 @@ void LLSelectMgr::repeatDuplicate()
data.offset = LLVector3::zero;
data.flags = 0x0;
- sendListToRegions("ObjectDuplicate", packDuplicateHeader, packDuplicate, &data, SEND_ONLY_ROOTS);
+ sendListToRegions("ObjectDuplicate", packDuplicateHeader, packDuplicate, logNoOp, &data, SEND_ONLY_ROOTS);
// move current selection based on delta from duplication position and update duplication position
for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
@@ -3900,7 +3945,7 @@ void LLSelectMgr::selectDuplicateOnRay(const LLVector3 &ray_start_region,
data.mFlags = (select_copy ? FLAGS_CREATE_SELECTED : 0x0);
sendListToRegions("ObjectDuplicateOnRay",
- packDuplicateOnRayHead, packObjectLocalID, &data, SEND_ONLY_ROOTS);
+ packDuplicateOnRayHead, packObjectLocalID, logNoOp, &data, SEND_ONLY_ROOTS);
if (select_copy)
{
@@ -3950,6 +3995,7 @@ void LLSelectMgr::sendMultipleUpdate(U32 type)
"MultipleObjectUpdate",
packAgentAndSessionID,
packMultipleUpdate,
+ logNoOp,
&type,
send_type);
}
@@ -4013,7 +4059,7 @@ void LLSelectMgr::sendOwner(const LLUUID& owner_id,
data.group_id = group_id;
data.override = override;
- sendListToRegions("ObjectOwner", packOwnerHead, packObjectLocalID, &data, SEND_ONLY_ROOTS);
+ sendListToRegions("ObjectOwner", packOwnerHead, packObjectLocalID, logNoOp, &data, SEND_ONLY_ROOTS);
}
// static
@@ -4037,7 +4083,7 @@ void LLSelectMgr::packOwnerHead(void *user_data)
void LLSelectMgr::sendGroup(const LLUUID& group_id)
{
LLUUID local_group_id(group_id);
- sendListToRegions("ObjectGroup", packAgentAndSessionAndGroupID, packObjectLocalID, &local_group_id, SEND_ONLY_ROOTS);
+ sendListToRegions("ObjectGroup", packAgentAndSessionAndGroupID, packObjectLocalID, logNoOp, &local_group_id, SEND_ONLY_ROOTS);
}
@@ -4061,7 +4107,7 @@ void LLSelectMgr::sendBuy(const LLUUID& buyer_id, const LLUUID& category_id, con
LLBuyData buy;
buy.mCategoryID = category_id;
buy.mSaleInfo = sale_info;
- sendListToRegions("ObjectBuy", packAgentGroupAndCatID, packBuyObjectIDs, &buy, SEND_ONLY_ROOTS);
+ sendListToRegions("ObjectBuy", packAgentGroupAndCatID, packBuyObjectIDs, logNoOp, &buy, SEND_ONLY_ROOTS);
}
// static
@@ -4105,7 +4151,7 @@ void LLSelectMgr::selectionSetObjectPermissions(U8 field,
data.mMask = mask;
data.mOverride = override;
- sendListToRegions("ObjectPermissions", packPermissionsHead, packPermissions, &data, SEND_ONLY_ROOTS);
+ sendListToRegions("ObjectPermissions", packPermissionsHead, packPermissions, logNoOp, &data, SEND_ONLY_ROOTS);
}
void LLSelectMgr::packPermissionsHead(void* user_data)
@@ -4148,6 +4194,7 @@ void LLSelectMgr::deselectAll()
"ObjectDeselect",
packAgentAndSessionID,
packObjectLocalID,
+ logNoOp,
NULL,
SEND_INDIVIDUALS);
@@ -4178,6 +4225,7 @@ void LLSelectMgr::deselectAllForStandingUp()
"ObjectDeselect",
packAgentAndSessionID,
packObjectLocalID,
+ logNoOp,
NULL,
SEND_INDIVIDUALS);
@@ -4259,6 +4307,7 @@ void LLSelectMgr::selectionSetObjectName(const std::string& name)
sendListToRegions("ObjectName",
packAgentAndSessionID,
packObjectName,
+ logNoOp,
(void*)(&name_copy),
SEND_ONLY_ROOTS);
}
@@ -4267,6 +4316,7 @@ void LLSelectMgr::selectionSetObjectName(const std::string& name)
sendListToRegions("ObjectName",
packAgentAndSessionID,
packObjectName,
+ logNoOp,
(void*)(&name_copy),
SEND_INDIVIDUALS);
}
@@ -4282,6 +4332,7 @@ void LLSelectMgr::selectionSetObjectDescription(const std::string& desc)
sendListToRegions("ObjectDescription",
packAgentAndSessionID,
packObjectDescription,
+ logNoOp,
(void*)(&desc_copy),
SEND_ONLY_ROOTS);
}
@@ -4290,6 +4341,7 @@ void LLSelectMgr::selectionSetObjectDescription(const std::string& desc)
sendListToRegions("ObjectDescription",
packAgentAndSessionID,
packObjectDescription,
+ logNoOp,
(void*)(&desc_copy),
SEND_INDIVIDUALS);
}
@@ -4303,6 +4355,7 @@ void LLSelectMgr::selectionSetObjectCategory(const LLCategory& category)
sendListToRegions("ObjectCategory",
packAgentAndSessionID,
packObjectCategory,
+ logNoOp,
(void*)(&category),
SEND_ONLY_ROOTS);
}
@@ -4312,6 +4365,7 @@ void LLSelectMgr::selectionSetObjectSaleInfo(const LLSaleInfo& sale_info)
sendListToRegions("ObjectSaleInfo",
packAgentAndSessionID,
packObjectSaleInfo,
+ logNoOp,
(void*)(&sale_info),
SEND_ONLY_ROOTS);
}
@@ -4345,6 +4399,7 @@ void LLSelectMgr::sendAttach(U8 attachment_point, bool replace)
"ObjectAttach",
packAgentIDAndSessionAndAttachment,
packObjectIDAndRotation,
+ logAttachmentRequest,
&attachment_point,
SEND_ONLY_ROOTS );
if (!build_mode)
@@ -4365,6 +4420,7 @@ void LLSelectMgr::sendDetach()
"ObjectDetach",
packAgentAndSessionID,
packObjectLocalID,
+ logDetachRequest,
NULL,
SEND_ONLY_ROOTS );
}
@@ -4381,6 +4437,7 @@ void LLSelectMgr::sendDropAttachment()
"ObjectDrop",
packAgentAndSessionID,
packObjectLocalID,
+ logDetachRequest,
NULL,
SEND_ONLY_ROOTS);
}
@@ -4400,6 +4457,7 @@ void LLSelectMgr::sendLink()
"ObjectLink",
packAgentAndSessionID,
packObjectLocalID,
+ logNoOp,
NULL,
SEND_ONLY_ROOTS);
}
@@ -4437,6 +4495,7 @@ void LLSelectMgr::sendDelink()
"ObjectDelink",
packAgentAndSessionID,
packObjectLocalID,
+ logNoOp,
NULL,
SEND_INDIVIDUALS);
}
@@ -4489,6 +4548,7 @@ void LLSelectMgr::sendSelect()
"ObjectSelect",
packAgentAndSessionID,
packObjectLocalID,
+ logNoOp,
NULL,
SEND_INDIVIDUALS);
}
@@ -4885,6 +4945,7 @@ void LLSelectMgr::packPermissions(LLSelectNode* node, void *user_data)
void LLSelectMgr::sendListToRegions(const std::string& message_name,
void (*pack_header)(void *user_data),
void (*pack_body)(LLSelectNode* node, void *user_data),
+ void (*log_func)(LLSelectNode* node, void *user_data),
void *user_data,
ESendType send_type)
{
@@ -5006,6 +5067,8 @@ void LLSelectMgr::sendListToRegions(const std::string& message_name,
{
// add another instance of the body of the data
(*pack_body)(node, user_data);
+ // do any related logging
+ (*log_func)(node, user_data);
++objects_sent;
++objects_in_this_packet;
@@ -6656,7 +6719,7 @@ void LLSelectMgr::undo()
{
BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts");
LLUUID group_id(gAgent.getGroupID());
- sendListToRegions("Undo", packAgentAndSessionAndGroupID, packObjectID, &group_id, select_linked_set ? SEND_ONLY_ROOTS : SEND_CHILDREN_FIRST);
+ sendListToRegions("Undo", packAgentAndSessionAndGroupID, packObjectID, logNoOp, &group_id, select_linked_set ? SEND_ONLY_ROOTS : SEND_CHILDREN_FIRST);
}
//-----------------------------------------------------------------------------
@@ -6674,7 +6737,7 @@ void LLSelectMgr::redo()
{
BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts");
LLUUID group_id(gAgent.getGroupID());
- sendListToRegions("Redo", packAgentAndSessionAndGroupID, packObjectID, &group_id, select_linked_set ? SEND_ONLY_ROOTS : SEND_CHILDREN_FIRST);
+ sendListToRegions("Redo", packAgentAndSessionAndGroupID, packObjectID, logNoOp, &group_id, select_linked_set ? SEND_ONLY_ROOTS : SEND_CHILDREN_FIRST);
}
//-----------------------------------------------------------------------------