From 1310fac3b10b3927cb502008c156c16631b97663 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 17 Jun 2020 23:38:55 +0300 Subject: SL-13359 #5 Implemented revised changes --- indra/newview/lltexturectrl.cpp | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 6a0464c657..2f5be2b32e 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -79,6 +79,61 @@ static const S32 LOCAL_TRACKING_ID_COLUMN = 1; //static const char WHITE_IMAGE_NAME[] = "Blank Texture"; //static const char NO_IMAGE_NAME[] = "None"; + + +//static +bool get_is_library_texture(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; +} + +LLUUID get_copy_free_item_by_asset_id(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; +} + +bool get_can_copy_texture(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 get_is_library_texture(image_id) || get_copy_free_item_by_asset_id(image_id).notNull(); +} + LLFloaterTexturePicker::LLFloaterTexturePicker( LLView* owner, LLUUID image_asset_id, -- cgit v1.2.3 From f3216ca1cd6e63a254123635c18ba661297e8eef Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 24 Jun 2020 18:57:49 +0300 Subject: SL-12688 Warnings part #2 --- indra/newview/lltexturectrl.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 2f5be2b32e..b5e4b3608a 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -82,24 +82,23 @@ static const S32 LOCAL_TRACKING_ID_COLUMN = 1; //static -bool get_is_library_texture(LLUUID image_id) +bool get_is_predefined_texture(LLUUID asset_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)) + if (asset_id == LLUUID(gSavedSettings.getString("DefaultObjectTexture")) + || asset_id == LLUUID(gSavedSettings.getString("UIImgWhiteUUID")) + || asset_id == LLUUID(gSavedSettings.getString("UIImgInvisibleUUID")) + || asset_id == LLUUID(SCULPT_DEFAULT_TEXTURE)) { return true; } return false; } -LLUUID get_copy_free_item_by_asset_id(LLUUID image_id) +LLUUID get_copy_free_item_by_asset_id(LLUUID asset_id) { LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; - LLAssetIDMatches asset_id_matches(image_id); + LLAssetIDMatches asset_id_matches(asset_id); gInventory.collectDescendentsIf(LLUUID::null, cats, items, @@ -125,13 +124,13 @@ LLUUID get_copy_free_item_by_asset_id(LLUUID image_id) return LLUUID::null; } -bool get_can_copy_texture(LLUUID image_id) +bool get_can_copy_texture(LLUUID asset_id) { // User is allowed to copy a texture if: // library asset or default texture, // or copy perm asset exists in user's inventory - return get_is_library_texture(image_id) || get_copy_free_item_by_asset_id(image_id).notNull(); + return get_is_predefined_texture(asset_id) || get_copy_free_item_by_asset_id(asset_id).notNull(); } LLFloaterTexturePicker::LLFloaterTexturePicker( -- cgit v1.2.3 From bbdbd6c2dd79adc4749e24c88c9f04755a4b12a1 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 15 Apr 2022 22:14:38 +0300 Subject: SL-17204 FIXED The texture with full permissions is settled on the prim after copying texture from the object with texture with no transfer permission --- indra/newview/lltexturectrl.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index cc912758e2..51ee5b6157 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -95,7 +95,7 @@ bool get_is_predefined_texture(LLUUID asset_id) return false; } -LLUUID get_copy_free_item_by_asset_id(LLUUID asset_id) +LLUUID get_copy_free_item_by_asset_id(LLUUID asset_id, bool no_trans_perm) { LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; @@ -105,6 +105,8 @@ LLUUID get_copy_free_item_by_asset_id(LLUUID asset_id) items, LLInventoryModel::INCLUDE_TRASH, asset_id_matches); + + LLUUID res; if (items.size()) { for (S32 i = 0; i < items.size(); i++) @@ -117,12 +119,17 @@ LLUUID get_copy_free_item_by_asset_id(LLUUID asset_id) gAgent.getID(), gAgent.getGroupID())) { - return itemp->getUUID(); + bool allow_trans = item_permissions.allowOperationBy(PERM_TRANSFER, gAgent.getID(), gAgent.getGroupID()); + if (allow_trans != no_trans_perm) + { + return itemp->getUUID(); + } + res = itemp->getUUID(); } } } } - return LLUUID::null; + return res; } bool get_can_copy_texture(LLUUID asset_id) -- cgit v1.2.3