From dbe5eb8a1dc18811f945f689f026cdcf180496dd Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 25 Jun 2019 17:54:21 +0300 Subject: SL-11431 [Legacy Profiles] Clicking someone else's profile picture should open image modal. --- indra/newview/lltexturectrl.cpp | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 1396a8546d..f5b96a3b5a 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -47,6 +47,7 @@ #include "llui.h" #include "llviewerinventory.h" #include "llpermissions.h" +#include "llpreviewtexture.h" #include "llsaleinfo.h" #include "llassetstorage.h" #include "lltextbox.h" @@ -997,6 +998,7 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p) mNeedsRawImageData( FALSE ), mValid( TRUE ), mShowLoadingPlaceholder( TRUE ), + mOpenTexPreview(false), mImageAssetID(p.image_id), mDefaultImageAssetID(p.default_image_id), mDefaultImageName(p.default_image_name), @@ -1249,12 +1251,31 @@ BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask) if (!handled && mBorder->parentPointInView(x, y)) { - showPicker(FALSE); - //grab textures first... - LLInventoryModelBackgroundFetch::instance().start(gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE)); - //...then start full inventory fetch. - LLInventoryModelBackgroundFetch::instance().start(); - handled = TRUE; + if (!mOpenTexPreview) + { + showPicker(FALSE); + //grab textures first... + LLInventoryModelBackgroundFetch::instance().start(gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE)); + //...then start full inventory fetch. + LLInventoryModelBackgroundFetch::instance().start(); + handled = TRUE; + } + else + { + if (getImageAssetID().notNull()) + { + LLPreviewTexture* preview_texture = LLFloaterReg::showTypedInstance("preview_texture", getValue()); + if (preview_texture && !preview_texture->isDependent()) + { + LLFloater* root_floater = gFloaterView->getParentFloater(this); + if (root_floater) + { + root_floater->addDependentFloater(preview_texture); + preview_texture->hideCtrlButtons(); + } + } + } + } } return handled; -- cgit v1.2.3 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