diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2025-05-28 22:48:17 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-28 22:48:17 +0300 |
commit | 91adb11d10fe0c18790be64fa7a6ce5b0bbdcb09 (patch) | |
tree | 3e5294e3b8ff07778e6134ed9dd41458386032ac /indra/newview/lloutfitslist.cpp | |
parent | b9ab6c3644da02bed6941dc8df433fb1c626f8c7 (diff) | |
parent | b08ba3fa7bc9e6309891e510fbfb5c4e2b5c922e (diff) |
Merge pull request #4183 from secondlife/marchcat/2505-merge
Marchcat/2505 merge
Diffstat (limited to 'indra/newview/lloutfitslist.cpp')
-rw-r--r-- | indra/newview/lloutfitslist.cpp | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index b9795f217f..2b2b5ea696 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -182,6 +182,17 @@ void LLOutfitsList::updateAddedCategory(LLUUID cat_id) LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id); if (!cat) return; + if (!isOutfitFolder(cat)) + { + // Assume a subfolder that contains or will contain outfits, track it + const LLUUID outfits = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); + mCategoriesObserver->addCategory(cat_id, [this, outfits]() + { + observerCallback(outfits); + }); + return; + } + std::string name = cat->getName(); outfit_accordion_tab_params tab_params(get_accordion_tab_params()); @@ -934,6 +945,39 @@ void LLOutfitListBase::observerCallback(const LLUUID& category_id) refreshList(category_id); } +bool LLOutfitListBase::isOutfitFolder(LLViewerInventoryCategory* cat) const +{ + if (!cat) + { + return false; + } + if (cat->getPreferredType() == LLFolderType::FT_OUTFIT) + { + return true; + } + // assumes that folder is somewhere inside MyOutfits + if (cat->getPreferredType() == LLFolderType::FT_NONE) + { + LLViewerInventoryCategory* inv_cat = dynamic_cast<LLViewerInventoryCategory*>(cat); + if (inv_cat && inv_cat->getDescendentCount() > 3) + { + LLInventoryModel::cat_array_t* cats; + LLInventoryModel::item_array_t* items; + gInventory.getDirectDescendentsOf(inv_cat->getUUID(), cats, items); + if (cats->empty() // protection against outfits inside + && items->size() > 3) // arbitrary, if doesn't have at least base parts, not an outfit + { + // For now assume this to be an old style outfit, not a subfolder + // but ideally no such 'outfits' should be left in My Outfits + // Todo: stop counting FT_NONE as outfits, + // convert obvious outfits into FT_OUTFIT + return true; + } + } + } + return false; +} + void LLOutfitListBase::refreshList(const LLUUID& category_id) { if (LLAppViewer::instance()->quitRequested()) @@ -1588,7 +1632,12 @@ bool LLOutfitAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask) { LLSD params; params["inv_type"] = LLInventoryType::IT_CATEGORY; - params["thumbnail_id"] = gInventory.getCategory(mFolderID)->getThumbnailUUID(); + LLViewerInventoryCategory* cat = gInventory.getCategory(mFolderID); + if (cat) + { + params["thumbnail_id"] = cat->getThumbnailUUID(); + } + // else consider returning params["item_id"] = mFolderID; LLToolTipMgr::instance().show(LLToolTip::Params() |