Add @shownametags:<distance>
parent
8fe310f283
commit
cdd624c4e7
|
|
@ -3088,7 +3088,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
|
|||
bool fRlvShowAvTag = true, fRlvShowAvName = true;
|
||||
if (RlvActions::isRlvEnabled())
|
||||
{
|
||||
fRlvShowAvTag = RlvActions::canShowName(RlvActions::SNC_NAMETAG, getID());
|
||||
fRlvShowAvTag = RlvActions::canShowNameTag(this);
|
||||
fRlvShowAvName = (fRlvShowAvTag) && (RlvActions::canShowName(RlvActions::SNC_DEFAULT, getID()));
|
||||
}
|
||||
// [/RLVa:KB]
|
||||
|
|
|
|||
|
|
@ -220,9 +220,6 @@ bool RlvActions::canShowName(EShowNamesContext eContext, const LLUUID& idAgent)
|
|||
{
|
||||
switch (eContext)
|
||||
{
|
||||
// Show/hide avatar nametag
|
||||
case SNC_NAMETAG:
|
||||
return (gRlvHandler.isException(RLV_BHVR_SHOWNAMETAGS, idAgent)) || (gAgentID == idAgent);
|
||||
// Show/hide avatar name
|
||||
case SNC_DEFAULT:
|
||||
case SNC_TELEPORTOFFER:
|
||||
|
|
@ -233,6 +230,19 @@ bool RlvActions::canShowName(EShowNamesContext eContext, const LLUUID& idAgent)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool RlvActions::canShowNameTag(const LLVOAvatar* pAvatar)
|
||||
{
|
||||
// An avatar's name tag can be shown if:
|
||||
// - not restricted from seeing avatars' name tags
|
||||
// - OR the avatar is a @shownametags exception
|
||||
// - OR the avatar is within the distance that nametags can be shown
|
||||
if ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMETAGS)) || (gRlvHandler.isException(RLV_BHVR_SHOWNAMETAGS, pAvatar->getID())) || (gAgentID == pAvatar->getID()) )
|
||||
return true;
|
||||
|
||||
const F32 nShowNameTagsDist = RlvBehaviourDictionary::instance().getModifier(RLV_MODIFIER_SHOWNAMETAGSDIST)->getValue<F32>();
|
||||
return (nShowNameTagsDist != 0.f) && (dist_vec_squared(pAvatar->getPositionGlobal(), gAgent.getPositionGlobal()) < nShowNameTagsDist * nShowNameTagsDist);
|
||||
}
|
||||
|
||||
bool RlvActions::canShowNearbyAgents()
|
||||
{
|
||||
return !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNEARBY);
|
||||
|
|
|
|||
|
|
@ -123,8 +123,9 @@ public:
|
|||
* (This is used to hide an avatar name in one case but not a near-identical case - such as teleporting a friend vs a nearby agent -
|
||||
* in a way that limits the amount of code that needs to be changed to carry context from one function to another)
|
||||
*/
|
||||
enum EShowNamesContext { SNC_DEFAULT = 0, SNC_NAMETAG, SNC_TELEPORTOFFER, SNC_TELEPORTREQUEST, SNC_COUNT };
|
||||
enum EShowNamesContext { SNC_DEFAULT = 0, SNC_TELEPORTOFFER, SNC_TELEPORTREQUEST, SNC_COUNT };
|
||||
static bool canShowName(EShowNamesContext eContext, const LLUUID& idAgent = LLUUID::null);
|
||||
static bool canShowNameTag(const LLVOAvatar* pAvatar);
|
||||
static void setShowName(EShowNamesContext eContext, bool fCanShowName) { if ( (eContext < SNC_COUNT) && (isRlvEnabled()) ) { s_BlockNamesContexts[eContext] = !fCanShowName; } }
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -274,6 +274,7 @@ enum ERlvBehaviourModifier
|
|||
RLV_MODIFIER_SETCAM_FOVMIN, // Minimum value for the camera's field of view (angle in radians)
|
||||
RLV_MODIFIER_SETCAM_FOVMAX, // Maximum value for the camera's field of view (angle in radians)
|
||||
RLV_MODIFIER_SETCAM_TEXTURE, // Specifies the UUID of the texture used to texture the world view
|
||||
RLV_MODIFIER_SHOWNAMETAGSDIST, // Distance at which name tags will still be shown
|
||||
RLV_MODIFIER_SITTPDIST,
|
||||
RLV_MODIFIER_TPLOCALDIST,
|
||||
|
||||
|
|
|
|||
|
|
@ -2564,28 +2564,31 @@ ERlvCmdRet RlvBehaviourHandler<RLV_BHVR_SHOWNAMES>::onCommand(const RlvCommand&
|
|||
return eRet;
|
||||
}
|
||||
|
||||
// Handles: @shownametags[:<uuid>]=n|y toggles
|
||||
template<> template<>
|
||||
void RlvBehaviourToggleHandler<RLV_BHVR_SHOWNAMETAGS>::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr)
|
||||
// Handles: @shownametags[:<distance>] value changes
|
||||
template<>
|
||||
void RlvBehaviourModifierHandler<RLV_MODIFIER_SHOWNAMETAGSDIST>::onValueChange() const
|
||||
{
|
||||
if (LLApp::isExiting())
|
||||
return; // Nothing to do if the viewer is shutting down
|
||||
|
||||
// Update the shownames context
|
||||
RlvActions::setShowName(RlvActions::SNC_NAMETAG, !fHasBhvr);
|
||||
|
||||
// Refresh all name tags
|
||||
LLVOAvatar::invalidateNameTags();
|
||||
}
|
||||
|
||||
// Handles: @shownametags[:<uuid>]=n|y
|
||||
// Handles: @shownametags[:<distance|uuid>]=n|y
|
||||
template<> template<>
|
||||
ERlvCmdRet RlvBehaviourHandler<RLV_BHVR_SHOWNAMETAGS>::onCommand(const RlvCommand& rlvCmd, bool& fRefCount)
|
||||
{
|
||||
ERlvCmdRet eRet = RlvBehaviourGenericHandler<RLV_OPTION_NONE_OR_EXCEPTION>::onCommand(rlvCmd, fRefCount);
|
||||
if ( (RLV_RET_SUCCESS == eRet) && (rlvCmd.hasOption()) )
|
||||
LLVOAvatar::invalidateNameTag(RlvCommandOptionHelper::parseOption<LLUUID>(rlvCmd.getOption()));
|
||||
return eRet;
|
||||
LLUUID idOption;
|
||||
if ( (rlvCmd.hasOption()) && (RlvCommandOptionHelper::parseOption(rlvCmd.getOption(), idOption)) )
|
||||
{
|
||||
ERlvCmdRet eRet = RlvBehaviourGenericHandler<RLV_OPTION_EXCEPTION>::onCommand(rlvCmd, fRefCount);
|
||||
if (RLV_RET_SUCCESS == eRet)
|
||||
LLVOAvatar::invalidateNameTag(idOption);
|
||||
fRefCount = false;
|
||||
return eRet;
|
||||
}
|
||||
return RlvBehaviourGenericHandler<RLV_OPTION_NONE_OR_MODIFIER>::onCommand(rlvCmd, fRefCount);
|
||||
}
|
||||
|
||||
// Handles: @shownearby=n|y toggles
|
||||
|
|
|
|||
|
|
@ -146,7 +146,8 @@ RlvBehaviourDictionary::RlvBehaviourDictionary()
|
|||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("showloc", RLV_BHVR_SHOWLOC));
|
||||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("showminimap", RLV_BHVR_SHOWMINIMAP));
|
||||
addEntry(new RlvBehaviourToggleProcessor<RLV_BHVR_SHOWNAMES>("shownames", RlvBehaviourInfo::BHVR_STRICT));
|
||||
addEntry(new RlvBehaviourToggleProcessor<RLV_BHVR_SHOWNAMETAGS>("shownametags", RlvBehaviourInfo::BHVR_STRICT ));
|
||||
addEntry(new RlvBehaviourProcessor<RLV_BHVR_SHOWNAMETAGS>("shownametags", RlvBehaviourInfo::BHVR_STRICT));
|
||||
addModifier(RLV_BHVR_SHOWNAMETAGS, RLV_MODIFIER_SHOWNAMETAGSDIST, new RlvBehaviourModifierHandler<RLV_MODIFIER_SHOWNAMETAGSDIST>("Name Tags - Visible Distance", 0.0f, true, new RlvBehaviourModifierCompMin));
|
||||
addEntry(new RlvBehaviourGenericToggleProcessor<RLV_BHVR_SHOWNEARBY, RLV_OPTION_NONE>("shownearby", RlvBehaviourInfo::BHVR_EXPERIMENTAL));
|
||||
addEntry(new RlvBehaviourGenericToggleProcessor<RLV_BHVR_SHOWSELF, RLV_OPTION_NONE, RlvBehaviourShowSelfToggleHandler>("showself", RlvBehaviourInfo::BHVR_EXPERIMENTAL));
|
||||
addEntry(new RlvBehaviourGenericToggleProcessor<RLV_BHVR_SHOWSELFHEAD, RLV_OPTION_NONE, RlvBehaviourShowSelfToggleHandler>("showselfhead", RlvBehaviourInfo::BHVR_EXPERIMENTAL));
|
||||
|
|
|
|||
Loading…
Reference in New Issue