diff options
-rw-r--r-- | indra/newview/llappearancemgr.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llappearancemgr.h | 4 | ||||
-rw-r--r-- | indra/newview/llinventoryobserver.cpp | 64 | ||||
-rw-r--r-- | indra/newview/llinventoryobserver.h | 13 | ||||
-rw-r--r-- | indra/newview/llstartup.cpp | 97 | ||||
-rw-r--r-- | indra/newview/llstartup.h | 2 |
6 files changed, 94 insertions, 89 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 52a5587a16..7deaaf1593 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1083,6 +1083,7 @@ void LLAppearanceMgr::shallowCopyCategory(const LLUUID& src_id, const LLUUID& ds llwarns << "folder not found for src " << src_id.asString() << llendl; return; } + llinfos << "starting, src_id " << src_id << " name " << src_cat->getName() << " dst_id " << dst_id << llendl; LLUUID parent_id = dst_id; if(parent_id.isNull()) { @@ -1103,6 +1104,7 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL LLInventoryModel::cat_array_t* cats; LLInventoryModel::item_array_t* items; gInventory.getDirectDescendentsOf(src_id, cats, items); + llinfos << "copying " << items->count() << " items" << llendl; for (LLInventoryModel::item_array_t::const_iterator iter = items->begin(); iter != items->end(); ++iter) @@ -1142,6 +1144,7 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL case LLAssetType::AT_BODYPART: case LLAssetType::AT_GESTURE: { + llinfos << "copying inventory item " << item->getName() << llendl; copy_inventory_item(gAgent.getID(), item->getPermissions().getOwner(), item->getUUID(), diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index e42f9f7d6f..0896f1a5cb 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -313,6 +313,9 @@ public: } virtual void done() { + llinfos << this << " done with incomplete " << mIncomplete.size() + << " complete " << mComplete.size() << " calling callable" << llendl; + gInventory.removeObserver(this); doOnIdleOneTime(mCallable); delete this; @@ -355,6 +358,7 @@ public: return; } + llinfos << "stage1 got " << item_array.count() << " items, passing to stage2 " << llendl; uuid_vec_t ids; for(S32 i = 0; i < count; ++i) { diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 0ac8fbcb15..fbc79d5a02 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -62,8 +62,7 @@ #include "llsdutil.h" #include <deque> -const U32 LLInventoryFetchItemsObserver::MAX_NUM_ATTEMPTS_TO_PROCESS = 10; -const F32 LLInventoryFetchItemsObserver::FETCH_TIMER_EXPIRY = 10.0f; +const F32 LLInventoryFetchItemsObserver::FETCH_TIMER_EXPIRY = 60.0f; LLInventoryObserver::LLInventoryObserver() @@ -143,52 +142,47 @@ void LLInventoryCompletionObserver::watchItem(const LLUUID& id) } LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const LLUUID& item_id) : - LLInventoryFetchObserver(item_id), - - mNumTries(MAX_NUM_ATTEMPTS_TO_PROCESS) + LLInventoryFetchObserver(item_id) { mIDs.clear(); mIDs.push_back(item_id); } LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids) : - LLInventoryFetchObserver(item_ids), - - mNumTries(MAX_NUM_ATTEMPTS_TO_PROCESS) + LLInventoryFetchObserver(item_ids) { } void LLInventoryFetchItemsObserver::changed(U32 mask) { + llinfos << this << " remaining incomplete " << mIncomplete.size() + << " complete " << mComplete.size() + << " wait period " << mFetchingPeriod.getRemainingTimeF32() + << llendl; + // scan through the incomplete items and move or erase them as // appropriate. if (!mIncomplete.empty()) { - // if period of an attempt expired... - if (mFetchingPeriod.hasExpired()) - { - // ...reset timer and reduce count of attempts - mFetchingPeriod.reset(); - mFetchingPeriod.setTimerExpirySec(FETCH_TIMER_EXPIRY); - --mNumTries; - - LL_INFOS("InventoryFetch") << "LLInventoryFetchItemsObserver: " << this << ", attempt(s) left: " << (S32)mNumTries << LL_ENDL; - } - - // do we still have any attempts? - bool timeout_expired = mNumTries <= 0; + // Have we exceeded max wait time? + bool timeout_expired = mFetchingPeriod.hasExpired(); for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); ) { const LLUUID& item_id = (*it); LLViewerInventoryItem* item = gInventory.getItem(item_id); - if (!item) + if (item && item->isFinished()) + { + mComplete.push_back(item_id); + it = mIncomplete.erase(it); + } + else { if (timeout_expired) { // Just concede that this item hasn't arrived in reasonable time and continue on. - LL_WARNS("InventoryFetch") << "Fetcher timed out when fetching inventory item UUID: " << item_id << LL_ENDL; + llwarns << "Fetcher timed out when fetching inventory item UUID: " << item_id << LL_ENDL; it = mIncomplete.erase(it); } else @@ -196,22 +190,16 @@ void LLInventoryFetchItemsObserver::changed(U32 mask) // Keep trying. ++it; } - continue; - } - if (item->isFinished()) - { - mComplete.push_back(item_id); - it = mIncomplete.erase(it); - continue; } - ++it; } - if (mIncomplete.empty()) - { - mNumTries = MAX_NUM_ATTEMPTS_TO_PROCESS; - done(); - } + } + + if (mIncomplete.empty()) + { + llinfos << this << " done at remaining incomplete " + << mIncomplete.size() << " complete " << mComplete.size() << llendl; + done(); } //llinfos << "LLInventoryFetchItemsObserver::changed() mComplete size " << mComplete.size() << llendl; //llinfos << "LLInventoryFetchItemsObserver::changed() mIncomplete size " << mIncomplete.size() << llendl; @@ -329,8 +317,8 @@ void LLInventoryFetchItemsObserver::startFetch() items_llsd.append(item_entry); } - mFetchingPeriod.resetWithExpiry(FETCH_TIMER_EXPIRY); - mNumTries = MAX_NUM_ATTEMPTS_TO_PROCESS; + mFetchingPeriod.reset(); + mFetchingPeriod.setTimerExpirySec(FETCH_TIMER_EXPIRY); fetch_items_from_llsd(items_llsd); } diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index 72c13f55c6..4a88a65bf8 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -109,18 +109,7 @@ public: /*virtual*/ void startFetch(); /*virtual*/ void changed(U32 mask); private: - S8 mNumTries; // Number of times changed() was called without success - LLFrameTimer mFetchingPeriod; - - /** - * If the viewer gets a notification, your observer assumes - * that that notification is for itself and then tries to process - * the results. The notification could be for something else (e.g. - * you're fetching an item and a notification gets triggered because - * you renamed some other item). This counter is to specify how many - * periods of time to wait for before giving up. - */ - static const U32 MAX_NUM_ATTEMPTS_TO_PROCESS; + LLTimer mFetchingPeriod; /** * Period of waiting a notification when requested items get added into inventory. diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 5bd97efce6..d64e3aac14 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2372,6 +2372,7 @@ void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S3 } // *HACK: Must match name in Library or agent inventory +const std::string ROOT_GESTURES_FOLDER = "Gestures"; const std::string COMMON_GESTURES_FOLDER = "Common Gestures"; const std::string MALE_GESTURES_FOLDER = "Male Gestures"; const std::string FEMALE_GESTURES_FOLDER = "Female Gestures"; @@ -2405,6 +2406,61 @@ bool callback_choose_gender(const LLSD& notification, const LLSD& response) return false; } +void LLStartUp::copyLibraryGestures(const std::string& same_gender_gestures) +{ + llinfos << "Copying library gestures" << llendl; + + // Copy gestures + LLUUID lib_gesture_cat_id = + gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE,false,true); + if (lib_gesture_cat_id.isNull()) + { + llwarns << "Unable to copy gestures, source category not found" << llendl; + } + LLUUID dst_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE); + + std::vector<std::string> gesture_folders_to_copy; + gesture_folders_to_copy.push_back(MALE_GESTURES_FOLDER); + gesture_folders_to_copy.push_back(FEMALE_GESTURES_FOLDER); + gesture_folders_to_copy.push_back(COMMON_GESTURES_FOLDER); + gesture_folders_to_copy.push_back(SPEECH_GESTURES_FOLDER); + gesture_folders_to_copy.push_back(OTHER_GESTURES_FOLDER); + + for(std::vector<std::string>::iterator it = gesture_folders_to_copy.begin(); + it != gesture_folders_to_copy.end(); + ++it) + { + std::string& folder_name = *it; + + LLPointer<LLInventoryCallback> cb(NULL); + + if (folder_name == same_gender_gestures || + folder_name == COMMON_GESTURES_FOLDER || + folder_name == OTHER_GESTURES_FOLDER) + { + cb = new ActivateGestureCallback; + } + + + LLUUID cat_id = findDescendentCategoryIDByName(lib_gesture_cat_id,folder_name); + if (cat_id.isNull()) + { + llwarns << "failed to find gesture folder for " << folder_name << llendl; + } + else + { + llinfos << "initiating fetch and copy for " << folder_name << " cat_id " << cat_id << llendl; + LLAppearanceMgr* app_mgr = LLAppearanceMgr::getInstance(); + callAfterCategoryFetch(cat_id, + boost::bind(&LLAppearanceMgr::shallowCopyCategory, + app_mgr, + cat_id, + dst_id, + cb)); + } + } +} + void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, const std::string& gender_name ) { @@ -2448,45 +2504,8 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, } // Copy gestures - LLUUID dst_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE); - LLAppearanceMgr *app_mgr = &(LLAppearanceMgr::instance()); - - std::vector<std::string> gesture_folders_to_copy; - gesture_folders_to_copy.push_back(MALE_GESTURES_FOLDER); - gesture_folders_to_copy.push_back(FEMALE_GESTURES_FOLDER); - gesture_folders_to_copy.push_back(COMMON_GESTURES_FOLDER); - gesture_folders_to_copy.push_back(SPEECH_GESTURES_FOLDER); - gesture_folders_to_copy.push_back(OTHER_GESTURES_FOLDER); - - for(std::vector<std::string>::iterator it = gesture_folders_to_copy.begin(); - it != gesture_folders_to_copy.end(); - ++it) - { - std::string& folder_name = *it; - - LLPointer<LLInventoryCallback> cb(NULL); - if (folder_name == same_gender_gestures || - folder_name == COMMON_GESTURES_FOLDER || - folder_name == OTHER_GESTURES_FOLDER) - { - cb = new ActivateGestureCallback; - } - - // - Copy gender-specific gestures. - LLUUID cat_id = findDescendentCategoryIDByName( - gInventory.getLibraryRootFolderID(), - folder_name); - if (cat_id.notNull()) - { - callAfterCategoryFetch(cat_id, - boost::bind(&LLAppearanceMgr::shallowCopyCategory, - app_mgr, - cat_id, - dst_id, - cb)); - } - } - + copyLibraryGestures(same_gender_gestures); + // This is really misnamed -- it means we have started loading // an outfit/shape that will give the avatar a gender eventually. JC gAgent.setGenderChosen(TRUE); diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h index e1e108ca6a..661ed29fc7 100644 --- a/indra/newview/llstartup.h +++ b/indra/newview/llstartup.h @@ -96,6 +96,8 @@ public: // Load default fonts not already loaded at start screen static void fontInit(); + static void LLStartUp::copyLibraryGestures(const std::string& same_gender_gestures); + // outfit_folder_name can be a folder anywhere in your inventory, // but the name must be a case-sensitive exact match. // gender_name is either "male" or "female" |