summaryrefslogtreecommitdiff
path: root/indra/newview/llmaterialeditor.cpp
diff options
context:
space:
mode:
authorcosmic-linden <111533034+cosmic-linden@users.noreply.github.com>2023-09-06 15:13:11 -0700
committerGitHub <noreply@github.com>2023-09-06 15:13:11 -0700
commit52d973e95567efcb145ed0de1f4b6f0e19663776 (patch)
tree621cb33a371e60f626b150c3ecc4b06152ce8321 /indra/newview/llmaterialeditor.cpp
parent88a4d1f5d30bd354d9e9813c2fb3bc3f140256f4 (diff)
parentc0bcc3740ea4c6662f9707d49ab5c7132bb2a0a8 (diff)
Merge pull request #361 from secondlife/SL-20167
SL-20167: Grey out the clipboard when copying the material is not allowed
Diffstat (limited to 'indra/newview/llmaterialeditor.cpp')
-rw-r--r--indra/newview/llmaterialeditor.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index daf6fdb20d..a0c3fd9a28 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -1953,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);