@@ -142,6 +142,17 @@ void LLOutfitsList::updateAddedCategory(LLUUID cat_id)
142
142
LLViewerInventoryCategory *cat = gInventory .getCategory (cat_id);
143
143
if (!cat) return ;
144
144
145
+ if (!isOutfitFolder (cat))
146
+ {
147
+ // Assume a subfolder that contains or will contain outfits, track it
148
+ const LLUUID outfits = gInventory .findCategoryUUIDForType (LLFolderType::FT_MY_OUTFITS);
149
+ mCategoriesObserver ->addCategory (cat_id, [this , outfits]()
150
+ {
151
+ observerCallback (outfits);
152
+ });
153
+ return ;
154
+ }
155
+
145
156
std::string name = cat->getName ();
146
157
147
158
outfit_accordion_tab_params tab_params (get_accordion_tab_params ());
@@ -819,49 +830,38 @@ void LLOutfitListBase::observerCallback(const LLUUID& category_id)
819
830
refreshList (category_id);
820
831
}
821
832
822
- class LLIsOutfitListFolder : public LLInventoryCollectFunctor
833
+ bool LLOutfitListBase::isOutfitFolder (LLViewerInventoryCategory* cat) const
823
834
{
824
- public:
825
- LLIsOutfitListFolder ()
835
+ if (!cat)
826
836
{
827
- mOutfitsId = gInventory . findCategoryUUIDForType (LLFolderType::FT_MY_OUTFITS) ;
837
+ return false ;
828
838
}
829
- virtual ~LLIsOutfitListFolder () {}
830
-
831
- bool operator ()(LLInventoryCategory* cat, LLInventoryItem* item) override
839
+ if (cat->getPreferredType () == LLFolderType::FT_OUTFIT)
832
840
{
833
- if (cat)
841
+ return true ;
842
+ }
843
+ // assumes that folder is somewhere inside MyOutfits
844
+ if (cat->getPreferredType () == LLFolderType::FT_NONE)
845
+ {
846
+ LLViewerInventoryCategory* inv_cat = dynamic_cast <LLViewerInventoryCategory*>(cat);
847
+ if (inv_cat && inv_cat->getDescendentCount () > 3 )
834
848
{
835
- if (cat->getPreferredType () == LLFolderType::FT_OUTFIT)
849
+ LLInventoryModel::cat_array_t * cats;
850
+ LLInventoryModel::item_array_t * items;
851
+ gInventory .getDirectDescendentsOf (inv_cat->getUUID (), cats, items);
852
+ if (cats->empty () // protection against outfits inside
853
+ && items->size () > 3 ) // arbitrary, if doesn't have at least base parts, not an outfit
836
854
{
855
+ // For now assume this to be an old style outfit, not a subfolder
856
+ // but ideally no such 'outfits' should be left in My Outfits
857
+ // Todo: stop counting FT_NONE as outfits,
858
+ // convert obvious outfits into FT_OUTFIT
837
859
return true ;
838
860
}
839
- if (cat->getPreferredType () == LLFolderType::FT_NONE
840
- && cat->getParentUUID () == mOutfitsId )
841
- {
842
- LLViewerInventoryCategory* inv_cat = dynamic_cast <LLViewerInventoryCategory*>(cat);
843
- if (inv_cat && inv_cat->getDescendentCount () > 3 )
844
- {
845
- LLInventoryModel::cat_array_t * cats;
846
- LLInventoryModel::item_array_t * items;
847
- gInventory .getDirectDescendentsOf (inv_cat->getUUID (), cats, items);
848
- if (cats->empty () // protection against outfits inside
849
- && items->size () > 3 ) // eyes, skin, hair and shape are required
850
- {
851
- // For now assume this to be an old style outfit, not a subfolder
852
- // but ideally no such 'outfits' should be left in My Outfits
853
- // Todo: stop counting FT_NONE as outfits,
854
- // convert obvious outfits into FT_OUTFIT
855
- return true ;
856
- }
857
- }
858
- }
859
861
}
860
- return false ;
861
862
}
862
- protected:
863
- LLUUID mOutfitsId ;
864
- };
863
+ return false ;
864
+ }
865
865
866
866
void LLOutfitListBase::refreshList (const LLUUID& category_id)
867
867
{
@@ -872,13 +872,13 @@ void LLOutfitListBase::refreshList(const LLUUID& category_id)
872
872
LLInventoryModel::item_array_t item_array;
873
873
874
874
// Collect all sub-categories of a given category.
875
- LLIsOutfitListFolder is_outfit ;
875
+ LLIsType is_category (LLAssetType::AT_CATEGORY) ;
876
876
gInventory .collectDescendentsIf (
877
877
category_id,
878
878
cat_array,
879
879
item_array,
880
880
LLInventoryModel::EXCLUDE_TRASH,
881
- is_outfit );
881
+ is_category );
882
882
883
883
// Memorize item names for each UUID
884
884
std::map<LLUUID, std::string> names;
0 commit comments