summaryrefslogtreecommitdiff
path: root/indra/newview/lltooldraganddrop.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2024-05-07 09:47:37 -0500
committerGitHub <noreply@github.com>2024-05-07 09:47:37 -0500
commit155ddf23363f1d5c534c69f50505faf67e51948f (patch)
tree976912ed4fa3bc2af7b0b68201460f08614748b5 /indra/newview/lltooldraganddrop.cpp
parentf79548ec68ebcef8f8f83705b65fd59da43c3e26 (diff)
parentf9473e8afcb624cc1b101195bf15943ec372b56f (diff)
Merge pull request #1421 from secondlife/DRTVWR-600-maint-A
Drtvwr 600 maint a
Diffstat (limited to 'indra/newview/lltooldraganddrop.cpp')
-rw-r--r--indra/newview/lltooldraganddrop.cpp74
1 files changed, 41 insertions, 33 deletions
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 4b9f29bca8..bbf70e55da 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -1692,13 +1692,13 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
// currently the ray's end point is an approximation,
// and is sometimes too short (causing failure.) so we
// double the ray's length:
- if (bypass_sim_raycast == false)
+ if (!bypass_sim_raycast)
{
LLVector3 ray_direction = ray_start - ray_end;
ray_end = ray_end - ray_direction;
}
-
-
+
+
// Message packing code should be it's own uninterrupted block
LLMessageSystem* msg = gMessageSystem;
if (mSource == SOURCE_NOTECARD)
@@ -1855,7 +1855,9 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj,
EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LLInventoryItem* item, EDragAndDropType type)
{
// check the basics
- if (!item || !obj) return ACCEPT_NO;
+ if (!item || !obj)
+ return ACCEPT_NO;
+
// HACK: downcast
LLViewerInventoryItem* vitem = (LLViewerInventoryItem*)item;
if (!vitem->isFinished() && (type != DAD_CATEGORY))
@@ -1866,13 +1868,14 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
// Library or agent inventory only.
return ACCEPT_NO;
}
- if (vitem->getIsLinkType()) return ACCEPT_NO; // No giving away links
+ if (vitem->getIsLinkType())
+ return ACCEPT_NO; // No giving away links
// deny attempts to drop from an object onto itself. This is to
// help make sure that drops that are from an object to an object
// don't have to worry about order of evaluation. Think of this
// like check for self in assignment.
- if(obj->getID() == item->getParentUUID())
+ if (obj->getID() == item->getParentUUID())
{
return ACCEPT_NO;
}
@@ -1882,7 +1885,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
// && (obj->mPermModify || obj->mFlagAllowInventoryAdd));
bool worn = false;
LLVOAvatarSelf* my_avatar = NULL;
- switch(item->getType())
+ switch (item->getType())
{
case LLAssetType::AT_OBJECT:
my_avatar = gAgentAvatarp;
@@ -1893,7 +1896,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
break;
case LLAssetType::AT_BODYPART:
case LLAssetType::AT_CLOTHING:
- if(gAgentWearables.isWearingItem(item->getUUID()))
+ if (gAgentWearables.isWearingItem(item->getUUID()))
{
worn = true;
}
@@ -1903,33 +1906,37 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
// because of incomplete LSL support. See STORM-1117.
return ACCEPT_NO;
default:
- break;
+ break;
}
const LLPermissions& perm = item->getPermissions();
bool modify = (obj->permModify() || obj->flagAllowInventoryAdd());
bool transfer = false;
- if((obj->permYouOwner() && (perm.getOwner() == gAgent.getID()))
+ if ((obj->permYouOwner() && (perm.getOwner() == gAgent.getID()))
|| perm.allowOperationBy(PERM_TRANSFER, gAgent.getID()))
{
transfer = true;
}
bool volume = (LL_PCODE_VOLUME == obj->getPCode());
bool attached = obj->isAttachment();
- bool unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? true : false;
- if(attached && !unrestricted)
+ bool unrestricted = (perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED;
+
+ if (attached && !unrestricted)
{
// Attachments are in world and in inventory simultaneously,
// at the moment server doesn't support such a situation.
return ACCEPT_NO_LOCKED;
}
- else if(modify && transfer && volume && !worn)
+
+ if (modify && transfer && volume && !worn)
{
return ACCEPT_YES_MULTI;
}
- else if(!modify)
+
+ if (!modify)
{
return ACCEPT_NO_LOCKED;
}
+
return ACCEPT_NO;
}
@@ -2619,41 +2626,41 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory(
return ACCEPT_NO_CUSTOM;
}
- if(mSource == SOURCE_AGENT)
+ if (mSource == SOURCE_AGENT)
{
const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if( gInventory.isObjectDescendentOf( category->getUUID(), trash_id ) )
+ if (gInventory.isObjectDescendentOf(category->getUUID(), trash_id))
{
return ACCEPT_NO;
}
const LLUUID &outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX);
- if(outbox_id.notNull() && gInventory.isObjectDescendentOf(category->getUUID(), outbox_id))
+ if (outbox_id.notNull() && gInventory.isObjectDescendentOf(category->getUUID(), outbox_id))
{
// Legacy
return ACCEPT_NO;
}
- if(drop)
+ if (drop)
{
- bool append = ( (mask & MASK_SHIFT) ? true : false );
- LLAppearanceMgr::instance().wearInventoryCategory(category, false, append);
+ LLAppearanceMgr::instance().wearInventoryCategory(category, false, mask & MASK_SHIFT);
}
+
return ACCEPT_YES_MULTI;
}
- else if(mSource == SOURCE_LIBRARY)
+
+ if (mSource == SOURCE_LIBRARY)
{
- if(drop)
+ if (drop)
{
LLAppearanceMgr::instance().wearInventoryCategory(category, true, false);
}
+
return ACCEPT_YES_MULTI;
}
- else
- {
- // TODO: copy/move category to avatar's inventory and then wear it.
- return ACCEPT_NO;
- }
+
+ // TODO: copy/move category to avatar's inventory and then wear it.
+ return ACCEPT_NO;
}
@@ -2664,15 +2671,15 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory(
// *HACK: In order to resolve SL-22177, we need to block drags
// from notecards and objects onto other objects.
- if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
- {
+ if ((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
return ACCEPT_NO;
- }
LLViewerInventoryItem* item;
LLViewerInventoryCategory* cat;
locateInventory(item, cat);
- if (!item || !item->isFinished()) return ACCEPT_NO;
+ if (!item || !item->isFinished())
+ return ACCEPT_NO;
+
LLViewerObject* root_object = obj;
if (obj && obj->getParent())
{
@@ -2684,17 +2691,18 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory(
}
EAcceptance rv = willObjectAcceptInventory(root_object, item);
- if(root_object && drop && (ACCEPT_YES_COPY_SINGLE <= rv))
+ if (root_object && drop && (ACCEPT_YES_COPY_SINGLE <= rv))
{
dropInventory(root_object, item, mSource, mSourceID);
}
+
return rv;
}
bool LLToolDragAndDrop::dadUpdateInventory(LLViewerObject* obj, bool drop)
{
EAcceptance rv = dad3dUpdateInventory(obj, -1, MASK_NONE, drop);
- return (rv >= ACCEPT_YES_COPY_SINGLE);
+ return rv >= ACCEPT_YES_COPY_SINGLE;
}
EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(