From 0c95f8bf30bc6ec9835c5a298bf27115a2a92047 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 19 Nov 2009 12:03:11 -0500 Subject: For EXT-2623 - object missing wearables and attachments on initial login --HG-- branch : avatar-pipeline --- indra/newview/llagentwearables.cpp | 57 ++++++++++++++++++++++++++++++++--- indra/newview/llinventoryobserver.cpp | 3 +- 2 files changed, 55 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 6b2033fc6f..e78ea88b94 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -2196,11 +2196,48 @@ void LLInitialWearablesFetch::processContents() delete this; } +class LLFetchAndLinkObserver: public LLInventoryFetchObserver +{ +public: + LLFetchAndLinkObserver(LLInventoryFetchObserver::item_ref_t& ids): + m_ids(ids) + { + llwarns << "LLFetchAndLinkObserver" << llendl; + } + ~LLFetchAndLinkObserver() + { + llwarns << "~LLFetchAndLinkObserver" << llendl; + } + virtual void done() + { + gInventory.removeObserver(this); + // Link to all fetched items in COF. + for (LLInventoryFetchObserver::item_ref_t::iterator it = m_ids.begin(); + it != m_ids.end(); + ++it) + { + LLUUID id = *it; + LLViewerInventoryItem *item = gInventory.getItem(*it); + if (!item) + { + llwarns << "LLFetchAndLinkObserver fetch failed!" << llendl; + continue; + } + link_inventory_item(gAgent.getID(), item->getLinkedUUID(), LLAppearanceManager::instance().getCOF(), item->getName(), + LLAssetType::AT_LINK, LLPointer(NULL)); + } + + } +private: + LLInventoryFetchObserver::item_ref_t m_ids; +}; + void LLInitialWearablesFetch::processWearablesMessage() { if (!mAgentInitialWearables.empty()) // We have an empty current outfit folder, use the message data instead. { - const LLUUID current_outfit_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); + const LLUUID current_outfit_id = LLAppearanceManager::instance().getCOF(); + LLInventoryFetchObserver::item_ref_t ids; for (U8 i = 0; i < mAgentInitialWearables.size(); ++i) { // Populate the current outfit folder with links to the wearables passed in the message @@ -2209,9 +2246,7 @@ void LLInitialWearablesFetch::processWearablesMessage() if (wearable_data->mAssetID.notNull()) { #ifdef USE_CURRENT_OUTFIT_FOLDER - const std::string link_name = "WearableLink"; // Unimportant what this is named, it isn't exposed. - link_inventory_item(gAgent.getID(), wearable_data->mItemID, current_outfit_id, link_name, - LLAssetType::AT_LINK, LLPointer(NULL)); + ids.push_back(wearable_data->mItemID); #endif // Fetch the wearables LLWearableList::instance().getAsset(wearable_data->mAssetID, @@ -2225,6 +2260,20 @@ void LLInitialWearablesFetch::processWearablesMessage() << wearable_data->mItemID << " assetID " << wearable_data->mAssetID << llendl; } } + + // Need to fetch the inventory items for ids, then create links to them after they arrive. + LLFetchAndLinkObserver *fetcher = new LLFetchAndLinkObserver(ids); + fetcher->fetchItems(ids); + // If no items to be fetched, done will never be triggered. + // TODO: Change LLInventoryFetchObserver::fetchItems to trigger done() on this condition. + if (fetcher->isEverythingComplete()) + { + fetcher->done(); + } + else + { + gInventory.addObserver(fetcher); + } } else { diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 3ccf593d27..e904fb6c92 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -115,7 +115,8 @@ void LLInventoryFetchObserver::changed(U32 mask) // BUG: This can cause done() to get called prematurely below. // This happens with the LLGestureInventoryFetchObserver that // loads gestures at startup. JC - it = mIncomplete.erase(it); + //it = mIncomplete.erase(it); + ++it; continue; } if(item->isComplete()) -- cgit v1.2.3 From 62ce5fa4628672c8f9b95faac2797ce82c59deed Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 19 Nov 2009 16:00:40 -0500 Subject: For EXT-2623 - object missing wearables and attachments on initial login --HG-- branch : avatar-pipeline --- indra/newview/llagentwearables.cpp | 30 +++++++++++++++++++++++++----- indra/newview/llappearancemgr.cpp | 4 ++++ indra/newview/llinventoryobserver.cpp | 19 ++++++++++++++----- indra/newview/llinventoryobserver.h | 3 ++- 4 files changed, 45 insertions(+), 11 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index e78ea88b94..a93b0c1357 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -2190,8 +2190,6 @@ void LLInitialWearablesFetch::processContents() else { processWearablesMessage(); - // Create links for attachments that may have arrived before the COF existed. - LLAppearanceManager::instance().linkRegisteredAttachments(); } delete this; } @@ -2200,7 +2198,8 @@ class LLFetchAndLinkObserver: public LLInventoryFetchObserver { public: LLFetchAndLinkObserver(LLInventoryFetchObserver::item_ref_t& ids): - m_ids(ids) + m_ids(ids), + LLInventoryFetchObserver(true) { llwarns << "LLFetchAndLinkObserver" << llendl; } @@ -2220,13 +2219,12 @@ public: LLViewerInventoryItem *item = gInventory.getItem(*it); if (!item) { - llwarns << "LLFetchAndLinkObserver fetch failed!" << llendl; + llwarns << "fetch failed!" << llendl; continue; } link_inventory_item(gAgent.getID(), item->getLinkedUUID(), LLAppearanceManager::instance().getCOF(), item->getName(), LLAssetType::AT_LINK, LLPointer(NULL)); } - } private: LLInventoryFetchObserver::item_ref_t m_ids; @@ -2261,6 +2259,28 @@ void LLInitialWearablesFetch::processWearablesMessage() } } + // Add all current attachments to the requested items as well. + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); + if( avatar ) + { + for (LLVOAvatar::attachment_map_t::const_iterator iter = avatar->mAttachmentPoints.begin(); + iter != avatar->mAttachmentPoints.end(); ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + if (!attachment) continue; + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); + attachment_iter != attachment->mAttachedObjects.end(); + ++attachment_iter) + { + LLViewerObject* attached_object = (*attachment_iter); + if (!attached_object) continue; + const LLUUID& item_id = attached_object->getItemID(); + if (item_id.isNull()) continue; + ids.push_back(item_id); + } + } + } + // Need to fetch the inventory items for ids, then create links to them after they arrive. LLFetchAndLinkObserver *fetcher = new LLFetchAndLinkObserver(ids); fetcher->fetchItems(ids); diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 60c6061e96..bec70ce827 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -990,6 +990,10 @@ void LLAppearanceManager::registerAttachment(const LLUUID& item_id) gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); gInventory.notifyObservers(); } + else + { + llwarns << "missing item, can't link" << llendl; + } } else { diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index e904fb6c92..06f4b36df3 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -112,11 +112,20 @@ void LLInventoryFetchObserver::changed(U32 mask) LLViewerInventoryItem* item = gInventory.getItem(*it); if(!item) { - // BUG: This can cause done() to get called prematurely below. - // This happens with the LLGestureInventoryFetchObserver that - // loads gestures at startup. JC - //it = mIncomplete.erase(it); - ++it; + if (mRetryIfMissing) + { + // BAP changed to skip these items, so we should keep retrying until they arrive. + // Did not make this the default behavior because of uncertainty about impact - + // could cause some observers that currently complete to wait forever. + ++it; + } + else + { + // BUG: This can cause done() to get called prematurely below. + // This happens with the LLGestureInventoryFetchObserver that + // loads gestures at startup. JC + it = mIncomplete.erase(it); + } continue; } if(item->isComplete()) diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index 384e6292e8..3a083e913b 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -106,7 +106,7 @@ protected: class LLInventoryFetchObserver : public LLInventoryObserver { public: - LLInventoryFetchObserver() {} + LLInventoryFetchObserver(bool retry_if_missing = false): mRetryIfMissing(retry_if_missing) {} virtual void changed(U32 mask); typedef std::vector item_ref_t; @@ -116,6 +116,7 @@ public: virtual void done() = 0; protected: + bool mRetryIfMissing; item_ref_t mComplete; item_ref_t mIncomplete; }; -- cgit v1.2.3 From fae78349915a1f8603beb034166f8ea5c64dc5a6 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 19 Nov 2009 17:36:13 -0500 Subject: cleanup: log file spam --HG-- branch : avatar-pipeline --- indra/newview/llagentwearables.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index a93b0c1357..6595e28622 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -2160,7 +2160,6 @@ void LLLibraryOutfitsFetch::contentsDone(void) LLInitialWearablesFetch::~LLInitialWearablesFetch() { - llinfos << "~LLInitialWearablesFetch" << llendl; } // virtual @@ -2201,11 +2200,9 @@ public: m_ids(ids), LLInventoryFetchObserver(true) { - llwarns << "LLFetchAndLinkObserver" << llendl; } ~LLFetchAndLinkObserver() { - llwarns << "~LLFetchAndLinkObserver" << llendl; } virtual void done() { -- cgit v1.2.3