From 1d6d3fc5a9698dfd64d5fa778823d38d514ec3b1 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 12 Jan 2010 16:33:08 -0800 Subject: Suppress rendering of last name "Resident" to display only SLIDs. Reviewed with Huseby --- indra/newview/llvoavatar.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4235f97eab..7df24c9ade 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2792,8 +2792,12 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) line += firstname->getString(); } - line += " "; - line += lastname->getString(); + // Suppress last name "Resident" as this is used for new SLID names + if (strcmp(lastname->getString(), "Resident")) + { + line += " "; + line += lastname->getString(); + } BOOL need_comma = FALSE; if (is_away || is_muted || is_busy) -- cgit v1.2.3 From 42176145c9e81dd99b65f88152df50a7b3ccf834 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 8 Feb 2010 14:55:30 -0800 Subject: Converted names build from avatar object LLNameValue pairs to SLID Added temporary getDisplayName() to LLCacheName Moved temporary placeholder display names into LLCacheName Eliminated rarely used LLAgentUI::buildName in favor of buildFullName Standardized buildFullName capitalization --- indra/newview/llvoavatar.cpp | 48 ++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 19 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 7df24c9ade..4f7b93b19d 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -44,6 +44,7 @@ #include #include "llaudioengine.h" +#include "llcachename.h" #include "noise.h" #include "sound_ids.h" @@ -2773,31 +2774,42 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) || is_appearance != mNameAppearance) { std::string line; - if (!sRenderGroupTitles) - { - // If all group titles are turned off, stack first name - // on a line above last name - line += firstname->getString(); - line += "\n"; - } - else if (title && title->getString() && title->getString()[0] != '\0') + // IDEVO JAMESDEBUG + //if (!sRenderGroupTitles) + //{ + // // If all group titles are turned off, stack first name + // // on a line above last name + // line += firstname->getString(); + // line += "\n"; + //} + //else if (title && title->getString() && title->getString()[0] != '\0') + //{ + // line += title->getString(); + // LLStringFn::replace_ascii_controlchars(line,LL_UNKNOWN_CHAR); + // line += "\n"; + // line += firstname->getString(); + //} + //else + //{ + // line += firstname->getString(); + //} + if (title && title->getString() && title->getString()[0] != '\0') { line += title->getString(); LLStringFn::replace_ascii_controlchars(line,LL_UNKNOWN_CHAR); line += "\n"; - line += firstname->getString(); } - else + + std::string display_name; + if (gCacheName->getDisplayName(getID(), display_name)) { - line += firstname->getString(); + line += display_name; } - - // Suppress last name "Resident" as this is used for new SLID names - if (strcmp(lastname->getString(), "Resident")) + else { - line += " "; - line += lastname->getString(); + line += LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); } + BOOL need_comma = FALSE; if (is_away || is_muted || is_busy) @@ -7520,9 +7532,7 @@ std::string LLVOAvatar::getFullname() const LLNameValue* last = getNVPair("LastName"); if (first && last) { - name += first->getString(); - name += " "; - name += last->getString(); + name = LLCacheName::buildFullName( first->getString(), last->getString() ); } return name; -- cgit v1.2.3 From 644c5cadbf8a0ab3ea7c2137e8819220a010c93f Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 10 Feb 2010 12:04:03 -0800 Subject: Name tags of friends appear in green. Refactored LLVOAvatar idleUpdateNameTag into smaller functions Eliminated unused LLHUDText::setUsePixelSize --- indra/newview/llvoavatar.cpp | 575 +++++++++++++++++++++++-------------------- 1 file changed, 305 insertions(+), 270 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4f7b93b19d..124851144a 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -53,6 +53,7 @@ #include "llanimationstates.h" #include "llavatarpropertiesprocessor.h" #include "llviewercontrol.h" +#include "llcallingcard.h" // IDEVO for LLAvatarTracker #include "lldrawpoolavatar.h" #include "lldriverparam.h" #include "lleditingmotion.h" @@ -651,11 +652,13 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mAppearanceAnimating(FALSE), mNameString(), mTitle(), - mNameAway(FALSE), - mNameBusy(FALSE), - mNameMute(FALSE), + mNameAway(false), + mNameBusy(false), + mNameMute(false), + mNameAppearance(false), + mNameFriend(false), + mNameAlpha(0.f), mRenderGroupTitles(sRenderGroupTitles), - mNameAppearance(FALSE), mFirstTEMessageReceived( FALSE ), mFirstAppearanceMessageReceived( FALSE ), mCulled( FALSE ), @@ -2660,303 +2663,335 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) && gSavedSettings.getS32("AvatarNameTagMode") )); } - if ( render_name ) + if ( !render_name ) { - BOOL new_name = FALSE; - if (visible_chat != mVisibleChat) + if (mNameText) { - mVisibleChat = visible_chat; - new_name = TRUE; + // ...clean up old name tag + mNameText->markDead(); + mNameText = NULL; + sNumVisibleChatBubbles--; } - - if (sRenderGroupTitles != mRenderGroupTitles) + return; + } + + BOOL new_name = FALSE; + if (visible_chat != mVisibleChat) + { + mVisibleChat = visible_chat; + new_name = TRUE; + } + + if (sRenderGroupTitles != mRenderGroupTitles) + { + mRenderGroupTitles = sRenderGroupTitles; + new_name = TRUE; + } + + // First Calculate Alpha + // If alpha > 0, create mNameText if necessary, otherwise delete it + F32 alpha = 0.f; + if (mAppAngle > 5.f) + { + const F32 START_FADE_TIME = NAME_SHOW_TIME - FADE_DURATION; + if (!visible_chat && sRenderName == RENDER_NAME_FADE && time_visible > START_FADE_TIME) { - mRenderGroupTitles = sRenderGroupTitles; - new_name = TRUE; + alpha = 1.f - (time_visible - START_FADE_TIME) / FADE_DURATION; } + else + { + // ...not fading, full alpha + alpha = 1.f; + } + } + else if (mAppAngle > 2.f) + { + // far away is faded out also + alpha = (mAppAngle-2.f)/3.f; + } - // First Calculate Alpha - // If alpha > 0, create mNameText if necessary, otherwise delete it + if (alpha <= 0.f) + { + if (mNameText) { - F32 alpha = 0.f; - if (mAppAngle > 5.f) + mNameText->markDead(); + mNameText = NULL; + sNumVisibleChatBubbles--; + } + return; + } + + if (!mNameText) + { + mNameText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT); + mNameText->setMass(10.f); + mNameText->setSourceObject(this); + mNameText->setVertAlignment(LLHUDText::ALIGN_VERT_TOP); + mNameText->setVisibleOffScreen(TRUE); + mNameText->setMaxLines(11); + mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); + mNameText->setUseBubble(TRUE); + sNumVisibleChatBubbles++; + new_name = TRUE; + } + + idleUpdateNameTagColor(new_name, alpha); + + LLVector3 name_position = idleUpdateNameTagPosition(root_pos_last); + mNameText->setPositionAgent(name_position); + + LLNameValue *title = getNVPair("Title"); + LLNameValue* firstname = getNVPair("FirstName"); + LLNameValue* lastname = getNVPair("LastName"); + + // Avatars must have a first and last name + if (!firstname || !lastname) return; + + bool is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY) != mSignaledAnimations.end(); + bool is_busy = mSignaledAnimations.find(ANIM_AGENT_BUSY) != mSignaledAnimations.end(); + bool is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end(); + bool is_muted; + if (isSelf()) + { + is_muted = false; + } + else + { + is_muted = LLMuteList::getInstance()->isMuted(getID()); + } + + // Rebuild name tag if state change detected + if (mNameString.empty() + || new_name + || (!title && !mTitle.empty()) + || (title && mTitle != title->getString()) + || is_away != mNameAway + || is_busy != mNameBusy + || is_muted != mNameMute + || is_appearance != mNameAppearance) + { + std::string line; + // IDEVO JAMESDEBUG + //if (!sRenderGroupTitles) + //{ + // // If all group titles are turned off, stack first name + // // on a line above last name + // line += firstname->getString(); + // line += "\n"; + //} + //else if (title && title->getString() && title->getString()[0] != '\0') + //{ + // line += title->getString(); + // LLStringFn::replace_ascii_controlchars(line,LL_UNKNOWN_CHAR); + // line += "\n"; + // line += firstname->getString(); + //} + //else + //{ + // line += firstname->getString(); + //} + if (sRenderGroupTitles + && title && title->getString() && title->getString()[0] != '\0') + { + line += title->getString(); + LLStringFn::replace_ascii_controlchars(line,LL_UNKNOWN_CHAR); + line += "\n"; + } + + std::string display_name; + if (gCacheName->getDisplayName(getID(), display_name)) + { + line += display_name; + } + else + { + line += LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); + } + + BOOL need_comma = FALSE; + + if (is_away || is_muted || is_busy) + { + line += " ("; + if (is_away) + { + line += LLTrans::getString("AvatarAway"); + need_comma = TRUE; + } + if (is_busy) { - const F32 START_FADE_TIME = NAME_SHOW_TIME - FADE_DURATION; - if (!visible_chat && sRenderName == RENDER_NAME_FADE && time_visible > START_FADE_TIME) + if (need_comma) { - alpha = 1.f - (time_visible - START_FADE_TIME) / FADE_DURATION; + line += ", "; } - else + line += LLTrans::getString("AvatarBusy"); + need_comma = TRUE; + } + if (is_muted) + { + if (need_comma) { - // ...not fading, full alpha - alpha = 1.f; + line += ", "; } + line += LLTrans::getString("AvatarMuted"); + need_comma = TRUE; } - else if (mAppAngle > 2.f) + line += ")"; + } + if (is_appearance) + { + line += "\n"; + line += LLTrans::getString("AvatarEditingAppearance"); + } + mNameAway = is_away; + mNameBusy = is_busy; + mNameMute = is_muted; + mNameAppearance = is_appearance; + mTitle = title ? title->getString() : ""; + LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); + mNameString = utf8str_to_wstring(line); + new_name = TRUE; + } + + if (visible_chat) + { + mNameText->setDropShadow(TRUE); + mNameText->setFont(LLFontGL::getFontSansSerif()); + mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_LEFT); + mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); + if (new_name) + { + mNameText->setLabel(mNameString); + } + + char line[MAX_STRING]; /* Flawfinder: ignore */ + line[0] = '\0'; + std::deque::iterator chat_iter = mChats.begin(); + mNameText->clearString(); + + LLColor4 new_chat = LLUIColorTable::instance().getColor( "AvatarNameColor" ); + LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f); + LLColor4 old_chat = lerp(normal_chat, LLColor4(0.6f, 0.6f, 0.6f, 1.f), 0.7f); + if (mTyping && mChats.size() >= MAX_BUBBLE_CHAT_UTTERANCES) + { + ++chat_iter; + } + + for(; chat_iter != mChats.end(); ++chat_iter) + { + F32 chat_fade_amt = llclamp((F32)((LLFrameTimer::getElapsedSeconds() - chat_iter->mTime) / CHAT_FADE_TIME), 0.f, 4.f); + LLFontGL::StyleFlags style; + switch(chat_iter->mChatType) { - // far away is faded out also - alpha = (mAppAngle-2.f)/3.f; + case CHAT_TYPE_WHISPER: + style = LLFontGL::ITALIC; + break; + case CHAT_TYPE_SHOUT: + style = LLFontGL::BOLD; + break; + default: + style = LLFontGL::NORMAL; + break; } - - if (alpha > 0.f) + if (chat_fade_amt < 1.f) { - if (!mNameText) - { - mNameText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT); - mNameText->setMass(10.f); - mNameText->setSourceObject(this); - mNameText->setVertAlignment(LLHUDText::ALIGN_VERT_TOP); - mNameText->setVisibleOffScreen(TRUE); - mNameText->setMaxLines(11); - mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); - mNameText->setUseBubble(TRUE); - sNumVisibleChatBubbles++; - new_name = TRUE; - } - - LLColor4 avatar_name_color = LLUIColorTable::instance().getColor( "AvatarNameColor" ); - avatar_name_color.setAlpha(alpha); - mNameText->setColor(avatar_name_color); - - LLQuaternion root_rot = mRoot.getWorldRotation(); - mNameText->setUsePixelSize(TRUE); - LLVector3 pixel_right_vec; - LLVector3 pixel_up_vec; - LLViewerCamera::getInstance()->getPixelVectors(root_pos_last, pixel_up_vec, pixel_right_vec); - LLVector3 camera_to_av = root_pos_last - LLViewerCamera::getInstance()->getOrigin(); - camera_to_av.normalize(); - LLVector3 local_camera_at = camera_to_av * ~root_rot; - LLVector3 local_camera_up = camera_to_av % LLViewerCamera::getInstance()->getLeftAxis(); - local_camera_up.normalize(); - local_camera_up = local_camera_up * ~root_rot; - - local_camera_up.scaleVec(mBodySize * 0.5f); - local_camera_at.scaleVec(mBodySize * 0.5f); - - LLVector3 name_position = mRoot.getWorldPosition() + - (local_camera_up * root_rot) - - (projected_vec(local_camera_at * root_rot, camera_to_av)); - name_position += pixel_up_vec * 15.f; - mNameText->setPositionAgent(name_position); + F32 u = clamp_rescale(chat_fade_amt, 0.9f, 1.f, 0.f, 1.f); + mNameText->addLine(utf8str_to_wstring(chat_iter->mText), lerp(new_chat, normal_chat, u), style); } - else if (mNameText) + else if (chat_fade_amt < 2.f) { - mNameText->markDead(); - mNameText = NULL; - sNumVisibleChatBubbles--; + F32 u = clamp_rescale(chat_fade_amt, 1.9f, 2.f, 0.f, 1.f); + mNameText->addLine(utf8str_to_wstring(chat_iter->mText), lerp(normal_chat, old_chat, u), style); + } + else if (chat_fade_amt < 3.f) + { + // *NOTE: only remove lines down to minimum number + mNameText->addLine(utf8str_to_wstring(chat_iter->mText), old_chat, style); } } - - LLNameValue *title = getNVPair("Title"); - LLNameValue* firstname = getNVPair("FirstName"); - LLNameValue* lastname = getNVPair("LastName"); + mNameText->setVisibleOffScreen(TRUE); - if (mNameText.notNull() && firstname && lastname) + if (mTyping) { - BOOL is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY) != mSignaledAnimations.end(); - BOOL is_busy = mSignaledAnimations.find(ANIM_AGENT_BUSY) != mSignaledAnimations.end(); - BOOL is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end(); - BOOL is_muted; - if (isSelf()) + S32 dot_count = (llfloor(mTypingTimer.getElapsedTimeF32() * 3.f) + 2) % 3 + 1; + switch(dot_count) { - is_muted = FALSE; + case 1: + mNameText->addLine(".", new_chat); + break; + case 2: + mNameText->addLine("..", new_chat); + break; + case 3: + mNameText->addLine("...", new_chat); + break; } - else - { - is_muted = LLMuteList::getInstance()->isMuted(getID()); - } - - if (mNameString.empty() || - new_name || - (!title && !mTitle.empty()) || - (title && mTitle != title->getString()) || - (is_away != mNameAway || is_busy != mNameBusy || is_muted != mNameMute) - || is_appearance != mNameAppearance) - { - std::string line; - // IDEVO JAMESDEBUG - //if (!sRenderGroupTitles) - //{ - // // If all group titles are turned off, stack first name - // // on a line above last name - // line += firstname->getString(); - // line += "\n"; - //} - //else if (title && title->getString() && title->getString()[0] != '\0') - //{ - // line += title->getString(); - // LLStringFn::replace_ascii_controlchars(line,LL_UNKNOWN_CHAR); - // line += "\n"; - // line += firstname->getString(); - //} - //else - //{ - // line += firstname->getString(); - //} - if (title && title->getString() && title->getString()[0] != '\0') - { - line += title->getString(); - LLStringFn::replace_ascii_controlchars(line,LL_UNKNOWN_CHAR); - line += "\n"; - } - std::string display_name; - if (gCacheName->getDisplayName(getID(), display_name)) - { - line += display_name; - } - else - { - line += LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); - } + } + } + else + { + static LLUICachedControl small_avatar_names("SmallAvatarNames"); + if (small_avatar_names) + { + mNameText->setFont(LLFontGL::getFontSansSerif()); + } + else + { + mNameText->setFont(LLFontGL::getFontSansSerifBig()); + } + mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_CENTER); + mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); + mNameText->setVisibleOffScreen(FALSE); + if (new_name) + { + mNameText->setLabel(""); + mNameText->setString(mNameString); + } + } +} - BOOL need_comma = FALSE; +// Compute name tag position during idle update +LLVector3 LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) +{ + LLQuaternion root_rot = mRoot.getWorldRotation(); + LLVector3 pixel_right_vec; + LLVector3 pixel_up_vec; + LLViewerCamera::getInstance()->getPixelVectors(root_pos_last, pixel_up_vec, pixel_right_vec); + LLVector3 camera_to_av = root_pos_last - LLViewerCamera::getInstance()->getOrigin(); + camera_to_av.normalize(); + LLVector3 local_camera_at = camera_to_av * ~root_rot; + LLVector3 local_camera_up = camera_to_av % LLViewerCamera::getInstance()->getLeftAxis(); + local_camera_up.normalize(); + local_camera_up = local_camera_up * ~root_rot; - if (is_away || is_muted || is_busy) - { - line += " ("; - if (is_away) - { - line += LLTrans::getString("AvatarAway"); - need_comma = TRUE; - } - if (is_busy) - { - if (need_comma) - { - line += ", "; - } - line += LLTrans::getString("AvatarBusy"); - need_comma = TRUE; - } - if (is_muted) - { - if (need_comma) - { - line += ", "; - } - line += LLTrans::getString("AvatarMuted"); - need_comma = TRUE; - } - line += ")"; - } - if (is_appearance) - { - line += "\n"; - line += LLTrans::getString("AvatarEditingAppearance"); - } - mNameAway = is_away; - mNameBusy = is_busy; - mNameMute = is_muted; - mNameAppearance = is_appearance; - mTitle = title ? title->getString() : ""; - LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); - mNameString = utf8str_to_wstring(line); - new_name = TRUE; - } - - if (visible_chat) - { - mNameText->setDropShadow(TRUE); - mNameText->setFont(LLFontGL::getFontSansSerif()); - mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_LEFT); - mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); - if (new_name) - { - mNameText->setLabel(mNameString); - } - - char line[MAX_STRING]; /* Flawfinder: ignore */ - line[0] = '\0'; - std::deque::iterator chat_iter = mChats.begin(); - mNameText->clearString(); - - LLColor4 new_chat = LLUIColorTable::instance().getColor( "AvatarNameColor" ); - LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f); - LLColor4 old_chat = lerp(normal_chat, LLColor4(0.6f, 0.6f, 0.6f, 1.f), 0.7f); - if (mTyping && mChats.size() >= MAX_BUBBLE_CHAT_UTTERANCES) - { - ++chat_iter; - } + local_camera_up.scaleVec(mBodySize * 0.5f); + local_camera_at.scaleVec(mBodySize * 0.5f); - for(; chat_iter != mChats.end(); ++chat_iter) - { - F32 chat_fade_amt = llclamp((F32)((LLFrameTimer::getElapsedSeconds() - chat_iter->mTime) / CHAT_FADE_TIME), 0.f, 4.f); - LLFontGL::StyleFlags style; - switch(chat_iter->mChatType) - { - case CHAT_TYPE_WHISPER: - style = LLFontGL::ITALIC; - break; - case CHAT_TYPE_SHOUT: - style = LLFontGL::BOLD; - break; - default: - style = LLFontGL::NORMAL; - break; - } - if (chat_fade_amt < 1.f) - { - F32 u = clamp_rescale(chat_fade_amt, 0.9f, 1.f, 0.f, 1.f); - mNameText->addLine(utf8str_to_wstring(chat_iter->mText), lerp(new_chat, normal_chat, u), style); - } - else if (chat_fade_amt < 2.f) - { - F32 u = clamp_rescale(chat_fade_amt, 1.9f, 2.f, 0.f, 1.f); - mNameText->addLine(utf8str_to_wstring(chat_iter->mText), lerp(normal_chat, old_chat, u), style); - } - else if (chat_fade_amt < 3.f) - { - // *NOTE: only remove lines down to minimum number - mNameText->addLine(utf8str_to_wstring(chat_iter->mText), old_chat, style); - } - } - mNameText->setVisibleOffScreen(TRUE); + LLVector3 name_position = mRoot.getWorldPosition() + + (local_camera_up * root_rot) - + (projected_vec(local_camera_at * root_rot, camera_to_av)); + name_position += pixel_up_vec * 15.f; + return name_position; +} - if (mTyping) - { - S32 dot_count = (llfloor(mTypingTimer.getElapsedTimeF32() * 3.f) + 2) % 3 + 1; - switch(dot_count) - { - case 1: - mNameText->addLine(".", new_chat); - break; - case 2: - mNameText->addLine("..", new_chat); - break; - case 3: - mNameText->addLine("...", new_chat); - break; - } +void LLVOAvatar::idleUpdateNameTagColor(BOOL new_name, F32 alpha) +{ + llassert(mNameText); - } - } - else - { - if (gSavedSettings.getBOOL("SmallAvatarNames")) - { - mNameText->setFont(LLFontGL::getFontSansSerif()); - } - else - { - mNameText->setFont(LLFontGL::getFontSansSerifBig()); - } - mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_CENTER); - mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); - mNameText->setVisibleOffScreen(FALSE); - if (new_name) - { - mNameText->setLabel(""); - mNameText->setString(mNameString); - } - } - } - } - else if (mNameText) + bool is_friend = LLAvatarTracker::instance().isBuddy(getID()); + if (new_name + || alpha != mNameAlpha + || is_friend != mNameFriend) { - mNameText->markDead(); - mNameText = NULL; - sNumVisibleChatBubbles--; + const char* color_name = (is_friend ? "AvatarNameFriendColor" : "AvatarNameColor"); + LLColor4 avatar_name_color = + LLUIColorTable::getInstance()->getColor( color_name ); + avatar_name_color.setAlpha(alpha); + mNameText->setColor(avatar_name_color); + + mNameFriend = is_friend; + mNameAlpha = alpha; } } -- cgit v1.2.3 From c2373fb5a6b08b2c32e5f93fa67b25f669e8b47f Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 11 Feb 2010 16:39:15 -0800 Subject: Created stub LLAvatarNameCache for display name lookup, as well as LLAvatarName base data object. Reviewed with Kelly. --- indra/newview/llvoavatar.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 265adb3e7f..e4de75d173 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -51,6 +51,7 @@ #include "llagent.h" // Get state values from here #include "llagentwearables.h" #include "llanimationstates.h" +#include "llavatarnamecache.h" #include "llavatarpropertiesprocessor.h" #include "llviewercontrol.h" #include "llcallingcard.h" // IDEVO for LLAvatarTracker @@ -2804,10 +2805,10 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) line += "\n"; } - std::string display_name; - if (gCacheName->getDisplayName(getID(), display_name)) + LLAvatarName av_name; + if (LLAvatarNameCache::get(getID(), &av_name)) { - line += display_name; + line += av_name.mDisplayName; } else { -- cgit v1.2.3 From ee81adb01b8619302898471fdbba5c93f716d10b Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 18 Feb 2010 18:46:41 -0800 Subject: Preference to set what fields name tags display, and first attempt at "use display names" menu item which doesn't work yet --- indra/newview/llvoavatar.cpp | 60 ++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 24 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e4de75d173..04809caa6f 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2805,50 +2805,62 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) line += "\n"; } + static LLUICachedControl show_display_names("NameTagShowDisplayNames"); + static LLUICachedControl show_slids("NameTagShowSLIDs"); + LLAvatarName av_name; - if (LLAvatarNameCache::get(getID(), &av_name)) + if (LLAvatarNameCache::useDisplayNames() + && LLAvatarNameCache::get(getID(), &av_name)) { - line += av_name.mDisplayName; + if (show_display_names) + { + line += av_name.mDisplayName; + line += "\n"; + } + if (show_slids) + { + line += "("; + line += av_name.mSLID; + line += ")\n"; + } } else { - line += LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); + if (show_display_names || show_slids) + { + line += LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); + line += "\n"; + } } - BOOL need_comma = FALSE; - - if (is_away || is_muted || is_busy) + static LLUICachedControl show_status("NameTagShowStatus"); + if (show_status + && (is_away || is_muted || is_busy || is_appearance) ) { - line += " ("; + //line += "("; if (is_away) { line += LLTrans::getString("AvatarAway"); - need_comma = TRUE; + line += ", "; } if (is_busy) { - if (need_comma) - { - line += ", "; - } line += LLTrans::getString("AvatarBusy"); - need_comma = TRUE; + line += ", "; } if (is_muted) { - if (need_comma) - { - line += ", "; - } line += LLTrans::getString("AvatarMuted"); - need_comma = TRUE; + line += ", "; } - line += ")"; - } - if (is_appearance) - { - line += "\n"; - line += LLTrans::getString("AvatarEditingAppearance"); + if (is_appearance) + { + line += LLTrans::getString("AvatarEditingAppearance"); + line += ", "; + } + // trim last ", " + line.resize( line.length() - 2 ); + //line += ")"; } mNameAway = is_away; mNameBusy = is_busy; -- cgit v1.2.3 From af8f8b4770eb45b4238d98ddd574ba726470f797 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 19 Feb 2010 11:11:45 -0800 Subject: Improved support for toggling display names on/off Stop pre-populated name cache because we have a web service now for lookup Added mIsLegacy to LLAvatarName so we can colorize those name tags differently --- indra/newview/llvoavatar.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 04809caa6f..73f292cbca 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -660,6 +660,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mNameFriend(false), mNameAlpha(0.f), mRenderGroupTitles(sRenderGroupTitles), + mUseDisplayNames( LLAvatarNameCache::useDisplayNames() ), mFirstTEMessageReceived( FALSE ), mFirstAppearanceMessageReceived( FALSE ), mCulled( FALSE ), @@ -2695,6 +2696,13 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) new_name = TRUE; } + // IDEVO HACK to force refresh + if (LLAvatarNameCache::useDisplayNames() != mUseDisplayNames) + { + mUseDisplayNames = LLAvatarNameCache::useDisplayNames(); + new_name = TRUE; + } + // First Calculate Alpha // If alpha > 0, create mNameText if necessary, otherwise delete it F32 alpha = 0.f; -- cgit v1.2.3 From a5099524e2a89d0162053c7165468b72bcaa2571 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 19 Feb 2010 15:14:14 -0800 Subject: Avatars with legacy names have special color name tags --- indra/newview/llvoavatar.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 73f292cbca..69a4abcdae 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3000,10 +3000,10 @@ LLVector3 LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) (projected_vec(local_camera_at * root_rot, camera_to_av)); name_position += pixel_up_vec * 15.f; return name_position; - } +} void LLVOAvatar::idleUpdateNameTagColor(BOOL new_name, F32 alpha) - { +{ llassert(mNameText); bool is_friend = LLAvatarTracker::instance().isBuddy(getID()); @@ -3011,7 +3011,22 @@ void LLVOAvatar::idleUpdateNameTagColor(BOOL new_name, F32 alpha) || alpha != mNameAlpha || is_friend != mNameFriend) { - const char* color_name = (is_friend ? "AvatarNameFriendColor" : "AvatarNameColor"); + const char* color_name = "AvatarNameColor"; + if (is_friend) + { + color_name = "AvatarNameFriendColor"; + } + else + { + // IDEVO can we avoid doing this lookup repeatedly? + LLAvatarName av_name; + if (LLAvatarNameCache::useDisplayNames() + && LLAvatarNameCache::get(getID(), &av_name) + && av_name.mIsLegacy) + { + color_name = "AvatarNameLegacyColor"; + } + } LLColor4 avatar_name_color = LLUIColorTable::getInstance()->getColor( color_name ); avatar_name_color.setAlpha(alpha); -- cgit v1.2.3 From 70f4e8ede81e1a1259345891c946dc447d686718 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 24 Feb 2010 11:03:52 -0800 Subject: Use async display name lookup for name tags, makes them refresh properly when toggling display name feature --- indra/newview/llvoavatar.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 69a4abcdae..2cd1d48aa0 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2755,6 +2755,11 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) LLVector3 name_position = idleUpdateNameTagPosition(root_pos_last); mNameText->setPositionAgent(name_position); + idleUpdateNameTagText(new_name); +} + +void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) +{ LLNameValue *title = getNVPair("Title"); LLNameValue* firstname = getNVPair("FirstName"); LLNameValue* lastname = getNVPair("LastName"); @@ -2816,10 +2821,18 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) static LLUICachedControl show_display_names("NameTagShowDisplayNames"); static LLUICachedControl show_slids("NameTagShowSLIDs"); - LLAvatarName av_name; - if (LLAvatarNameCache::useDisplayNames() - && LLAvatarNameCache::get(getID(), &av_name)) + if (LLAvatarNameCache::useDisplayNames()) { + LLAvatarName av_name; + if (!LLAvatarNameCache::get(getID(), &av_name)) + { + // ...call this function back when the name arrives + // and force a rebuild + LLAvatarNameCache::get(getID(), + boost::bind(&LLVOAvatar::idleUpdateNameTagText, this, TRUE)); + } + + // Might be blank if name not available yet, that's OK if (show_display_names) { line += av_name.mDisplayName; @@ -2880,7 +2893,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) new_name = TRUE; } - if (visible_chat) + if (mVisibleChat) { mNameText->setDropShadow(TRUE); mNameText->setFont(LLFontGL::getFontSansSerif()); -- cgit v1.2.3 From f3e0e9a5264a80d146a1d4d77fd9c4f5d3070278 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 24 Feb 2010 14:31:46 -0800 Subject: Hack to refresh name tags when I change my display name. Also fixes a crash when turning on display names. --- indra/newview/llvoavatar.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 2cd1d48aa0..ac91ded18b 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2829,7 +2829,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) // ...call this function back when the name arrives // and force a rebuild LLAvatarNameCache::get(getID(), - boost::bind(&LLVOAvatar::idleUpdateNameTagText, this, TRUE)); + boost::bind(&LLVOAvatar::invalidateName, this)); } // Might be blank if name not available yet, that's OK @@ -7629,6 +7629,13 @@ std::string LLVOAvatar::getFullname() const return name; } +// IDEVO +void LLVOAvatar::invalidateName() +{ + // force update by clearing name string + mNameString.clear(); +} + LLHost LLVOAvatar::getObjectHost() const { LLViewerRegion* region = getRegion(); -- cgit v1.2.3 From 3eec41f6716940ffcfd4bf239e1e493c2d0a0658 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 24 Feb 2010 17:21:12 -0800 Subject: Re-color name tags after display name changes --- indra/newview/llvoavatar.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index ac91ded18b..7f57289fc3 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7634,6 +7634,8 @@ void LLVOAvatar::invalidateName() { // force update by clearing name string mNameString.clear(); + // and force color update by tweaking alpha + mNameAlpha = F32_MAX; } LLHost LLVOAvatar::getObjectHost() const -- cgit v1.2.3 From 36c35bca2663447216027015c10aa921ab75abfb Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 25 Feb 2010 17:06:17 -0800 Subject: Support multiple fonts, colors and styles in name tags Simplified LLHUDText string API to be UTF8 only Added per-text segment font support Changed LLVOAvatar invalidateNameTag to clearNameTag --- indra/newview/llvoavatar.cpp | 172 ++++++++++++++++++++++--------------------- 1 file changed, 88 insertions(+), 84 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 7f57289fc3..8e017b2a51 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2749,13 +2749,13 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) sNumVisibleChatBubbles++; new_name = TRUE; } - - idleUpdateNameTagColor(new_name, alpha); - + LLVector3 name_position = idleUpdateNameTagPosition(root_pos_last); mNameText->setPositionAgent(name_position); idleUpdateNameTagText(new_name); + + idleUpdateNameTagAlpha(new_name, alpha); } void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) @@ -2779,6 +2779,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) { is_muted = LLMuteList::getInstance()->isMuted(getID()); } + bool is_friend = LLAvatarTracker::instance().isBuddy(getID()); // Rebuild name tag if state change detected if (mNameString.empty() @@ -2788,34 +2789,20 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) || is_away != mNameAway || is_busy != mNameBusy || is_muted != mNameMute - || is_appearance != mNameAppearance) + || is_appearance != mNameAppearance + || is_friend != mNameFriend) { - std::string line; - // IDEVO JAMESDEBUG - //if (!sRenderGroupTitles) - //{ - // // If all group titles are turned off, stack first name - // // on a line above last name - // line += firstname->getString(); - // line += "\n"; - //} - //else if (title && title->getString() && title->getString()[0] != '\0') - //{ - // line += title->getString(); - // LLStringFn::replace_ascii_controlchars(line,LL_UNKNOWN_CHAR); - // line += "\n"; - // line += firstname->getString(); - //} - //else - //{ - // line += firstname->getString(); - //} + LLColor4 name_tag_color = getNameTagColor(is_friend); + + clearNameTag(); + if (sRenderGroupTitles && title && title->getString() && title->getString()[0] != '\0') { - line += title->getString(); - LLStringFn::replace_ascii_controlchars(line,LL_UNKNOWN_CHAR); - line += "\n"; + std::string title_str = title->getString(); + LLStringFn::replace_ascii_controlchars(title_str,LL_UNKNOWN_CHAR); + addNameTagLine(title_str, name_tag_color, LLFontGL::ITALIC, + LLFontGL::getFontSansSerifSmall()); } static LLUICachedControl show_display_names("NameTagShowDisplayNames"); @@ -2829,28 +2816,28 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) // ...call this function back when the name arrives // and force a rebuild LLAvatarNameCache::get(getID(), - boost::bind(&LLVOAvatar::invalidateName, this)); + boost::bind(&LLVOAvatar::clearNameTag, this)); } // Might be blank if name not available yet, that's OK if (show_display_names) { - line += av_name.mDisplayName; - line += "\n"; + addNameTagLine(av_name.mDisplayName, name_tag_color, LLFontGL::NORMAL, + LLFontGL::getFontSansSerifBig()); } if (show_slids) { - line += "("; - line += av_name.mSLID; - line += ")\n"; + addNameTagLine(av_name.mSLID, LLColor4::red, LLFontGL::NORMAL, + LLFontGL::getFontSansSerif()); } } else { if (show_display_names || show_slids) { - line += LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); - line += "\n"; + std::string full_name = + LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); + addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, NULL); } } @@ -2858,7 +2845,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) if (show_status && (is_away || is_muted || is_busy || is_appearance) ) { - //line += "("; + std::string line; if (is_away) { line += LLTrans::getString("AvatarAway"); @@ -2881,15 +2868,17 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) } // trim last ", " line.resize( line.length() - 2 ); - //line += ")"; + addNameTagLine(line, LLColor4::blue, LLFontGL::NORMAL, + LLFontGL::getFontSansSerifSmall()); } mNameAway = is_away; mNameBusy = is_busy; mNameMute = is_muted; mNameAppearance = is_appearance; + mNameFriend = is_friend; mTitle = title ? title->getString() : ""; LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); - mNameString = utf8str_to_wstring(line); +// mNameString = utf8str_to_wstring(line); new_name = TRUE; } @@ -2899,10 +2888,10 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) mNameText->setFont(LLFontGL::getFontSansSerif()); mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_LEFT); mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); - if (new_name) - { - mNameText->setLabel(mNameString); - } +// if (new_name) +// { +// mNameText->setLabel(mNameString); +// } char line[MAX_STRING]; /* Flawfinder: ignore */ line[0] = '\0'; @@ -2936,17 +2925,17 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) if (chat_fade_amt < 1.f) { F32 u = clamp_rescale(chat_fade_amt, 0.9f, 1.f, 0.f, 1.f); - mNameText->addLine(utf8str_to_wstring(chat_iter->mText), lerp(new_chat, normal_chat, u), style); + mNameText->addLine(chat_iter->mText, lerp(new_chat, normal_chat, u), style); } else if (chat_fade_amt < 2.f) { F32 u = clamp_rescale(chat_fade_amt, 1.9f, 2.f, 0.f, 1.f); - mNameText->addLine(utf8str_to_wstring(chat_iter->mText), lerp(normal_chat, old_chat, u), style); + mNameText->addLine(chat_iter->mText, lerp(normal_chat, old_chat, u), style); } else if (chat_fade_amt < 3.f) { // *NOTE: only remove lines down to minimum number - mNameText->addLine(utf8str_to_wstring(chat_iter->mText), old_chat, style); + mNameText->addLine(chat_iter->mText, old_chat, style); } } mNameText->setVisibleOffScreen(TRUE); @@ -2971,6 +2960,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) } else { + // ...not using chat bubbles, just names static LLUICachedControl small_avatar_names("SmallAvatarNames"); if (small_avatar_names) { @@ -2983,11 +2973,36 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_CENTER); mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); mNameText->setVisibleOffScreen(FALSE); - if (new_name) - { - mNameText->setLabel(""); - mNameText->setString(mNameString); - } +// if (new_name) +// { +// mNameText->setLabel(""); +// mNameText->setString(mNameString); +// } + } +} + +void LLVOAvatar::addNameTagLine(const std::string& line, const LLColor4& color, S32 style, const LLFontGL* font) +{ + llassert(mNameText); + if (mVisibleChat) + { + mNameText->addLabel(line); + } + else + { + mNameText->addLine(line, color, (LLFontGL::StyleFlags)style, font); + } + mNameString += line; + mNameString += '\n'; +} + +void LLVOAvatar::clearNameTag() +{ + mNameString.clear(); + if (mNameText) + { + mNameText->setLabel( "" ); + mNameText->setString( "" ); } } @@ -3015,39 +3030,37 @@ LLVector3 LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) return name_position; } -void LLVOAvatar::idleUpdateNameTagColor(BOOL new_name, F32 alpha) +void LLVOAvatar::idleUpdateNameTagAlpha(BOOL new_name, F32 alpha) { llassert(mNameText); - bool is_friend = LLAvatarTracker::instance().isBuddy(getID()); if (new_name - || alpha != mNameAlpha - || is_friend != mNameFriend) + || alpha != mNameAlpha) { - const char* color_name = "AvatarNameColor"; - if (is_friend) - { - color_name = "AvatarNameFriendColor"; - } - else + mNameText->setAlpha(alpha); + mNameAlpha = alpha; + } +} + +LLColor4 LLVOAvatar::getNameTagColor(bool is_friend) +{ + const char* color_name = "AvatarNameColor"; + if (is_friend) + { + color_name = "AvatarNameFriendColor"; + } + else + { + // IDEVO can we avoid doing this lookup repeatedly? + LLAvatarName av_name; + if (LLAvatarNameCache::useDisplayNames() + && LLAvatarNameCache::get(getID(), &av_name) + && av_name.mIsLegacy) { - // IDEVO can we avoid doing this lookup repeatedly? - LLAvatarName av_name; - if (LLAvatarNameCache::useDisplayNames() - && LLAvatarNameCache::get(getID(), &av_name) - && av_name.mIsLegacy) - { - color_name = "AvatarNameLegacyColor"; - } + color_name = "AvatarNameLegacyColor"; } - LLColor4 avatar_name_color = - LLUIColorTable::getInstance()->getColor( color_name ); - avatar_name_color.setAlpha(alpha); - mNameText->setColor(avatar_name_color); - - mNameFriend = is_friend; - mNameAlpha = alpha; } + return LLUIColorTable::getInstance()->getColor( color_name ); } //-------------------------------------------------------------------- @@ -7629,15 +7642,6 @@ std::string LLVOAvatar::getFullname() const return name; } -// IDEVO -void LLVOAvatar::invalidateName() -{ - // force update by clearing name string - mNameString.clear(); - // and force color update by tweaking alpha - mNameAlpha = F32_MAX; -} - LLHost LLVOAvatar::getObjectHost() const { LLViewerRegion* region = getRegion(); -- cgit v1.2.3 From d2680b86170255e701d44e51ab9f5883a9fd61d8 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 26 Feb 2010 13:41:47 -0800 Subject: Less ugly name tag fonts and colors --- indra/newview/llvoavatar.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 8e017b2a51..93662a030f 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2801,7 +2801,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) { std::string title_str = title->getString(); LLStringFn::replace_ascii_controlchars(title_str,LL_UNKNOWN_CHAR); - addNameTagLine(title_str, name_tag_color, LLFontGL::ITALIC, + addNameTagLine(title_str, name_tag_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); } @@ -2827,7 +2827,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) } if (show_slids) { - addNameTagLine(av_name.mSLID, LLColor4::red, LLFontGL::NORMAL, + addNameTagLine(av_name.mSLID, name_tag_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerif()); } } @@ -2835,9 +2835,13 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) { if (show_display_names || show_slids) { + + static LLUICachedControl small_avatar_names("SmallAvatarNames"); + const LLFontGL* font = + (small_avatar_names ? LLFontGL::getFontSansSerif() : LLFontGL::getFontSansSerifBig() ); std::string full_name = LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); - addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, NULL); + addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font); } } @@ -2868,7 +2872,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) } // trim last ", " line.resize( line.length() - 2 ); - addNameTagLine(line, LLColor4::blue, LLFontGL::NORMAL, + addNameTagLine(line, name_tag_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); } mNameAway = is_away; @@ -2961,15 +2965,6 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) else { // ...not using chat bubbles, just names - static LLUICachedControl small_avatar_names("SmallAvatarNames"); - if (small_avatar_names) - { - mNameText->setFont(LLFontGL::getFontSansSerif()); - } - else - { - mNameText->setFont(LLFontGL::getFontSansSerifBig()); - } mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_CENTER); mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); mNameText->setVisibleOffScreen(FALSE); -- cgit v1.2.3 From a235f3d5ea734db03a1a64901c893016f0320f18 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 26 Feb 2010 16:58:29 -0800 Subject: Clean out some dead code --- indra/newview/llvoavatar.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 93662a030f..9a9fbc22e2 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2882,7 +2882,6 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) mNameFriend = is_friend; mTitle = title ? title->getString() : ""; LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); -// mNameString = utf8str_to_wstring(line); new_name = TRUE; } @@ -2892,10 +2891,6 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) mNameText->setFont(LLFontGL::getFontSansSerif()); mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_LEFT); mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); -// if (new_name) -// { -// mNameText->setLabel(mNameString); -// } char line[MAX_STRING]; /* Flawfinder: ignore */ line[0] = '\0'; @@ -2968,11 +2963,6 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_CENTER); mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); mNameText->setVisibleOffScreen(FALSE); -// if (new_name) -// { -// mNameText->setLabel(""); -// mNameText->setString(mNameString); -// } } } -- cgit v1.2.3 From 541291b366c4813217be5cb9118cd74778d0daeb Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 26 Feb 2010 17:31:55 -0800 Subject: Removed unnecessary include llhudtext.h from llviewerobject.h --- indra/newview/llvoavatar.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 9a9fbc22e2..317bc0da29 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -63,6 +63,7 @@ #include "llheadrotmotion.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" +#include "llhudtext.h" #include "llkeyframefallmotion.h" #include "llkeyframestandmotion.h" #include "llkeyframewalkmotion.h" -- cgit v1.2.3 From 3d074fa20167a7c06f00c394481060e3d7101b11 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 8 Mar 2010 13:39:22 -0800 Subject: Simplify name tag prefs and put SLID on top of display name --- indra/newview/llvoavatar.cpp | 85 +++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 45 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f7df0dc2cf..b56e4d3d2e 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2808,6 +2808,35 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) clearNameTag(); + if (is_away || is_muted || is_busy || is_appearance) + { + std::string line; + if (is_away) + { + line += LLTrans::getString("AvatarAway"); + line += ", "; + } + if (is_busy) + { + line += LLTrans::getString("AvatarBusy"); + line += ", "; + } + if (is_muted) + { + line += LLTrans::getString("AvatarMuted"); + line += ", "; + } + if (is_appearance) + { + line += LLTrans::getString("AvatarEditingAppearance"); + line += ", "; + } + // trim last ", " + line.resize( line.length() - 2 ); + addNameTagLine(line, name_tag_color, LLFontGL::NORMAL, + LLFontGL::getFontSansSerifSmall()); + } + if (sRenderGroupTitles && title && title->getString() && title->getString()[0] != '\0') { @@ -2832,61 +2861,27 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) } // Might be blank if name not available yet, that's OK - if (show_display_names) - { - addNameTagLine(av_name.mDisplayName, name_tag_color, LLFontGL::NORMAL, - LLFontGL::getFontSansSerifBig()); - } if (show_slids) { addNameTagLine(av_name.mSLID, name_tag_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerif()); } - } - else - { - if (show_display_names || show_slids) + if (show_display_names) { - - static LLUICachedControl small_avatar_names("SmallAvatarNames"); - const LLFontGL* font = - (small_avatar_names ? LLFontGL::getFontSansSerif() : LLFontGL::getFontSansSerifBig() ); - std::string full_name = - LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); - addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font); + addNameTagLine(av_name.mDisplayName, name_tag_color, LLFontGL::NORMAL, + LLFontGL::getFontSansSerifBig()); } } - - static LLUICachedControl show_status("NameTagShowStatus"); - if (show_status - && (is_away || is_muted || is_busy || is_appearance) ) + else { - std::string line; - if (is_away) - { - line += LLTrans::getString("AvatarAway"); - line += ", "; - } - if (is_busy) - { - line += LLTrans::getString("AvatarBusy"); - line += ", "; - } - if (is_muted) - { - line += LLTrans::getString("AvatarMuted"); - line += ", "; - } - if (is_appearance) - { - line += LLTrans::getString("AvatarEditingAppearance"); - line += ", "; - } - // trim last ", " - line.resize( line.length() - 2 ); - addNameTagLine(line, name_tag_color, LLFontGL::NORMAL, - LLFontGL::getFontSansSerifSmall()); + static LLUICachedControl small_avatar_names("SmallAvatarNames"); + const LLFontGL* font = + (small_avatar_names ? LLFontGL::getFontSansSerif() : LLFontGL::getFontSansSerifBig() ); + std::string full_name = + LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); + addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font); } + mNameAway = is_away; mNameBusy = is_busy; mNameMute = is_muted; -- cgit v1.2.3 From 717a4800f1ae0ae6ea0bbe9ed0af21c7851f5d0a Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 9 Mar 2010 14:28:48 -0800 Subject: Break name tag code out into LLHUDNameTag Start by duplicating the LLHUDText code, then stripping out functionality that only needs to exist in one place (like force-based juggling of name tag positions) --- indra/newview/llvoavatar.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b56e4d3d2e..e039544779 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -63,7 +63,8 @@ #include "llheadrotmotion.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" -#include "llhudtext.h" +#include "llhudnametag.h" +#include "llhudtext.h" // for mText/mDebugText #include "llkeyframefallmotion.h" #include "llkeyframestandmotion.h" #include "llkeyframewalkmotion.h" @@ -2750,14 +2751,14 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) if (!mNameText) { - mNameText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT); + mNameText = static_cast( LLHUDObject::addHUDObject( + LLHUDObject::LL_HUD_NAME_TAG) ); mNameText->setMass(10.f); mNameText->setSourceObject(this); - mNameText->setVertAlignment(LLHUDText::ALIGN_VERT_TOP); + mNameText->setVertAlignment(LLHUDNameTag::ALIGN_VERT_TOP); mNameText->setVisibleOffScreen(TRUE); mNameText->setMaxLines(11); mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); - mNameText->setUseBubble(TRUE); sNumVisibleChatBubbles++; new_name = TRUE; } @@ -2896,7 +2897,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) { mNameText->setDropShadow(TRUE); mNameText->setFont(LLFontGL::getFontSansSerif()); - mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_LEFT); + mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_LEFT); mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); char line[MAX_STRING]; /* Flawfinder: ignore */ @@ -2967,7 +2968,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) else { // ...not using chat bubbles, just names - mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_CENTER); + mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_CENTER); mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); mNameText->setVisibleOffScreen(FALSE); } -- cgit v1.2.3 From 7337b4b05bf2218796742a0ee1ddb0fdf27236c4 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 9 Mar 2010 15:23:16 -0800 Subject: More harmonization of LLHUDNameTag vs. LLHUDText Eliminating now-unused code from LLHUDText --- indra/newview/llvoavatar.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e039544779..5e1e2bb511 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2895,7 +2895,6 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) if (mVisibleChat) { - mNameText->setDropShadow(TRUE); mNameText->setFont(LLFontGL::getFontSansSerif()); mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_LEFT); mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); -- cgit v1.2.3 From 8527463c157021bdbda8c1eff18c659f3cd37037 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 9 Mar 2010 16:44:34 -0800 Subject: More name-tag vs. hud-text cleanup --- indra/newview/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5e1e2bb511..582fc811a0 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2753,7 +2753,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) { mNameText = static_cast( LLHUDObject::addHUDObject( LLHUDObject::LL_HUD_NAME_TAG) ); - mNameText->setMass(10.f); + //mNameText->setMass(10.f); mNameText->setSourceObject(this); mNameText->setVertAlignment(LLHUDNameTag::ALIGN_VERT_TOP); mNameText->setVisibleOffScreen(TRUE); -- cgit v1.2.3 From 0ee6a6025cba2f63c5c33c20870f67afd62f6372 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 10 Mar 2010 15:41:30 -0800 Subject: Name tag color and position hackery for demo --- indra/newview/llvoavatar.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 582fc811a0..4c8bb0ac13 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2834,16 +2834,20 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) } // trim last ", " line.resize( line.length() - 2 ); - addNameTagLine(line, name_tag_color, LLFontGL::NORMAL, + LLColor4 status_color = + LLUIColorTable::getInstance()->getColor("NameTagStatus"); + addNameTagLine(line, status_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); } if (sRenderGroupTitles && title && title->getString() && title->getString()[0] != '\0') { + LLColor4 group_color = + LLUIColorTable::getInstance()->getColor("NameTagGroup"); std::string title_str = title->getString(); LLStringFn::replace_ascii_controlchars(title_str,LL_UNKNOWN_CHAR); - addNameTagLine(title_str, name_tag_color, LLFontGL::NORMAL, + addNameTagLine(title_str, group_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); } @@ -2864,13 +2868,15 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) // Might be blank if name not available yet, that's OK if (show_slids) { - addNameTagLine(av_name.mSLID, name_tag_color, LLFontGL::NORMAL, - LLFontGL::getFontSansSerif()); + // JAMESDEBUG HACK + LLColor4 slid_color = name_tag_color * 0.8f; + addNameTagLine(av_name.mSLID, slid_color, LLFontGL::NORMAL, + LLFontGL::getFontSansSerifSmall()); } if (show_display_names) { addNameTagLine(av_name.mDisplayName, name_tag_color, LLFontGL::NORMAL, - LLFontGL::getFontSansSerifBig()); + LLFontGL::getFontSansSerif()); } } else @@ -2904,7 +2910,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) std::deque::iterator chat_iter = mChats.begin(); mNameText->clearString(); - LLColor4 new_chat = LLUIColorTable::instance().getColor( "AvatarNameColor" ); + LLColor4 new_chat = LLUIColorTable::instance().getColor( "NameTagChat" ); LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f); LLColor4 old_chat = lerp(normal_chat, LLColor4(0.6f, 0.6f, 0.6f, 1.f), 0.7f); if (mTyping && mChats.size() >= MAX_BUBBLE_CHAT_UTTERANCES) @@ -3036,10 +3042,10 @@ void LLVOAvatar::idleUpdateNameTagAlpha(BOOL new_name, F32 alpha) LLColor4 LLVOAvatar::getNameTagColor(bool is_friend) { - const char* color_name = "AvatarNameColor"; + const char* color_name = "NameTagText"; if (is_friend) { - color_name = "AvatarNameFriendColor"; + color_name = "NameTagFriend"; } else { @@ -3049,7 +3055,7 @@ LLColor4 LLVOAvatar::getNameTagColor(bool is_friend) && LLAvatarNameCache::get(getID(), &av_name) && av_name.mIsLegacy) { - color_name = "AvatarNameLegacyColor"; + color_name = "NameTagLegacy"; } } return LLUIColorTable::getInstance()->getColor( color_name ); -- cgit v1.2.3 From d2f9e34598621f1dabad15025417efd6b81dddf0 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 23 Mar 2010 11:41:33 -0700 Subject: Part DEV-47695 route display name changes via sim for rebroadcast to nearby avatars for name tag updates and to update cached display name for LSL nonblocking functions --- indra/newview/llvoavatar.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4c8bb0ac13..f3850d58a1 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3004,6 +3004,18 @@ void LLVOAvatar::clearNameTag() } } +//static +void LLVOAvatar::invalidateNameTag(const LLUUID& agent_id) +{ + LLViewerObject* obj = gObjectList.findObject(agent_id); + if (!obj) return; + + LLVOAvatar* avatar = dynamic_cast(obj); + if (!avatar) return; + + avatar->clearNameTag(); +} + // Compute name tag position during idle update LLVector3 LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) { -- cgit v1.2.3 From adbe038385393785ae5cf56ecdd6a87fc28a28ee Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 7 Apr 2010 10:21:47 -0700 Subject: Fix bad indentation --- indra/newview/llvoavatar.cpp | 194 +++++++++++++++++++++---------------------- 1 file changed, 97 insertions(+), 97 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 67ae5b1eb0..5bf9f69ae3 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2696,18 +2696,18 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) return; } - BOOL new_name = FALSE; - if (visible_chat != mVisibleChat) - { - mVisibleChat = visible_chat; - new_name = TRUE; - } - - if (sRenderGroupTitles != mRenderGroupTitles) - { - mRenderGroupTitles = sRenderGroupTitles; - new_name = TRUE; - } + BOOL new_name = FALSE; + if (visible_chat != mVisibleChat) + { + mVisibleChat = visible_chat; + new_name = TRUE; + } + + if (sRenderGroupTitles != mRenderGroupTitles) + { + mRenderGroupTitles = sRenderGroupTitles; + new_name = TRUE; + } // IDEVO HACK to force refresh if (LLAvatarNameCache::useDisplayNames() != mUseDisplayNames) @@ -2716,30 +2716,30 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) new_name = TRUE; } - // First Calculate Alpha - // If alpha > 0, create mNameText if necessary, otherwise delete it - F32 alpha = 0.f; - if (mAppAngle > 5.f) - { - const F32 START_FADE_TIME = NAME_SHOW_TIME - FADE_DURATION; - if (!visible_chat && sRenderName == RENDER_NAME_FADE && time_visible > START_FADE_TIME) - { - alpha = 1.f - (time_visible - START_FADE_TIME) / FADE_DURATION; - } - else - { - // ...not fading, full alpha - alpha = 1.f; - } - } - else if (mAppAngle > 2.f) - { - // far away is faded out also - alpha = (mAppAngle-2.f)/3.f; - } + // First Calculate Alpha + // If alpha > 0, create mNameText if necessary, otherwise delete it + F32 alpha = 0.f; + if (mAppAngle > 5.f) + { + const F32 START_FADE_TIME = NAME_SHOW_TIME - FADE_DURATION; + if (!visible_chat && sRenderName == RENDER_NAME_FADE && time_visible > START_FADE_TIME) + { + alpha = 1.f - (time_visible - START_FADE_TIME) / FADE_DURATION; + } + else + { + // ...not fading, full alpha + alpha = 1.f; + } + } + else if (mAppAngle > 2.f) + { + // far away is faded out also + alpha = (mAppAngle-2.f)/3.f; + } if (alpha <= 0.f) - { + { if (mNameText) { mNameText->markDead(); @@ -2749,19 +2749,19 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) return; } - if (!mNameText) - { + if (!mNameText) + { mNameText = static_cast( LLHUDObject::addHUDObject( LLHUDObject::LL_HUD_NAME_TAG) ); //mNameText->setMass(10.f); - mNameText->setSourceObject(this); + mNameText->setSourceObject(this); mNameText->setVertAlignment(LLHUDNameTag::ALIGN_VERT_TOP); - mNameText->setVisibleOffScreen(TRUE); - mNameText->setMaxLines(11); - mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); - sNumVisibleChatBubbles++; - new_name = TRUE; - } + mNameText->setVisibleOffScreen(TRUE); + mNameText->setMaxLines(11); + mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); + sNumVisibleChatBubbles++; + new_name = TRUE; + } LLVector3 name_position = idleUpdateNameTagPosition(root_pos_last); mNameText->setPositionAgent(name_position); @@ -2772,10 +2772,10 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) } void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) - { - LLNameValue *title = getNVPair("Title"); - LLNameValue* firstname = getNVPair("FirstName"); - LLNameValue* lastname = getNVPair("LastName"); +{ + LLNameValue *title = getNVPair("Title"); + LLNameValue* firstname = getNVPair("FirstName"); + LLNameValue* lastname = getNVPair("LastName"); // Avatars must have a first and last name if (!firstname || !lastname) return; @@ -2784,14 +2784,14 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) bool is_busy = mSignaledAnimations.find(ANIM_AGENT_BUSY) != mSignaledAnimations.end(); bool is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end(); bool is_muted; - if (isSelf()) - { + if (isSelf()) + { is_muted = false; - } - else - { - is_muted = LLMuteList::getInstance()->isMuted(getID()); - } + } + else + { + is_muted = LLMuteList::getInstance()->isMuted(getID()); + } bool is_friend = LLAvatarTracker::instance().isBuddy(getID()); // Rebuild name tag if state change detected @@ -2804,21 +2804,21 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) || is_muted != mNameMute || is_appearance != mNameAppearance || is_friend != mNameFriend) - { + { LLColor4 name_tag_color = getNameTagColor(is_friend); clearNameTag(); if (is_away || is_muted || is_busy || is_appearance) - { + { std::string line; - if (is_away) - { - line += LLTrans::getString("AvatarAway"); + if (is_away) + { + line += LLTrans::getString("AvatarAway"); line += ", "; - } - if (is_busy) - { + } + if (is_busy) + { line += LLTrans::getString("AvatarBusy"); line += ", "; } @@ -2828,10 +2828,10 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) line += ", "; } if (is_appearance) - { + { line += LLTrans::getString("AvatarEditingAppearance"); - line += ", "; - } + line += ", "; + } // trim last ", " line.resize( line.length() - 2 ); LLColor4 status_color = @@ -2849,7 +2849,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) LLStringFn::replace_ascii_controlchars(title_str,LL_UNKNOWN_CHAR); addNameTagLine(title_str, group_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); - } + } static LLUICachedControl show_display_names("NameTagShowDisplayNames"); static LLUICachedControl show_slids("NameTagShowSLIDs"); @@ -2858,7 +2858,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) { LLAvatarName av_name; if (!LLAvatarNameCache::get(getID(), &av_name)) - { + { // ...call this function back when the name arrives // and force a rebuild LLAvatarNameCache::get(getID(), @@ -2867,48 +2867,48 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) // Might be blank if name not available yet, that's OK if (show_slids) - { + { // JAMESDEBUG HACK LLColor4 slid_color = name_tag_color * 0.8f; addNameTagLine(av_name.mSLID, slid_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); - } + } if (show_display_names) { addNameTagLine(av_name.mDisplayName, name_tag_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerif()); - } - } + } + } else - { + { static LLUICachedControl small_avatar_names("SmallAvatarNames"); const LLFontGL* font = (small_avatar_names ? LLFontGL::getFontSansSerif() : LLFontGL::getFontSansSerifBig() ); std::string full_name = LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font); - } + } - mNameAway = is_away; - mNameBusy = is_busy; - mNameMute = is_muted; - mNameAppearance = is_appearance; + mNameAway = is_away; + mNameBusy = is_busy; + mNameMute = is_muted; + mNameAppearance = is_appearance; mNameFriend = is_friend; - mTitle = title ? title->getString() : ""; - LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); - new_name = TRUE; - } + mTitle = title ? title->getString() : ""; + LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); + new_name = TRUE; + } if (mVisibleChat) - { - mNameText->setFont(LLFontGL::getFontSansSerif()); + { + mNameText->setFont(LLFontGL::getFontSansSerif()); mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_LEFT); - mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); + mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); - char line[MAX_STRING]; /* Flawfinder: ignore */ - line[0] = '\0'; - std::deque::iterator chat_iter = mChats.begin(); - mNameText->clearString(); + char line[MAX_STRING]; /* Flawfinder: ignore */ + line[0] = '\0'; + std::deque::iterator chat_iter = mChats.begin(); + mNameText->clearString(); LLColor4 new_chat = LLUIColorTable::instance().getColor( "NameTagChat" ); LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f); @@ -2980,16 +2980,16 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) } void LLVOAvatar::addNameTagLine(const std::string& line, const LLColor4& color, S32 style, const LLFontGL* font) - { +{ llassert(mNameText); if (mVisibleChat) { mNameText->addLabel(line); - } - else - { + } + else + { mNameText->addLine(line, color, (LLFontGL::StyleFlags)style, font); - } + } mNameString += line; mNameString += '\n'; } @@ -2998,8 +2998,8 @@ void LLVOAvatar::clearNameTag() { mNameString.clear(); if (mNameText) - { - mNameText->setLabel(""); + { + mNameText->setLabel(""); mNameText->setString( "" ); } } @@ -3049,8 +3049,8 @@ void LLVOAvatar::idleUpdateNameTagAlpha(BOOL new_name, F32 alpha) { mNameText->setAlpha(alpha); mNameAlpha = alpha; - } - } + } +} LLColor4 LLVOAvatar::getNameTagColor(bool is_friend) { -- cgit v1.2.3 From 99f5307543e03e296edf2d9d9c0b26d38d56d034 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 7 Apr 2010 10:26:03 -0700 Subject: SLID goes under display name --- indra/newview/llvoavatar.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5bf9f69ae3..6aac53dd73 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2866,6 +2866,11 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) } // Might be blank if name not available yet, that's OK + if (show_display_names) + { + addNameTagLine(av_name.mDisplayName, name_tag_color, LLFontGL::NORMAL, + LLFontGL::getFontSansSerif()); + } if (show_slids) { // JAMESDEBUG HACK @@ -2873,11 +2878,6 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) addNameTagLine(av_name.mSLID, slid_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); } - if (show_display_names) - { - addNameTagLine(av_name.mDisplayName, name_tag_color, LLFontGL::NORMAL, - LLFontGL::getFontSansSerif()); - } } else { -- cgit v1.2.3 From 65e565e0e1d7b964048a32a92f59a5dd8f74bb0c Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 12 Apr 2010 16:36:12 -0700 Subject: DEV-47529 Convert viewer to use final People API lookup URL format Reviewed with Simon --- indra/newview/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 6aac53dd73..74ff9b74b6 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3065,7 +3065,7 @@ LLColor4 LLVOAvatar::getNameTagColor(bool is_friend) LLAvatarName av_name; if (LLAvatarNameCache::useDisplayNames() && LLAvatarNameCache::get(getID(), &av_name) - && av_name.mIsLegacy) + && av_name.mIsDisplayNameDefault) { color_name = "NameTagLegacy"; } -- cgit v1.2.3 From a159751e61526f7d389c2b951be057b5155f1c69 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 13 Apr 2010 12:03:49 -0700 Subject: Hide SLID if it matches display name, leave SLIDs on by default otherwise I don't like this, but Crimp and Hamilton want it to address M's concerns about impersonation. --- indra/newview/llvoavatar.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 74ff9b74b6..881012467e 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2871,10 +2871,11 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) addNameTagLine(av_name.mDisplayName, name_tag_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerif()); } - if (show_slids) + // Suppress SLID display if display name matches exactly (ugh) + if (show_slids && !av_name.mIsDisplayNameDefault) { // JAMESDEBUG HACK - LLColor4 slid_color = name_tag_color * 0.8f; + LLColor4 slid_color = name_tag_color * 0.83f; addNameTagLine(av_name.mSLID, slid_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); } -- cgit v1.2.3 From d89de271437f35f9d26e28409e6cc1d593a2fc7a Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 26 Apr 2010 10:51:42 -0700 Subject: DEV-47529 Viewer turns display names on/off based on region capability Also refreshes name tags so you can see the state. Reviewed with Kelly. --- indra/newview/llvoavatar.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 881012467e..9e56357b30 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3017,6 +3017,20 @@ void LLVOAvatar::invalidateNameTag(const LLUUID& agent_id) avatar->clearNameTag(); } +//static +void LLVOAvatar::invalidateNameTags() +{ + std::vector::iterator it = LLCharacter::sInstances.begin(); + for ( ; it != LLCharacter::sInstances.end(); ++it) + { + LLVOAvatar* avatar = dynamic_cast(*it); + if (!avatar) continue; + if (avatar->isDead()) continue; + + avatar->clearNameTag(); + } +} + // Compute name tag position during idle update LLVector3 LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) { -- cgit v1.2.3 From 4fca2fe33013186d269f4f4f7b43d2a36089e539 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 5 May 2010 17:16:26 -0700 Subject: WIP Final name tag colors, fonts, show logic --- indra/newview/llvoavatar.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 9e56357b30..c71cb1feaa 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3069,21 +3069,30 @@ void LLVOAvatar::idleUpdateNameTagAlpha(BOOL new_name, F32 alpha) LLColor4 LLVOAvatar::getNameTagColor(bool is_friend) { - const char* color_name = "NameTagText"; + const char* color_name; if (is_friend) { color_name = "NameTagFriend"; } - else + else if (LLAvatarNameCache::useDisplayNames()) { - // IDEVO can we avoid doing this lookup repeatedly? + // ...color based on whether SLID "matches" a computed display + // name LLAvatarName av_name; - if (LLAvatarNameCache::useDisplayNames() - && LLAvatarNameCache::get(getID(), &av_name) + if (LLAvatarNameCache::get(getID(), &av_name) && av_name.mIsDisplayNameDefault) - { - color_name = "NameTagLegacy"; + { + color_name = "NameTagMatch"; } + else + { + color_name = "NameTagMismatch"; + } + } + else + { + // ...not using display names + color_name = "NameTagLegacy"; } return LLUIColorTable::getInstance()->getColor( color_name ); } -- cgit v1.2.3 From 3bc7e63f92b29f4be44a589b661d7ff911b443cf Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 12 May 2010 13:54:49 -0700 Subject: Fix merge problem, crash on close prefs due to SmallAvatarNames Was deleted in trunk in code I refactored extensively. --- indra/newview/llvoavatar.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 8fa845e54a..9ee2c913c6 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2886,9 +2886,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) } else { - static LLUICachedControl small_avatar_names("SmallAvatarNames"); - const LLFontGL* font = - (small_avatar_names ? LLFontGL::getFontSansSerif() : LLFontGL::getFontSansSerifBig() ); + const LLFontGL* font = LLFontGL::getFontSansSerif(); std::string full_name = LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font); -- cgit v1.2.3 From f4148502e484d516b42c4a88603eee6889d45697 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 18 May 2010 16:00:45 -0700 Subject: Rename mSLID to mUsername to match the name of the field in the UI Product made a late-breaking request to change the name of this field. The wire protocol for People API has not yet changed. --- indra/newview/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5e6f294071..e7721d6068 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2880,7 +2880,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) { // JAMESDEBUG HACK LLColor4 slid_color = name_tag_color * 0.83f; - addNameTagLine(av_name.mSLID, slid_color, LLFontGL::NORMAL, + addNameTagLine(av_name.mUsername, slid_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); } } -- cgit v1.2.3 From cbc9fcabf945558ef22d35e2957ae9f1c879ef7b Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 19 May 2010 09:38:49 -0700 Subject: DEV-50013 More SLID to Username renames --- indra/newview/llvoavatar.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e7721d6068..40e1f31697 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2856,7 +2856,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) } static LLUICachedControl show_display_names("NameTagShowDisplayNames"); - static LLUICachedControl show_slids("NameTagShowSLIDs"); + static LLUICachedControl show_usernames("NameTagShowUsernames"); if (LLAvatarNameCache::useDisplayNames()) { @@ -2876,11 +2876,11 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) LLFontGL::getFontSansSerif()); } // Suppress SLID display if display name matches exactly (ugh) - if (show_slids && !av_name.mIsDisplayNameDefault) + if (show_usernames && !av_name.mIsDisplayNameDefault) { - // JAMESDEBUG HACK - LLColor4 slid_color = name_tag_color * 0.83f; - addNameTagLine(av_name.mUsername, slid_color, LLFontGL::NORMAL, + // *HACK: Desaturate the color + LLColor4 username_color = name_tag_color * 0.83f; + addNameTagLine(av_name.mUsername, username_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); } } -- cgit v1.2.3 From d822206a48633e03f7456663d7d7d82b73ba209f Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 19 May 2010 10:25:52 -0700 Subject: Remove colors for match/mismatch/friends from name tags Product team request. Reviewed with Leyla --- indra/newview/llvoavatar.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 40e1f31697..a9250991f6 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3072,14 +3072,15 @@ void LLVOAvatar::idleUpdateNameTagAlpha(BOOL new_name, F32 alpha) LLColor4 LLVOAvatar::getNameTagColor(bool is_friend) { + static LLUICachedControl show_friends("NameTagShowFriends"); const char* color_name; - if (is_friend) + if (show_friends && is_friend) { color_name = "NameTagFriend"; } else if (LLAvatarNameCache::useDisplayNames()) { - // ...color based on whether SLID "matches" a computed display + // ...color based on whether username "matches" a computed display // name LLAvatarName av_name; if (LLAvatarNameCache::get(getID(), &av_name) -- cgit v1.2.3 From e7b1a16f071ff0ab253136a284e20d737352a5ca Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 20 May 2010 16:39:26 -0700 Subject: Strip out debug code related to toggling display names on/off --- indra/newview/llvoavatar.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 7e061d69c9..cc38616cb8 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -665,7 +665,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mNameAlpha(0.f), mRenderGroupTitles(sRenderGroupTitles), mNameCloud(false), - mUseDisplayNames( LLAvatarNameCache::useDisplayNames() ), mFirstTEMessageReceived( FALSE ), mFirstAppearanceMessageReceived( FALSE ), mCulled( FALSE ), @@ -2748,13 +2747,6 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) new_name = TRUE; } - // IDEVO HACK to force refresh - if (LLAvatarNameCache::useDisplayNames() != mUseDisplayNames) - { - mUseDisplayNames = LLAvatarNameCache::useDisplayNames(); - new_name = TRUE; - } - // First Calculate Alpha // If alpha > 0, create mNameText if necessary, otherwise delete it F32 alpha = 0.f; -- cgit v1.2.3 From 20cea3b0f97c8c24ede5e8ec86dd426e7b1c9e34 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 16 Sep 2010 14:15:32 -0700 Subject: As a resident, when I elect to see friends names in green, it should also colour their group tags so that the name tags don't look like crap. This also applies to status message - Away/Busy in nametag --- indra/newview/llvoavatar.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 9dc49169df..a4efacdca9 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2952,20 +2952,16 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) } // trim last ", " line.resize( line.length() - 2 ); - LLColor4 status_color = - LLUIColorTable::getInstance()->getColor("NameTagStatus"); - addNameTagLine(line, status_color, LLFontGL::NORMAL, + addNameTagLine(line, name_tag_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); } if (sRenderGroupTitles && title && title->getString() && title->getString()[0] != '\0') { - LLColor4 group_color = - LLUIColorTable::getInstance()->getColor("NameTagGroup"); std::string title_str = title->getString(); LLStringFn::replace_ascii_controlchars(title_str,LL_UNKNOWN_CHAR); - addNameTagLine(title_str, group_color, LLFontGL::NORMAL, + addNameTagLine(title_str, name_tag_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); } -- cgit v1.2.3