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/llappearancemgr.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 909f32cd21..ab7adeeedc 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1701,6 +1701,7 @@ void LLAppearanceMgr::shallowCopyCategory(const LLUUID& src_id, const LLUUID& ds { parent_id = gInventory.getRootFolderID(); } + // USES UDP PATH LLUUID subfolder_id = gInventory.createNewCategory( parent_id, LLFolderType::FT_NONE, src_cat->getName()); @@ -2725,7 +2726,8 @@ void LLAppearanceMgr::wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool ap { pid = gInventory.getRootFolderID(); } - + + // UDP PATH LLUUID new_cat_id = gInventory.createNewCategory( pid, LLFolderType::FT_NONE, @@ -3994,7 +3996,8 @@ void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, boo func); } else - { + { + // UDP PATH LLUUID folder_id = gInventory.createNewCategory( parent_id, LLFolderType::FT_OUTFIT, -- 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/llappearancemgr.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index ab7adeeedc..4fc09c7739 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3989,6 +3989,7 @@ void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, boo // existence of AIS as an indicator the fix is present. Does // not actually use AIS to create the category. inventory_func_type func = boost::bind(&LLAppearanceMgr::onOutfitFolderCreated,this,_1,show_panel); + LLUUID folder_id = gInventory.createNewCategory( parent_id, LLFolderType::FT_OUTFIT, -- 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/llappearancemgr.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 4fc09c7739..d05c30d722 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1702,6 +1702,7 @@ void LLAppearanceMgr::shallowCopyCategory(const LLUUID& src_id, const LLUUID& ds parent_id = gInventory.getRootFolderID(); } // USES UDP PATH + // D567 needs to carry over thumbnail info LLUUID subfolder_id = gInventory.createNewCategory( parent_id, LLFolderType::FT_NONE, src_cat->getName()); @@ -2728,6 +2729,7 @@ void LLAppearanceMgr::wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool ap } // UDP PATH + // D567 needs to carry over thumbnail info if present LLUUID new_cat_id = gInventory.createNewCategory( pid, LLFolderType::FT_NONE, @@ -3983,6 +3985,7 @@ void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, boo // First, make a folder in the My Outfits directory. const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); + // D567 replace with coros if (AISAPI::isAvailable()) { // cap-based category creation was buggy until recently. use @@ -3990,6 +3993,7 @@ void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, boo // not actually use AIS to create the category. inventory_func_type func = boost::bind(&LLAppearanceMgr::onOutfitFolderCreated,this,_1,show_panel); + // D567 copy thumbnail info from source folder LLUUID folder_id = gInventory.createNewCategory( parent_id, LLFolderType::FT_OUTFIT, @@ -3998,7 +4002,8 @@ void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, boo } else { - // UDP PATH + // UDP PATH, should remove + // D567 copy thumbnail info from source folder LLUUID folder_id = gInventory.createNewCategory( parent_id, LLFolderType::FT_OUTFIT, -- cgit v1.2.3 From a777a0b27ed6adfa99d708e289e704915f2b62b7 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 7 Mar 2023 21:51:14 +0200 Subject: SL-18629 WIP Replacing UDP creation messages with callback based AIS --- indra/newview/llappearancemgr.cpp | 56 ++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 21 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index d8e239822e..5595a92b43 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1703,12 +1703,17 @@ void LLAppearanceMgr::shallowCopyCategory(const LLUUID& src_id, const LLUUID& ds } // USES UDP PATH // D567 needs to carry over thumbnail info - LLUUID subfolder_id = gInventory.createNewCategory( parent_id, - LLFolderType::FT_NONE, - src_cat->getName()); - shallowCopyCategoryContents(src_id, subfolder_id, cb); + gInventory.createNewCategory( + parent_id, + LLFolderType::FT_NONE, + src_cat->getName(), + [src_id, cb](const LLUUID &new_id) + { + LLAppearanceMgr::getInstance()->shallowCopyCategoryContents(src_id, new_id, cb); - gInventory.notifyObservers(); + gInventory.notifyObservers(); + } + ); } void LLAppearanceMgr::slamCategoryLinks(const LLUUID& src_id, const LLUUID& dst_id, @@ -2730,21 +2735,27 @@ void LLAppearanceMgr::wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool ap // UDP PATH // D567 needs to carry over thumbnail info if present - LLUUID new_cat_id = gInventory.createNewCategory( + gInventory.createNewCategory( pid, LLFolderType::FT_NONE, - name); - - // Create a CopyMgr that will copy items, manage its own destruction - new LLCallAfterInventoryCopyMgr( - *items, new_cat_id, std::string("wear_inventory_category_callback"), - boost::bind(&LLAppearanceMgr::wearInventoryCategoryOnAvatar, - LLAppearanceMgr::getInstance(), - gInventory.getCategory(new_cat_id), - append)); - - // BAP fixes a lag in display of created dir. - gInventory.notifyObservers(); + name, + [cat_id, append](const LLUUID& new_cat_id) + { + LLInventoryModel::cat_array_t* cats; + LLInventoryModel::item_array_t* items; + gInventory.getDirectDescendentsOf(cat_id, cats, items); + // Create a CopyMgr that will copy items, manage its own destruction + new LLCallAfterInventoryCopyMgr( + *items, new_cat_id, std::string("wear_inventory_category_callback"), + boost::bind(&LLAppearanceMgr::wearInventoryCategoryOnAvatar, + LLAppearanceMgr::getInstance(), + gInventory.getCategory(new_cat_id), + append)); + + // BAP fixes a lag in display of created dir. + gInventory.notifyObservers(); + } + ); } else { @@ -4004,11 +4015,14 @@ void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, boo { // UDP PATH, should remove // D567 copy thumbnail info from source folder - LLUUID folder_id = gInventory.createNewCategory( + gInventory.createNewCategory( parent_id, LLFolderType::FT_OUTFIT, - new_folder_name); - onOutfitFolderCreated(folder_id, show_panel); + new_folder_name, + [show_panel](const LLUUID &new_cat_id) + { + LLAppearanceMgr::getInstance()->onOutfitFolderCreated(new_cat_id, show_panel); + }); } } -- 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/llappearancemgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 5595a92b43..1c55113082 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3213,7 +3213,7 @@ void LLAppearanceMgr::copyLibraryGestures() // Copy gestures LLUUID lib_gesture_cat_id = - gInventory.findLibraryCategoryUUIDForType(LLFolderType::FT_GESTURE,false); + gInventory.findLibraryCategoryUUIDForType(LLFolderType::FT_GESTURE); if (lib_gesture_cat_id.isNull()) { LL_WARNS() << "Unable to copy gestures, source category not found" << LL_ENDL; -- cgit v1.2.3 From da27311473c2c2cc35440f88aa25c9378fc8f4d4 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 10 Mar 2023 23:55:05 +0200 Subject: SL-18629 Creare items via AIS placeholder --- indra/newview/llappearancemgr.cpp | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 1c55113082..4e36a4c351 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3996,34 +3996,17 @@ void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, boo // First, make a folder in the My Outfits directory. const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); - // D567 replace with coros - if (AISAPI::isAvailable()) - { - // cap-based category creation was buggy until recently. use - // existence of AIS as an indicator the fix is present. Does - // not actually use AIS to create the category. - inventory_func_type func = boost::bind(&LLAppearanceMgr::onOutfitFolderCreated,this,_1,show_panel); - // D567 copy thumbnail info from source folder - gInventory.createNewCategory( - parent_id, - LLFolderType::FT_OUTFIT, - new_folder_name, - func); - } - else - { - // UDP PATH, should remove - // D567 copy thumbnail info from source folder - gInventory.createNewCategory( - parent_id, - LLFolderType::FT_OUTFIT, - new_folder_name, - [show_panel](const LLUUID &new_cat_id) + // UDP PATH, should remove + // D567 copy thumbnail info from source folder + gInventory.createNewCategory( + parent_id, + LLFolderType::FT_OUTFIT, + new_folder_name, + [show_panel](const LLUUID &new_cat_id) { LLAppearanceMgr::getInstance()->onOutfitFolderCreated(new_cat_id, show_panel); }); - } } void LLAppearanceMgr::wearBaseOutfit() -- 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/llappearancemgr.cpp | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 4e36a4c351..1de3cef3ba 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -40,6 +40,7 @@ #include "llgesturemgr.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" +#include "llinventorymodelbackgroundfetch.h" #include "llinventoryobserver.h" #include "llnotificationsutil.h" #include "lloutfitobserver.h" @@ -2416,6 +2417,46 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool enforce_item_restrictions, LL_DEBUGS("Avatar") << self_av_string() << "starting" << LL_ENDL; + if (gInventory.hasPosiblyBrockenLinks()) + { + // Inventory has either broken links or links that + // haven't loaded yet and fetch is still in progress. + // Check if LLAppearanceMgr needs to wait. + LLUUID current_outfit_id = getCOF(); + LLInventoryModel::item_array_t cof_items; + LLInventoryModel::cat_array_t cof_cats; + LLFindBrokenLinks is_brocken_link; + gInventory.collectDescendentsIf(current_outfit_id, + cof_cats, + cof_items, + LLInventoryModel::EXCLUDE_TRASH, + is_brocken_link); + + if (cof_items.size() > 0) + { + // Some links haven't loaded yet, but fetch isn't complete so + // links are likely fine and we will have to wait for them to + // load (if inventory takes too long to load, might be a good + // idea to make this check periodical) + if (!mBulkFecthCallbackSlot.connected()) + { + nullary_func_t cb = post_update_func; + mBulkFecthCallbackSlot = + LLInventoryModelBackgroundFetch::getInstance()->setAllFoldersFetchedCallback( + [this, enforce_ordering, post_update_func, cb]() + { + // inventory model should be already tracking this + // callback, but make sure rebuildBrockenLinks gets + // called before a cof update + gInventory.rebuildBrockenLinks(); + updateAppearanceFromCOF(enforce_ordering, post_update_func, post_update_func); + mBulkFecthCallbackSlot.disconnect(); + }); + } + return; + } + } + if (enforce_item_restrictions) { // The point here is just to call @@ -4213,6 +4254,11 @@ LLAppearanceMgr::LLAppearanceMgr(): LLAppearanceMgr::~LLAppearanceMgr() { mActive = false; + + if (!mBulkFecthCallbackSlot.connected()) + { + mBulkFecthCallbackSlot.disconnect(); + } } void LLAppearanceMgr::setAttachmentInvLinkEnable(bool val) -- cgit v1.2.3 From 6fd7427c576ec922b6c670b4ff9381c7cb738b5b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sun, 26 Mar 2023 13:44:50 +0300 Subject: SL-18003 Bulk fetch some items by fetching whole folder --- indra/newview/llappearancemgr.cpp | 64 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 1de3cef3ba..b36ea1c457 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -4385,6 +4385,70 @@ public: ~CallAfterCategoryFetchStage1() { } + /*virtual*/ void startFetch() + { + bool ais3 = AISAPI::isAvailable(); + for (uuid_vec_t::const_iterator it = mIDs.begin(); it != mIDs.end(); ++it) + { + LLViewerInventoryCategory* cat = gInventory.getCategory(*it); + if (!cat) continue; + if (!isCategoryComplete(cat)) + { + // CHECK IT: isCategoryComplete() checks both version and descendant count but + // fetch() only works for Unknown version and doesn't care about descentants, + // as result fetch won't start and folder will potentially get stuck as + // incomplete in observer. + // Likely either both should use only version or both should check descendants. + cat->fetch(); //blindly fetch it without seeing if anything else is fetching it. + mIncomplete.push_back(*it); //Add to list of things being downloaded for this observer. + } + else if (ais3) + { + LLInventoryModel::cat_array_t* cats; + LLInventoryModel::item_array_t* items; + gInventory.getDirectDescendentsOf(cat->getUUID(), cats, items); + + if (items) + { + S32 complete_count = 0; + S32 incomplete_count = 0; + for (LLInventoryModel::item_array_t::const_iterator it = items->begin(); it < items->end(); ++it) + { + if (!(*it)->isFinished()) + { + incomplete_count++; + } + else + { + complete_count++; + } + } + // AIS can fetch couple items, but if there + // is more than a dozen it will be very slow + // it's faster to get whole folder in such case + const S32 MAX_INDIVIDUAL_FETCH = 10; + if (incomplete_count > MAX_INDIVIDUAL_FETCH + || (incomplete_count > 1 && complete_count == 0)) + { + // To prevent premature removal from mIncomplete and + // since we are doing a full refetch anyway, mark unknown + cat->setVersion(LLViewerInventoryCategory::VERSION_UNKNOWN); + LLInventoryModelBackgroundFetch::instance().start(*it, false); + mIncomplete.push_back(*it); + } + else + { + // let stage2 handle incomplete ones + mComplete.push_back(*it); + } + } + } + else + { + mComplete.push_back(*it); + } + } + } virtual void done() { if (mComplete.size() <= 0) -- 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/llappearancemgr.cpp | 42 +++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 15 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index b36ea1c457..8e44411d52 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2420,7 +2420,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool enforce_item_restrictions, if (gInventory.hasPosiblyBrockenLinks()) { // Inventory has either broken links or links that - // haven't loaded yet and fetch is still in progress. + // haven't loaded yet. // Check if LLAppearanceMgr needs to wait. LLUUID current_outfit_id = getCOF(); LLInventoryModel::item_array_t cof_items; @@ -2438,22 +2438,34 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool enforce_item_restrictions, // links are likely fine and we will have to wait for them to // load (if inventory takes too long to load, might be a good // idea to make this check periodical) - if (!mBulkFecthCallbackSlot.connected()) + if (LLInventoryModelBackgroundFetch::getInstance()->folderFetchActive()) { - nullary_func_t cb = post_update_func; - mBulkFecthCallbackSlot = - LLInventoryModelBackgroundFetch::getInstance()->setAllFoldersFetchedCallback( - [this, enforce_ordering, post_update_func, cb]() + if (!mBulkFecthCallbackSlot.connected()) { - // inventory model should be already tracking this - // callback, but make sure rebuildBrockenLinks gets - // called before a cof update - gInventory.rebuildBrockenLinks(); - updateAppearanceFromCOF(enforce_ordering, post_update_func, post_update_func); - mBulkFecthCallbackSlot.disconnect(); - }); + nullary_func_t cb = post_update_func; + mBulkFecthCallbackSlot = + LLInventoryModelBackgroundFetch::getInstance()->setFetchCompletionCallback( + [this, enforce_ordering, post_update_func, cb]() + { + // inventory model should be already tracking this + // callback, but make sure rebuildBrockenLinks gets + // called before a cof update + gInventory.rebuildBrockenLinks(); + updateAppearanceFromCOF(enforce_ordering, post_update_func, post_update_func); + mBulkFecthCallbackSlot.disconnect(); + }); + } + return; + } + else + { + // this should have happened on completion callback, + // check why it didn't then fix it + llassert(false); + + // try to recover now + gInventory.rebuildBrockenLinks(); } - return; } } @@ -4433,7 +4445,7 @@ public: // To prevent premature removal from mIncomplete and // since we are doing a full refetch anyway, mark unknown cat->setVersion(LLViewerInventoryCategory::VERSION_UNKNOWN); - LLInventoryModelBackgroundFetch::instance().start(*it, false); + cat->fetch(); mIncomplete.push_back(*it); } else -- 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/llappearancemgr.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 8e44411d52..a4dc0c341e 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2786,8 +2786,6 @@ void LLAppearanceMgr::wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool ap pid = gInventory.getRootFolderID(); } - // UDP PATH - // D567 needs to carry over thumbnail info if present gInventory.createNewCategory( pid, LLFolderType::FT_NONE, @@ -2807,7 +2805,8 @@ void LLAppearanceMgr::wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool ap // BAP fixes a lag in display of created dir. gInventory.notifyObservers(); - } + }, + cat->getThumbnailUUID() ); } else @@ -4050,8 +4049,6 @@ void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, boo // First, make a folder in the My Outfits directory. const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); - // UDP PATH, should remove - // D567 copy thumbnail info from source folder gInventory.createNewCategory( parent_id, LLFolderType::FT_OUTFIT, -- cgit v1.2.3 From d33328584f331287cce626804e10c962e7c3ce48 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 8 Apr 2023 02:42:39 +0300 Subject: SL-19529 Fix uninitialized variable and calback counter --- indra/newview/llappearancemgr.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index a4dc0c341e..59bf418a00 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1702,8 +1702,6 @@ void LLAppearanceMgr::shallowCopyCategory(const LLUUID& src_id, const LLUUID& ds { parent_id = gInventory.getRootFolderID(); } - // USES UDP PATH - // D567 needs to carry over thumbnail info gInventory.createNewCategory( parent_id, LLFolderType::FT_NONE, @@ -1713,7 +1711,8 @@ void LLAppearanceMgr::shallowCopyCategory(const LLUUID& src_id, const LLUUID& ds LLAppearanceMgr::getInstance()->shallowCopyCategoryContents(src_id, new_id, cb); gInventory.notifyObservers(); - } + }, + src_cat->getThumbnailUUID() ); } -- 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/llappearancemgr.cpp | 98 ++++++++++++++++++++++++++------------- 1 file changed, 67 insertions(+), 31 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 59bf418a00..e160b5813f 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -586,6 +586,66 @@ LLUpdateAppearanceAndEditWearableOnDestroy::~LLUpdateAppearanceAndEditWearableOn } } +class LLBrokenLinkObserver : public LLInventoryObserver +{ +public: + LLUUID mUUID; + bool mEnforceItemRestrictions; + bool mEnforceOrdering; + nullary_func_t mPostUpdateFunc; + + LLBrokenLinkObserver(const LLUUID& uuid, + bool enforce_item_restrictions , + bool enforce_ordering , + nullary_func_t post_update_func) : + mUUID(uuid), + mEnforceItemRestrictions(enforce_item_restrictions), + mEnforceOrdering(enforce_ordering), + mPostUpdateFunc(post_update_func) + { + } + /* virtual */ void changed(U32 mask); + void postProcess(); +}; + +void LLBrokenLinkObserver::changed(U32 mask) +{ + if (mask & LLInventoryObserver::REBUILD) + { + // This observer should be executed after LLInventoryPanel::itemChanged(), + // but if it isn't, consider calling updateAppearanceFromCOF with a delay + const uuid_set_t& changed_item_ids = gInventory.getChangedIDs(); + for (uuid_set_t::const_iterator it = changed_item_ids.begin(); it != changed_item_ids.end(); ++it) + { + const LLUUID& id = *it; + if (id == mUUID) + { + // Might not be processed yet and it is not a + // good idea to update appearane here, postpone. + doOnIdleOneTime([this]() + { + postProcess(); + }); + + gInventory.removeObserver(this); + return; + } + } + } +} + +void LLBrokenLinkObserver::postProcess() +{ + LLViewerInventoryItem* item = gInventory.getItem(mUUID); + llassert(item && !item->getIsBrokenLink()); // the whole point was to get a correct link + + LLAppearanceMgr::instance().updateAppearanceFromCOF( + mEnforceItemRestrictions , + mEnforceOrdering , + mPostUpdateFunc); + delete this; +} + struct LLFoundData { @@ -2435,35 +2495,16 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool enforce_item_restrictions, { // Some links haven't loaded yet, but fetch isn't complete so // links are likely fine and we will have to wait for them to - // load (if inventory takes too long to load, might be a good - // idea to make this check periodical) + // load if (LLInventoryModelBackgroundFetch::getInstance()->folderFetchActive()) { - if (!mBulkFecthCallbackSlot.connected()) - { - nullary_func_t cb = post_update_func; - mBulkFecthCallbackSlot = - LLInventoryModelBackgroundFetch::getInstance()->setFetchCompletionCallback( - [this, enforce_ordering, post_update_func, cb]() - { - // inventory model should be already tracking this - // callback, but make sure rebuildBrockenLinks gets - // called before a cof update - gInventory.rebuildBrockenLinks(); - updateAppearanceFromCOF(enforce_ordering, post_update_func, post_update_func); - mBulkFecthCallbackSlot.disconnect(); - }); - } - return; - } - else - { - // this should have happened on completion callback, - // check why it didn't then fix it - llassert(false); - // try to recover now - gInventory.rebuildBrockenLinks(); + LLBrokenLinkObserver* observer = new LLBrokenLinkObserver(cof_items.front()->getUUID(), + enforce_item_restrictions, + enforce_ordering, + post_update_func); + gInventory.addObserver(observer); + return; } } } @@ -4262,11 +4303,6 @@ LLAppearanceMgr::LLAppearanceMgr(): LLAppearanceMgr::~LLAppearanceMgr() { mActive = false; - - if (!mBulkFecthCallbackSlot.connected()) - { - mBulkFecthCallbackSlot.disconnect(); - } } void LLAppearanceMgr::setAttachmentInvLinkEnable(bool val) -- cgit v1.2.3 From c3d22fba600a6c40268dfbec15ec1fe145cbbb1d Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 13 Apr 2023 13:27:30 +0300 Subject: SL-19533 MacOS build fix --- indra/newview/llappearancemgr.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index e160b5813f..9115d7e5c2 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -638,6 +638,11 @@ void LLBrokenLinkObserver::postProcess() { LLViewerInventoryItem* item = gInventory.getItem(mUUID); llassert(item && !item->getIsBrokenLink()); // the whole point was to get a correct link + if (item && item->getIsBrokenLink()) + { + LL_INFOS_ONCE("Avatar") << "Outfit link broken despite being regenerated" << LL_ENDL; + LL_DEBUGS("Avatar", "Inventory") << "Outfit link " << mUUID << " \"" << item->getName() << "\" is broken despite being regenerated" << LL_ENDL; + } LLAppearanceMgr::instance().updateAppearanceFromCOF( mEnforceItemRestrictions , -- cgit v1.2.3 From 154ab03bf8a5dacc3128718d1f15160f0cbe2b33 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 25 Apr 2023 03:38:26 +0300 Subject: SL-19533 Special COF handling #2 --- indra/newview/llappearancemgr.cpp | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 9115d7e5c2..297403fc6c 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -4561,18 +4561,31 @@ protected: nullary_func_t mCallable; }; +void callAfterCOFFetch(nullary_func_t cb) +{ + if (AISAPI::isAvailable()) + { + AISAPI::FetchCOF([cb](const LLUUID& id) { cb(); }); + } + else + { + LLUUID cat_id = LLAppearanceMgr::instance().getCOF(); + callAfterCategoryFetch(cat_id, cb); + } +} + void callAfterCategoryFetch(const LLUUID& cat_id, nullary_func_t cb) { - CallAfterCategoryFetchStage1 *stage1 = new CallAfterCategoryFetchStage1(cat_id, cb); - stage1->startFetch(); - if (stage1->isFinished()) - { - stage1->done(); - } - else - { - gInventory.addObserver(stage1); - } + CallAfterCategoryFetchStage1* stage1 = new CallAfterCategoryFetchStage1(cat_id, cb); + stage1->startFetch(); + if (stage1->isFinished()) + { + stage1->done(); + } + else + { + gInventory.addObserver(stage1); + } } void add_wearable_type_counts(const uuid_vec_t& ids, -- cgit v1.2.3 From c1a3c7b239dcde347403c818d4ad1eeedf45d280 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 25 Apr 2023 13:51:23 +0300 Subject: SL-19533 Special COF handling #3 --- indra/newview/llappearancemgr.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 297403fc6c..d79525ec62 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -4563,13 +4563,16 @@ protected: void callAfterCOFFetch(nullary_func_t cb) { - if (AISAPI::isAvailable()) + LLUUID cat_id = LLAppearanceMgr::instance().getCOF(); + LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); + if (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN && AISAPI::isAvailable()) { + // Assume that we have no relevant cache. Fetch cof, and items cof's links point to. AISAPI::FetchCOF([cb](const LLUUID& id) { cb(); }); } else { - LLUUID cat_id = LLAppearanceMgr::instance().getCOF(); + // Assume that cache is present. Process like a normal folder. callAfterCategoryFetch(cat_id, cb); } } -- cgit v1.2.3 From 697d3be3c9906a6d578a961710fc43816b6adeae Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 27 Apr 2023 01:30:57 +0300 Subject: SL-19533 Implement subset variant of children request --- indra/newview/llappearancemgr.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index d79525ec62..4133470973 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -4568,7 +4568,18 @@ void callAfterCOFFetch(nullary_func_t cb) if (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN && AISAPI::isAvailable()) { // Assume that we have no relevant cache. Fetch cof, and items cof's links point to. - AISAPI::FetchCOF([cb](const LLUUID& id) { cb(); }); + AISAPI::FetchCOF([cb](const LLUUID& id) + { + cb(); + LLUUID cat_id = LLAppearanceMgr::instance().getCOF(); + LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); + if (cat) + { + cat->setFetching(LLViewerInventoryCategory::FETCH_NONE); + } + }); + // Mark it so that background fetch won't request it if it didn't already + cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE); } else { -- 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/llappearancemgr.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 4133470973..454ac5d88c 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -4565,10 +4565,14 @@ void callAfterCOFFetch(nullary_func_t cb) { LLUUID cat_id = LLAppearanceMgr::instance().getCOF(); LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); - if (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN && AISAPI::isAvailable()) + if (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN) { - // Assume that we have no relevant cache. Fetch cof, and items cof's links point to. - AISAPI::FetchCOF([cb](const LLUUID& id) + if (AISAPI::isAvailable()) + { + // Mark cof (update timer) so that background fetch won't request it + cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE); + // Assume that we have no relevant cache. Fetch cof, and items cof's links point to. + AISAPI::FetchCOF([cb](const LLUUID& id) { cb(); LLUUID cat_id = LLAppearanceMgr::instance().getCOF(); @@ -4578,8 +4582,14 @@ void callAfterCOFFetch(nullary_func_t cb) cat->setFetching(LLViewerInventoryCategory::FETCH_NONE); } }); - // Mark it so that background fetch won't request it if it didn't already - cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE); + } + else + { + LL_WARNS() << "AIS API v3 not available, can't use AISAPI::FetchCOF" << LL_ENDL; + // startup should have marked folder as fetching, remove that + cat->setFetching(LLViewerInventoryCategory::FETCH_NONE); + callAfterCategoryFetch(cat_id, cb); + } } else { -- 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/llappearancemgr.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 454ac5d88c..d4fc6a9f9d 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -4612,6 +4612,35 @@ void callAfterCategoryFetch(const LLUUID& cat_id, nullary_func_t cb) } } +void callAfterCategoryLinksFetch(const LLUUID &cat_id, nullary_func_t cb) +{ + LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id); + if (AISAPI::isAvailable()) + { + // Mark folder (update timer) so that background fetch won't request it + cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE); + // Assume that we have no relevant cache. Fetch folder, and items folder's links point to. + AISAPI::FetchCategoryLinks(cat_id, + [cb, cat_id](const LLUUID &id) + { + cb(); + LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id); + if (cat) + { + cat->setFetching(LLViewerInventoryCategory::FETCH_NONE); + } + }); + } + else + { + LL_WARNS() << "AIS API v3 not available, can't use AISAPI::FetchCOF" << LL_ENDL; + // startup should have marked folder as fetching, remove that + cat->setFetching(LLViewerInventoryCategory::FETCH_NONE); + callAfterCategoryFetch(cat_id, cb); + } + +} + void add_wearable_type_counts(const uuid_vec_t& ids, S32& clothing_count, S32& bodypart_count, -- 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/llappearancemgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index d4fc6a9f9d..6251737699 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3821,7 +3821,7 @@ void LLAppearanceMgr::serverAppearanceUpdateCoro(LLCoreHttpUtil::HttpCoroutineAd if (cofVersion == LLViewerInventoryCategory::VERSION_UNKNOWN) { - LL_WARNS("AVatar") << "COF version is unknown... not requesting until COF version is known." << LL_ENDL; + LL_INFOS("AVatar") << "COF version is unknown... not requesting until COF version is known." << LL_ENDL; return; } else -- cgit v1.2.3 From fa47e4402b7925a45c5fec9fb9d92fb5e34a589e Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 14 Sep 2023 18:42:42 +0300 Subject: SL-20285 Sturdier cof and fixed link fetching --- indra/newview/llappearancemgr.cpp | 58 +++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 30 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 80ef5e3bae..876ae23e62 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -4446,7 +4446,7 @@ public: { LLViewerInventoryCategory* cat = gInventory.getCategory(*it); if (!cat) continue; - if (!isCategoryComplete(cat)) + if (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN) { // CHECK IT: isCategoryComplete() checks both version and descendant count but // fetch() only works for Unknown version and doesn't care about descentants, @@ -4456,6 +4456,12 @@ public: cat->fetch(); //blindly fetch it without seeing if anything else is fetching it. mIncomplete.push_back(*it); //Add to list of things being downloaded for this observer. } + else if (!isCategoryComplete(cat)) + { + LL_DEBUGS("Inventory") << "Categoty " << *it << " incomplete despite having version" << LL_ENDL; + LLInventoryModelBackgroundFetch::instance().scheduleFolderFetch(*it, true); + mIncomplete.push_back(*it); + } else if (ais3) { LLInventoryModel::cat_array_t* cats; @@ -4484,10 +4490,7 @@ public: if (incomplete_count > MAX_INDIVIDUAL_FETCH || (incomplete_count > 1 && complete_count == 0)) { - // To prevent premature removal from mIncomplete and - // since we are doing a full refetch anyway, mark unknown - cat->setVersion(LLViewerInventoryCategory::VERSION_UNKNOWN); - cat->fetch(); + LLInventoryModelBackgroundFetch::instance().scheduleFolderFetch(*it, true); mIncomplete.push_back(*it); } else @@ -4496,6 +4499,7 @@ public: mComplete.push_back(*it); } } + // else should have been handled by isCategoryComplete } else { @@ -4519,13 +4523,11 @@ public: // What we do here is get the complete information on the // items in the requested category, and set up an observer // that will wait for that to happen. - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t item_array; - gInventory.collectDescendents(mComplete.front(), - cat_array, - item_array, - LLInventoryModel::EXCLUDE_TRASH); - S32 count = item_array.size(); + LLInventoryModel::cat_array_t* cats; + LLInventoryModel::item_array_t* items; + gInventory.getDirectDescendentsOf(mComplete.front(), cats, items); + + S32 count = items->size(); if(!count) { LL_WARNS() << "Nothing fetched in category " << mComplete.front() @@ -4537,11 +4539,13 @@ public: return; } - LL_INFOS() << "stage1 got " << item_array.size() << " items, passing to stage2 " << LL_ENDL; + LLViewerInventoryCategory* cat = gInventory.getCategory(mComplete.front()); + S32 version = cat ? cat->getVersion() : -2; + LL_INFOS() << "stage1, category " << mComplete.front() << " got " << count << " items, version " << version << " passing to stage2 " << LL_ENDL; uuid_vec_t ids; for(S32 i = 0; i < count; ++i) { - ids.push_back(item_array.at(i)->getUUID()); + ids.push_back(items->at(i)->getUUID()); } gInventory.removeObserver(this); @@ -4570,14 +4574,14 @@ void callAfterCOFFetch(nullary_func_t cb) { LLUUID cat_id = LLAppearanceMgr::instance().getCOF(); LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); - if (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN) + + if (AISAPI::isAvailable()) { - if (AISAPI::isAvailable()) - { - // Mark cof (update timer) so that background fetch won't request it - cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE); - // Assume that we have no relevant cache. Fetch cof, and items cof's links point to. - AISAPI::FetchCOF([cb](const LLUUID& id) + // Mark cof (update timer) so that background fetch won't request it + cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE); + // For reliability assume that we have no relevant cache, so + // fetch cof along with items cof's links point to. + AISAPI::FetchCOF([cb](const LLUUID& id) { cb(); LLUUID cat_id = LLAppearanceMgr::instance().getCOF(); @@ -4587,18 +4591,12 @@ void callAfterCOFFetch(nullary_func_t cb) cat->setFetching(LLViewerInventoryCategory::FETCH_NONE); } }); - } - else - { - LL_WARNS() << "AIS API v3 not available, can't use AISAPI::FetchCOF" << LL_ENDL; - // startup should have marked folder as fetching, remove that - cat->setFetching(LLViewerInventoryCategory::FETCH_NONE); - callAfterCategoryFetch(cat_id, cb); - } } else { - // Assume that cache is present. Process like a normal folder. + LL_INFOS() << "AIS API v3 not available, using callAfterCategoryFetch" << LL_ENDL; + // startup should have marked folder as fetching, remove that + cat->setFetching(LLViewerInventoryCategory::FETCH_NONE); callAfterCategoryFetch(cat_id, cb); } } -- cgit v1.2.3 From b09c19d27ceb2a3695cd688b1ccffcb3084f0e46 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 14 Sep 2023 20:58:42 +0300 Subject: SL-20285 Updated individual request count declaration --- indra/newview/llappearancemgr.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 876ae23e62..8010b84c20 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -4486,8 +4486,7 @@ public: // AIS can fetch couple items, but if there // is more than a dozen it will be very slow // it's faster to get whole folder in such case - const S32 MAX_INDIVIDUAL_FETCH = 10; - if (incomplete_count > MAX_INDIVIDUAL_FETCH + if (incomplete_count > LLInventoryFetchItemsObserver::MAX_INDIVIDUAL_ITEM_REQUESTS || (incomplete_count > 1 && complete_count == 0)) { LLInventoryModelBackgroundFetch::instance().scheduleFolderFetch(*it, true); -- cgit v1.2.3