From 819eec6f8c3abbf71ec3bdaaf4891068574fdc46 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 9 Jan 2023 21:14:16 +0000 Subject: SL-18924 - basic get/set functions for thumbnail UUID, removed obsolete binary pack/unpack functions for inventory --- indra/llinventory/llinventory.cpp | 148 ++++--------------------- indra/llinventory/llinventory.h | 6 +- indra/llinventory/tests/inventorymisc_test.cpp | 20 ---- 3 files changed, 22 insertions(+), 152 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 81261f0767..b897198d10 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -40,9 +40,11 @@ ///---------------------------------------------------------------------------- /// Exported functions ///---------------------------------------------------------------------------- +// FIXME D567 - what's the point of these, especially if we don't even use them consistently? static const std::string INV_ITEM_ID_LABEL("item_id"); static const std::string INV_FOLDER_ID_LABEL("cat_id"); static const std::string INV_PARENT_ID_LABEL("parent_id"); +static const std::string INV_THUMBNAIL_ID_LABEL("thumbnail_id"); static const std::string INV_ASSET_TYPE_LABEL("type"); static const std::string INV_PREFERRED_TYPE_LABEL("preferred_type"); static const std::string INV_INVENTORY_TYPE_LABEL("inv_type"); @@ -99,6 +101,7 @@ void LLInventoryObject::copyObject(const LLInventoryObject* other) mParentUUID = other->mParentUUID; mType = other->mType; mName = other->mName; + mThumbnailUUID = other->mThumbnailUUID; } const LLUUID& LLInventoryObject::getUUID() const @@ -111,6 +114,11 @@ const LLUUID& LLInventoryObject::getParentUUID() const return mParentUUID; } +const LLUUID& LLInventoryObject::getThumbnailUUID() const +{ + return mThumbnailUUID; +} + const std::string& LLInventoryObject::getName() const { return mName; @@ -160,6 +168,11 @@ void LLInventoryObject::setParent(const LLUUID& new_parent) mParentUUID = new_parent; } +void LLInventoryObject::setThumbnailUUID(const LLUUID& thumbnail_uuid) +{ + mThumbnailUUID = thumbnail_uuid; +} + void LLInventoryObject::setType(LLAssetType::EType type) { mType = type; @@ -972,135 +985,6 @@ fail: } -// Deleted LLInventoryItem::exportFileXML() and LLInventoryItem::importXML() -// because I can't find any non-test code references to it. 2009-05-04 JC - -S32 LLInventoryItem::packBinaryBucket(U8* bin_bucket, LLPermissions* perm_override) const -{ - // Figure out which permissions to use. - LLPermissions perm; - if (perm_override) - { - // Use the permissions override. - perm = *perm_override; - } - else - { - // Use the current permissions. - perm = getPermissions(); - } - - // describe the inventory item - char* buffer = (char*) bin_bucket; - std::string creator_id_str; - - perm.getCreator().toString(creator_id_str); - std::string owner_id_str; - perm.getOwner().toString(owner_id_str); - std::string last_owner_id_str; - perm.getLastOwner().toString(last_owner_id_str); - std::string group_id_str; - perm.getGroup().toString(group_id_str); - std::string asset_id_str; - getAssetUUID().toString(asset_id_str); - S32 size = sprintf(buffer, /* Flawfinder: ignore */ - "%d|%d|%s|%s|%s|%s|%s|%x|%x|%x|%x|%x|%s|%s|%d|%d|%x", - getType(), - getInventoryType(), - getName().c_str(), - creator_id_str.c_str(), - owner_id_str.c_str(), - last_owner_id_str.c_str(), - group_id_str.c_str(), - perm.getMaskBase(), - perm.getMaskOwner(), - perm.getMaskGroup(), - perm.getMaskEveryone(), - perm.getMaskNextOwner(), - asset_id_str.c_str(), - getDescription().c_str(), - getSaleInfo().getSaleType(), - getSaleInfo().getSalePrice(), - getFlags()) + 1; - - return size; -} - -void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size) -{ - // Early exit on an empty binary bucket. - if (bin_bucket_size <= 1) return; - - if (NULL == bin_bucket) - { - LL_ERRS() << "unpackBinaryBucket failed. bin_bucket is NULL." << LL_ENDL; - return; - } - - // Convert the bin_bucket into a string. - std::vector item_buffer(bin_bucket_size+1); - memcpy(&item_buffer[0], bin_bucket, bin_bucket_size); /* Flawfinder: ignore */ - item_buffer[bin_bucket_size] = '\0'; - std::string str(&item_buffer[0]); - - LL_DEBUGS() << "item buffer: " << str << LL_ENDL; - - // Tokenize the string. - typedef boost::tokenizer > tokenizer; - boost::char_separator sep("|", "", boost::keep_empty_tokens); - tokenizer tokens(str, sep); - tokenizer::iterator iter = tokens.begin(); - - // Extract all values. - LLUUID item_id; - item_id.generate(); - setUUID(item_id); - - LLAssetType::EType type; - type = (LLAssetType::EType)(atoi((*(iter++)).c_str())); - setType( type ); - - LLInventoryType::EType inv_type; - inv_type = (LLInventoryType::EType)(atoi((*(iter++)).c_str())); - setInventoryType( inv_type ); - - std::string name((*(iter++)).c_str()); - rename( name ); - - LLUUID creator_id((*(iter++)).c_str()); - LLUUID owner_id((*(iter++)).c_str()); - LLUUID last_owner_id((*(iter++)).c_str()); - LLUUID group_id((*(iter++)).c_str()); - PermissionMask mask_base = strtoul((*(iter++)).c_str(), NULL, 16); - PermissionMask mask_owner = strtoul((*(iter++)).c_str(), NULL, 16); - PermissionMask mask_group = strtoul((*(iter++)).c_str(), NULL, 16); - PermissionMask mask_every = strtoul((*(iter++)).c_str(), NULL, 16); - PermissionMask mask_next = strtoul((*(iter++)).c_str(), NULL, 16); - LLPermissions perm; - perm.init(creator_id, owner_id, last_owner_id, group_id); - perm.initMasks(mask_base, mask_owner, mask_group, mask_every, mask_next); - setPermissions(perm); - //LL_DEBUGS() << "perm: " << perm << LL_ENDL; - - LLUUID asset_id((*(iter++)).c_str()); - setAssetUUID(asset_id); - - std::string desc((*(iter++)).c_str()); - setDescription(desc); - - LLSaleInfo::EForSale sale_type; - sale_type = (LLSaleInfo::EForSale)(atoi((*(iter++)).c_str())); - S32 price = atoi((*(iter++)).c_str()); - LLSaleInfo sale_info(sale_type, price); - setSaleInfo(sale_info); - - U32 flags = strtoul((*(iter++)).c_str(), NULL, 16); - setFlags(flags); - - time_t now = time(NULL); - setCreationDate(now); -} - ///---------------------------------------------------------------------------- /// Class LLInventoryCategory ///---------------------------------------------------------------------------- @@ -1152,6 +1036,7 @@ LLSD LLInventoryCategory::asLLSD() const LLSD sd = LLSD(); sd["item_id"] = mUUID; sd["parent_id"] = mParentUUID; + sd["thumbnail_id"] = mThumbnailUUID; S8 type = static_cast(mPreferredType); sd["type"] = type; sd["name"] = mName; @@ -1184,6 +1069,11 @@ bool LLInventoryCategory::fromLLSD(const LLSD& sd) { mParentUUID = sd[w]; } + w = INV_THUMBNAIL_ID_LABEL; + if (sd.has(w)) + { + mThumbnailUUID = sd[w]; + } w = INV_ASSET_TYPE_LABEL; if (sd.has(w)) { diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index 7d9f9704f1..dfe8b7659b 100644 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -70,6 +70,7 @@ public: virtual const LLUUID& getUUID() const; // inventoryID that this item points to virtual const LLUUID& getLinkedUUID() const; // inventoryID that this item points to, else this item's inventoryID const LLUUID& getParentUUID() const; + virtual const LLUUID& getThumbnailUUID() const; virtual const std::string& getName() const; virtual LLAssetType::EType getType() const; LLAssetType::EType getActualType() const; // bypasses indirection for linked items @@ -84,6 +85,7 @@ public: void setUUID(const LLUUID& new_uuid); virtual void rename(const std::string& new_name); void setParent(const LLUUID& new_parent); + virtual void setThumbnailUUID(const LLUUID& thumbnail_uuid); void setType(LLAssetType::EType type); virtual void setCreationDate(time_t creation_date_utc); // only stored for items @@ -108,6 +110,7 @@ public: protected: LLUUID mUUID; LLUUID mParentUUID; // Parent category. Root categories have LLUUID::NULL. + LLUUID mThumbnailUUID; LLAssetType::EType mType; std::string mName; time_t mCreationDate; // seconds from 1/1/1970, UTC @@ -203,9 +206,6 @@ public: // Helper Functions //-------------------------------------------------------------------- public: - // Pack all information needed to reconstruct this item into the given binary bucket. - S32 packBinaryBucket(U8* bin_bucket, LLPermissions* perm_override = NULL) const; - void unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size); LLSD asLLSD() const; void asLLSD( LLSD& sd ) const; bool fromLLSD(const LLSD& sd, bool is_new = true); diff --git a/indra/llinventory/tests/inventorymisc_test.cpp b/indra/llinventory/tests/inventorymisc_test.cpp index e8b063bffe..039fa938dd 100644 --- a/indra/llinventory/tests/inventorymisc_test.cpp +++ b/indra/llinventory/tests/inventorymisc_test.cpp @@ -400,27 +400,7 @@ namespace tut // Deleted LLInventoryItem::exportFileXML() and LLInventoryItem::importXML() // because I can't find any non-test code references to it. 2009-05-04 JC } - - template<> template<> - void inventory_object::test<10>() - { - LLPointer src1 = create_random_inventory_item(); - U8* bin_bucket = new U8[300]; - S32 bin_bucket_size = src1->packBinaryBucket(bin_bucket, NULL); - - LLPointer src2 = new LLInventoryItem(); - src2->unpackBinaryBucket(bin_bucket, bin_bucket_size); - ensure_equals("1.sale price::getSalePrice() failed price", src1->getSaleInfo().getSalePrice(), src2->getSaleInfo().getSalePrice()); - ensure_equals("2.sale type::getSaleType() failed type", src1->getSaleInfo().getSaleType(), src2->getSaleInfo().getSaleType()); - ensure_equals("3.type::getType() failed", src1->getType(), src2->getType()); - ensure_equals("4.inventory type::getInventoryType() failed type", src1->getInventoryType(), src2->getInventoryType()); - ensure_equals("5.name::getName() failed", src1->getName(), src2->getName()); - ensure_equals("6.description::getDescription() failed", src1->getDescription(), src2->getDescription()); - ensure_equals("7.flags::getFlags() failed", src1->getFlags(), src2->getFlags()); - - } - template<> template<> void inventory_object::test<11>() { -- cgit v1.3 From 999c8cd3b92cdc64549167a261c8c629edc03c55 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 1 Feb 2023 01:33:30 +0200 Subject: SL-19117 Textures should return asset id when thumbnail is not set --- indra/llinventory/llinventory.cpp | 11 +++++++++++ indra/llinventory/llinventory.h | 1 + indra/newview/llfolderviewmodelinventory.h | 1 + indra/newview/llinspecttexture.cpp | 2 +- indra/newview/llinventorybridge.cpp | 15 +++++++++++++++ indra/newview/llinventorybridge.h | 2 ++ indra/newview/llinventorypanel.cpp | 1 + indra/newview/llpanelobjectinventory.cpp | 1 + 8 files changed, 33 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index b897198d10..e00f652622 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -349,6 +349,7 @@ void LLInventoryItem::copyItem(const LLInventoryItem* other) copyObject(other); mPermissions = other->mPermissions; mAssetUUID = other->mAssetUUID; + mThumbnailUUID = other->mThumbnailUUID; mDescription = other->mDescription; mSaleInfo = other->mSaleInfo; mInventoryType = other->mInventoryType; @@ -413,6 +414,7 @@ U32 LLInventoryItem::getCRC32() const //LL_DEBUGS() << "8 crc: " << std::hex << crc << std::dec << LL_ENDL; crc += (U32)mCreationDate; //LL_DEBUGS() << "9 crc: " << std::hex << crc << std::dec << LL_ENDL; + crc += mThumbnailUUID.getCRC32(); return crc; } @@ -502,6 +504,15 @@ void LLInventoryItem::setSaleInfo(const LLSaleInfo& sale_info) mSaleInfo = sale_info; } +const LLUUID& LLInventoryItem::getThumbnailUUID() const +{ + if (mThumbnailUUID.isNull() && mType == LLAssetType::AT_TEXTURE) + { + return mAssetUUID; + } + return mThumbnailUUID; +} + LLInventoryType::EType LLInventoryItem::getInventoryType() const { return mInventoryType; diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index dfe8b7659b..7af542c49a 100644 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -162,6 +162,7 @@ public: virtual const std::string& getDescription() const; virtual const std::string& getActualDescription() const; // Does not follow links virtual const LLSaleInfo& getSaleInfo() const; + virtual const LLUUID& getThumbnailUUID() const; virtual LLInventoryType::EType getInventoryType() const; virtual U32 getFlags() const; virtual time_t getCreationDate() const; diff --git a/indra/newview/llfolderviewmodelinventory.h b/indra/newview/llfolderviewmodelinventory.h index de28091c32..87e49189d8 100644 --- a/indra/newview/llfolderviewmodelinventory.h +++ b/indra/newview/llfolderviewmodelinventory.h @@ -39,6 +39,7 @@ class LLFolderViewModelItemInventory public: LLFolderViewModelItemInventory(class LLFolderViewModelInventory& root_view_model); virtual const LLUUID& getUUID() const = 0; + virtual const LLUUID& getThumbnailUUID() const = 0; virtual time_t getCreationDate() const = 0; // UTC seconds virtual void setCreationDate(time_t creation_date_utc) = 0; virtual PermissionMask getPermissionMask() const = 0; diff --git a/indra/newview/llinspecttexture.cpp b/indra/newview/llinspecttexture.cpp index af96561c45..8a8d7ed1bb 100644 --- a/indra/newview/llinspecttexture.cpp +++ b/indra/newview/llinspecttexture.cpp @@ -138,7 +138,7 @@ LLToolTip* LLInspectTextureUtil::createInventoryToolTip(LLToolTip::Params p) { const LLSD& sdTooltip = p.create_params; - if (sdTooltip.has("thumbnail_id")) + if (sdTooltip.has("thumbnail_id") && sdTooltip["thumbnail_id"].asUUID().notNull()) { // go straight for tooltip regardless of type return LLUICtrlFactory::create(p); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 7793b71f56..405c1f884a 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2154,6 +2154,21 @@ LLViewerInventoryItem* LLItemBridge::getItem() const return item; } +const LLUUID& LLItemBridge::getThumbnailUUID() const +{ + LLViewerInventoryItem* item = NULL; + LLInventoryModel* model = getInventoryModel(); + if(model) + { + item = (LLViewerInventoryItem*)model->getItem(mUUID); + } + if (item) + { + return item->getThumbnailUUID(); + } + return LLUUID::null; +} + BOOL LLItemBridge::isItemPermissive() const { LLViewerInventoryItem* item = getItem(); diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index bdffecf1c6..d56e0b778d 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -84,6 +84,7 @@ public: // LLInvFVBridge functionality //-------------------------------------------------------------------- virtual const LLUUID& getUUID() const { return mUUID; } + virtual const LLUUID& getThumbnailUUID() const { return LLUUID::null; } virtual void clearDisplayName() { mDisplayName.clear(); } virtual void restoreItem() {} virtual void restoreToWorld() {} @@ -251,6 +252,7 @@ public: virtual LLUIImagePtr getIconOverlay() const; LLViewerInventoryItem* getItem() const; + virtual const LLUUID& getThumbnailUUID() const; protected: BOOL confirmRemoveItem(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index d6f4b8f103..e013de2491 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1287,6 +1287,7 @@ BOOL LLInventoryPanel::handleToolTip(S32 x, S32 y, MASK mask) { LLSD params; params["inv_type"] = vm_item_p->getInventoryType(); + params["thumbnail_id"] = vm_item_p->getThumbnailUUID(); params["item_id"] = vm_item_p->getUUID(); LLToolTipMgr::instance().show(LLToolTip::Params() diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index fff25c6c61..70da9e430a 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -116,6 +116,7 @@ public: virtual PermissionMask getPermissionMask() const { return PERM_NONE; } /*virtual*/ LLFolderType::EType getPreferredType() const { return LLFolderType::FT_NONE; } virtual const LLUUID& getUUID() const { return mUUID; } + virtual const LLUUID& getThumbnailUUID() const { return LLUUID::null;} virtual time_t getCreationDate() const; virtual void setCreationDate(time_t creation_date_utc); -- cgit v1.3 From cf901b5abbe5c24da92c6c0320e3831a3798a539 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 2 Mar 2023 01:46:38 +0200 Subject: SL-19282 Thumbnail adjustments Follow links, fix outfts missing 'image' option, adjust inspector, recolor 'worn' in gallery --- indra/llinventory/llinventory.cpp | 9 --------- indra/llinventory/llinventory.h | 1 - indra/newview/llinspecttexture.cpp | 29 +++++++++++++++++++++++++++-- indra/newview/llinventorybridge.cpp | 1 + indra/newview/lloutfitgallery.cpp | 5 ++++- indra/newview/llviewerinventory.cpp | 17 +++++++++++++++++ indra/newview/llviewerinventory.h | 1 + 7 files changed, 50 insertions(+), 13 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index e00f652622..abe1b4dbd3 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -504,15 +504,6 @@ void LLInventoryItem::setSaleInfo(const LLSaleInfo& sale_info) mSaleInfo = sale_info; } -const LLUUID& LLInventoryItem::getThumbnailUUID() const -{ - if (mThumbnailUUID.isNull() && mType == LLAssetType::AT_TEXTURE) - { - return mAssetUUID; - } - return mThumbnailUUID; -} - LLInventoryType::EType LLInventoryItem::getInventoryType() const { return mInventoryType; diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index 7af542c49a..dfe8b7659b 100644 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -162,7 +162,6 @@ public: virtual const std::string& getDescription() const; virtual const std::string& getActualDescription() const; // Does not follow links virtual const LLSaleInfo& getSaleInfo() const; - virtual const LLUUID& getThumbnailUUID() const; virtual LLInventoryType::EType getInventoryType() const; virtual U32 getFlags() const; virtual time_t getCreationDate() const; diff --git a/indra/newview/llinspecttexture.cpp b/indra/newview/llinspecttexture.cpp index 4ec0767c4e..843b4da757 100644 --- a/indra/newview/llinspecttexture.cpp +++ b/indra/newview/llinspecttexture.cpp @@ -59,6 +59,7 @@ LLToolTip* LLInspectTextureUtil::createInventoryToolTip(LLToolTip::Params p) if (sdTooltip.has("thumbnail_id") && sdTooltip["thumbnail_id"].asUUID().notNull()) { // go straight for thumbnail regardless of type + // TODO: make a tooltip factory? return LLUICtrlFactory::create(p); } @@ -147,12 +148,12 @@ LLTexturePreviewView::~LLTexturePreviewView() void LLTexturePreviewView::draw() { + LLView::draw(); + if (m_Image) { LLRect rctClient = getLocalRect(); - gl_rect_2d(rctClient, LLColor4::black); - rctClient.stretch(-2); if (4 == m_Image->getComponents()) gl_rect_2d_checkerboard(rctClient); gl_draw_scaled_image(rctClient.mLeft, rctClient.mBottom, rctClient.getWidth(), rctClient.getHeight(), m_Image); @@ -199,6 +200,11 @@ LLTextureToolTip::LLTextureToolTip(const LLToolTip::Params& p) , mPreviewSize(256) { mMaxWidth = llmax(mMaxWidth, mPreviewSize); + + // Currently has to share params with LLToolTip, override values + setBackgroundColor(LLColor4::black); + setTransparentColor(LLColor4::black); + setBorderVisible(true); } LLTextureToolTip::~LLTextureToolTip() @@ -229,6 +235,25 @@ void LLTextureToolTip::initFromParams(const LLToolTip::Params& p) mPreviewView->setImageFromItemId(sdTextureParams["item_id"].asUUID()); } + // Currently has to share params with LLToolTip, override values manually + // Todo: provide from own params instead, may be like object inspector does it + LLViewBorder::Params border_params; + border_params.border_thickness(LLPANEL_BORDER_WIDTH); + border_params.highlight_light_color(LLColor4::white); + border_params.highlight_dark_color(LLColor4::white); + border_params.shadow_light_color(LLColor4::white); + border_params.shadow_dark_color(LLColor4::white); + addBorder(border_params); + setBorderVisible(true); + + setBackgroundColor(LLColor4::black); + setBackgroundVisible(true); + setBackgroundOpaque(true); + setBackgroundImage(nullptr); + setTransparentImage(nullptr); + + mTextBox->setColor(LLColor4::white); + snapToChildren(); } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 5f1db0895c..0c7f237415 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -4240,6 +4240,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items if (cat && (cat->getPreferredType() == LLFolderType::FT_OUTFIT)) { items.push_back(std::string("Rename")); + items.push_back(std::string("thumbnail")); addDeleteContextMenuOptions(items, disabled_items); // EXT-4030: disallow deletion of currently worn outfit diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 6ef8080d8c..a275af1565 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -741,10 +741,13 @@ void LLOutfitGalleryItem::setOutfitWorn(bool value) mWorn = value; LLStringUtil::format_map_t worn_string_args; std::string worn_string = getString("worn_string", worn_string_args); - LLUIColor text_color = LLUIColorTable::instance().getColor(mSelected ? "White" : (mWorn ? "OutfitGalleryItemWorn" : "White"), LLColor4::white); + LLUIColor text_color = LLUIColorTable::instance().getColor("White", LLColor4::white); mOutfitWornText->setReadOnlyColor(text_color.get()); mOutfitNameText->setReadOnlyColor(text_color.get()); + mOutfitWornText->setFont(value ? LLFontGL::getFontSansSerifBold() : LLFontGL::getFontSansSerifSmall()); + mOutfitNameText->setFont(value ? LLFontGL::getFontSansSerifBold() : LLFontGL::getFontSansSerifSmall()); mOutfitWornText->setValue(value ? worn_string : ""); + mOutfitNameText->setText(mOutfitName); // refresh LLTextViewModel to pick up font changes } void LLOutfitGalleryItem::setSelected(bool value) diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 50252556de..27f57bda81 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1893,6 +1893,23 @@ const LLSaleInfo& LLViewerInventoryItem::getSaleInfo() const return LLInventoryItem::getSaleInfo(); } +const LLUUID& LLViewerInventoryItem::getThumbnailUUID() const +{ + if (mThumbnailUUID.isNull() && mType == LLAssetType::AT_TEXTURE) + { + return mAssetUUID; + } + if (mThumbnailUUID.isNull() && mType == LLAssetType::AT_LINK) + { + return gInventory.getItem(getLinkedUUID())->getThumbnailUUID(); + } + if (mThumbnailUUID.isNull() && mType == LLAssetType::AT_LINK_FOLDER) + { + return gInventory.getCategory(getLinkedUUID())->getThumbnailUUID(); + } + return mThumbnailUUID; +} + LLInventoryType::EType LLViewerInventoryItem::getInventoryType() const { if (const LLViewerInventoryItem *linked_item = getLinkedItem()) diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 24b632632b..3914dae343 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -72,6 +72,7 @@ public: virtual const LLUUID& getCreatorUUID() const; virtual const std::string& getDescription() const; virtual const LLSaleInfo& getSaleInfo() const; + virtual const LLUUID& getThumbnailUUID() const; virtual LLInventoryType::EType getInventoryType() const; virtual bool isWearableType() const; virtual LLWearableType::EType getWearableType() const; -- cgit v1.3 From 80b33a015735daf08b8904b3581b3edcce9368d3 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 10 Mar 2023 20:15:41 +0200 Subject: SL-18629 Unpack thumbnail asset id --- indra/llinventory/llinventory.cpp | 56 ++++++++++++++++++++++++++++++++++++-- indra/newview/llinventorymodel.cpp | 1 + 2 files changed, 55 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index abe1b4dbd3..db18bd4c0e 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -44,6 +44,7 @@ static const std::string INV_ITEM_ID_LABEL("item_id"); static const std::string INV_FOLDER_ID_LABEL("cat_id"); static const std::string INV_PARENT_ID_LABEL("parent_id"); +static const std::string INV_THUMBNAIL_LABEL("thumbnail"); static const std::string INV_THUMBNAIL_ID_LABEL("thumbnail_id"); static const std::string INV_ASSET_TYPE_LABEL("type"); static const std::string INV_PREFERRED_TYPE_LABEL("preferred_type"); @@ -863,6 +864,34 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) { mParentUUID = sd[w]; } + w = INV_THUMBNAIL_LABEL; + if (sd.has(w)) + { + LLSD thumbnail_map = sd[w]; + w = INV_ASSET_ID_LABEL; + if (thumbnail_map.has(w)) + { + mThumbnailUUID = thumbnail_map[w]; + } + /* + asset_id + acc0ec86 - 17f2 - 4b92 - ab41 - 6718b1f755f7 + perms + 8 + service + 3 + version + 1 + */ + } + else + { + w = INV_THUMBNAIL_ID_LABEL; + if (sd.has(w)) + { + mThumbnailUUID = sd[w]; + } + } w = INV_PERMISSIONS_LABEL; if (sd.has(w)) { @@ -1071,10 +1100,33 @@ bool LLInventoryCategory::fromLLSD(const LLSD& sd) { mParentUUID = sd[w]; } - w = INV_THUMBNAIL_ID_LABEL; + w = INV_THUMBNAIL_LABEL; if (sd.has(w)) { - mThumbnailUUID = sd[w]; + LLSD thumbnail_map = sd[w]; + w = INV_ASSET_ID_LABEL; + if (thumbnail_map.has(w)) + { + mThumbnailUUID = thumbnail_map[w]; + } + /* + asset_id + acc0ec86 - 17f2 - 4b92 - ab41 - 6718b1f755f7 + perms + 8 + service + 3 + version + 1 + */ + } + else + { + w = INV_THUMBNAIL_ID_LABEL; + if (sd.has(w)) + { + mThumbnailUUID = sd[w]; + } } w = INV_ASSET_TYPE_LABEL; if (sd.has(w)) diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 774ed051c0..bfff876c96 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -193,6 +193,7 @@ public: titem->unpackMessage(item); LL_DEBUGS("Inventory") << "unpacked item '" << titem->getName() << "' in " << titem->getParentUUID() << LL_ENDL; + // callback id might be no longer supported U32 callback_id = item["callback_id"].asInteger(); if (titem->getUUID().notNull()) -- cgit v1.3 From e4de43fe5e640a1d30e78c68b90eefdf87b908e2 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 10 Mar 2023 21:30:28 +0200 Subject: SL-18629 Pack thumbnail asset id --- indra/llinventory/llinventory.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index db18bd4c0e..8904d9fb8a 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -812,6 +812,7 @@ void LLInventoryItem::asLLSD( LLSD& sd ) const sd[INV_ITEM_ID_LABEL] = mUUID; sd[INV_PARENT_ID_LABEL] = mParentUUID; sd[INV_PERMISSIONS_LABEL] = ll_create_sd_from_permissions(mPermissions); + sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); U32 mask = mPermissions.getMaskBase(); if(((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) @@ -867,13 +868,13 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) w = INV_THUMBNAIL_LABEL; if (sd.has(w)) { - LLSD thumbnail_map = sd[w]; + const LLSD &thumbnail_map = sd[w]; w = INV_ASSET_ID_LABEL; if (thumbnail_map.has(w)) { mThumbnailUUID = thumbnail_map[w]; } - /* + /* Example: asset_id acc0ec86 - 17f2 - 4b92 - ab41 - 6718b1f755f7 perms @@ -1067,7 +1068,7 @@ LLSD LLInventoryCategory::asLLSD() const LLSD sd = LLSD(); sd["item_id"] = mUUID; sd["parent_id"] = mParentUUID; - sd["thumbnail_id"] = mThumbnailUUID; + sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); S8 type = static_cast(mPreferredType); sd["type"] = type; sd["name"] = mName; @@ -1103,22 +1104,12 @@ bool LLInventoryCategory::fromLLSD(const LLSD& sd) w = INV_THUMBNAIL_LABEL; if (sd.has(w)) { - LLSD thumbnail_map = sd[w]; + const LLSD &thumbnail_map = sd[w]; w = INV_ASSET_ID_LABEL; if (thumbnail_map.has(w)) { mThumbnailUUID = thumbnail_map[w]; } - /* - asset_id - acc0ec86 - 17f2 - 4b92 - ab41 - 6718b1f755f7 - perms - 8 - service - 3 - version - 1 - */ } else { @@ -1250,6 +1241,7 @@ LLSD LLInventoryCategory::exportLLSD() const cat_data[INV_PARENT_ID_LABEL] = mParentUUID; cat_data[INV_ASSET_TYPE_LABEL] = LLAssetType::lookup(mType); cat_data[INV_PREFERRED_TYPE_LABEL] = LLFolderType::lookup(mPreferredType); + cat_data[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); cat_data[INV_NAME_LABEL] = mName; return cat_data; @@ -1273,6 +1265,14 @@ bool LLInventoryCategory::importLLSD(const LLSD& cat_data) { setPreferredType(LLFolderType::lookup(cat_data[INV_PREFERRED_TYPE_LABEL].asString())); } + if (cat_data.has(INV_THUMBNAIL_LABEL)) + { + const LLSD &thumbnail_data = cat_data[INV_THUMBNAIL_LABEL]; + if (thumbnail_data.has(INV_ASSET_ID_LABEL)) + { + setThumbnailUUID(thumbnail_data[INV_ASSET_ID_LABEL].asUUID()); + } + } if (cat_data.has(INV_NAME_LABEL)) { mName = cat_data[INV_NAME_LABEL].asString(); -- cgit v1.3 From 9d90fbc73df9c07deef8737e56cc3f466d2c4d05 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 10 Mar 2023 22:43:40 +0200 Subject: SL-18629 LLTask thumbnail packing and unpacking --- indra/llinventory/llinventory.cpp | 79 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 5 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 8904d9fb8a..c6049f3ec4 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -671,6 +671,26 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) { mType = LLAssetType::lookup(valuestr); } + else if (0 == strcmp("metadata", keyword)) + { + LLSD metadata(valuestr); + if (metadata.has("thumbnail")) + { + const LLSD& thumbnail = metadata["thumbnail"]; + if (thumbnail.has("asset_id")) + { + setThumbnailUUID(thumbnail["asset_id"].asUUID()); + } + else + { + setThumbnailUUID(LLUUID::null); + } + } + else + { + setThumbnailUUID(LLUUID::null); + } + } else if(0 == strcmp("inv_type", keyword)) { mInventoryType = LLInventoryType::lookup(std::string(valuestr)); @@ -760,6 +780,13 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu output_stream << "\t\tparent_id\t" << uuid_str << "\n"; mPermissions.exportLegacyStream(output_stream); + if (mThumbnailUUID.notNull()) + { + LLSD metadata; + metadata["thumbnail"] = LLSD().with("asset_id", mThumbnailUUID); + output_stream << "\t\tmetadata\t" << metadata << "|\n"; + } + // Check for permissions to see the asset id, and if so write it // out as an asset id. Otherwise, apply our cheesy encryption. if(include_asset_key) @@ -812,7 +839,11 @@ void LLInventoryItem::asLLSD( LLSD& sd ) const sd[INV_ITEM_ID_LABEL] = mUUID; sd[INV_PARENT_ID_LABEL] = mParentUUID; sd[INV_PERMISSIONS_LABEL] = ll_create_sd_from_permissions(mPermissions); - sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); + + if (mThumbnailUUID.notNull()) + { + sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); + } U32 mask = mPermissions.getMaskBase(); if(((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) @@ -865,6 +896,7 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) { mParentUUID = sd[w]; } + mThumbnailUUID.setNull(); w = INV_THUMBNAIL_LABEL; if (sd.has(w)) { @@ -890,7 +922,7 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) w = INV_THUMBNAIL_ID_LABEL; if (sd.has(w)) { - mThumbnailUUID = sd[w]; + mThumbnailUUID = sd[w].asUUID(); } } w = INV_PERMISSIONS_LABEL; @@ -1068,11 +1100,15 @@ LLSD LLInventoryCategory::asLLSD() const LLSD sd = LLSD(); sd["item_id"] = mUUID; sd["parent_id"] = mParentUUID; - sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); S8 type = static_cast(mPreferredType); sd["type"] = type; sd["name"] = mName; + if (mThumbnailUUID.notNull()) + { + sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); + } + return sd; } @@ -1101,6 +1137,7 @@ bool LLInventoryCategory::fromLLSD(const LLSD& sd) { mParentUUID = sd[w]; } + mThumbnailUUID.setNull(); w = INV_THUMBNAIL_LABEL; if (sd.has(w)) { @@ -1210,6 +1247,26 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) LLStringUtil::replaceNonstandardASCII(mName, ' '); LLStringUtil::replaceChar(mName, '|', ' '); } + else if (0 == strcmp("metadata", keyword)) + { + LLSD metadata(valuestr); + if (metadata.has("thumbnail")) + { + const LLSD& thumbnail = metadata["thumbnail"]; + if (thumbnail.has("asset_id")) + { + setThumbnailUUID(thumbnail["asset_id"].asUUID()); + } + else + { + setThumbnailUUID(LLUUID::null); + } + } + else + { + setThumbnailUUID(LLUUID::null); + } + } else { LL_WARNS() << "unknown keyword '" << keyword @@ -1230,6 +1287,12 @@ BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL) output_stream << "\t\ttype\t" << LLAssetType::lookup(mType) << "\n"; output_stream << "\t\tpref_type\t" << LLFolderType::lookup(mPreferredType) << "\n"; output_stream << "\t\tname\t" << mName.c_str() << "|\n"; + if (mThumbnailUUID.notNull()) + { + LLSD metadata; + metadata["thumbnail"] = LLSD().with("asset_id", mThumbnailUUID); + output_stream << "\t\tmetadata\t" << metadata << "|\n"; + } output_stream << "\t}\n"; return TRUE; } @@ -1241,9 +1304,13 @@ LLSD LLInventoryCategory::exportLLSD() const cat_data[INV_PARENT_ID_LABEL] = mParentUUID; cat_data[INV_ASSET_TYPE_LABEL] = LLAssetType::lookup(mType); cat_data[INV_PREFERRED_TYPE_LABEL] = LLFolderType::lookup(mPreferredType); - cat_data[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); cat_data[INV_NAME_LABEL] = mName; + if (mThumbnailUUID.notNull()) + { + cat_data[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); + } + return cat_data; } @@ -1265,14 +1332,16 @@ bool LLInventoryCategory::importLLSD(const LLSD& cat_data) { setPreferredType(LLFolderType::lookup(cat_data[INV_PREFERRED_TYPE_LABEL].asString())); } + LLUUID thumbnail_uuid; if (cat_data.has(INV_THUMBNAIL_LABEL)) { const LLSD &thumbnail_data = cat_data[INV_THUMBNAIL_LABEL]; if (thumbnail_data.has(INV_ASSET_ID_LABEL)) { - setThumbnailUUID(thumbnail_data[INV_ASSET_ID_LABEL].asUUID()); + thumbnail_uuid = thumbnail_data[INV_ASSET_ID_LABEL].asUUID(); } } + setThumbnailUUID(thumbnail_uuid); if (cat_data.has(INV_NAME_LABEL)) { mName = cat_data[INV_NAME_LABEL].asString(); -- cgit v1.3 From bb4967817e5e0251ebcbae861fcd998f22ce0c0c Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 7 Apr 2023 21:01:00 +0300 Subject: SL-18918 Fix folder type when creating folders Might be better to replace "type" with "type_default" everywere, not just for AIS --- indra/llinventory/llinventory.cpp | 25 +++++++++++++++++++++---- indra/llinventory/llinventory.h | 1 + indra/newview/llinventorymodel.cpp | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index c6049f3ec4..ef86d2d89b 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -1098,11 +1098,28 @@ void LLInventoryCategory::setPreferredType(LLFolderType::EType type) LLSD LLInventoryCategory::asLLSD() const { LLSD sd = LLSD(); - sd["item_id"] = mUUID; - sd["parent_id"] = mParentUUID; + sd[INV_ITEM_ID_LABEL] = mUUID; + sd[INV_PARENT_ID_LABEL] = mParentUUID; S8 type = static_cast(mPreferredType); - sd["type"] = type; - sd["name"] = mName; + sd[INV_ASSET_TYPE_LABEL] = type; + sd[INV_NAME_LABEL] = mName; + + if (mThumbnailUUID.notNull()) + { + sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); + } + + return sd; +} + +LLSD LLInventoryCategory::asAISLLSD() const +{ + LLSD sd = LLSD(); + sd[INV_FOLDER_ID_LABEL_WS] = mUUID; + sd[INV_PARENT_ID_LABEL] = mParentUUID; + S8 type = static_cast(mPreferredType); + sd[INV_ASSET_TYPE_LABEL_WS] = type; + sd[INV_NAME_LABEL] = mName; if (mThumbnailUUID.notNull()) { diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index dfe8b7659b..516cfc6a24 100644 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -253,6 +253,7 @@ public: LLFolderType::EType getPreferredType() const; void setPreferredType(LLFolderType::EType type); LLSD asLLSD() const; + LLSD asAISLLSD() const; bool fromLLSD(const LLSD& sd); //-------------------------------------------------------------------- diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 80f16a854b..4bca2ce650 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1010,7 +1010,7 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, new_inventory["categories"] = LLSD::emptyArray(); LLViewerInventoryCategory cat(LLUUID::null, parent_id, preferred_type, name, gAgent.getID()); cat.setThumbnailUUID(thumbnail_id); - LLSD cat_sd = cat.asLLSD(); + LLSD cat_sd = cat.asAISLLSD(); new_inventory["categories"].append(cat_sd); AISAPI::CreateInventory( parent_id, -- cgit v1.3 From e7a1ac5db84c6ec77053e5115c997236ae6bf0df Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 24 Apr 2023 21:37:24 +0300 Subject: SL-19503 Deleting a thumbnail for folder does not remove thumbnail in viewer --- indra/llinventory/llinventory.cpp | 6 +----- indra/newview/llviewerinventory.cpp | 5 +---- 2 files changed, 2 insertions(+), 9 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index ef86d2d89b..81ace2a5a8 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -1120,11 +1120,7 @@ LLSD LLInventoryCategory::asAISLLSD() const S8 type = static_cast(mPreferredType); sd[INV_ASSET_TYPE_LABEL_WS] = type; sd[INV_NAME_LABEL] = mName; - - if (mThumbnailUUID.notNull()) - { - sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); - } + sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); return sd; } diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 8b0d14b3e9..96f0b500a0 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1377,11 +1377,8 @@ void update_inventory_category( return; } - LLPointer new_cat = new LLViewerInventoryCategory(obj); - new_cat->fromLLSD(updates); - LLSD new_llsd = new_cat->asLLSD(); AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); - AISAPI::UpdateCategory(cat_id, new_llsd, cr); + AISAPI::UpdateCategory(cat_id, updates, cr); } } -- cgit v1.3 From 4c3a7b106429f3ede827fd28acd25cc00fcb8649 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 25 Apr 2023 00:03:42 +0300 Subject: SL-19503 Fix thumbnails not being restored from cache --- indra/llinventory/llinventory.cpp | 4 ++-- indra/newview/llinventorymodel.cpp | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 81ace2a5a8..ecd070236f 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -1345,16 +1345,16 @@ bool LLInventoryCategory::importLLSD(const LLSD& cat_data) { setPreferredType(LLFolderType::lookup(cat_data[INV_PREFERRED_TYPE_LABEL].asString())); } - LLUUID thumbnail_uuid; if (cat_data.has(INV_THUMBNAIL_LABEL)) { + LLUUID thumbnail_uuid; const LLSD &thumbnail_data = cat_data[INV_THUMBNAIL_LABEL]; if (thumbnail_data.has(INV_ASSET_ID_LABEL)) { thumbnail_uuid = thumbnail_data[INV_ASSET_ID_LABEL].asUUID(); } + setThumbnailUUID(thumbnail_uuid); } - setThumbnailUUID(thumbnail_uuid); if (cat_data.has(INV_NAME_LABEL)) { mName = cat_data[INV_NAME_LABEL].asString(); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 32acd0eb03..873d3e1ccf 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -2638,12 +2638,6 @@ bool LLInventoryModel::loadSkeleton( cat->setUUID(folder_id.asUUID()); cat->setParent(parent_id.asUUID()); - LLSD thumbnail = (*it)["thumbnail"]; - if (thumbnail.isMap()) - { - cat->setThumbnailUUID(thumbnail["asset_id"].asUUID()); - } - LLFolderType::EType preferred_type = LLFolderType::FT_NONE; LLSD type_default = (*it)["type_default"]; if(type_default.isDefined()) @@ -2735,6 +2729,10 @@ bool LLInventoryModel::loadSkeleton( else { cached_ids.insert(tcat->getUUID()); + + // At the moment download does not provide a thumbnail + // uuid, use the one from cache + tcat->setThumbnailUUID(cat->getThumbnailUUID()); } } -- cgit v1.3 From 04fc8c4db45175cbe036474c53eacdd3b9f56eaa Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 27 Jun 2023 00:26:32 +0300 Subject: SL-18629 Fixed missed case of unpacking metadata --- indra/llinventory/llinventory.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index ecd070236f..f0b593bba7 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -215,6 +215,26 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) { mType = LLAssetType::lookup(valuestr); } + else if (0 == strcmp("metadata", keyword)) + { + LLSD metadata(valuestr); + if (metadata.has("thumbnail")) + { + const LLSD& thumbnail = metadata["thumbnail"]; + if (thumbnail.has("asset_id")) + { + setThumbnailUUID(thumbnail["asset_id"].asUUID()); + } + else + { + setThumbnailUUID(LLUUID::null); + } + } + else + { + setThumbnailUUID(LLUUID::null); + } + } else if(0 == strcmp("name", keyword)) { //strcpy(valuestr, buffer + strlen(keyword) + 3); -- cgit v1.3 From 4b5b048cb6280cbd9fd303acd96fce73461d1fb4 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 22 Aug 2023 21:14:06 +0300 Subject: SL-20187 [AIS3] Don't fill thumbnail field if null thumbnail is set --- indra/llinventory/llinventory.cpp | 9 ++++++++- indra/newview/llfloaterchangeitemthumbnail.cpp | 12 ++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index f0b593bba7..13a496b4d7 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -1140,7 +1140,14 @@ LLSD LLInventoryCategory::asAISLLSD() const S8 type = static_cast(mPreferredType); sd[INV_ASSET_TYPE_LABEL_WS] = type; sd[INV_NAME_LABEL] = mName; - sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); + if (mThumbnailUUID.notNull()) + { + sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); + } + else + { + sd[INV_THUMBNAIL_LABEL] = LLSD(); + } return sd; } diff --git a/indra/newview/llfloaterchangeitemthumbnail.cpp b/indra/newview/llfloaterchangeitemthumbnail.cpp index 692ef3b163..77212507ab 100644 --- a/indra/newview/llfloaterchangeitemthumbnail.cpp +++ b/indra/newview/llfloaterchangeitemthumbnail.cpp @@ -787,8 +787,16 @@ void LLFloaterChangeItemThumbnail::setThumbnailId(const LLUUID& new_thumbnail_id if (obj->getThumbnailUUID() != new_thumbnail_id) { LLSD updates; - // At the moment server expects id as a string - updates["thumbnail"] = LLSD().with("asset_id", new_thumbnail_id.asString()); + if (new_thumbnail_id.notNull()) + { + // At the moment server expects id as a string + updates["thumbnail"] = LLSD().with("asset_id", new_thumbnail_id.asString()); + } + else + { + // No thumbnail isntead of 'null id thumbnail' + updates["thumbnail"] = LLSD(); + } LLViewerInventoryCategory* view_folder = dynamic_cast(obj); if (view_folder) { -- cgit v1.3 From c382d4e9756ec407188afcd94a64a07cd883bba1 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 25 Aug 2023 19:26:58 +0300 Subject: SL-20199 Error creating new folder --- indra/llinventory/llinventory.cpp | 6 +----- indra/llinventory/llinventory.h | 2 +- indra/newview/llinventorymodel.cpp | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 13a496b4d7..5adf1fa0e6 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -1132,7 +1132,7 @@ LLSD LLInventoryCategory::asLLSD() const return sd; } -LLSD LLInventoryCategory::asAISLLSD() const +LLSD LLInventoryCategory::asAISCreateCatLLSD() const { LLSD sd = LLSD(); sd[INV_FOLDER_ID_LABEL_WS] = mUUID; @@ -1144,10 +1144,6 @@ LLSD LLInventoryCategory::asAISLLSD() const { sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); } - else - { - sd[INV_THUMBNAIL_LABEL] = LLSD(); - } return sd; } diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index 516cfc6a24..6d4535af27 100644 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -253,7 +253,7 @@ public: LLFolderType::EType getPreferredType() const; void setPreferredType(LLFolderType::EType type); LLSD asLLSD() const; - LLSD asAISLLSD() const; + LLSD asAISCreateCatLLSD() const; bool fromLLSD(const LLSD& sd); //-------------------------------------------------------------------- diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index a41ab4eec3..ea771661ec 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1029,7 +1029,7 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, new_inventory["categories"] = LLSD::emptyArray(); LLViewerInventoryCategory cat(LLUUID::null, parent_id, preferred_type, name, gAgent.getID()); cat.setThumbnailUUID(thumbnail_id); - LLSD cat_sd = cat.asAISLLSD(); + LLSD cat_sd = cat.asAISCreateCatLLSD(); new_inventory["categories"].append(cat_sd); AISAPI::CreateInventory( parent_id, -- cgit v1.3