summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-09-29 21:27:37 +0300
committerakleshchev <117672381+akleshchev@users.noreply.github.com>2023-10-03 21:14:34 +0300
commitaee8f570e14684e6143a18541ba0bc9a5060fa98 (patch)
tree3bce2ecb6a1b4552c6516da259f11444cbcf9ffe /indra
parentd4123ec30d9a5daa96b28f2b8a3cc36ccd7e9cb1 (diff)
SL-20368 Request outfits using 'links'
instead of getting items one by one
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llappearancemgr.cpp32
-rw-r--r--indra/newview/llappearancemgr.h2
-rw-r--r--indra/newview/llinventoryobserver.cpp65
3 files changed, 60 insertions, 39 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 8010b84c20..667ae999bb 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -2776,9 +2776,33 @@ void LLAppearanceMgr::wearInventoryCategory(LLInventoryCategory* category, bool
else
{
selfStartPhase("wear_inventory_category_fetch");
- callAfterCategoryFetch(category->getUUID(),boost::bind(&LLAppearanceMgr::wearCategoryFinal,
- &LLAppearanceMgr::instance(),
- category->getUUID(), copy, append));
+ if (AISAPI::isAvailable() && category->getPreferredType() == LLFolderType::FT_OUTFIT)
+ {
+ // for reliability just fetch it whole, linked items included
+ LLViewerInventoryCategory* cat = (LLViewerInventoryCategory*)category;
+ LLUUID cat_id = category->getUUID();
+ cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE);
+ AISAPI::FetchCategoryLinks(cat_id,
+ [cat_id, copy, append](const LLUUID& id)
+ {
+ LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
+ if (cat)
+ {
+ cat->setFetching(LLViewerInventoryCategory::FETCH_NONE);
+ }
+ if (id.isNull())
+ {
+ LL_WARNS() << "failed to fetch category, attempting to wear as is " << cat_id << LL_ENDL;
+ }
+ LLAppearanceMgr::instance().wearCategoryFinal(cat_id, copy, append);
+ });
+ }
+ else
+ {
+ callAfterCategoryFetch(category->getUUID(), boost::bind(&LLAppearanceMgr::wearCategoryFinal,
+ &LLAppearanceMgr::instance(),
+ category->getUUID(), copy, append));
+ }
}
}
@@ -2787,7 +2811,7 @@ S32 LLAppearanceMgr::getActiveCopyOperations() const
return LLCallAfterInventoryCopyMgr::getInstanceCount();
}
-void LLAppearanceMgr::wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool append)
+void LLAppearanceMgr::wearCategoryFinal(const LLUUID& cat_id, bool copy_items, bool append)
{
LL_INFOS("Avatar") << self_av_string() << "starting" << LL_ENDL;
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 43839e47a6..da29ceee3a 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -58,7 +58,7 @@ public:
void updateCOF(const LLUUID& category, bool append = false);
void wearInventoryCategory(LLInventoryCategory* category, bool copy, bool append);
void wearInventoryCategoryOnAvatar(LLInventoryCategory* category, bool append);
- void wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool append);
+ void wearCategoryFinal(const LLUUID& cat_id, bool copy_items, bool append);
void wearOutfitByName(const std::string& name);
void changeOutfit(bool proceed, const LLUUID& category, bool append);
void replaceCurrentOutfit(const LLUUID& new_outfit);
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp
index 281a8bc789..b6c2e954a4 100644
--- a/indra/newview/llinventoryobserver.cpp
+++ b/indra/newview/llinventoryobserver.cpp
@@ -337,52 +337,49 @@ void LLInventoryFetchItemsObserver::startFetch()
{
for (requests_by_folders_t::value_type &folder : requests)
{
- if (folder.second.size() > MAX_INDIVIDUAL_ITEM_REQUESTS)
+ LLViewerInventoryCategory* cat = gInventory.getCategory(folder.first);
+ if (cat)
{
- // requesting one by one will take a while
- // do whole folder
- LLInventoryModelBackgroundFetch::getInstance()->scheduleFolderFetch(folder.first, true);
- }
- else
- {
- LLViewerInventoryCategory* cat = gInventory.getCategory(folder.first);
- if (cat)
+ if (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN)
{
- if (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN)
- {
- // start fetching whole folder since it's not ready either way
- cat->fetch();
- }
- else if (cat->getViewerDescendentCount() <= folder.second.size()
- || cat->getDescendentCount() <= folder.second.size())
- {
- // Start fetching whole folder since we need all items
- LLInventoryModelBackgroundFetch::getInstance()->scheduleFolderFetch(folder.first, true);
+ // start fetching whole folder since it's not ready either way
+ cat->fetch();
+ }
+ else if (folder.second.size() > MAX_INDIVIDUAL_ITEM_REQUESTS)
+ {
+ // requesting one by one will take a while
+ // do whole folder
+ LLInventoryModelBackgroundFetch::getInstance()->scheduleFolderFetch(folder.first, true);
+ }
+ else if (cat->getViewerDescendentCount() <= folder.second.size()
+ || cat->getDescendentCount() <= folder.second.size())
+ {
+ // Start fetching whole folder since we need all items
+ LLInventoryModelBackgroundFetch::getInstance()->scheduleFolderFetch(folder.first, true);
- }
- else
- {
- // get items one by one
- for (LLUUID &item_id : folder.second)
- {
- LLInventoryModelBackgroundFetch::getInstance()->scheduleItemFetch(item_id);
- }
- }
}
else
{
- // Isn't supposed to happen? We should have all folders
- // and if item exists, folder is supposed to exist as well.
- llassert(false);
- LL_WARNS("Inventory") << "Missing folder: " << folder.first << " fetching items individually" << LL_ENDL;
-
// get items one by one
- for (LLUUID &item_id : folder.second)
+ for (LLUUID& item_id : folder.second)
{
LLInventoryModelBackgroundFetch::getInstance()->scheduleItemFetch(item_id);
}
}
}
+ else
+ {
+ // Isn't supposed to happen? We should have all folders
+ // and if item exists, folder is supposed to exist as well.
+ llassert(false);
+ LL_WARNS("Inventory") << "Missing folder: " << folder.first << " fetching items individually" << LL_ENDL;
+
+ // get items one by one
+ for (LLUUID& item_id : folder.second)
+ {
+ LLInventoryModelBackgroundFetch::getInstance()->scheduleItemFetch(item_id);
+ }
+ }
}
}
else