diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2012-04-02 17:26:38 -0400 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2012-04-02 17:26:38 -0400 |
commit | 7c14e354aedf5de21a3255a467750a09f18e33eb (patch) | |
tree | 5b52f70e6a668ddd0bc650779fffc611834ed113 /indra | |
parent | 02328a13d7a5b6fde9f4a7afa7816e3acc7eee83 (diff) |
SH-3064 WIP - centralized logic for mapping rez status S32 values to strings
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llviewerassetstats.cpp | 7 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 25 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.h | 1 | ||||
-rwxr-xr-x | indra/newview/llvoavatarself.cpp | 10 | ||||
-rwxr-xr-x | indra/newview/tests/llviewerassetstats_test.cpp | 9 |
5 files changed, 30 insertions, 22 deletions
diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp index 0adefbc500..9e627a5c61 100755 --- a/indra/newview/llviewerassetstats.cpp +++ b/indra/newview/llviewerassetstats.cpp @@ -346,11 +346,10 @@ LLViewerAssetStats::asLLSD(bool compact_output) slot[mean_tag] = LLSD(F64(stats.mFPS.getMean())); } reg_stat[avatar_tag][avatar_nearby_tag] = LLSD::emptyArray(); - if (stats.mAvatarRezStates.size() > 2) + for (S32 rez_stat=0; rez_stat < stats.mAvatarRezStates.size(); ++rez_stat) { - reg_stat[avatar_tag][avatar_nearby_tag]["cloud"] = stats.mAvatarRezStates[0]; - reg_stat[avatar_tag][avatar_nearby_tag]["gray"] = stats.mAvatarRezStates[1]; - reg_stat[avatar_tag][avatar_nearby_tag]["textured"] = stats.mAvatarRezStates[2]; + std::string rez_status_name = LLVOAvatar::rezStatusToString(rez_stat); + reg_stat["nearby"][rez_status_name] = stats.mAvatarRezStates[rez_stat]; } U32 grid_x(0), grid_y(0); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 1537435526..c6726fa860 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -779,13 +779,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, std::string LLVOAvatar::avString() const { - std::string viz_string; - if (getIsCloud()) - viz_string = "cloud"; - else if (isFullyTextured()) - viz_string = "textured"; - else - viz_string = "gray"; + std::string viz_string = LLVOAvatar::rezStatusToString(getRezzedStatus()); return " Avatar '" + getFullname() + "' " + viz_string + " "; } @@ -1076,6 +1070,15 @@ void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts) } // static +std::string LLVOAvatar::rezStatusToString(S32 rez_status) +{ + if (rez_status==0) return "cloud"; + if (rez_status==1) return "gray"; + if (rez_status==2) return "textured"; + return "unknown"; +} + +// static void LLVOAvatar::dumpBakedStatus() { LLVector3d camera_pos_global = gAgentCamera.getCameraPositionGlobal(); @@ -8607,13 +8610,7 @@ void LLVOAvatar::idleUpdateRenderCost() } - std::string viz_string; - if (getIsCloud()) - viz_string = "cloud"; - else if (isFullyTextured()) - viz_string = "textured"; - else - viz_string = "gray"; + std::string viz_string = LLVOAvatar::rezStatusToString(getRezzedStatus()); setDebugText(llformat("%s %d", viz_string.c_str(), cost)); mVisualComplexity = cost; F32 green = 1.f-llclamp(((F32) cost-(F32)ARC_LIMIT)/(F32)ARC_LIMIT, 0.f, 1.f); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 76261c0dc8..04ef8d2014 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -555,6 +555,7 @@ public: BOOL isFullyBaked(); static BOOL areAllNearbyInstancesBaked(S32& grey_avatars); static void getNearbyRezzedStats(std::vector<S32>& counts); + static std::string rezStatusToString(S32 status); //-------------------------------------------------------------------- // Baked textures diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 5eb0cefb40..96f9ff39dd 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2128,14 +2128,16 @@ LLSD LLVOAvatarSelf::metricsData() // runway - add region info LLSD result; result["id"] = getID(); - result["rez_status"] = getRezzedStatus(); + result["rez_status"] = LLVOAvatar::rezStatusToString(getRezzedStatus()); result["is_self"] = isSelf(); std::vector<S32> rez_counts; LLVOAvatar::getNearbyRezzedStats(rez_counts); result["nearby"] = LLSD::emptyMap(); - result["nearby"]["cloud"] = rez_counts[0]; - result["nearby"]["gray"] = rez_counts[1]; - result["nearby"]["textured"] = rez_counts[2]; + for (S32 i=0; i<rez_counts.size(); ++i) + { + std::string rez_status_name = LLVOAvatar::rezStatusToString(i); + result["nearby"][rez_status_name] = rez_counts[i]; + } result["timers"]["debug_existence"] = mDebugExistenceTimer.getElapsedTimeF32(); result["timers"]["ruth_debug"] = mRuthDebugTimer.getElapsedTimeF32(); result["timers"]["ruth"] = mRuthTimer.getElapsedTimeF32(); diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp index 5e18f91b23..ba760c0695 100755 --- a/indra/newview/tests/llviewerassetstats_test.cpp +++ b/indra/newview/tests/llviewerassetstats_test.cpp @@ -45,6 +45,15 @@ void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts) counts[2] = 1; } +// static +std::string LLVOAvatar::rezStatusToString(S32 rez_status) +{ + if (rez_status==0) return "cloud"; + if (rez_status=1) return "gray"; + if (rez_status=2) return "textured"; + return "unknown"; +} + static const char * all_keys[] = { "duration", |