summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-02-24 11:03:52 -0800
committerJames Cook <james@lindenlab.com>2010-02-24 11:03:52 -0800
commit70f4e8ede81e1a1259345891c946dc447d686718 (patch)
treefaf05d5c860ec7d6bdad2455e93457a248c60ece
parent4fafec91fb9e687861c520da0a520354a98bd522 (diff)
Use async display name lookup for name tags, makes them refresh properly when toggling display name feature
-rw-r--r--indra/newview/llvoavatar.cpp21
-rw-r--r--indra/newview/llvoavatar.h1
2 files changed, 18 insertions, 4 deletions
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<bool> show_display_names("NameTagShowDisplayNames");
static LLUICachedControl<bool> 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());
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index f70c68bcba..b370bcb26d 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -210,6 +210,7 @@ public:
void idleUpdateLoadingEffect();
void idleUpdateWindEffect();
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 idleUpdateRenderCost();