From b95b20a1be56ff7baa3ad20e8d0571ec9f07ab12 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 8 Apr 2025 20:28:50 +0300 Subject: #3757 Allow subfolders in "My Outfits" --- indra/newview/lloutfitslist.cpp | 47 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 6e666b8a4b..cfbfe8f8e0 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -819,6 +819,49 @@ void LLOutfitListBase::observerCallback(const LLUUID& category_id) refreshList(category_id); } +class LLIsOutfitListFolder : public LLInventoryCollectFunctor +{ +public: + LLIsOutfitListFolder() + { + mOutfitsId = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); + } + virtual ~LLIsOutfitListFolder() {} + + bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) override + { + if (cat) + { + if (cat->getPreferredType() == LLFolderType::FT_OUTFIT) + { + return true; + } + if (cat->getPreferredType() == LLFolderType::FT_NONE + && cat->getParentUUID() == mOutfitsId) + { + LLViewerInventoryCategory* inv_cat = dynamic_cast(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 (items->size() > 3) // eyes, skin, hair and shape are required + { + // 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; + } +protected: + LLUUID mOutfitsId; +}; + void LLOutfitListBase::refreshList(const LLUUID& category_id) { bool wasNull = mRefreshListState.CategoryUUID.isNull(); @@ -828,13 +871,13 @@ void LLOutfitListBase::refreshList(const LLUUID& category_id) LLInventoryModel::item_array_t item_array; // Collect all sub-categories of a given category. - LLIsType is_category(LLAssetType::AT_CATEGORY); + LLIsOutfitListFolder is_outfit; gInventory.collectDescendentsIf( category_id, cat_array, item_array, LLInventoryModel::EXCLUDE_TRASH, - is_category); + is_outfit); // Memorize item names for each UUID std::map names; -- cgit v1.2.3 From 1bb8fb2795920b57a5934ffa394d78a6c5733ce8 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 8 Apr 2025 22:39:41 +0300 Subject: #3757 Menu for subfodlers in outfits --- indra/newview/lloutfitslist.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index cfbfe8f8e0..9d8493549d 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -845,7 +845,8 @@ public: LLInventoryModel::cat_array_t* cats; LLInventoryModel::item_array_t* items; gInventory.getDirectDescendentsOf(inv_cat->getUUID(), cats, items); - if (items->size() > 3) // eyes, skin, hair and shape are required + if (cats->empty() // protection against outfits inside + && items->size() > 3) // eyes, skin, hair and shape are required { // For now assume this to be an old style outfit, not a subfolder // but ideally no such 'outfits' should be left in My Outfits -- cgit v1.2.3 From c94e00a10ba6a61bbf5f53fdb2b1c6e345743068 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 13 May 2025 18:21:23 +0300 Subject: #4069 Fix crash at handleToolTip --- indra/newview/lloutfitslist.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 9d8493549d..4ad4cb8d2c 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -1396,7 +1396,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() -- cgit v1.2.3 From 888d4ae9dfaf7ba3866c668fbac92502ce252f3b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 13 May 2025 21:39:10 +0300 Subject: #4072 Fix Appearance floater not updating --- indra/newview/lloutfitslist.cpp | 70 ++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 4ad4cb8d2c..df53c66ec1 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -142,6 +142,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()); @@ -819,49 +830,38 @@ void LLOutfitListBase::observerCallback(const LLUUID& category_id) refreshList(category_id); } -class LLIsOutfitListFolder : public LLInventoryCollectFunctor +bool LLOutfitListBase::isOutfitFolder(LLViewerInventoryCategory* cat) const { -public: - LLIsOutfitListFolder() + if (!cat) { - mOutfitsId = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); + return false; } - virtual ~LLIsOutfitListFolder() {} - - bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) override + if (cat->getPreferredType() == LLFolderType::FT_OUTFIT) { - if (cat) + return true; + } + // assumes that folder is somewhere inside MyOutfits + if (cat->getPreferredType() == LLFolderType::FT_NONE) + { + LLViewerInventoryCategory* inv_cat = dynamic_cast(cat); + if (inv_cat && inv_cat->getDescendentCount() > 3) { - if (cat->getPreferredType() == LLFolderType::FT_OUTFIT) + 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; } - if (cat->getPreferredType() == LLFolderType::FT_NONE - && cat->getParentUUID() == mOutfitsId) - { - LLViewerInventoryCategory* inv_cat = dynamic_cast(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) // eyes, skin, hair and shape are required - { - // 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; } -protected: - LLUUID mOutfitsId; -}; + return false; +} void LLOutfitListBase::refreshList(const LLUUID& category_id) { @@ -872,13 +872,13 @@ void LLOutfitListBase::refreshList(const LLUUID& category_id) LLInventoryModel::item_array_t item_array; // Collect all sub-categories of a given category. - LLIsOutfitListFolder is_outfit; + LLIsType is_category(LLAssetType::AT_CATEGORY); gInventory.collectDescendentsIf( category_id, cat_array, item_array, LLInventoryModel::EXCLUDE_TRASH, - is_outfit); + is_category); // Memorize item names for each UUID std::map names; -- cgit v1.2.3