summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-04-26 10:51:42 -0700
committerJames Cook <james@lindenlab.com>2010-04-26 10:51:42 -0700
commitd89de271437f35f9d26e28409e6cc1d593a2fc7a (patch)
tree8cea7005d835a2706939657aef8a552c342b1449 /indra
parentc1ff7147974a031643776d8ea950f1bc1466737c (diff)
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.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llappviewer.cpp18
-rw-r--r--indra/newview/llvoavatar.cpp14
-rw-r--r--indra/newview/llvoavatar.h2
3 files changed, 33 insertions, 1 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index e160951b91..3b236676f1 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -3919,7 +3919,8 @@ void LLAppViewer::idleNameCache()
std::string name_lookup_url;
name_lookup_url.reserve(128); // avoid a memory allocation below
name_lookup_url = region->getCapability("GetDisplayNames");
- if (!name_lookup_url.empty())
+ bool have_capability = !name_lookup_url.empty();
+ if (have_capability)
{
// we have support for display names, use it
U32 url_size = name_lookup_url.size();
@@ -3939,6 +3940,21 @@ void LLAppViewer::idleNameCache()
LLAvatarNameCache::setNameLookupURL( std::string() );
}
+ // Error recovery - did we change state?
+ if (LLAvatarNameCache::useDisplayNames() && !have_capability)
+ {
+ // ...we just lost the capability, turn names off
+ LLAvatarNameCache::setUseDisplayNames(false);
+ // name tags are persistant on screen, so make sure they refresh
+ LLVOAvatar::invalidateNameTags();
+ }
+ else if (!LLAvatarNameCache::useDisplayNames() && have_capability)
+ {
+ // ...we just gained the capability, turn names on
+ LLAvatarNameCache::setUseDisplayNames(true);
+ LLVOAvatar::invalidateNameTags();
+ }
+
LLAvatarNameCache::idle();
}
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<LLCharacter*>::iterator it = LLCharacter::sInstances.begin();
+ for ( ; it != LLCharacter::sInstances.end(); ++it)
+ {
+ LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(*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)
{
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 4e0275deb5..ad0e2b096e 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -216,6 +216,8 @@ public:
LLColor4 getNameTagColor(bool is_friend);
void clearNameTag();
static void invalidateNameTag(const LLUUID& agent_id);
+ // force all name tags to rebuild, useful when display names turned on/off
+ static void invalidateNameTags();
void addNameTagLine(const std::string& line, const LLColor4& color, S32 style, const LLFontGL* font);
void idleUpdateRenderCost();
void idleUpdateTractorBeam();