From 27046fcc14239d36604790c993a90394361ec873 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 21 Nov 2022 13:48:23 +0000 Subject: SL-18629 - moving createNewCategory to AIS3 --- indra/newview/llinventorymodel.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index fab7ae8f1a..36797a3f28 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -664,24 +664,25 @@ const LLUUID LLInventoryModel::findLibraryCategoryUUIDForType(LLFolderType::ETyp // updateCategory() with a newly generated UUID category, but this // version will take care of details like what the name should be // based on preferred type. Returns the UUID of the new category. +// +// On failure, returns a null UUID. +// FIXME: callers do not check for or handle a null results currently. LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, LLFolderType::EType preferred_type, const std::string& pname, inventory_func_type callback) { - LLUUID id; + LLUUID id; // Initially null. if (!isInventoryUsable()) { LL_WARNS(LOG_INV) << "Inventory is not usable; can't create requested category of type " << preferred_type << LL_ENDL; - // FIXME failing but still returning an id? return id; } if(LLFolderType::lookup(preferred_type) == LLFolderType::badLookup()) { LL_DEBUGS(LOG_INV) << "Attempt to create undefined category." << LL_ENDL; - // FIXME failing but still returning an id? return id; } @@ -708,7 +709,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, std::string url; if ( viewer_region ) url = viewer_region->getCapability("CreateInventoryCategory"); - + if (!url.empty() && callback) { //Let's use the new capability. -- cgit v1.2.3 From f6208020f5b27b84aeb9ca258e8dbddce9c49bce Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 22 Nov 2022 15:46:08 +0000 Subject: SL-18629 - use AISAPI for some paths of new category creation --- indra/newview/llinventorymodel.cpp | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 36797a3f28..a7b3076e52 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -694,38 +694,20 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, LL_WARNS(LOG_INV) << "Creating new system folder, type " << preferred_type << LL_ENDL; } - id.generate(); std::string name = pname; - if(!pname.empty()) - { - name.assign(pname); - } - else + if (pname.empty()) { name.assign(LLViewerFolderType::lookupNewCategoryName(preferred_type)); } - LLViewerRegion* viewer_region = gAgent.getRegion(); - std::string url; - if ( viewer_region ) - url = viewer_region->getCapability("CreateInventoryCategory"); - - if (!url.empty() && callback) + if (callback) { - //Let's use the new capability. - - LLSD request, body; - body["folder_id"] = id; - body["parent_id"] = parent_id; - body["type"] = (LLSD::Integer) preferred_type; - body["name"] = name; - - request["message"] = "CreateInventoryCategory"; - request["payload"] = body; - - LL_DEBUGS(LOG_INV) << "Creating category via request: " << ll_pretty_print_sd(request) << LL_ENDL; - LLCoros::instance().launch("LLInventoryModel::createNewCategoryCoro", - boost::bind(&LLInventoryModel::createNewCategoryCoro, this, url, body, callback)); + LLSD new_inventory = LLSD::emptyMap(); + new_inventory["categories"] = LLSD::emptyArray(); + LLViewerInventoryCategory cat(LLUUID::null, parent_id, preferred_type, name, gAgent.getID()); + LLSD cat_sd = cat.asLLSD(); + new_inventory["categories"].append(cat_sd); + AISAPI::CreateInventory(parent_id, new_inventory, callback); return LLUUID::null; } @@ -740,6 +722,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, // assuming instant success. // Add the category to the internal representation + id.generate(); LLPointer cat = new LLViewerInventoryCategory(id, parent_id, preferred_type, name, gAgent.getID()); cat->setVersion(LLViewerInventoryCategory::VERSION_INITIAL - 1); // accountForUpdate() will icrease version by 1 -- cgit v1.2.3 From ce5ac93883b71b6abf8cffa35204541e257c6b02 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 24 Jan 2023 20:15:22 +0000 Subject: SL-18629 - various notes on work for D567 --- indra/newview/llinventorymodel.cpp | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index a7b3076e52..b64dd431db 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -700,8 +700,13 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, name.assign(LLViewerFolderType::lookupNewCategoryName(preferred_type)); } +#ifdef USE_AIS_FOR_NC + // D567 currently this doesn't really work due to limitations in + // AIS3, also violates the common caller assumption that we can + // assign the id and return immediately. if (callback) { + // D567 note that we no longer assign the UUID in the viewer, so various workflows need to change. LLSD new_inventory = LLSD::emptyMap(); new_inventory["categories"] = LLSD::emptyArray(); LLViewerInventoryCategory cat(LLUUID::null, parent_id, preferred_type, name, gAgent.getID()); @@ -711,17 +716,47 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, return LLUUID::null; } +#else + LLViewerRegion* viewer_region = gAgent.getRegion(); + std::string url; + if ( viewer_region ) + url = viewer_region->getCapability("CreateInventoryCategory"); + + if (!url.empty() && callback) + { + //Let's use the new capability. + + id.generate(); + LLSD request, body; + body["folder_id"] = id; + body["parent_id"] = parent_id; + body["type"] = (LLSD::Integer) preferred_type; + body["name"] = name; + + request["message"] = "CreateInventoryCategory"; + request["payload"] = body; + + LL_DEBUGS(LOG_INV) << "Creating category via request: " << ll_pretty_print_sd(request) << LL_ENDL; + LLCoros::instance().launch("LLInventoryModel::createNewCategoryCoro", + boost::bind(&LLInventoryModel::createNewCategoryCoro, this, url, body, callback)); + + return LLUUID::null; + } +#endif + if (!gMessageSystem) { return LLUUID::null; } - // FIXME this UDP code path needs to be removed. Requires + // D567 FIXME this UDP code path needs to be removed. Requires // reworking many of the callers to use callbacks rather than // assuming instant success. // Add the category to the internal representation + LL_WARNS() << "D567 need to remove this usage" << LL_ENDL; + id.generate(); LLPointer cat = new LLViewerInventoryCategory(id, parent_id, preferred_type, name, gAgent.getID()); -- cgit v1.2.3 From 1140ae3489a9e260a0abb808b4152f2d57384d67 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Thu, 29 Dec 2022 19:51:33 +0100 Subject: Add a texture inspector and show it when hovering over an inventory textory (or folder containing - among others - exactly one texture) and when hovering over notecard embedded textures --- indra/newview/llinventorymodel.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 8b2a1a14f0..edd489f021 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -451,6 +451,31 @@ void LLInventoryModel::getDirectDescendentsOf(const LLUUID& cat_id, items = get_ptr_in_map(mParentChildItemTree, cat_id); } +void LLInventoryModel::getDirectDescendentsOf(const LLUUID& cat_id, cat_array_t& categories, item_array_t& items, LLInventoryCollectFunctor& f) const +{ + if (cat_array_t* categoriesp = get_ptr_in_map(mParentChildCategoryTree, cat_id)) + { + for (LLViewerInventoryCategory* pFolder : *categoriesp) + { + if (f(pFolder, nullptr)) + { + categories.push_back(pFolder); + } + } + } + + if (item_array_t* itemsp = get_ptr_in_map(mParentChildItemTree, cat_id)) + { + for (LLViewerInventoryItem* pItem : *itemsp) + { + if (f(nullptr, pItem)) + { + items.push_back(pItem); + } + } + } +} + LLMD5 LLInventoryModel::hashDirectDescendentNames(const LLUUID& cat_id) const { LLInventoryModel::cat_array_t* cat_array; -- cgit v1.2.3 From 8b8d4795a76246915b15d19154723cdb1f20ba99 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sun, 5 Mar 2023 22:35:29 +0200 Subject: SL-18629 Generic message for BulkUpdateInventory --- indra/newview/llinventorymodel.cpp | 230 +++++++++++++++++++++++++++++++++++-- 1 file changed, 222 insertions(+), 8 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 7e500a56c3..fb19994054 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -37,6 +37,7 @@ #include "llappearancemgr.h" #include "llavatarnamecache.h" #include "llclipboard.h" +#include "lldispatcher.h" #include "llinventorypanel.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" @@ -49,6 +50,7 @@ #include "llviewercontrol.h" #include "llviewernetwork.h" #include "llpreview.h" +#include "llviewergenericmessage.h" #include "llviewermessage.h" #include "llviewerfoldertype.h" #include "llviewerwindow.h" @@ -132,6 +134,221 @@ bool LLCanCache::operator()(LLInventoryCategory* cat, LLInventoryItem* item) return rv; } +struct InventoryCallbackInfo +{ + InventoryCallbackInfo(U32 callback, const LLUUID& inv_id) : + mCallback(callback), mInvID(inv_id) {} + U32 mCallback; + LLUUID mInvID; +}; + +///---------------------------------------------------------------------------- +/// Class LLDispatchClassifiedClickThrough +///---------------------------------------------------------------------------- + +class LLDispatchBulkUpdateInventory : public LLDispatchHandler +{ +public: + virtual bool operator()( + const LLDispatcher* dispatcher, + const std::string& key, + const LLUUID& invoice, + const sparam_t& strings) + { + LLSD message; + + // Expect single string parameter in the form of a notation serialized LLSD. + sparam_t::const_iterator it = strings.begin(); + if (it != strings.end()) { + const std::string& llsdRaw = *it++; + std::istringstream llsdData(llsdRaw); + if (!LLSDSerialize::deserialize(message, llsdData, llsdRaw.length())) + { + LL_WARNS() << "LLDispatchBulkUpdateInventory: Attempted to read parameter data into LLSD but failed:" << llsdRaw << LL_ENDL; + } + } + + LLInventoryModel::update_map_t update; + LLInventoryModel::cat_array_t folders; + LLInventoryModel::item_array_t items; + std::list cblist; + uuid_vec_t wearable_ids; + + LLSD item_data = message["item_data"]; + if (item_data.isArray()) + { + for (LLSD::array_iterator itd = item_data.beginArray(); itd != item_data.endArray(); ++itd) + { + const LLSD &item(*itd); + + // Agent id probably should be in the root of the message + LLUUID agent_id = item["agent_id"].asUUID(); + if (agent_id != gAgent.getID()) + { + LL_WARNS() << "Got a BulkUpdateInventory for the wrong agent." << LL_ENDL; + return false; + } + + LLPointer titem = new LLViewerInventoryItem; + titem->unpackMessage(item); + LL_DEBUGS("Inventory") << "unpacked item '" << titem->getName() << "' in " + << titem->getParentUUID() << LL_ENDL; + U32 callback_id = item["callback_id"].asInteger(); + + if (titem->getUUID().notNull()) + { + items.push_back(titem); + cblist.push_back(InventoryCallbackInfo(callback_id, titem->getUUID())); + if (titem->getInventoryType() == LLInventoryType::IT_WEARABLE) + { + wearable_ids.push_back(titem->getUUID()); + } + + // examine update for changes. + LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID()); + if (itemp) + { + if (titem->getParentUUID() == itemp->getParentUUID()) + { + update[titem->getParentUUID()]; + } + else + { + ++update[titem->getParentUUID()]; + --update[itemp->getParentUUID()]; + } + } + else + { + LLViewerInventoryCategory* folderp = gInventory.getCategory(titem->getParentUUID()); + if (folderp) + { + ++update[titem->getParentUUID()]; + } + } + } + else + { + cblist.push_back(InventoryCallbackInfo(callback_id, LLUUID::null)); + } + } + } + + LLSD folder_data = message["folder_data"]; + if (folder_data.isArray()) + { + for (LLSD::array_iterator itd = folder_data.beginArray(); itd != folder_data.endArray(); ++itd) + { + const LLSD &folder(*itd); + + LLPointer tfolder = new LLViewerInventoryCategory(gAgent.getID()); + tfolder->unpackMessage(folder); + + LL_DEBUGS("Inventory") << "unpacked folder '" << tfolder->getName() << "' (" + << tfolder->getUUID() << ") in " << tfolder->getParentUUID() + << LL_ENDL; + + // If the folder is a listing or a version folder, all we need to do is update the SLM data + int depth_folder = depth_nesting_in_marketplace(tfolder->getUUID()); + if ((depth_folder == 1) || (depth_folder == 2)) + { + // Trigger an SLM listing update + LLUUID listing_uuid = (depth_folder == 1 ? tfolder->getUUID() : tfolder->getParentUUID()); + S32 listing_id = LLMarketplaceData::instance().getListingID(listing_uuid); + LLMarketplaceData::instance().getListing(listing_id); + // In that case, there is no item to update so no callback -> we skip the rest of the update + } + else if (tfolder->getUUID().notNull()) + { + folders.push_back(tfolder); + LLViewerInventoryCategory* folderp = gInventory.getCategory(tfolder->getUUID()); + if (folderp) + { + if (tfolder->getParentUUID() == folderp->getParentUUID()) + { + update[tfolder->getParentUUID()]; + } + else + { + ++update[tfolder->getParentUUID()]; + --update[folderp->getParentUUID()]; + } + } + else + { + // we could not find the folder, so it is probably + // new. However, we only want to attempt accounting + // for the parent if we can find the parent. + folderp = gInventory.getCategory(tfolder->getParentUUID()); + if (folderp) + { + ++update[tfolder->getParentUUID()]; + } + } + } + } + } + + gInventory.accountForUpdate(update); + + for (LLInventoryModel::cat_array_t::iterator cit = folders.begin(); cit != folders.end(); ++cit) + { + gInventory.updateCategory(*cit); + } + for (LLInventoryModel::item_array_t::iterator iit = items.begin(); iit != items.end(); ++iit) + { + gInventory.updateItem(*iit); + } + gInventory.notifyObservers(); + + /* + Transaction id not included? + + // The incoming inventory could span more than one BulkInventoryUpdate packet, + // so record the transaction ID for this purchase, then wear all clothing + // that comes in as part of that transaction ID. JC + if (LLInventoryState::sWearNewClothing) + { + LLInventoryState::sWearNewClothingTransactionID = tid; + LLInventoryState::sWearNewClothing = FALSE; + } + + if (tid.notNull() && tid == LLInventoryState::sWearNewClothingTransactionID) + { + count = wearable_ids.size(); + for (i = 0; i < count; ++i) + { + LLViewerInventoryItem* wearable_item; + wearable_item = gInventory.getItem(wearable_ids[i]); + LLAppearanceMgr::instance().wearItemOnAvatar(wearable_item->getUUID(), true, true); + } + } + */ + + if (LLInventoryState::sWearNewClothing && wearable_ids.size() > 0) + { + LLInventoryState::sWearNewClothing = FALSE; + + size_t count = wearable_ids.size(); + for (S32 i = 0; i < count; ++i) + { + LLViewerInventoryItem* wearable_item; + wearable_item = gInventory.getItem(wearable_ids[i]); + LLAppearanceMgr::instance().wearItemOnAvatar(wearable_item->getUUID(), true, true); + } + } + + std::list::iterator inv_it; + for (inv_it = cblist.begin(); inv_it != cblist.end(); ++inv_it) + { + InventoryCallbackInfo cbinfo = (*inv_it); + gInventoryCallbacks.fire(cbinfo.mCallback, cbinfo.mInvID); + } + return true; + } +}; +static LLDispatchBulkUpdateInventory sBulkUpdateInventory; + ///---------------------------------------------------------------------------- /// Class LLInventoryValidationInfo ///---------------------------------------------------------------------------- @@ -2827,6 +3044,11 @@ void LLInventoryModel::initHttpRequest() mHttpHeaders->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_LLSD_XML); mHttpPolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_INVENTORY); } + + if (!gGenericDispatcher.isHandlerPresent("BulkUpdateInventory")) + { + gGenericDispatcher.addHandler("BulkUpdateInventory", &sBulkUpdateInventory); + } } void LLInventoryModel::handleResponses(bool foreground) @@ -3417,14 +3639,6 @@ void LLInventoryModel::processSaveAssetIntoInventory(LLMessageSystem* msg, } } -struct InventoryCallbackInfo -{ - InventoryCallbackInfo(U32 callback, const LLUUID& inv_id) : - mCallback(callback), mInvID(inv_id) {} - U32 mCallback; - LLUUID mInvID; -}; - // static void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) { -- cgit v1.2.3 From 811da7dbb1bdbf04a2dceb02ad4d296db4274076 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 7 Mar 2023 22:39:36 +0200 Subject: SL-18629 WIP Replacing UDP creation messages with callback based AIS #2 findCategory and move_item_to_marketplacelistings --- indra/newview/llinventorymodel.cpp | 107 +++++++++++++++++++++++++++---------- 1 file changed, 78 insertions(+), 29 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index fb19994054..b2cfc8584e 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -804,10 +804,63 @@ void LLInventoryModel::consolidateForType(const LLUUID& main_id, LLFolderType::E } } +void LLInventoryModel::ensureCategoryForTypeExists(LLFolderType::EType preferred_type) +{ + LLUUID rv = LLUUID::null; + LLUUID root_id = gInventory.getRootFolderID(); + if (LLFolderType::FT_ROOT_INVENTORY == preferred_type) + { + rv = root_id; + } + else if (root_id.notNull()) + { + cat_array_t* cats = NULL; + cats = get_ptr_in_map(mParentChildCategoryTree, root_id); + if (cats) + { + S32 count = cats->size(); + for (S32 i = 0; i < count; ++i) + { + LLViewerInventoryCategory* p_cat = cats->at(i); + if (p_cat && p_cat->getPreferredType() == preferred_type) + { + const LLUUID& folder_id = cats->at(i)->getUUID(); + if (rv.isNull() || folder_id < rv) + { + rv = folder_id; + } + } + } + } + } + + if (rv.isNull() && root_id.notNull()) + { + + if (isInventoryUsable()) + { + createNewCategory( + root_id, + preferred_type, + LLStringUtil::null, + [preferred_type](const LLUUID &new_cat_id) + { + LL_DEBUGS("Inventory") << "Created category: " << new_cat_id + << " for type: " << preferred_type << LL_ENDL; + } + ); + } + else + { + LL_WARNS("Inventory") << "Can't create requested folder, type " << preferred_type + << " because inventory is not usable" << LL_ENDL; + } + } +} + const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot( LLFolderType::EType preferred_type, - bool create_folder, - const LLUUID& root_id) + const LLUUID& root_id) const { LLUUID rv = LLUUID::null; if(LLFolderType::FT_ROOT_INVENTORY == preferred_type) @@ -836,18 +889,14 @@ const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot( } } - if(rv.isNull() && create_folder && root_id.notNull()) + if(rv.isNull() && root_id.notNull() && preferred_type != LLFolderType::FT_MARKETPLACE_LISTINGS) { - - if (isInventoryUsable()) - { - return createNewCategory(root_id, preferred_type, LLStringUtil::null); - } - else - { - LL_WARNS("Inventory") << "Can't create requested folder, type " << preferred_type - << " because inventory is not usable" << LL_ENDL; - } + // if it does not exists, it should either be added + // to createCommonSystemCategories or server should + // have set it + llassert(false); + LL_WARNS("Inventory") << "Tried to find folder, type " << preferred_type + << " but category does not exist" << LL_ENDL; } return rv; } @@ -856,12 +905,12 @@ const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot( // specifies 'type' as what it defaults to containing. The category is // not necessarily only for that type. *NOTE: This will create a new // inventory category on the fly if one does not exist. -const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType preferred_type, bool create_folder) +const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType preferred_type) const { - return findCategoryUUIDForTypeInRoot(preferred_type, create_folder, gInventory.getRootFolderID()); + return findCategoryUUIDForTypeInRoot(preferred_type, gInventory.getRootFolderID()); } -const LLUUID LLInventoryModel::findUserDefinedCategoryUUIDForType(LLFolderType::EType preferred_type) +const LLUUID LLInventoryModel::findUserDefinedCategoryUUIDForType(LLFolderType::EType preferred_type) const { LLUUID cat_id; switch (preferred_type) @@ -892,14 +941,14 @@ const LLUUID LLInventoryModel::findUserDefinedCategoryUUIDForType(LLFolderType:: if (cat_id.isNull() || !getCategory(cat_id)) { - cat_id = findCategoryUUIDForTypeInRoot(preferred_type, true, getRootFolderID()); + cat_id = findCategoryUUIDForTypeInRoot(preferred_type, getRootFolderID()); } return cat_id; } -const LLUUID LLInventoryModel::findLibraryCategoryUUIDForType(LLFolderType::EType preferred_type, bool create_folder) +const LLUUID LLInventoryModel::findLibraryCategoryUUIDForType(LLFolderType::EType preferred_type) const { - return findCategoryUUIDForTypeInRoot(preferred_type, create_folder, gInventory.getLibraryRootFolderID()); + return findCategoryUUIDForTypeInRoot(preferred_type, gInventory.getLibraryRootFolderID()); } // Convenience function to create a new category. You could call @@ -1556,7 +1605,7 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat, U32 mask |= LLInventoryObserver::LABEL; } // Under marketplace, category labels are quite complex and need extra upate - const LLUUID marketplace_id = findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + const LLUUID marketplace_id = findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); if (marketplace_id.notNull() && isObjectDescendentOf(cat->getUUID(), marketplace_id)) { mask |= LLInventoryObserver::LABEL; @@ -2881,7 +2930,7 @@ void LLInventoryModel::buildParentChildMap() } } - const BOOL COF_exists = (findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, FALSE) != LLUUID::null); + const BOOL COF_exists = (findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT) != LLUUID::null); sFirstTimeInViewer2 = !COF_exists || gAgent.isFirstLogin(); @@ -3101,14 +3150,14 @@ LLCore::HttpHandle LLInventoryModel::requestPost(bool foreground, void LLInventoryModel::createCommonSystemCategories() { - gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH,true); - gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE,true); - gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD,true); - gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS,true); - gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, true); - gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK, true); // folder should exist before user tries to 'landmark this' - gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS, true); - gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX, true); + gInventory.ensureCategoryForTypeExists(LLFolderType::FT_TRASH); + gInventory.ensureCategoryForTypeExists(LLFolderType::FT_FAVORITE); + gInventory.ensureCategoryForTypeExists(LLFolderType::FT_CALLINGCARD); + gInventory.ensureCategoryForTypeExists(LLFolderType::FT_MY_OUTFITS); + gInventory.ensureCategoryForTypeExists(LLFolderType::FT_CURRENT_OUTFIT); + gInventory.ensureCategoryForTypeExists(LLFolderType::FT_LANDMARK); // folder should exist before user tries to 'landmark this' + gInventory.ensureCategoryForTypeExists(LLFolderType::FT_SETTINGS); + gInventory.ensureCategoryForTypeExists(LLFolderType::FT_INBOX); } struct LLUUIDAndName -- cgit v1.2.3 From ff6ff01c6a3822c8160279fecd3c3f2e636c4349 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 10 Mar 2023 00:12:16 +0200 Subject: SL-18629 Replacing UDP creation messages with callback based AIS --- indra/newview/llinventorymodel.cpp | 110 +++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 59 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index b2cfc8584e..774ed051c0 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -954,27 +954,23 @@ const LLUUID LLInventoryModel::findLibraryCategoryUUIDForType(LLFolderType::ETyp // Convenience function to create a new category. You could call // updateCategory() with a newly generated UUID category, but this // version will take care of details like what the name should be -// based on preferred type. Returns the UUID of the new category. -// -// On failure, returns a null UUID. -// FIXME: callers do not check for or handle a null results currently. -LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, +// based on preferred type. +void LLInventoryModel::createNewCategory(const LLUUID& parent_id, LLFolderType::EType preferred_type, const std::string& pname, inventory_func_type callback) { - LLUUID id; // Initially null. if (!isInventoryUsable()) { LL_WARNS(LOG_INV) << "Inventory is not usable; can't create requested category of type " << preferred_type << LL_ENDL; - return id; + return; } if(LLFolderType::lookup(preferred_type) == LLFolderType::badLookup()) { LL_DEBUGS(LOG_INV) << "Attempt to create undefined category." << LL_ENDL; - return id; + return; } if (preferred_type != LLFolderType::FT_NONE) @@ -990,24 +986,53 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, { name.assign(LLViewerFolderType::lookupNewCategoryName(preferred_type)); } - + #ifdef USE_AIS_FOR_NC - // D567 currently this doesn't really work due to limitations in - // AIS3, also violates the common caller assumption that we can - // assign the id and return immediately. - if (callback) + // D567 currently this doesn't really work due to limitations in + // AIS3, also violates the common caller assumption that we can + // assign the id and return immediately. + if (callback && AISAPI::isAvailable()) { - // D567 note that we no longer assign the UUID in the viewer, so various workflows need to change. LLSD new_inventory = LLSD::emptyMap(); new_inventory["categories"] = LLSD::emptyArray(); LLViewerInventoryCategory cat(LLUUID::null, parent_id, preferred_type, name, gAgent.getID()); LLSD cat_sd = cat.asLLSD(); new_inventory["categories"].append(cat_sd); - AISAPI::CreateInventory(parent_id, new_inventory, callback); + AISAPI::CreateInventory( + parent_id, + new_inventory, + [this, callback, parent_id, preferred_type, name] (const LLUUID& new_category) + { + if (new_category.isNull()) + { + callback(new_category); + return; + } + + LLViewerInventoryCategory* folderp = gInventory.getCategory(new_category); + if (!folderp) + { + // Add the category to the internal representation + LLPointer cat = new LLViewerInventoryCategory( + new_category, + parent_id, + preferred_type, + name, + gAgent.getID()); + + LLInventoryModel::LLCategoryUpdate update(cat->getParentUUID(), 1); + accountForUpdate(update); + + cat->setVersion(LLViewerInventoryCategory::VERSION_INITIAL - 1); // accountForUpdate() will icrease version by 1 + cat->setDescendentCount(0); + updateCategory(cat); + } - return LLUUID::null; + callback(new_category); + }); + return; } -#else +#endif LLViewerRegion* viewer_region = gAgent.getRegion(); std::string url; if ( viewer_region ) @@ -1016,7 +1041,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, if (!url.empty() && callback) { //Let's use the new capability. - + LLUUID id; id.generate(); LLSD request, body; body["folder_id"] = id; @@ -1030,48 +1055,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, LL_DEBUGS(LOG_INV) << "Creating category via request: " << ll_pretty_print_sd(request) << LL_ENDL; LLCoros::instance().launch("LLInventoryModel::createNewCategoryCoro", boost::bind(&LLInventoryModel::createNewCategoryCoro, this, url, body, callback)); - - return LLUUID::null; } -#endif - - - if (!gMessageSystem) - { - return LLUUID::null; - } - - // D567 FIXME this UDP code path needs to be removed. Requires - // reworking many of the callers to use callbacks rather than - // assuming instant success. - - // Add the category to the internal representation - LL_WARNS() << "D567 need to remove this usage" << LL_ENDL; - - id.generate(); - LLPointer cat = - new LLViewerInventoryCategory(id, parent_id, preferred_type, name, gAgent.getID()); - cat->setVersion(LLViewerInventoryCategory::VERSION_INITIAL - 1); // accountForUpdate() will icrease version by 1 - cat->setDescendentCount(0); - LLCategoryUpdate update(cat->getParentUUID(), 1); - accountForUpdate(update); - updateCategory(cat); - - LL_DEBUGS(LOG_INV) << "Creating category via UDP message CreateInventoryFolder, type " << preferred_type << LL_ENDL; - - // Create the category on the server. We do this to prevent people - // from munging their protected folders. - LLMessageSystem* msg = gMessageSystem; - msg->newMessage("CreateInventoryFolder"); - msg->nextBlock("AgentData"); - msg->addUUID("AgentID", gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlock("FolderData"); - cat->packMessage(msg); - gAgent.sendReliableMessage(); - - // return the folder id of the newly created folder - return id; } void LLInventoryModel::createNewCategoryCoro(std::string url, LLSD postData, inventory_func_type callback) @@ -1095,12 +1079,20 @@ void LLInventoryModel::createNewCategoryCoro(std::string url, LLSD postData, inv if (!status) { LL_WARNS() << "HTTP failure attempting to create category." << LL_ENDL; + if (callback) + { + callback(LLUUID::null); + } return; } if (!result.has("folder_id")) { LL_WARNS() << "Malformed response contents" << ll_pretty_print_sd(result) << LL_ENDL; + if (callback) + { + callback(LLUUID::null); + } return; } -- cgit v1.2.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/newview/llinventorymodel.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llinventorymodel.cpp') 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.2.3 From cd61492723866ae9a268820d643976693f42b02a Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 13 Mar 2023 15:36:50 +0200 Subject: SL-19109 Fix item updates not getting a callback #2 --- indra/newview/llinventorymodel.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index bfff876c96..ee0dd2422a 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -965,12 +965,20 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, { LL_WARNS(LOG_INV) << "Inventory is not usable; can't create requested category of type " << preferred_type << LL_ENDL; + if (callback) + { + callback(LLUUID::null); + } return; } if(LLFolderType::lookup(preferred_type) == LLFolderType::badLookup()) { LL_DEBUGS(LOG_INV) << "Attempt to create undefined category." << LL_ENDL; + if (callback) + { + callback(LLUUID::null); + } return; } @@ -992,7 +1000,7 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, // D567 currently this doesn't really work due to limitations in // AIS3, also violates the common caller assumption that we can // assign the id and return immediately. - if (callback && AISAPI::isAvailable()) + if (AISAPI::isAvailable()) { LLSD new_inventory = LLSD::emptyMap(); new_inventory["categories"] = LLSD::emptyArray(); @@ -1006,7 +1014,10 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, { if (new_category.isNull()) { - callback(new_category); + if (callback) + { + callback(new_category); + } return; } @@ -1029,7 +1040,10 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, updateCategory(cat); } - callback(new_category); + if (callback) + { + callback(new_category); + } }); return; } @@ -1039,7 +1053,7 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, if ( viewer_region ) url = viewer_region->getCapability("CreateInventoryCategory"); - if (!url.empty() && callback) + if (!url.empty()) { //Let's use the new capability. LLUUID id; @@ -1056,7 +1070,13 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, LL_DEBUGS(LOG_INV) << "Creating category via request: " << ll_pretty_print_sd(request) << LL_ENDL; LLCoros::instance().launch("LLInventoryModel::createNewCategoryCoro", boost::bind(&LLInventoryModel::createNewCategoryCoro, this, url, body, callback)); + return; } + + if (callback) + { + callback(LLUUID::null); // Notify about failure + } } void LLInventoryModel::createNewCategoryCoro(std::string url, LLSD postData, inventory_func_type callback) -- cgit v1.2.3 From ac145cb21f382b8eab9f770cecfa23ea9d58aac6 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 14 Mar 2023 23:21:26 +0200 Subject: SL-18629 WIP Fetch Inventory using AIS caps --- indra/newview/llinventorymodel.cpp | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index ee0dd2422a..65690228e7 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1754,19 +1754,6 @@ void LLInventoryModel::changeCategoryParent(LLViewerInventoryCategory* cat, notifyObservers(); } -void LLInventoryModel::onAISUpdateReceived(const std::string& context, const LLSD& update) -{ - LLTimer timer; - if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) - { - dump_sequential_xml(gAgentAvatarp->getFullname() + "_ais_update", update); - } - - AISUpdate ais_update(update); // parse update llsd into stuff to do. - ais_update.doUpdate(); // execute the updates in the appropriate order. - LL_INFOS(LOG_INV) << "elapsed: " << timer.getElapsedTimeF32() << LL_ENDL; -} - // Does not appear to be used currently. void LLInventoryModel::onItemUpdated(const LLUUID& item_id, const LLSD& updates, bool update_parent_version) { -- cgit v1.2.3 From 4f9f149939cfd79ba6d18ed90202b29225c2969c Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 17 Mar 2023 22:42:14 +0200 Subject: SL-18629 Try fetching inventory on BulkUpdateInventory to get missing data --- indra/newview/llinventorymodel.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 65690228e7..43bfaf454c 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -3811,10 +3811,20 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) for (cat_array_t::iterator cit = folders.begin(); cit != folders.end(); ++cit) { gInventory.updateCategory(*cit); + + // Temporary workaround: just fetch the item using AIS to get missing fields. + // If this works fine we might want to extract ids only from the message + // then use AIS as a primary fetcher + AISAPI::FetchCategoryChildren((*cit)->getUUID(), AISAPI::INVENTORY, false); } for (item_array_t::iterator iit = items.begin(); iit != items.end(); ++iit) { gInventory.updateItem(*iit); + + // Temporary workaround: just fetch the item using AIS to get missing fields. + // If this works fine we might want to extract ids only from the message + // then use AIS as a primary fetcher + AISAPI::FetchItem((*iit)->getUUID(), AISAPI::INVENTORY, false); } gInventory.notifyObservers(); -- cgit v1.2.3 From f98c1403fb47990181c504acfbf5d35a393225b7 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 18 Mar 2023 01:15:27 +0200 Subject: SL-18674 Reenable folder creation via AIS v3 Add item fetching via AIS v3 --- indra/newview/llinventorymodel.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 43bfaf454c..52121d644f 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -996,7 +996,6 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, name.assign(LLViewerFolderType::lookupNewCategoryName(preferred_type)); } -#ifdef USE_AIS_FOR_NC // D567 currently this doesn't really work due to limitations in // AIS3, also violates the common caller assumption that we can // assign the id and return immediately. @@ -1047,7 +1046,7 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, }); return; } -#endif + LLViewerRegion* viewer_region = gAgent.getRegion(); std::string url; if ( viewer_region ) -- cgit v1.2.3 From 0a2a1b35649ff405bdccf9e499609af435528300 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 18 Mar 2023 01:15:27 +0200 Subject: SL-18674 Cleanup --- indra/newview/llinventorymodel.cpp | 66 -------------------------------------- 1 file changed, 66 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 52121d644f..a6f56c3a9c 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -996,9 +996,6 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, name.assign(LLViewerFolderType::lookupNewCategoryName(preferred_type)); } - // D567 currently this doesn't really work due to limitations in - // AIS3, also violates the common caller assumption that we can - // assign the id and return immediately. if (AISAPI::isAvailable()) { LLSD new_inventory = LLSD::emptyMap(); @@ -3380,9 +3377,6 @@ void LLInventoryModel::registerCallbacks(LLMessageSystem* msg) msg->setHandlerFuncFast(_PREHASH_RemoveInventoryItem, processRemoveInventoryItem, NULL); - msg->setHandlerFuncFast(_PREHASH_UpdateInventoryFolder, - processUpdateInventoryFolder, - NULL); msg->setHandlerFuncFast(_PREHASH_RemoveInventoryFolder, processRemoveInventoryFolder, NULL); @@ -3525,66 +3519,6 @@ void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**) gInventory.notifyObservers(); } -// static -void LLInventoryModel::processUpdateInventoryFolder(LLMessageSystem* msg, - void**) -{ - LL_DEBUGS(LOG_INV) << "LLInventoryModel::processUpdateInventoryFolder()" << LL_ENDL; - LLUUID agent_id, folder_id, parent_id; - //char name[DB_INV_ITEM_NAME_BUF_SIZE]; - msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_AgentID, agent_id); - if(agent_id != gAgent.getID()) - { - LL_WARNS(LOG_INV) << "Got an UpdateInventoryFolder for the wrong agent." - << LL_ENDL; - return; - } - LLPointer lastfolder; // hack - cat_array_t folders; - update_map_t update; - S32 count = msg->getNumberOfBlocksFast(_PREHASH_FolderData); - for(S32 i = 0; i < count; ++i) - { - LLPointer tfolder = new LLViewerInventoryCategory(gAgent.getID()); - lastfolder = tfolder; - tfolder->unpackMessage(msg, _PREHASH_FolderData, i); - // make sure it's not a protected folder - tfolder->setPreferredType(LLFolderType::FT_NONE); - folders.push_back(tfolder); - // examine update for changes. - LLViewerInventoryCategory* folderp = gInventory.getCategory(tfolder->getUUID()); - if(folderp) - { - if(tfolder->getParentUUID() == folderp->getParentUUID()) - { - update[tfolder->getParentUUID()]; - } - else - { - ++update[tfolder->getParentUUID()]; - --update[folderp->getParentUUID()]; - } - } - else - { - ++update[tfolder->getParentUUID()]; - } - } - gInventory.accountForUpdate(update); - for (cat_array_t::iterator it = folders.begin(); it != folders.end(); ++it) - { - gInventory.updateCategory(*it); - } - gInventory.notifyObservers(); - - // *HACK: Do the 'show' logic for a new item in the inventory. - LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(); - if (active_panel) - { - active_panel->setSelection(lastfolder->getUUID(), TAKE_FOCUS_NO); - } -} - // static void LLInventoryModel::removeInventoryFolder(LLUUID agent_id, LLMessageSystem* msg) -- cgit v1.2.3 From 7dad882c2f43b53c1618a4b140bd0b35be6fa106 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 18 Mar 2023 03:05:08 +0200 Subject: SL-18629 MAC build fix --- indra/newview/llinventorymodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index a6f56c3a9c..c54a59d12f 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -3748,7 +3748,7 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) // Temporary workaround: just fetch the item using AIS to get missing fields. // If this works fine we might want to extract ids only from the message // then use AIS as a primary fetcher - AISAPI::FetchCategoryChildren((*cit)->getUUID(), AISAPI::INVENTORY, false); + AISAPI::FetchCategoryChildren((*cit)->getUUID(), AISAPI::INVENTORY); } for (item_array_t::iterator iit = items.begin(); iit != items.end(); ++iit) { @@ -3757,7 +3757,7 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) // Temporary workaround: just fetch the item using AIS to get missing fields. // If this works fine we might want to extract ids only from the message // then use AIS as a primary fetcher - AISAPI::FetchItem((*iit)->getUUID(), AISAPI::INVENTORY, false); + AISAPI::FetchItem((*iit)->getUUID(), AISAPI::INVENTORY); } gInventory.notifyObservers(); -- cgit v1.2.3 From 72131418aa943b93f61508993d7006b02ebd9c35 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sun, 19 Mar 2023 16:11:21 +0200 Subject: SL-18629 Rebuild brocken link on fetch compeltion. --- indra/newview/llinventorymodel.cpp | 47 +++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index c54a59d12f..b82f0c3ede 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -41,6 +41,7 @@ #include "llinventorypanel.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" +#include "llinventorymodelbackgroundfetch.h" #include "llinventoryobserver.h" #include "llinventorypanel.h" #include "llfloaterpreviewtrash.h" @@ -439,6 +440,7 @@ LLInventoryModel::LLInventoryModel() mIsNotifyObservers(FALSE), mModifyMask(LLInventoryObserver::ALL), mChangedItemIDs(), + mBulckFecthCallbackSlot(), mObservers(), mHttpRequestFG(NULL), mHttpRequestBG(NULL), @@ -470,6 +472,11 @@ void LLInventoryModel::cleanupInventory() mObservers.erase(iter); delete observer; } + + if (mBulckFecthCallbackSlot.connected()) + { + mBulckFecthCallbackSlot.disconnect(); + } mObservers.clear(); // Run down HTTP transport @@ -1750,6 +1757,15 @@ void LLInventoryModel::changeCategoryParent(LLViewerInventoryCategory* cat, notifyObservers(); } +void LLInventoryModel::rebuildBrockenLinks() +{ + for (LLUUID link_id : mPossiblyBrockenLinks) + { + addChangedMask(LLInventoryObserver::REBUILD, link_id); + } + mPossiblyBrockenLinks.clear(); +} + // Does not appear to be used currently. void LLInventoryModel::onItemUpdated(const LLUUID& item_id, const LLSD& updates, bool update_parent_version) { @@ -2368,9 +2384,34 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item) // The item will show up as a broken link. if (item->getIsBrokenLink()) { - LL_INFOS(LOG_INV) << "Adding broken link [ name: " << item->getName() - << " itemID: " << item->getUUID() - << " assetID: " << item->getAssetUUID() << " ) parent: " << item->getParentUUID() << LL_ENDL; + if (!LLInventoryModelBackgroundFetch::getInstance()->isEverythingFetched()) + { + // isEverythingFetched is actually 'initial' fetch only. + // Schedule this link for a recheck once inventory gets loaded + mPossiblyBrockenLinks.insert(item->getUUID()); + if (!mBulckFecthCallbackSlot.connected()) + { + // Links might take a while to update this way, and there + // might be a lot of them. A better option might be to check + // links periodically with final check on fetch completion. + mBulckFecthCallbackSlot = + LLInventoryModelBackgroundFetch::getInstance()->setAllFoldersFetchedCallback( + []() + { + gInventory.rebuildBrockenLinks(); + }); + } + LL_DEBUGS(LOG_INV) << "Scheduling a link to be rebuilt later [ name: " << item->getName() + << " itemID: " << item->getUUID() + << " assetID: " << item->getAssetUUID() << " ) parent: " << item->getParentUUID() << LL_ENDL; + + } + else + { + LL_INFOS(LOG_INV) << "Adding broken link [ name: " << item->getName() + << " itemID: " << item->getUUID() + << " assetID: " << item->getAssetUUID() << " ) parent: " << item->getParentUUID() << LL_ENDL; + } } if (item->getIsLinkType()) { -- cgit v1.2.3 From b68a67491026a055f0de9df349508b9e60a200ed Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 20 Mar 2023 22:06:20 +0200 Subject: SL-18629 Load cof only once links are ready --- indra/newview/llinventorymodel.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index b82f0c3ede..b833571ee9 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -440,7 +440,7 @@ LLInventoryModel::LLInventoryModel() mIsNotifyObservers(FALSE), mModifyMask(LLInventoryObserver::ALL), mChangedItemIDs(), - mBulckFecthCallbackSlot(), + mBulkFecthCallbackSlot(), mObservers(), mHttpRequestFG(NULL), mHttpRequestBG(NULL), @@ -473,9 +473,9 @@ void LLInventoryModel::cleanupInventory() delete observer; } - if (mBulckFecthCallbackSlot.connected()) + if (mBulkFecthCallbackSlot.connected()) { - mBulckFecthCallbackSlot.disconnect(); + mBulkFecthCallbackSlot.disconnect(); } mObservers.clear(); @@ -1764,6 +1764,7 @@ void LLInventoryModel::rebuildBrockenLinks() addChangedMask(LLInventoryObserver::REBUILD, link_id); } mPossiblyBrockenLinks.clear(); + notifyObservers(); } // Does not appear to be used currently. @@ -2389,16 +2390,17 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item) // isEverythingFetched is actually 'initial' fetch only. // Schedule this link for a recheck once inventory gets loaded mPossiblyBrockenLinks.insert(item->getUUID()); - if (!mBulckFecthCallbackSlot.connected()) + if (!mBulkFecthCallbackSlot.connected()) { // Links might take a while to update this way, and there // might be a lot of them. A better option might be to check // links periodically with final check on fetch completion. - mBulckFecthCallbackSlot = + mBulkFecthCallbackSlot = LLInventoryModelBackgroundFetch::getInstance()->setAllFoldersFetchedCallback( - []() + [this]() { - gInventory.rebuildBrockenLinks(); + rebuildBrockenLinks(); + mBulkFecthCallbackSlot.disconnect(); }); } LL_DEBUGS(LOG_INV) << "Scheduling a link to be rebuilt later [ name: " << item->getName() -- cgit v1.2.3 From 04501955c7d0cd19d13ac1374f6f06e944f6ea61 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 23 Mar 2023 21:13:30 +0200 Subject: SL-19108 Disable "Image" button for task inventories Thumbnails are not supported for task inventories yet --- indra/newview/llinventorymodel.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index b833571ee9..6d9142cc5c 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -3448,6 +3448,10 @@ void LLInventoryModel::processUpdateCreateInventoryItem(LLMessageSystem* msg, vo msg->getU32Fast(_PREHASH_InventoryData, _PREHASH_CallbackID, callback_id); gInventoryCallbacks.fire(callback_id, item_id); + + // todo: instead of unpacking message fully, + // grab only an item_id, then fetch via AIS + AISAPI::FetchItem(item_id, AISAPI::INVENTORY); } } -- cgit v1.2.3 From 6826ed7167e15f05e721e6aa9ade3c655991ccee Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 24 Mar 2023 00:08:46 +0200 Subject: SL-19445 Increment inventory cache version for Inventory thumbnails Inventory thumbnails appear as lost when moving between non thumbnail and thumbnail viewers. Release viewer doesn't know to cache thumbnails, thumbnail viewer loads release's cache and finds no thumbnails, but version control appears to be valid so viewer thinks there is nothing to download. --- indra/newview/llinventorymodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 6d9142cc5c..56f0a68f70 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -76,7 +76,7 @@ // Increment this if the inventory contents change in a non-backwards-compatible way. // For viewer 2, the addition of link items makes a pre-viewer-2 cache incorrect. -const S32 LLInventoryModel::sCurrentInvCacheVersion = 2; +const S32 LLInventoryModel::sCurrentInvCacheVersion = 3; BOOL LLInventoryModel::sFirstTimeInViewer2 = TRUE; ///---------------------------------------------------------------------------- -- cgit v1.2.3 From 9fa64f1e2087a8e45adad7298d2dd3661bd80e25 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 24 Mar 2023 18:03:09 +0200 Subject: SL-18003 Fix items not being marked as complete when fetched via ais --- indra/newview/llinventorymodel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 56f0a68f70..4c2383d211 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -3451,7 +3451,7 @@ void LLInventoryModel::processUpdateCreateInventoryItem(LLMessageSystem* msg, vo // todo: instead of unpacking message fully, // grab only an item_id, then fetch via AIS - AISAPI::FetchItem(item_id, AISAPI::INVENTORY); + LLInventoryModelBackgroundFetch::instance().start(item_id, false); } } @@ -3795,7 +3795,7 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) // Temporary workaround: just fetch the item using AIS to get missing fields. // If this works fine we might want to extract ids only from the message // then use AIS as a primary fetcher - AISAPI::FetchCategoryChildren((*cit)->getUUID(), AISAPI::INVENTORY); + LLInventoryModelBackgroundFetch::instance().start((*cit)->getUUID(), false); } for (item_array_t::iterator iit = items.begin(); iit != items.end(); ++iit) { @@ -3804,7 +3804,7 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) // Temporary workaround: just fetch the item using AIS to get missing fields. // If this works fine we might want to extract ids only from the message // then use AIS as a primary fetcher - AISAPI::FetchItem((*iit)->getUUID(), AISAPI::INVENTORY); + LLInventoryModelBackgroundFetch::instance().start((*iit)->getUUID(), false); } gInventory.notifyObservers(); -- cgit v1.2.3 From 110ed8f4d3152c91ddd7577234ad37b666be86c9 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 28 Mar 2023 00:53:35 +0300 Subject: SL-18003 Don't cause excessive full rebuild --- indra/newview/llinventorymodel.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 4c2383d211..47fd17ef86 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1759,6 +1759,9 @@ void LLInventoryModel::changeCategoryParent(LLViewerInventoryCategory* cat, void LLInventoryModel::rebuildBrockenLinks() { + // make sure we aren't adding expensive Rebuild to anything else. + notifyObservers(); + for (LLUUID link_id : mPossiblyBrockenLinks) { addChangedMask(LLInventoryObserver::REBUILD, link_id); -- cgit v1.2.3 From 89a8c96f36983738645a2116d9d432e3bd88f1df Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 28 Mar 2023 02:27:34 +0300 Subject: SL-18003 Bulk download items when possible And signal fodler fetch completion when folder of recursive fetch is done, do not hold it for individual items --- indra/newview/llinventorymodel.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 47fd17ef86..bfc7840708 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1762,7 +1762,7 @@ void LLInventoryModel::rebuildBrockenLinks() // make sure we aren't adding expensive Rebuild to anything else. notifyObservers(); - for (LLUUID link_id : mPossiblyBrockenLinks) + for (const LLUUID &link_id : mPossiblyBrockenLinks) { addChangedMask(LLInventoryObserver::REBUILD, link_id); } @@ -2388,7 +2388,7 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item) // The item will show up as a broken link. if (item->getIsBrokenLink()) { - if (!LLInventoryModelBackgroundFetch::getInstance()->isEverythingFetched()) + if (LLInventoryModelBackgroundFetch::getInstance()->folderFetchActive()) { // isEverythingFetched is actually 'initial' fetch only. // Schedule this link for a recheck once inventory gets loaded @@ -2399,7 +2399,7 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item) // might be a lot of them. A better option might be to check // links periodically with final check on fetch completion. mBulkFecthCallbackSlot = - LLInventoryModelBackgroundFetch::getInstance()->setAllFoldersFetchedCallback( + LLInventoryModelBackgroundFetch::getInstance()->setFetchCompletionCallback( [this]() { rebuildBrockenLinks(); @@ -3798,7 +3798,10 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) // Temporary workaround: just fetch the item using AIS to get missing fields. // If this works fine we might want to extract ids only from the message // then use AIS as a primary fetcher - LLInventoryModelBackgroundFetch::instance().start((*cit)->getUUID(), false); + + // Use AIS derectly to not reset folder's version + // Todo: May be LLInventoryModelBackgroundFetch needs a 'forced' option + AISAPI::FetchCategoryChildren((*cit)->getUUID(), AISAPI::INVENTORY); } for (item_array_t::iterator iit = items.begin(); iit != items.end(); ++iit) { @@ -3807,7 +3810,7 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) // Temporary workaround: just fetch the item using AIS to get missing fields. // If this works fine we might want to extract ids only from the message // then use AIS as a primary fetcher - LLInventoryModelBackgroundFetch::instance().start((*iit)->getUUID(), false); + LLInventoryModelBackgroundFetch::instance().scheduleItemFetch((*iit)->getUUID()); } gInventory.notifyObservers(); -- cgit v1.2.3 From 3bf9c78f564f0b6c4fd79163bd63c0a6c1fab7cb Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 28 Mar 2023 19:38:26 +0300 Subject: SL-18003 Improve dupplicate prevention Try getting lost and found --- indra/newview/llinventorymodel.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index bfc7840708..9a874350bf 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -3453,8 +3453,8 @@ void LLInventoryModel::processUpdateCreateInventoryItem(LLMessageSystem* msg, vo gInventoryCallbacks.fire(callback_id, item_id); // todo: instead of unpacking message fully, - // grab only an item_id, then fetch via AIS - LLInventoryModelBackgroundFetch::instance().start(item_id, false); + // grab only an item_id, then fetch + LLInventoryModelBackgroundFetch::instance().scheduleItemFetch(item_id, true); } } @@ -3798,10 +3798,7 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) // Temporary workaround: just fetch the item using AIS to get missing fields. // If this works fine we might want to extract ids only from the message // then use AIS as a primary fetcher - - // Use AIS derectly to not reset folder's version - // Todo: May be LLInventoryModelBackgroundFetch needs a 'forced' option - AISAPI::FetchCategoryChildren((*cit)->getUUID(), AISAPI::INVENTORY); + LLInventoryModelBackgroundFetch::instance().scheduleFolderFetch((*cit)->getUUID(), true /*force, since it has changes*/); } for (item_array_t::iterator iit = items.begin(); iit != items.end(); ++iit) { @@ -3810,7 +3807,7 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) // Temporary workaround: just fetch the item using AIS to get missing fields. // If this works fine we might want to extract ids only from the message // then use AIS as a primary fetcher - LLInventoryModelBackgroundFetch::instance().scheduleItemFetch((*iit)->getUUID()); + LLInventoryModelBackgroundFetch::instance().scheduleItemFetch((*iit)->getUUID(), true); } gInventory.notifyObservers(); -- cgit v1.2.3 From 11b2f138cecc123c3e6876b56ea63c5fbd734d56 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 29 Mar 2023 04:28:07 +0300 Subject: SL-19502 Copying folders should copy thumbnails --- indra/newview/llinventorymodel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 9a874350bf..70ff07c0c2 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -966,7 +966,8 @@ const LLUUID LLInventoryModel::findLibraryCategoryUUIDForType(LLFolderType::ETyp void LLInventoryModel::createNewCategory(const LLUUID& parent_id, LLFolderType::EType preferred_type, const std::string& pname, - inventory_func_type callback) + inventory_func_type callback, + const LLUUID& thumbnail_id) { if (!isInventoryUsable()) { @@ -1008,6 +1009,7 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, LLSD new_inventory = LLSD::emptyMap(); 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(); new_inventory["categories"].append(cat_sd); AISAPI::CreateInventory( -- cgit v1.2.3 From a2ef7c807659046d7201487029a969d396eea89d Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 31 Mar 2023 01:19:58 +0300 Subject: SL-18672 Update handling of login skeleton to handle new fields --- indra/newview/llinventorymodel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 360cc44d48..80f16a854b 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -2600,6 +2600,12 @@ 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()) -- cgit v1.2.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/newview/llinventorymodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llinventorymodel.cpp') 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.2.3 From 53f2e1710aab77361085fe2c2a41fea87ede0fb8 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 13 Apr 2023 02:20:33 +0300 Subject: SL-19533 Faster declouding --- indra/newview/llinventorymodel.cpp | 50 +++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 6 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 4bca2ce650..32acd0eb03 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1764,11 +1764,19 @@ void LLInventoryModel::rebuildBrockenLinks() // make sure we aren't adding expensive Rebuild to anything else. notifyObservers(); - for (const LLUUID &link_id : mPossiblyBrockenLinks) + for (const broken_links_t::value_type &link_list : mPossiblyBrockenLinks) { - addChangedMask(LLInventoryObserver::REBUILD, link_id); + for (const LLUUID& link_id : link_list.second) + { + addChangedMask(LLInventoryObserver::REBUILD , link_id); + } + } + for (const LLUUID& link_id : mLinksRebuildList) + { + addChangedMask(LLInventoryObserver::REBUILD , link_id); } mPossiblyBrockenLinks.clear(); + mLinksRebuildList.clear(); notifyObservers(); } @@ -2075,6 +2083,20 @@ void LLInventoryModel::idleNotifyObservers() { // *FIX: Think I want this conditional or moved elsewhere... handleResponses(true); + + if (mLinksRebuildList.size() > 0) + { + if (mModifyMask != LLInventoryObserver::NONE || (mChangedItemIDs.size() != 0)) + { + notifyObservers(); + } + for (const LLUUID& link_id : mLinksRebuildList) + { + addChangedMask(LLInventoryObserver::REBUILD , link_id); + } + mLinksRebuildList.clear(); + notifyObservers(); + } if (mModifyMask == LLInventoryObserver::NONE && (mChangedItemIDs.size() == 0)) { @@ -2394,11 +2416,14 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item) // The item will show up as a broken link. if (item->getIsBrokenLink()) { - if (LLInventoryModelBackgroundFetch::getInstance()->folderFetchActive()) + if (item->getAssetUUID().notNull() + && LLInventoryModelBackgroundFetch::getInstance()->folderFetchActive()) { - // isEverythingFetched is actually 'initial' fetch only. - // Schedule this link for a recheck once inventory gets loaded - mPossiblyBrockenLinks.insert(item->getUUID()); + // Schedule this link for a recheck as inventory gets loaded + // Todo: expand to cover not just an initial fetch + mPossiblyBrockenLinks[item->getAssetUUID()].insert(item->getUUID()); + + // Do a blank rebuild of links once fetch is done if (!mBulkFecthCallbackSlot.connected()) { // Links might take a while to update this way, and there @@ -2408,6 +2433,9 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item) LLInventoryModelBackgroundFetch::getInstance()->setFetchCompletionCallback( [this]() { + // rebuild is just in case, primary purpose is to wipe + // the list since we won't be getting anything 'new' + // see mLinksRebuildList rebuildBrockenLinks(); mBulkFecthCallbackSlot.disconnect(); }); @@ -2424,6 +2452,16 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item) << " assetID: " << item->getAssetUUID() << " ) parent: " << item->getParentUUID() << LL_ENDL; } } + if (!mPossiblyBrockenLinks.empty()) + { + // check if we are waiting for this item + broken_links_t::iterator iter = mPossiblyBrockenLinks.find(item->getUUID()); + if (iter != mPossiblyBrockenLinks.end()) + { + mLinksRebuildList.insert(iter->second.begin() , iter->second.end()); + mPossiblyBrockenLinks.erase(iter); + } + } if (item->getIsLinkType()) { // Add back-link from linked-to UUID. -- cgit v1.2.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/newview/llinventorymodel.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') 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.2.3 From c008d3e030ca4019e24de9a4831dc36727555fd2 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 25 Apr 2023 12:25:15 +0300 Subject: SL-19533 Reduce inventory fetch stalls --- indra/newview/llinventorymodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 873d3e1ccf..48539f4748 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -4681,7 +4681,6 @@ LLPointer LLInventoryModel::validate() const } else if (count_under_root > 1) { - LL_WARNS("Inventory") << "Fatal inventory corruption: system folder type has excess copies under root, type " << ft << " count " << count_under_root << LL_ENDL; validation_info->mDuplicateRequiredSystemFolders.insert(folder_type); if (!is_automatic && folder_type != LLFolderType::FT_SETTINGS) { @@ -4689,6 +4688,7 @@ LLPointer LLInventoryModel::validate() const // outfits, trash and other non-automatic folders. validation_info->mFatalSystemDuplicate++; fatal_errs++; + LL_WARNS("Inventory") << "Fatal inventory corruption: system folder type has excess copies under root, type " << ft << " count " << count_under_root << LL_ENDL; } else { @@ -4697,6 +4697,7 @@ LLPointer LLInventoryModel::validate() const // Exception: FT_SETTINGS is not automatic, but only deserves a warning. validation_info->mWarnings["non_fatal_system_duplicate_under_root"]++; warning_count++; + LL_WARNS("Inventory") << "System folder type has excess copies under root, type " << ft << " count " << count_under_root << LL_ENDL; } } if (count_elsewhere > 0) -- cgit v1.2.3 From 98681ef73ff33e0c0ff321e839a8e79b2cb334de Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 5 May 2023 15:56:21 +0300 Subject: SL-19533 Prevent COF dupplicate request --- indra/newview/llinventorymodel.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 48539f4748..c65901a754 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -853,8 +853,17 @@ void LLInventoryModel::ensureCategoryForTypeExists(LLFolderType::EType preferred LLStringUtil::null, [preferred_type](const LLUUID &new_cat_id) { - LL_DEBUGS("Inventory") << "Created category: " << new_cat_id - << " for type: " << preferred_type << LL_ENDL; + if (new_cat_id.isNull()) + { + LL_WARNS("Inventory") + << "Failed to create folder of type " << preferred_type + << LL_ENDL; + } + else + { + LL_DEBUGS("Inventory") << "Created category: " << new_cat_id + << " for type: " << preferred_type << LL_ENDL; + } } ); } -- cgit v1.2.3 From 6e2e9d5904b3cc89deb755f3552d915104065aa0 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 12 May 2023 18:26:02 +0300 Subject: SL-19649 Adjust other classes for new deleteAllChildren mechanics --- indra/newview/llinventorymodel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index c65901a754..bc0d523bd2 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -906,7 +906,10 @@ const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot( } } - if(rv.isNull() && root_id.notNull() && preferred_type != LLFolderType::FT_MARKETPLACE_LISTINGS) + if(rv.isNull() + && root_id.notNull() + && preferred_type != LLFolderType::FT_MARKETPLACE_LISTINGS + && preferred_type != LLFolderType::FT_OUTBOX) { // if it does not exists, it should either be added // to createCommonSystemCategories or server should -- cgit v1.2.3 From 23311903106293f29e22d21314bdab03bbd499f7 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 31 May 2023 19:28:48 +0300 Subject: Revert "SL-19795 Unified scroll" --- indra/newview/llinventorymodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index bc0d523bd2..59b34cc95c 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -914,7 +914,7 @@ const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot( // if it does not exists, it should either be added // to createCommonSystemCategories or server should // have set it - llassert(false); + llassert(!isInventoryUsable()); LL_WARNS("Inventory") << "Tried to find folder, type " << preferred_type << " but category does not exist" << LL_ENDL; } -- cgit v1.2.3 From 14eadadf993eb4f89188aa4cd8ea0859a86374d3 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 13 Jun 2023 22:41:49 +0300 Subject: SL-19857 Exception at category creation --- indra/newview/llinventorymodel.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 59b34cc95c..ed375661b8 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1031,13 +1031,14 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, { if (new_category.isNull()) { - if (callback) + if (callback && !callback.empty()) { callback(new_category); } return; } + // todo: not needed since AIS does the accounting? LLViewerInventoryCategory* folderp = gInventory.getCategory(new_category); if (!folderp) { @@ -1057,7 +1058,7 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, updateCategory(cat); } - if (callback) + if (callback && !callback.empty()) { callback(new_category); } -- cgit v1.2.3 From 3058e6e6fd66ad4abb91fa5354ee11f6b7843a02 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Wed, 19 Jul 2023 21:15:52 +0300 Subject: SL-20015 wait for the outfit items to load before wearing it --- indra/newview/llinventorymodel.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index ed375661b8..586f1388ff 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -79,6 +79,8 @@ const S32 LLInventoryModel::sCurrentInvCacheVersion = 3; BOOL LLInventoryModel::sFirstTimeInViewer2 = TRUE; +S32 LLInventoryModel::sPendingSystemFolders = 0; + ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- @@ -861,8 +863,9 @@ void LLInventoryModel::ensureCategoryForTypeExists(LLFolderType::EType preferred } else { - LL_DEBUGS("Inventory") << "Created category: " << new_cat_id + LL_WARNS("Inventory") << "Created category: " << new_cat_id << " for type: " << preferred_type << LL_ENDL; + sPendingSystemFolders--; } } ); @@ -873,6 +876,10 @@ void LLInventoryModel::ensureCategoryForTypeExists(LLFolderType::EType preferred << " because inventory is not usable" << LL_ENDL; } } + else + { + sPendingSystemFolders--; + } } const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot( @@ -3253,6 +3260,9 @@ LLCore::HttpHandle LLInventoryModel::requestPost(bool foreground, void LLInventoryModel::createCommonSystemCategories() { + //amount of System Folder we should wait for + sPendingSystemFolders = 8; + gInventory.ensureCategoryForTypeExists(LLFolderType::FT_TRASH); gInventory.ensureCategoryForTypeExists(LLFolderType::FT_FAVORITE); gInventory.ensureCategoryForTypeExists(LLFolderType::FT_CALLINGCARD); -- cgit v1.2.3 From 6b5345eabd75e62b99333c51877b02e5a54f66d2 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 5 Aug 2023 17:36:38 +0300 Subject: SL-20120 Fix unneeded warnings - Don't Warn about unknown cof version, it's expected during fetch, Info is enough - Fix 'unexpected attachments' due to unknown cof, also should fix viewer trying to create a link before cof is ready - Fix 'accounting' warnings when getting item updates for unfetched folders (Note: viewer doesn't know folders version, if fetch is already in progress we might get an old version) --- indra/newview/llinventorymodel.cpp | 43 ++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 11 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 586f1388ff..aa750a19b0 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -3788,15 +3788,22 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) LLViewerInventoryCategory* folderp = gInventory.getCategory(tfolder->getUUID()); if(folderp) { - if(tfolder->getParentUUID() == folderp->getParentUUID()) - { - update[tfolder->getParentUUID()]; - } - else - { - ++update[tfolder->getParentUUID()]; - --update[folderp->getParentUUID()]; - } + if (folderp->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN) + { + if (tfolder->getParentUUID() == folderp->getParentUUID()) + { + update[tfolder->getParentUUID()]; + } + else + { + ++update[tfolder->getParentUUID()]; + --update[folderp->getParentUUID()]; + } + } + else + { + folderp->fetch(); + } } else { @@ -3806,7 +3813,14 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) folderp = gInventory.getCategory(tfolder->getParentUUID()); if(folderp) { - ++update[tfolder->getParentUUID()]; + if (folderp->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN) + { + ++update[tfolder->getParentUUID()]; + } + else + { + folderp->fetch(); + } } } } @@ -3852,7 +3866,14 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) LLViewerInventoryCategory* folderp = gInventory.getCategory(titem->getParentUUID()); if(folderp) { - ++update[titem->getParentUUID()]; + if (folderp->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN) + { + ++update[titem->getParentUUID()]; + } + else + { + folderp->fetch(); + } } } } -- cgit v1.2.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/newview/llinventorymodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llinventorymodel.cpp') 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.2.3 From 5566f28b039e2f3999e397a26243707affc80991 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 3 Oct 2023 19:27:26 +0300 Subject: D559 Post merge fixes --- indra/newview/llinventorymodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index e6fe00b044..f7c327c699 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -3269,7 +3269,7 @@ LLCore::HttpHandle LLInventoryModel::requestPost(bool foreground, void LLInventoryModel::createCommonSystemCategories() { //amount of System Folder we should wait for - sPendingSystemFolders = 8; + sPendingSystemFolders = 9; gInventory.ensureCategoryForTypeExists(LLFolderType::FT_TRASH); gInventory.ensureCategoryForTypeExists(LLFolderType::FT_FAVORITE); -- cgit v1.2.3