From 7c89967a1d817e6a2ad0171cbb75deb6ef7becc2 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Sat, 11 Jun 2016 22:47:23 +0200 Subject: [PATCH] Added @showself=n|y and @showselfhead=n|y --HG-- branch : RLVa --- indra/newview/llagent.cpp | 10 ++++++++-- indra/newview/llvoavatarself.cpp | 23 ++++++++++++++++++++--- indra/newview/rlvhandler.cpp | 9 +++++++++ indra/newview/rlvhelper.cpp | 2 ++ indra/newview/rlvhelper.h | 1 + 5 files changed, 40 insertions(+), 5 deletions(-) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index bd4513714f..bf8607d43e 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1928,7 +1928,10 @@ std::ostream& operator<<(std::ostream &s, const LLAgent &agent) //----------------------------------------------------------------------------- BOOL LLAgent::needsRenderAvatar() { - if (gAgentCamera.cameraMouselook() && !LLVOAvatar::sVisibleInFirstPerson) +// if (gAgentCamera.cameraMouselook() && !LLVOAvatar::sVisibleInFirstPerson) +// [RLVa:KB] - Checked: RLVa-2.0.2 + if ( (gAgentCamera.cameraMouselook() && !LLVOAvatar::sVisibleInFirstPerson) || (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWSELF)) ) +// [/RLVa:KB] { return FALSE; } @@ -1939,7 +1942,10 @@ BOOL LLAgent::needsRenderAvatar() // TRUE if we need to render your own avatar's head. BOOL LLAgent::needsRenderHead() { - return (LLVOAvatar::sVisibleInFirstPerson && LLPipeline::sReflectionRender) || (mShowAvatar && !gAgentCamera.cameraMouselook()); +// [RLVa:KB] - Checked: RLVa-2.0.2 + return ((LLVOAvatar::sVisibleInFirstPerson && LLPipeline::sReflectionRender) || (mShowAvatar && !gAgentCamera.cameraMouselook())) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWSELFHEAD)); +// [/RLVa:KB] +// return (LLVOAvatar::sVisibleInFirstPerson && LLPipeline::sReflectionRender) || (mShowAvatar && !gAgentCamera.cameraMouselook()); } //----------------------------------------------------------------------------- diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 9cef4eda9d..e6685c92a8 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -65,8 +65,9 @@ #include "llsdutil.h" #include "llstartup.h" #include "llsdserialize.h" -// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a) +// [RLVa:KB] - Checked: RLVa-2.0.2 #include "rlvhandler.h" +#include "rlvhelper.h" #include "rlvlocks.h" // [/RLVa:KB] @@ -1062,12 +1063,25 @@ void LLVOAvatarSelf::updateAttachmentVisibility(U32 camera_mode) } else { +// [RLVa:KB] - Checked: RLVa-2.0.2 + bool fRlvCanShowAttachment = true; + if (rlv_handler_t::isEnabled()) + { + fRlvCanShowAttachment = + (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWSELF)) && + ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWSELFHEAD)) || (RLV_ATTACHGROUP_HEAD != rlvAttachGroupFromIndex(attachment->getGroup())) ); + } +// [/RLVa:KB] + switch (camera_mode) { case CAMERA_MODE_MOUSELOOK: if (LLVOAvatar::sVisibleInFirstPerson && attachment->getVisibleInFirstPerson()) { - attachment->setAttachmentVisibility(TRUE); +// [RLVa:KB] - Checked: RLVa-2.0.2 + attachment->setAttachmentVisibility(fRlvCanShowAttachment); +// [/RLVa:KB] +// attachment->setAttachmentVisibility(TRUE); } else { @@ -1075,7 +1089,10 @@ void LLVOAvatarSelf::updateAttachmentVisibility(U32 camera_mode) } break; default: - attachment->setAttachmentVisibility(TRUE); +// [RLVa:KB] - Checked: RLVa-2.0.2 + attachment->setAttachmentVisibility(fRlvCanShowAttachment); +// [/RLVa:KB] +// attachment->setAttachmentVisibility(TRUE); break; } } diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 5360932e4e..2022fbfb22 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -29,6 +29,7 @@ #include "llviewerregion.h" // Command specific includes +#include "llagentcamera.h" // @showself #include "llavatarnamecache.h" // @shownames #include "llavatarlist.h" // @shownames #include "llenvmanager.h" // @setenv @@ -1794,6 +1795,14 @@ ERlvCmdRet RlvBehaviourHandler::onCommand(const RlvComman return eRet; } +// Handles: @showself=n|y and @showselfhead=n|y toggles +template<> template<> +void RlvBehaviourShowSelfToggleHandler::onCommandToggle(ERlvBehaviour eBvhr, bool fHasBhvr) +{ + if (isAgentAvatarValid()) + gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode()); +} + // ============================================================================ // Command handlers (RLV_TYPE_FORCE) // diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index f5e248255e..f2a8e98c37 100644 --- a/indra/newview/rlvhelper.cpp +++ b/indra/newview/rlvhelper.cpp @@ -139,6 +139,8 @@ RlvBehaviourDictionary::RlvBehaviourDictionary() addEntry(new RlvBehaviourGenericProcessor("showminimap", RLV_BHVR_SHOWMINIMAP)); addEntry(new RlvBehaviourToggleProcessor("shownames", RlvBehaviourInfo::BHVR_STRICT)); addEntry(new RlvBehaviourToggleProcessor("shownametags", RlvBehaviourInfo::BHVR_STRICT )); + addEntry(new RlvBehaviourGenericToggleProcessor("showself", RlvBehaviourInfo::BHVR_EXTENDED)); + addEntry(new RlvBehaviourGenericToggleProcessor("showselfhead", RlvBehaviourInfo::BHVR_EXTENDED)); addEntry(new RlvBehaviourGenericProcessor("showworldmap", RLV_BHVR_SHOWWORLDMAP)); addEntry(new RlvBehaviourGenericProcessor("sit", RLV_BHVR_SIT)); addEntry(new RlvBehaviourGenericProcessor("sittp", RLV_BHVR_SITTP)); diff --git a/indra/newview/rlvhelper.h b/indra/newview/rlvhelper.h index e172b1d492..19ffa33fac 100644 --- a/indra/newview/rlvhelper.h +++ b/indra/newview/rlvhelper.h @@ -116,6 +116,7 @@ template using RlvReplyHandler = RlvCommandHandler RlvBehaviourAddRemAttachHandler; // Shared between @addattach and @remattach typedef RlvBehaviourHandler RlvBehaviourSendChannelHandler; // Shared between @addattach and @remattach +typedef RlvBehaviourToggleHandler RlvBehaviourShowSelfToggleHandler; // Shared between @showself and @showselfhead typedef RlvForceHandler RlvForceRemAttachHandler; // Shared between @remattach and @detach //