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.meow-7.2.2
parent
c1ff714797
commit
d89de27143
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue