summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelface.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-06-02 15:27:34 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-06-02 16:58:28 +0300
commit090bb3e6de6d5cb70ed372748a76e391f61cb32e (patch)
tree125cf5d0642b9e2ef467ecb637e032473069a3b4 /indra/newview/llpanelface.cpp
parentcf2e2a6cf31194c03bdda6531cebada2f0bbf390 (diff)
SL-13359 #1 Revert floater_tools and object panel changes
Diffstat (limited to 'indra/newview/llpanelface.cpp')
-rw-r--r--indra/newview/llpanelface.cpp63
1 files changed, 59 insertions, 4 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 13d0e377d7..369861fa25 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -2929,7 +2929,7 @@ void LLPanelFace::onCopyFaces()
{
LLUUID item_id;
LLUUID id = te_data["te"]["imageid"].asUUID();
- bool full_perm = LLPanelObject::isLibraryTexture(id) || (objectp->permCopy() && objectp->permTransfer() && objectp->permModify());
+ bool full_perm = LLPanelFace::isLibraryTexture(id) || (objectp->permCopy() && objectp->permTransfer() && objectp->permModify());
if (id.notNull() && !full_perm)
{
@@ -2944,7 +2944,7 @@ void LLPanelFace::onCopyFaces()
// as result it is Hightly unreliable, leaves little control to user, borderline hack
// but there are little options to preserve permissions - multiple inventory
// items might reference same asset and inventory search is expensive.
- item_id = LLPanelObject::getCopyPermInventoryTextureId(id);
+ item_id = LLPanelFace::getCopyPermInventoryTextureId(id);
// record value to avoid repeating inventory search when possible
asset_item_map[id] = item_id;
}
@@ -3022,7 +3022,7 @@ void LLPanelFace::onCopyFaces()
if (mat_data.has("NormMap"))
{
LLUUID id = mat_data["NormMap"].asUUID();
- if (id.notNull() && !LLPanelObject::canCopyTexture(id))
+ if (id.notNull() && !LLPanelFace::canCopyTexture(id))
{
mat_data["NormMap"] = LLUUID(gSavedSettings.getString( "DefaultObjectTexture" ));
mat_data["NormMapNoCopy"] = true;
@@ -3032,7 +3032,7 @@ void LLPanelFace::onCopyFaces()
if (mat_data.has("SpecMap"))
{
LLUUID id = mat_data["SpecMap"].asUUID();
- if (id.notNull() && !LLPanelObject::canCopyTexture(id))
+ if (id.notNull() && !LLPanelFace::canCopyTexture(id))
{
mat_data["SpecMap"] = LLUUID(gSavedSettings.getString( "DefaultObjectTexture" ));
mat_data["SpecMapNoCopy"] = true;
@@ -3504,3 +3504,58 @@ bool LLPanelFace::pasteEnabletMenuItem(const LLSD& userdata)
return true;
}
+
+//static
+bool LLPanelFace::isLibraryTexture(LLUUID image_id)
+{
+ if (gInventory.isObjectDescendentOf(image_id, gInventory.getLibraryRootFolderID())
+ || image_id == LLUUID(gSavedSettings.getString("DefaultObjectTexture"))
+ || image_id == LLUUID(gSavedSettings.getString("UIImgWhiteUUID"))
+ || image_id == LLUUID(gSavedSettings.getString("UIImgInvisibleUUID"))
+ || image_id == LLUUID(SCULPT_DEFAULT_TEXTURE))
+ {
+ return true;
+ }
+ return false;
+}
+
+//static
+LLUUID LLPanelFace::getCopyPermInventoryTextureId(LLUUID image_id)
+{
+ LLViewerInventoryCategory::cat_array_t cats;
+ LLViewerInventoryItem::item_array_t items;
+ LLAssetIDMatches asset_id_matches(image_id);
+ gInventory.collectDescendentsIf(LLUUID::null,
+ cats,
+ items,
+ LLInventoryModel::INCLUDE_TRASH,
+ asset_id_matches);
+ if (items.size())
+ {
+ for (S32 i = 0; i < items.size(); i++)
+ {
+ LLViewerInventoryItem* itemp = items[i];
+ if (itemp)
+ {
+ LLPermissions item_permissions = itemp->getPermissions();
+ if (item_permissions.allowOperationBy(PERM_COPY,
+ gAgent.getID(),
+ gAgent.getGroupID()))
+ {
+ return itemp->getUUID();
+ }
+ }
+ }
+ }
+ return LLUUID::null;
+}
+
+// Static
+bool LLPanelFace::canCopyTexture(LLUUID image_id)
+{
+ // User is allowed to copy a texture if:
+ // library asset or default texture,
+ // or copy perm asset exists in user's inventory
+
+ return isLibraryTexture(image_id) || getCopyPermInventoryTextureId(image_id).notNull();
+}