summaryrefslogtreecommitdiff
path: root/indra/newview/lltooldraganddrop.cpp
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2023-07-21 13:01:11 -0700
committerCosmic Linden <cosmic@lindenlab.com>2023-08-11 16:30:49 -0700
commite7e565dc6e7e0c666132ffffa4798b2cfc00d6a4 (patch)
tree0c142c10d50be9a52dba2f73f3b26865e829be24 /indra/newview/lltooldraganddrop.cpp
parent9be8103142dc16b58dcf930d5d1f70f49272837f (diff)
SL-20024: Put material in object inventory when material is no-modify or no-transfer
Diffstat (limited to 'indra/newview/lltooldraganddrop.cpp')
-rw-r--r--indra/newview/lltooldraganddrop.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index dd5f607b04..23a6634154 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -1042,6 +1042,26 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj,
// we should return false here. This will requre a separate listener
// since without listener, we have no way to receive update
}
+ else if (LLAssetType::AT_MATERIAL == new_item->getType() &&
+ !item->getPermissions().allowOperationBy(PERM_MODIFY, gAgent.getID()))
+ {
+ // Check that we can add the material as inventory to the object
+ if (willObjectAcceptInventory(hit_obj,item) < ACCEPT_YES_COPY_SINGLE )
+ {
+ return FALSE;
+ }
+ // *FIX: may want to make sure agent can paint hit_obj.
+
+ // Add the material item to the target object's inventory.
+ hit_obj->updateMaterialInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
+
+ // Force the object to update and refetch its inventory so it has this material.
+ hit_obj->dirtyInventory();
+ hit_obj->requestInventory();
+ // TODO: Check to see if adding the item was successful; if not, then
+ // we should return false here. This will requre a separate listener
+ // since without listener, we have no way to receive update
+ }
return TRUE;
}