From 73324129820075c9db2db5a0108a7d1c1403f459 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 5 Apr 2024 02:35:07 +0300 Subject: viewer#676 Use attacment info for rez state reporting --- indra/newview/app_settings/settings.xml | 11 ++++ indra/newview/llvoavatar.cpp | 63 +++++++++++++++++----- indra/newview/llvoavatar.h | 8 +-- indra/newview/llvoavatarself.cpp | 7 ++- indra/newview/skins/default/xui/en/menu_viewer.xml | 10 ++++ 5 files changed, 82 insertions(+), 17 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 5997c59048..bf556b9046 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10346,6 +10346,17 @@ Value 1 + NameTagDebugAVRezState + + Comment + Show Avatar Rez state in name tag + Persist + 0 + Type + Boolean + Value + 0 + RenderInitError Comment 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& counts) +void LLVOAvatar::getNearbyRezzedStats(std::vector& 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::iterator iter = LLCharacter::sInstances.begin(); iter != LLCharacter::sInstances.end(); ++iter) { @@ -989,8 +995,23 @@ void LLVOAvatar::getNearbyRezzedStats(std::vector& 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 show_display_names("NameTagShowDisplayNames", true); static LLUICachedControl show_usernames("NameTagShowUsernames", true); + static LLUICachedControl 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 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; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 2af62ca83b..f83ea59080 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -382,7 +382,8 @@ public: // Loading state //-------------------------------------------------------------------- public: - bool isFullyLoaded() const; + bool isFullyLoaded() const; + F32 getFirstDecloudTime() const {return mFirstDecloudTime;} // check and return current state relative to limits // default will test only the geometry (combined=false). @@ -422,6 +423,7 @@ protected: private: bool mFirstFullyVisible; + F32 mFirstDecloudTime; F32 mFirstUseDelaySeconds; LLFrameTimer mFirstAppearanceMessageTimer; @@ -715,7 +717,7 @@ public: bool isFullyBaked(); static bool areAllNearbyInstancesBaked(S32& grey_avatars); - static void getNearbyRezzedStats(std::vector& counts); + static void getNearbyRezzedStats(std::vector& counts, F32& avg_cloud_time, S32& cloud_avatars); static std::string rezStatusToString(S32 status); //-------------------------------------------------------------------- @@ -939,7 +941,7 @@ protected: // Map of attachment points, by ID //-------------------------------------------------------------------- public: - S32 getAttachmentCount(); // Warning: order(N) not order(1) + S32 getAttachmentCount() const; // Warning: order(N) not order(1) typedef std::map attachment_map_t; attachment_map_t mAttachmentPoints; std::vector > mPendingAttachment; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index b1ca5f7a4b..b71b5022fc 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2226,16 +2226,21 @@ void LLVOAvatarSelf::appearanceChangeMetricsCoro(std::string url) // Status of our own rezzing. msg["rez_status"] = LLVOAvatar::rezStatusToString(getRezzedStatus()); + msg["first_decloud_time"] = getFirstDecloudTime(); // Status of all nearby avs including ourself. msg["nearby"] = LLSD::emptyArray(); std::vector rez_counts; - LLVOAvatar::getNearbyRezzedStats(rez_counts); + F32 avg_time; + S32 total_cloud_avatars; + LLVOAvatar::getNearbyRezzedStats(rez_counts, avg_time, total_cloud_avatars); for (S32 rez_stat = 0; rez_stat < rez_counts.size(); ++rez_stat) { std::string rez_status_name = LLVOAvatar::rezStatusToString(rez_stat); msg["nearby"][rez_status_name] = rez_counts[rez_stat]; } + msg["nearby"]["avg_decloud_time"] = avg_time; + msg["nearby"]["cloud_total"] = total_cloud_avatars; // std::vector bucket_fields("timer_name","is_self","grid_x","grid_y","is_using_server_bake"); std::vector by_fields; diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index d580369ab2..bc2ec6c984 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3916,6 +3916,16 @@ function="World.EnvPreset" + + + + -- cgit v1.2.3