summaryrefslogtreecommitdiff
path: root/indra/newview/llinventoryfunctions.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-11-11 23:34:37 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-11-11 23:34:37 +0200
commit92af5af736c2d6f3ac2f3ae5539da4bdea22e2a5 (patch)
tree888a19c6343d37ff1fc8fd22362799c143671a93 /indra/newview/llinventoryfunctions.cpp
parentb1f84f13a8a1d0404e4593ac413b66af8d135f40 (diff)
parent04c473ab46041133ea6a87dbe0d43e662472adf5 (diff)
Merge branch 'master' (DRTVWR-507-maint) into DRTVWR-521-maint
# Conflicts: # autobuild.xml # indra/llcommon/llerror.cpp
Diffstat (limited to 'indra/newview/llinventoryfunctions.cpp')
-rw-r--r--indra/newview/llinventoryfunctions.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 9f54feb3d7..937e38aaf0 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -79,6 +79,7 @@
#include "lltooldraganddrop.h"
#include "lltrans.h"
#include "lluictrlfactory.h"
+#include "llviewermenu.h"
#include "llviewermessage.h"
#include "llviewerfoldertype.h"
#include "llviewerobjectlist.h"
@@ -656,6 +657,50 @@ BOOL get_is_item_removable(const LLInventoryModel* model, const LLUUID& id)
return TRUE;
}
+bool get_is_item_editable(const LLUUID& inv_item_id)
+{
+ if (const LLInventoryItem* inv_item = gInventory.getLinkedItem(inv_item_id))
+ {
+ switch (inv_item->getType())
+ {
+ case LLAssetType::AT_BODYPART:
+ case LLAssetType::AT_CLOTHING:
+ return gAgentWearables.isWearableModifiable(inv_item_id);
+ case LLAssetType::AT_OBJECT:
+ return true;
+ default:
+ return false;;
+ }
+ }
+ return gAgentAvatarp->getWornAttachment(inv_item_id) != nullptr;
+}
+
+void handle_item_edit(const LLUUID& inv_item_id)
+{
+ if (get_is_item_editable(inv_item_id))
+ {
+ if (const LLInventoryItem* inv_item = gInventory.getLinkedItem(inv_item_id))
+ {
+ switch (inv_item->getType())
+ {
+ case LLAssetType::AT_BODYPART:
+ case LLAssetType::AT_CLOTHING:
+ LLAgentWearables::editWearable(inv_item_id);
+ break;
+ case LLAssetType::AT_OBJECT:
+ handle_attachment_edit(inv_item_id);
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ handle_attachment_edit(inv_item_id);
+ }
+ }
+}
+
BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id)
{
// NOTE: This function doesn't check the folder's children.