diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-04-05 02:35:07 +0300 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-04-15 23:44:06 +0300 |
commit | 73324129820075c9db2db5a0108a7d1c1403f459 (patch) | |
tree | b00beadfc4c862c52464bb5357d765e98ef7607a /indra/newview/llvoavatar.cpp | |
parent | eee39a9654e610cd2bb861c9a34f2071c098ac39 (diff) |
viewer#676 Use attacment info for rez state reporting
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rw-r--r-- | indra/newview/llvoavatar.cpp | 63 |
1 files changed, 50 insertions, 13 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index fd99491eb7..10c403fbd8 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -679,6 +679,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mVisuallyMuteSetting(AV_RENDER_NORMALLY), mMutedAVColor(LLColor4::white /* used for "uninitialize" */), mFirstFullyVisible(true), + mFirstDecloudTime(-1.f), mFirstUseDelaySeconds(FIRST_APPEARANCE_CLOUD_MIN_DELAY), mFullyLoaded(false), mPreviousFullyLoaded(false), @@ -924,7 +925,9 @@ S32 LLVOAvatar::getRezzedStatus() const { if (getIsCloud()) return 0; bool textured = isFullyTextured(); - if (textured && allBakedTexturesCompletelyDownloaded()) return 3; + bool all_baked_loaded = allBakedTexturesCompletelyDownloaded(); + if (textured && all_baked_loaded && getAttachmentCount() == mSimAttachments.size()) return 4; + if (textured && all_baked_loaded) return 3; if (textured) return 2; llassert(hasGray()); return 1; // gray @@ -977,10 +980,13 @@ bool LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars) } // static -void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts) +void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts, F32& avg_cloud_time, S32& cloud_avatars) { counts.clear(); - counts.resize(4); + counts.resize(5); + avg_cloud_time = 0; + cloud_avatars = 0; + S32 count_avg = 0; for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); iter != LLCharacter::sInstances.end(); ++iter) { @@ -989,8 +995,23 @@ void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts) { S32 rez_status = inst->getRezzedStatus(); counts[rez_status]++; + F32 time = inst->getFirstDecloudTime(); + if (time >= 0) + { + avg_cloud_time+=time; + count_avg++; + } + if (!inst->isFullyLoaded() || time < 0) + { + // still renders as cloud + cloud_avatars++; + } } } + if (count_avg > 0) + { + avg_cloud_time /= count_avg; + } } // static @@ -998,8 +1019,9 @@ std::string LLVOAvatar::rezStatusToString(S32 rez_status) { if (rez_status==0) return "cloud"; if (rez_status==1) return "gray"; - if (rez_status==2) return "downloading"; - if (rez_status==3) return "full"; + if (rez_status==2) return "downloading baked"; + if (rez_status==3) return "loading attachments"; + if (rez_status==4) return "full"; return "unknown"; } @@ -3100,14 +3122,15 @@ void LLVOAvatar::idleUpdateLoadingEffect() if (mFirstFullyVisible) { mFirstFullyVisible = false; + mFirstDecloudTime = mFirstAppearanceMessageTimer.getElapsedTimeF32(); if (isSelf()) { - LL_INFOS("Avatar") << avString() << "self isFullyLoaded, mFirstFullyVisible" << LL_ENDL; + LL_INFOS("Avatar") << avString() << "self isFullyLoaded, mFirstFullyVisible after " << mFirstDecloudTime << LL_ENDL; LLAppearanceMgr::instance().onFirstFullyVisible(); } else { - LL_INFOS("Avatar") << avString() << "other isFullyLoaded, mFirstFullyVisible" << LL_ENDL; + LL_INFOS("Avatar") << avString() << "other isFullyLoaded, mFirstFullyVisible after " << mFirstDecloudTime << LL_ENDL; } } @@ -3418,6 +3441,7 @@ void LLVOAvatar::idleUpdateNameTagText(bool new_name) static LLUICachedControl<bool> show_display_names("NameTagShowDisplayNames", true); static LLUICachedControl<bool> show_usernames("NameTagShowUsernames", true); + static LLUICachedControl<bool> show_rez_status("NameTagDebugAVRezState", false); if (LLAvatarName::useDisplayNames()) { @@ -3451,6 +3475,12 @@ void LLVOAvatar::idleUpdateNameTagText(bool new_name) addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font, true); } + if (show_rez_status) + { + std::string av_string = LLVOAvatar::rezStatusToString(mLastRezzedStatus); + addNameTagLine(av_string, name_tag_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall(), true); + } + mNameAway = is_away; mNameDoNotDisturb = is_do_not_disturb; mNameMute = is_muted; @@ -7888,11 +7918,11 @@ LLVOAvatar* LLVOAvatar::findAvatarFromAttachment( LLViewerObject* obj ) return NULL; } -S32 LLVOAvatar::getAttachmentCount() +S32 LLVOAvatar::getAttachmentCount() const { S32 count = 0; - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) + for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) { LLViewerJointAttachment* pAttachment = iter->second; count += pAttachment->mAttachedObjects.size(); @@ -8060,7 +8090,7 @@ bool LLVOAvatar::getIsCloud() const void LLVOAvatar::updateRezzedStatusTimers(S32 rez_status) { // State machine for rezzed status. Statuses are -1 on startup, 0 - // = cloud, 1 = gray, 2 = downloading, 3 = full. + // = cloud, 1 = gray, 2 = downloading, 3 = waiting for attachments, 4 = full. // Purpose is to collect time data for each it takes avatar to reach // various loading landmarks: gray, textured (partial), textured fully. @@ -8093,7 +8123,7 @@ void LLVOAvatar::updateRezzedStatusTimers(S32 rez_status) stopPhase("load_" + LLVOAvatar::rezStatusToString(i)); stopPhase("first_load_" + LLVOAvatar::rezStatusToString(i), false); } - if (rez_status == 3) + if (rez_status == 4) { // "fully loaded", mark any pending appearance change complete. selfStopPhase("update_appearance_from_cof"); @@ -8104,6 +8134,12 @@ void LLVOAvatar::updateRezzedStatusTimers(S32 rez_status) } } mLastRezzedStatus = rez_status; + + static LLUICachedControl<bool> show_rez_status("NameTagDebugAVRezState", false); + if (show_rez_status) + { + mNameIsSet = false; + } } } @@ -8249,7 +8285,7 @@ bool LLVOAvatar::updateIsFullyLoaded() ); // compare amount of attachments to one reported by simulator - if (!loading && !isSelf() && mLastCloudAttachmentCount != mSimAttachments.size()) + if (!loading && !isSelf() && rez_status < 4 && mLastCloudAttachmentCount != mSimAttachments.size()) { S32 attachment_count = getAttachmentCount(); if (mLastCloudAttachmentCount != attachment_count) @@ -9345,8 +9381,9 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe << " on point " << (S32)attach_point << LL_ENDL; mSimAttachments[attachment_id] = attach_point; - } + } + // todo? Doesn't detect if attachments were switched if (old_size != mSimAttachments.size()) { mLastCloudAttachmentCount = 0; |