summaryrefslogtreecommitdiff
path: root/indra/newview/llmaterialeditor.cpp
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2023-09-11 11:51:20 -0500
committerRunitaiLinden <davep@lindenlab.com>2023-09-11 11:51:20 -0500
commit74940194fa5cd4c5182f141ef262e5568156bdce (patch)
tree8d3a8e779d34a94b4df3dc4517dfa598b4b98367 /indra/newview/llmaterialeditor.cpp
parente3e1d42ab3021cf6e6ac68fff54c9185fd3a0ad1 (diff)
parent0b02bf5d262fe9a6de968686420c4d525ac04077 (diff)
Merge remote-tracking branch 'remotes/origin/DRTVWR-559' into davep/SL-19842
Diffstat (limited to 'indra/newview/llmaterialeditor.cpp')
-rw-r--r--indra/newview/llmaterialeditor.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index 54d85c87ac..a0c3fd9a28 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -1197,10 +1197,16 @@ bool LLMaterialEditor::saveIfNeeded()
}
else
{
- //make a new inventory item
- std::string res_desc = buildMaterialDescription();
+ // Make a new inventory item and set upload permissions
LLPermissions local_permissions;
local_permissions.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null);
+
+ U32 everyone_perm = LLFloaterPerms::getEveryonePerms("Materials");
+ U32 group_perm = LLFloaterPerms::getGroupPerms("Materials");
+ U32 next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Materials");
+ local_permissions.initMasks(PERM_ALL, PERM_ALL, everyone_perm, group_perm, next_owner_perm);
+
+ std::string res_desc = buildMaterialDescription();
createInventoryItem(buffer, mMaterialName, res_desc, local_permissions);
// We do not update floater with uploaded asset yet, so just close it.
@@ -1947,6 +1953,32 @@ bool LLMaterialEditor::canSaveObjectsMaterial()
return can_use_objects_material(func, std::vector({PERM_COPY, PERM_MODIFY}), permissions, item_out);
}
+bool LLMaterialEditor::canClipboardObjectsMaterial()
+{
+ if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() != 1)
+ {
+ return false;
+ }
+
+ struct LLSelectedTEGetNullMat : public LLSelectedTEFunctor
+ {
+ bool apply(LLViewerObject* objectp, S32 te_index)
+ {
+ return objectp->getRenderMaterialID(te_index).isNull();
+ }
+ } null_func;
+
+ if (LLSelectMgr::getInstance()->getSelection()->applyToTEs(&null_func))
+ {
+ return true;
+ }
+
+ LLSelectedTEGetMatData func(true);
+ LLPermissions permissions;
+ LLViewerInventoryItem* item_out;
+ return can_use_objects_material(func, std::vector({PERM_COPY, PERM_MODIFY, PERM_TRANSFER}), permissions, item_out);
+}
+
void LLMaterialEditor::saveObjectsMaterialAs()
{
LLSelectedTEGetMatData func(true);