From 8b3a19f19c3215c9d83d4d89c9c0a6a6e2ea3230 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 3 Dec 2021 23:34:29 +0200 Subject: SL-16445 Small cleanup in llvoavatar --- indra/newview/llvoavatar.cpp | 57 +++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 22 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 0e0ebce949..becbd37f32 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1324,7 +1324,8 @@ void LLVOAvatar::calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) { LL_RECORD_BLOCK_TIME(FTM_AVATAR_EXTENT_UPDATE); - S32 box_detail = gSavedSettings.getS32("AvatarBoundingBoxComplexity"); + static LLCachedControl box_detail_cache(gSavedSettings, "AvatarBoundingBoxComplexity"); + S32 box_detail = box_detail_cache; if (getOverallAppearance() != AOA_NORMAL) { if (isControlAvatar()) @@ -2533,10 +2534,11 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) { LL_INFOS() << "Warning! Idle on dead avatar" << LL_ENDL; return; - } + } + static LLCachedControl disable_all_render_types(gSavedSettings, "DisableAllRenderTypes"); if (!(gPipeline.hasRenderType(mIsControlAvatar ? LLPipeline::RENDER_TYPE_CONTROL_AV : LLPipeline::RENDER_TYPE_AVATAR)) - && !(gSavedSettings.getBOOL("DisableAllRenderTypes")) && !isSelf()) + && !disable_all_render_types && !isSelf()) { return; } @@ -2677,7 +2679,8 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) // Don't render the user's own voice visualizer when in mouselook, or when opening the mic is disabled. if(isSelf()) { - if(gAgentCamera.cameraMouselook() || gSavedSettings.getBOOL("VoiceDisableMic")) + static LLCachedControl voice_disable_mic(gSavedSettings, "VoiceDisableMic"); + if(gAgentCamera.cameraMouselook() || voice_disable_mic) { render_visualizer = false; } @@ -3146,11 +3149,14 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) } const F32 time_visible = mTimeVisible.getElapsedTimeF32(); - const F32 NAME_SHOW_TIME = gSavedSettings.getF32("RenderNameShowTime"); // seconds - const F32 FADE_DURATION = gSavedSettings.getF32("RenderNameFadeDuration"); // seconds - BOOL visible_avatar = isVisible() || mNeedsAnimUpdate; - BOOL visible_chat = gSavedSettings.getBOOL("UseChatBubbles") && (mChats.size() || mTyping); - BOOL render_name = visible_chat || + + static LLCachedControl NAME_SHOW_TIME(gSavedSettings, "RenderNameShowTime"); // seconds + static LLCachedControl FADE_DURATION(gSavedSettings, "RenderNameFadeDuration"); // seconds + static LLCachedControl use_chat_bubbles(gSavedSettings, "UseChatBubbles"); + + bool visible_avatar = isVisible() || mNeedsAnimUpdate; + bool visible_chat = use_chat_bubbles && (mChats.size() || mTyping); + bool render_name = visible_chat || (visible_avatar && ((sRenderName == RENDER_NAME_ALWAYS) || (sRenderName == RENDER_NAME_FADE && time_visible < NAME_SHOW_TIME))); @@ -3158,10 +3164,11 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) // draw if we're specifically hiding our own name. if (isSelf()) { + static LLCachedControl render_name_show_self(gSavedSettings, "RenderNameShowSelf"); + static LLCachedControl name_tag_mode(gSavedSettings, "AvatarNameTagMode"); render_name = render_name && !gAgentCamera.cameraMouselook() - && (visible_chat || (gSavedSettings.getBOOL("RenderNameShowSelf") - && gSavedSettings.getS32("AvatarNameTagMode") )); + && (visible_chat || (render_name_show_self && name_tag_mode)); } if ( !render_name ) @@ -3176,7 +3183,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) return; } - BOOL new_name = FALSE; + bool new_name = FALSE; if (visible_chat != mVisibleChat) { mVisibleChat = visible_chat; @@ -3241,7 +3248,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) idleUpdateNameTagAlpha(new_name, alpha); } -void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) +void LLVOAvatar::idleUpdateNameTagText(bool new_name) { LLNameValue *title = getNVPair("Title"); LLNameValue* firstname = getNVPair("FirstName"); @@ -3551,7 +3558,7 @@ void LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) mNameText->setPositionAgent(name_position); } -void LLVOAvatar::idleUpdateNameTagAlpha(BOOL new_name, F32 alpha) +void LLVOAvatar::idleUpdateNameTagAlpha(bool new_name, F32 alpha) { llassert(mNameText); @@ -3694,7 +3701,8 @@ void LLVOAvatar::updateAppearanceMessageDebugText() { debug_line += llformat(" - cof: %d req: %d rcv:%d", curr_cof_version, last_request_cof_version, last_received_cof_version); - if (gSavedSettings.getBOOL("DebugForceAppearanceRequestFailure")) + static LLCachedControl debug_force_failure(gSavedSettings, "DebugForceAppearanceRequestFailure"); + if (debug_force_failure) { debug_line += " FORCING ERRS"; } @@ -5928,7 +5936,8 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL //} //else { - LLUUID sound_id = LLUUID(gSavedSettings.getString("UISndTyping")); + static LLCachedControl ui_snd_string(gSavedSettings, "UISndTyping"); + LLUUID sound_id = LLUUID(ui_snd_string); gAudiop->triggerSound(sound_id, getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_SFX, char_pos_global); } } @@ -5996,7 +6005,7 @@ void LLVOAvatar::resetAnimations() // animations. LLUUID LLVOAvatar::remapMotionID(const LLUUID& id) { - BOOL use_new_walk_run = gSavedSettings.getBOOL("UseNewWalkRun"); + static LLCachedControl use_new_walk_run(gSavedSettings, "UseNewWalkRun"); LLUUID result = id; // start special case female walk for female avatars @@ -8184,7 +8193,8 @@ BOOL LLVOAvatar::isFullyLoaded() const bool LLVOAvatar::isTooComplex() const { bool too_complex; - bool render_friend = (LLAvatarTracker::instance().isBuddy(getID()) && gSavedSettings.getBOOL("AlwaysRenderFriends")); + static LLCachedControl always_render_friends(gSavedSettings, "AlwaysRenderFriends"); + bool render_friend = (LLAvatarTracker::instance().isBuddy(getID()) && always_render_friends); if (isSelf() || render_friend || mVisuallyMuteSetting == AV_ALWAYS_RENDER) { @@ -9037,7 +9047,8 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe // Parse visual params, if any. S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam); - bool drop_visual_params_debug = gSavedSettings.getBOOL("BlockSomeAvatarAppearanceVisualParams") && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing + static LLCachedControl block_some_avatars(gSavedSettings, "BlockSomeAvatarAppearanceVisualParams"); + bool drop_visual_params_debug = block_some_avatars && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing if( num_blocks > 1 && !drop_visual_params_debug) { //LL_DEBUGS("Avatar") << avString() << " handle visual params, num_blocks " << num_blocks << LL_ENDL; @@ -9142,10 +9153,12 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32 void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { LL_DEBUGS("Avatar") << "starts" << LL_ENDL; - - bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); + + static LLCachedControl enable_verbose_dumps(gSavedSettings, "DebugAvatarAppearanceMessage"); + static LLCachedControl block_avatar_appearance_messages(gSavedSettings, "BlockAvatarAppearanceMessages"); + std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_"; - if (gSavedSettings.getBOOL("BlockAvatarAppearanceMessages")) + if (block_avatar_appearance_messages) { LL_WARNS() << "Blocking AvatarAppearance message" << LL_ENDL; return; -- cgit v1.2.3