diff options
Diffstat (limited to 'indra/newview/llagentwearablesfetch.cpp')
-rw-r--r-- | indra/newview/llagentwearablesfetch.cpp | 79 |
1 files changed, 41 insertions, 38 deletions
diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index 45274a8e2c..03d09a3798 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -39,7 +39,8 @@ #include "llinventoryfunctions.h" #include "llvoavatarself.h" -LLInitialWearablesFetch::LLInitialWearablesFetch() +LLInitialWearablesFetch::LLInitialWearablesFetch(const LLUUID& cof_id) : + LLInventoryFetchDescendentsObserver(cof_id) { } @@ -54,7 +55,7 @@ void LLInitialWearablesFetch::done() // gInventory.notifyObservers. The results will be handled in the next // idle tick instead. gInventory.removeObserver(this); - doOnIdle(boost::bind(&LLInitialWearablesFetch::processContents,this)); + doOnIdleOneTime(boost::bind(&LLInitialWearablesFetch::processContents,this)); } void LLInitialWearablesFetch::add(InitialWearableData &data) @@ -69,7 +70,7 @@ void LLInitialWearablesFetch::processContents() LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t wearable_array; LLFindWearables is_wearable; - gInventory.collectDescendentsIf(mCompleteFolders.front(), cat_array, wearable_array, + gInventory.collectDescendentsIf(mComplete.front(), cat_array, wearable_array, LLInventoryModel::EXCLUDE_TRASH, is_wearable); LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true); @@ -86,12 +87,11 @@ void LLInitialWearablesFetch::processContents() delete this; } -class LLFetchAndLinkObserver: public LLInventoryFetchObserver +class LLFetchAndLinkObserver: public LLInventoryFetchItemsObserver { public: - LLFetchAndLinkObserver(LLInventoryFetchObserver::item_ref_t& ids): - m_ids(ids), - LLInventoryFetchObserver(true) // retry for missing items + LLFetchAndLinkObserver(uuid_vec_t& ids): + LLInventoryFetchItemsObserver(ids) { } ~LLFetchAndLinkObserver() @@ -103,8 +103,8 @@ public: // Link to all fetched items in COF. LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy; - for (LLInventoryFetchObserver::item_ref_t::iterator it = m_ids.begin(); - it != m_ids.end(); + for (uuid_vec_t::iterator it = mIDs.begin(); + it != mIDs.end(); ++it) { LLUUID id = *it; @@ -119,12 +119,11 @@ public: item->getLinkedUUID(), LLAppearanceMgr::instance().getCOF(), item->getName(), + item->getDescription(), LLAssetType::AT_LINK, link_waiter); } } -private: - LLInventoryFetchObserver::item_ref_t m_ids; }; void LLInitialWearablesFetch::processWearablesMessage() @@ -132,7 +131,7 @@ void LLInitialWearablesFetch::processWearablesMessage() if (!mAgentInitialWearables.empty()) // We have an empty current outfit folder, use the message data instead. { const LLUUID current_outfit_id = LLAppearanceMgr::instance().getCOF(); - LLInventoryFetchObserver::item_ref_t ids; + uuid_vec_t ids; for (U8 i = 0; i < mAgentInitialWearables.size(); ++i) { // Populate the current outfit folder with links to the wearables passed in the message @@ -173,10 +172,10 @@ void LLInitialWearablesFetch::processWearablesMessage() // Need to fetch the inventory items for ids, then create links to them after they arrive. LLFetchAndLinkObserver *fetcher = new LLFetchAndLinkObserver(ids); - fetcher->fetchItems(ids); + fetcher->startFetch(); // If no items to be fetched, done will never be triggered. - // TODO: Change LLInventoryFetchObserver::fetchItems to trigger done() on this condition. - if (fetcher->isEverythingComplete()) + // TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition. + if (fetcher->isFinished()) { fetcher->done(); } @@ -191,7 +190,8 @@ void LLInitialWearablesFetch::processWearablesMessage() } } -LLLibraryOutfitsFetch::LLLibraryOutfitsFetch() : +LLLibraryOutfitsFetch::LLLibraryOutfitsFetch(const LLUUID& my_outfits_id) : + LLInventoryFetchDescendentsObserver(my_outfits_id), mCurrFetchStep(LOFS_FOLDER), mOutfitsPopulated(false) { @@ -210,8 +210,8 @@ void LLLibraryOutfitsFetch::done() { // Delay this until idle() routine, since it's a heavy operation and // we also can't have it run within notifyObservers. - doOnIdle(boost::bind(&LLLibraryOutfitsFetch::doneIdle,this)); - gInventory.removeObserver(this); // Prevent doOnIdle from being added twice. + doOnIdleOneTime(boost::bind(&LLLibraryOutfitsFetch::doneIdle,this)); + gInventory.removeObserver(this); // Prevent doOnIdleOneTime from being added twice. } void LLLibraryOutfitsFetch::doneIdle() @@ -254,7 +254,7 @@ void LLLibraryOutfitsFetch::doneIdle() } } -void LLLibraryOutfitsFetch::folderDone(void) +void LLLibraryOutfitsFetch::folderDone() { LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t wearable_array; @@ -282,20 +282,21 @@ void LLLibraryOutfitsFetch::folderDone(void) mLibraryClothingID = cat->getUUID(); } - mCompleteFolders.clear(); + mComplete.clear(); // Get the complete information on the items in the inventory. uuid_vec_t folders; folders.push_back(mClothingID); folders.push_back(mLibraryClothingID); - fetchDescendents(folders); - if (isEverythingComplete()) + setFetchIDs(folders); + startFetch(); + if (isFinished()) { done(); } } -void LLLibraryOutfitsFetch::outfitsDone(void) +void LLLibraryOutfitsFetch::outfitsDone() { LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t wearable_array; @@ -336,10 +337,10 @@ void LLLibraryOutfitsFetch::outfitsDone(void) mImportedClothingID = cat->getUUID(); } - mCompleteFolders.clear(); - - fetchDescendents(folders); - if (isEverythingComplete()) + mComplete.clear(); + setFetchIDs(folders); + startFetch(); + if (isFinished()) { done(); } @@ -372,7 +373,7 @@ private: }; // Copy the clothing folders from the library into the imported clothing folder -void LLLibraryOutfitsFetch::libraryDone(void) +void LLLibraryOutfitsFetch::libraryDone() { if (mImportedClothingID != LLUUID::null) { @@ -427,22 +428,22 @@ void LLLibraryOutfitsFetch::libraryDone(void) } } -void LLLibraryOutfitsFetch::importedFolderFetch(void) +void LLLibraryOutfitsFetch::importedFolderFetch() { // Fetch the contents of the Imported Clothing Folder uuid_vec_t folders; folders.push_back(mImportedClothingID); - mCompleteFolders.clear(); - - fetchDescendents(folders); - if (isEverythingComplete()) + mComplete.clear(); + setFetchIDs(folders); + startFetch(); + if (isFinished()) { done(); } } -void LLLibraryOutfitsFetch::importedFolderDone(void) +void LLLibraryOutfitsFetch::importedFolderDone() { LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t wearable_array; @@ -463,15 +464,16 @@ void LLLibraryOutfitsFetch::importedFolderDone(void) mImportedClothingFolders.push_back(cat->getUUID()); } - mCompleteFolders.clear(); - fetchDescendents(folders); - if (isEverythingComplete()) + mComplete.clear(); + setFetchIDs(folders); + startFetch(); + if (isFinished()) { done(); } } -void LLLibraryOutfitsFetch::contentsDone(void) +void LLLibraryOutfitsFetch::contentsDone() { LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t wearable_array; @@ -506,6 +508,7 @@ void LLLibraryOutfitsFetch::contentsDone(void) item->getLinkedUUID(), new_outfit_folder_id, item->getName(), + item->getDescription(), LLAssetType::AT_LINK, NULL); } |