From 126bfa4877303b47abbc99f09c09a931c20cbd3b Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Fri, 31 Mar 2023 15:23:11 +0300 Subject: SL-19379 WIP fix for displaying folder link items, added correct action for 'paste as link' --- indra/newview/llinventorygallery.cpp | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'indra/newview/llinventorygallery.cpp') diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 8c49cd5a4b..499d51c431 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -222,6 +222,9 @@ void LLInventoryGallery::updateRootFolder() } } + const LLUUID cof = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); + mCategoriesObserver->addCategory(cof, boost::bind(&LLInventoryGallery::onCOFChanged, this)); + if (!mGalleryCreated) { initGallery(); @@ -243,9 +246,6 @@ void LLInventoryGallery::initGallery() } reArrangeRows(); mGalleryCreated = true; - - const LLUUID cof = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); - mCategoriesObserver->addCategory(cof, boost::bind(&LLInventoryGallery::onCOFChanged, this)); } } @@ -646,7 +646,14 @@ void LLInventoryGallery::updateAddedItem(LLUUID item_id) LLInventoryType::EType inventory_type(LLInventoryType::IT_CATEGORY); U32 misc_flags = 0; bool is_worn = false; - if (LLAssetType::AT_CATEGORY == obj->getType()) + LLInventoryItem* inv_item = gInventory.getItem(item_id); + if (inv_item) + { + inventory_type = inv_item->getInventoryType(); + misc_flags = inv_item->getFlags(); + is_worn = LLAppearanceMgr::instance().isLinkedInCOF(item_id); + } + else if (LLAssetType::AT_CATEGORY == obj->getType()) { name = get_localized_folder_name(item_id); if(thumbnail_id.isNull()) @@ -654,16 +661,6 @@ void LLInventoryGallery::updateAddedItem(LLUUID item_id) thumbnail_id = getOutfitImageID(item_id); } } - else - { - LLInventoryItem* inv_item = gInventory.getItem(item_id); - if (inv_item) - { - inventory_type = inv_item->getInventoryType(); - misc_flags = inv_item->getFlags(); - is_worn = LLAppearanceMgr::instance().isLinkedInCOF(item_id); - } - } LLInventoryGalleryItem* item = buildGalleryItem(name, item_id, obj->getType(), thumbnail_id, inventory_type, misc_flags, obj->getIsLinkType(), is_worn); mItemMap.insert(LLInventoryGallery::gallery_item_map_t::value_type(item_id, item)); @@ -1049,7 +1046,16 @@ void LLInventoryGalleryItem::setType(LLAssetType::EType type, LLInventoryType::E if(mIsFolder) { mSortGroup = SG_NORMAL_FOLDER; - LLViewerInventoryCategory * cat = gInventory.getCategory(mUUID); + LLUUID folder_id = mUUID; + if(mIsLink) + { + LLInventoryObject* obj = gInventory.getObject(mUUID); + if (obj) + { + folder_id = obj->getLinkedUUID(); + } + } + LLViewerInventoryCategory* cat = gInventory.getCategory(folder_id); if (cat) { LLFolderType::EType preferred_type = cat->getPreferredType(); -- cgit v1.2.3