diff options
author | James Cook <james@lindenlab.com> | 2010-02-25 17:06:17 -0800 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2010-02-25 17:06:17 -0800 |
commit | 36c35bca2663447216027015c10aa921ab75abfb (patch) | |
tree | c716404bf813a4635fef60a7419a3961c6de10b4 | |
parent | 3eec41f6716940ffcfd4bf239e1e493c2d0a0658 (diff) |
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
-rw-r--r-- | indra/newview/llglsandbox.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llhudtext.cpp | 79 | ||||
-rw-r--r-- | indra/newview/llhudtext.h | 29 | ||||
-rw-r--r-- | indra/newview/lltracker.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 172 | ||||
-rw-r--r-- | indra/newview/llvoavatar.h | 8 |
8 files changed, 165 insertions, 143 deletions
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 750a9d478f..134e63fa35 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -983,7 +983,7 @@ void LLViewerObjectList::renderObjectBeacons() color = debug_beacon.mTextColor; color.mV[3] *= 1.f; - hud_textp->setString(utf8str_to_wstring(debug_beacon.mString)); + hud_textp->setString(debug_beacon.mString); hud_textp->setColor(color); hud_textp->setPositionAgent(debug_beacon.mPositionAgent); debug_beacon.mHUDObject = hud_textp; diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 53fc176268..347b87f808 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -490,6 +490,7 @@ void LLHUDText::renderText(BOOL for_select) for(std::vector<LLHUDTextSegment>::iterator segment_iter = mLabelSegments.begin(); segment_iter != mLabelSegments.end(); ++segment_iter ) { + // Label segments use default font const LLFontGL* fontp = (segment_iter->mStyle == LLFontGL::BOLD) ? mBoldFontp : mFontp; y_offset -= fontp->getLineHeight(); @@ -527,7 +528,7 @@ void LLHUDText::renderText(BOOL for_select) for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin() + start_segment; segment_iter != mTextSegments.end(); ++segment_iter ) { - const LLFontGL* fontp = (segment_iter->mStyle == LLFontGL::BOLD) ? mBoldFontp : mFontp; + const LLFontGL* fontp = segment_iter->mFont; y_offset -= fontp->getLineHeight(); U8 style = segment_iter->mStyle; @@ -561,15 +562,10 @@ void LLHUDText::renderText(BOOL for_select) } } -void LLHUDText::setStringUTF8(const std::string &wtext) -{ - setString(utf8str_to_wstring(wtext)); -} - -void LLHUDText::setString(const LLWString &wtext) +void LLHUDText::setString(const std::string &text_utf8) { mTextSegments.clear(); - addLine(wtext, mColor); + addLine(text_utf8, mColor); } void LLHUDText::clearString() @@ -578,21 +574,19 @@ void LLHUDText::clearString() } -void LLHUDText::addLine(const std::string &str, const LLColor4& color, const LLFontGL::StyleFlags style) -{ - addLine(utf8str_to_wstring(str), color, style); -} - - -void LLHUDText::addLine(const LLWString &wstr, const LLColor4& color, const LLFontGL::StyleFlags style) +void LLHUDText::addLine(const std::string &text_utf8, + const LLColor4& color, + const LLFontGL::StyleFlags style, + const LLFontGL* font) { - if (gNoRender) + LLWString wline = utf8str_to_wstring(text_utf8); + if (!wline.empty()) { - return; - } - if (!wstr.empty()) - { - LLWString wline(wstr); + // use default font for segment if custom font not specified + if (!font) + { + font = mFontp; + } typedef boost::tokenizer<boost::char_separator<llwchar>, LLWString::const_iterator, LLWString > tokenizer; LLWString seps(utf8str_to_wstring("\r\n")); boost::char_separator<llwchar> sep(seps.c_str()); @@ -605,8 +599,10 @@ void LLHUDText::addLine(const LLWString &wstr, const LLColor4& color, const LLFo U32 line_length = 0; do { - S32 segment_length = mFontp->maxDrawableChars(iter->substr(line_length).c_str(), mUseBubble ? HUD_TEXT_MAX_WIDTH : HUD_TEXT_MAX_WIDTH_NO_BUBBLE, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); - mTextSegments.push_back(LLHUDTextSegment(iter->substr(line_length, segment_length), style, color)); + F32 max_pixels = (mUseBubble ? HUD_TEXT_MAX_WIDTH : HUD_TEXT_MAX_WIDTH_NO_BUBBLE); + S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + LLHUDTextSegment segment(iter->substr(line_length, segment_length), style, color, font); + mTextSegments.push_back(segment); line_length += segment_length; } while (line_length != iter->size()); @@ -615,18 +611,17 @@ void LLHUDText::addLine(const LLWString &wstr, const LLColor4& color, const LLFo } } -void LLHUDText::setLabel(const std::string &label) +void LLHUDText::setLabel(const std::string &label_utf8) { - setLabel(utf8str_to_wstring(label)); + mLabelSegments.clear(); + addLabel(label_utf8); } -void LLHUDText::setLabel(const LLWString &wlabel) +void LLHUDText::addLabel(const std::string& label_utf8) { - mLabelSegments.clear(); - - if (!wlabel.empty()) + LLWString wstr = utf8string_to_wstring(label_utf8); + if (!wstr.empty()) { - LLWString wstr(wlabel); LLWString seps(utf8str_to_wstring("\r\n")); LLWString empty; @@ -642,7 +637,8 @@ void LLHUDText::setLabel(const LLWString &wlabel) do { S32 segment_length = mFontp->maxDrawableChars(iter->substr(line_length).c_str(), mUseBubble ? HUD_TEXT_MAX_WIDTH : HUD_TEXT_MAX_WIDTH_NO_BUBBLE, wstr.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); - mLabelSegments.push_back(LLHUDTextSegment(iter->substr(line_length, segment_length), LLFontGL::NORMAL, mColor)); + LLHUDTextSegment segment(iter->substr(line_length, segment_length), LLFontGL::NORMAL, mColor, mFontp); + mLabelSegments.push_back(segment); line_length += segment_length; } while (line_length != iter->size()); @@ -677,6 +673,16 @@ void LLHUDText::setColor(const LLColor4 &color) } } +void LLHUDText::setAlpha(F32 alpha) +{ + mColor.mV[VALPHA] = alpha; + for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin(); + segment_iter != mTextSegments.end(); ++segment_iter ) + { + segment_iter->mColor.mV[VALPHA] = alpha; + } +} + void LLHUDText::setDoFade(const BOOL do_fade) { @@ -821,12 +827,12 @@ LLVector2 LLHUDText::updateScreenPos(LLVector2 &offset) void LLHUDText::updateSize() { + F32 height = 0.f; F32 width = 0.f; S32 max_lines = getMaxLines(); - S32 lines = (max_lines < 0) ? (S32)mTextSegments.size() : llmin((S32)mTextSegments.size(), max_lines); - - F32 height = (F32)mFontp->getLineHeight() * (lines + mLabelSegments.size()); + //S32 lines = (max_lines < 0) ? (S32)mTextSegments.size() : llmin((S32)mTextSegments.size(), max_lines); + //F32 height = (F32)mFontp->getLineHeight() * (lines + mLabelSegments.size()); S32 start_segment; if (max_lines < 0) start_segment = 0; @@ -835,13 +841,16 @@ void LLHUDText::updateSize() std::vector<LLHUDTextSegment>::iterator iter = mTextSegments.begin() + start_segment; while (iter != mTextSegments.end()) { - width = llmax(width, llmin(iter->getWidth(mFontp), HUD_TEXT_MAX_WIDTH)); + const LLFontGL* fontp = iter->mFont; + height += fontp->getLineHeight(); + width = llmax(width, llmin(iter->getWidth(fontp), HUD_TEXT_MAX_WIDTH)); ++iter; } iter = mLabelSegments.begin(); while (iter != mLabelSegments.end()) { + height += mFontp->getLineHeight(); width = llmax(width, llmin(iter->getWidth(mFontp), HUD_TEXT_MAX_WIDTH)); ++iter; } diff --git a/indra/newview/llhudtext.h b/indra/newview/llhudtext.h index 5d88b5d6ab..f7248ceffc 100644 --- a/indra/newview/llhudtext.h +++ b/indra/newview/llhudtext.h @@ -34,7 +34,7 @@ #define LL_LLHUDTEXT_H #include "llpointer.h" -#include "lldarrayptr.h" +//#include "lldarrayptr.h" #include "llhudobject.h" #include "v4color.h" @@ -45,7 +45,7 @@ #include "llfontgl.h" #include <set> #include <vector> -#include "lldarray.h" +//#include "lldarray.h" // Renders a 2D text billboard floating at the location specified. class LLDrawable; @@ -62,14 +62,19 @@ protected: class LLHUDTextSegment { public: - LLHUDTextSegment(const LLWString& text, const LLFontGL::StyleFlags style, const LLColor4& color) - : mColor(color), mStyle(style), mText(text) {} + LLHUDTextSegment(const LLWString& text, const LLFontGL::StyleFlags style, const LLColor4& color, const LLFontGL* font) + : mColor(color), + mStyle(style), + mText(text), + mFont(font) + {} F32 getWidth(const LLFontGL* font); - const LLWString& getText() const { return mText; }; + const LLWString& getText() const { return mText; } void clearFontWidthMap() { mFontWidthMap.clear(); } LLColor4 mColor; LLFontGL::StyleFlags mStyle; + const LLFontGL* mFont; private: LLWString mText; std::map<const LLFontGL*, F32> mFontWidthMap; @@ -89,16 +94,18 @@ public: } EVertAlignment; public: - void setStringUTF8(const std::string &utf8string); - void setString(const LLWString &wstring); + void setString(const std::string& text_utf8); +// void setString(const LLWString &wstring); void clearString(); - void addLine(const std::string &text, const LLColor4& color, const LLFontGL::StyleFlags style = LLFontGL::NORMAL); - void addLine(const LLWString &wtext, const LLColor4& color, const LLFontGL::StyleFlags style = LLFontGL::NORMAL); - void setLabel(const std::string &label); - void setLabel(const LLWString &label); + void addLine(const std::string &text_utf8, const LLColor4& color, const LLFontGL::StyleFlags style = LLFontGL::NORMAL, const LLFontGL* font = NULL); +// void addLine(const LLWString &wtext, const LLColor4& color, const LLFontGL::StyleFlags style = LLFontGL::NORMAL, const LLFontGL* font = NULL); + void setLabel(const std::string& label_utf8); +// void setLabel(const LLWString &label); + void addLabel(const std::string& label_utf8); void setDropShadow(const BOOL do_shadow); void setFont(const LLFontGL* font); void setColor(const LLColor4 &color); + void setAlpha(F32 alpha); void setZCompare(const BOOL zcompare); void setDoFade(const BOOL do_fade); void setVisibleOffScreen(BOOL visible) { mVisibleOffScreen = visible; } diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp index 407cc23d0d..280763be57 100644 --- a/indra/newview/lltracker.cpp +++ b/indra/newview/lltracker.cpp @@ -568,16 +568,16 @@ void LLTracker::renderBeacon(LLVector3d pos_global, std::string text; text = llformat( "%.0f m", to_vec.magVec()); - LLWString wstr; - wstr += utf8str_to_wstring(label); - wstr += '\n'; - wstr += utf8str_to_wstring(text); + std::string str; + str += label; + str += '\n'; + str += text; hud_textp->setFont(LLFontGL::getFontSansSerif()); hud_textp->setZCompare(FALSE); hud_textp->setColor(LLColor4(1.f, 1.f, 1.f, llmax(0.2f, llmin(1.f,(dist-FADE_DIST)/FADE_DIST)))); - hud_textp->setString(wstr); + hud_textp->setString(str); hud_textp->setVertAlignment(LLHUDText::ALIGN_VERT_CENTER); hud_textp->setPositionAgent(pos_agent); } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 309bed7fc3..83d52fbbfc 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2674,7 +2674,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(chatter); if (avatar) { - avatar->invalidateName(); + avatar->clearNameTag(); } } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index d0afa9d9de..6e4d375d28 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -1071,7 +1071,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // alpha was flipped so that it zero encoded better coloru.mV[3] = 255 - coloru.mV[3]; mText->setColor(LLColor4(coloru)); - mText->setStringUTF8(temp_string); + mText->setString(temp_string); if (mDrawable.notNull()) { @@ -1463,7 +1463,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, dp->unpackBinaryDataFixed(coloru.mV, 4, "Color"); coloru.mV[3] = 255 - coloru.mV[3]; mText->setColor(LLColor4(coloru)); - mText->setStringUTF8(temp_string); + mText->setString(temp_string); setChanged(TEXTURE); } @@ -4119,7 +4119,7 @@ void LLViewerObject::setDebugText(const std::string &utf8text) mText->setOnHUDAttachment(isHUDAttachment()); } mText->setColor(LLColor4::white); - mText->setStringUTF8(utf8text); + mText->setString(utf8text); mText->setZCompare(FALSE); mText->setDoFade(FALSE); updateText(); 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<bool> 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<bool> 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(); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index b1bdf453f3..b63e3b2ebd 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -212,7 +212,10 @@ public: void idleUpdateNameTag(const LLVector3& root_pos_last); void idleUpdateNameTagText(BOOL new_name); LLVector3 idleUpdateNameTagPosition(const LLVector3& root_pos_last); - void idleUpdateNameTagColor(BOOL new_name, F32 alpha); + void idleUpdateNameTagAlpha(BOOL new_name, F32 alpha); + LLColor4 getNameTagColor(bool is_friend); + void clearNameTag(); + void addNameTagLine(const std::string& line, const LLColor4& color, S32 style, const LLFontGL* font); void idleUpdateRenderCost(); void idleUpdateTractorBeam(); void idleUpdateBelowWater(); @@ -819,12 +822,11 @@ private: public: std::string getFullname() const; // Returns "FirstName LastName" - void invalidateName(); // force name to update protected: static void getAnimLabels(LLDynamicArray<std::string>* labels); static void getAnimNames(LLDynamicArray<std::string>* names); private: - LLWString mNameString; + std::string mNameString; // UTF-8 title + name + status std::string mTitle; bool mNameAway; bool mNameBusy; |