diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llappviewer.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llvoavatar.h | 2 |
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(); |