Merge branch 'rlva/development'

master
Kitty Barnett 2021-02-14 22:21:49 +01:00
commit 80e0984a75
13 changed files with 110 additions and 39 deletions

View File

@ -2275,7 +2275,7 @@ void LLFloaterPreference::refreshEnabledState()
// [RLVa:KB] - Checked: 2010-03-18 (RLVa-1.2.0a) | Modified: RLVa-0.2.0a
// "Atmospheric Shaders" can't be disabled - but can be enabled - under @setenv=n
ctrl_wind_light->setEnabled( (RlvActions::canChangeEnvironment()) || (!gSavedSettings.getBOOL("WindLightUseAtmosShaders")));
ctrl_wind_light->setEnabled( ((RlvActions::canChangeEnvironment()) && (!RlvActions::hasBehaviour(RLV_BHVR_SETSPHERE))) || (!gSavedSettings.getBOOL("WindLightUseAtmosShaders")));
// [/RLVa:KB]
// ctrl_wind_light->setEnabled(TRUE);

View File

@ -37,6 +37,10 @@
#include "llscriptfloater.h"
#include "llavatarname.h"
#include "llavatarnamecache.h"
// [RLVa:KB] - @sendchat and @sendchannel/sendchannelexcept
#include "rlvactions.h"
#include "rlvcommon.h"
// [/RLVa:KB]
using namespace LLNotificationsUI;
@ -112,6 +116,24 @@ bool LLScriptHandler::processNotification(const LLNotificationPtr& notification)
if(notification->hasFormElements() && !notification->canShowToast())
{
// [RLVa:KB] - @sendchat and @sendchannel/sendchannelexcept
if (RlvActions::isRlvEnabled())
{
const LLSD& sdPayload = notification->getPayload();
if (sdPayload.has("chat_channel"))
{
const S32 nChannel = sdPayload["chat_channel"].asInteger();
// *TODO-RLVa: it's too late into the release cycle to block all script interactions so just take care of the nearby chat loophole for now
bool fBlock = (0 == nChannel) ? RlvActions::hasBehaviour(RLV_BHVR_SENDCHAT) : /*!RlvActions::canSendChannel(nChannel)*/false;
if (fBlock)
{
RlvUtil::notifyBlocked("blocked_scriptdialog");
return false;
}
}
}
// [/RLVa:KB]
LLScriptFloaterManager::getInstance()->onAddNotification(notification->getID());
}
else if (notification->canShowToast())

View File

@ -8179,6 +8179,20 @@ bool callback_script_dialog(const LLSD& notification, const LLSD& response)
}
}
// [RLVa:KB] - @sendchat and @sendchannel/sendchannelexcept
if ( (RlvActions::isRlvEnabled()) && (0 <= button_idx) )
{
const S32 nChannel = notification["payload"]["chat_channel"].asInteger();
// *TODO-RLVa: it's too late into the release cycle to block all script interactions so just take care of the nearby chat loophole for now
bool fBlock = (0 == nChannel) ? RlvActions::hasBehaviour(RLV_BHVR_SENDCHAT) : /*!RlvActions::canSendChannel(nChannel)*/false;
if (fBlock)
{
button_idx = -1;
}
}
// [/RLVa:KB]
if (0 <= button_idx)
{
LLMessageSystem* msg = gMessageSystem;

View File

@ -107,33 +107,33 @@ bool LLVfxManager::removeEffect(const LLUUID& idEffect)
return true;
}
void LLVfxManager::runEffect(EVisualEffect eCode, const LLVisualEffectParams* pParams)
void LLVfxManager::runEffect(EVisualEffect eCode, LLVisualEffectParams* pParams)
{
// *TODO-Catz: once we're done, check whether iterating over the entire list still has negliable impact
auto pred = [eCode](const LLVisualEffect* pEffect) { return pEffect->getCode() == eCode; };
auto beginEffect = boost::make_filter_iterator(pred, m_Effects.begin(), m_Effects.end()),
auto itEffect = boost::make_filter_iterator(pred, m_Effects.begin(), m_Effects.end()),
endEffect = boost::make_filter_iterator(pred, m_Effects.end(), m_Effects.end());
auto effectRange = boost::make_iterator_range(beginEffect, endEffect);
for (LLVisualEffect* pEffect : effectRange)
for (; itEffect != endEffect; ++itEffect)
{
pEffect->run(pParams);
if (pParams)
pParams->step(itEffect == endEffect);
(*itEffect)->run(pParams);
}
}
void LLVfxManager::runEffect(EVisualEffectType eType, const LLVisualEffectParams* pParams)
void LLVfxManager::runEffect(EVisualEffectType eType, LLVisualEffectParams* pParams)
{
// *TODO-Catz: once we're done, check whether iterating over the entire list still has negliable impact
auto pred = [eType](const LLVisualEffect* pEffect) { return pEffect->getType() == eType; };
auto beginEffect = boost::make_filter_iterator(pred, m_Effects.begin(), m_Effects.end()),
endEffect = boost::make_filter_iterator(pred, m_Effects.end(), m_Effects.end());
auto effectRange = boost::make_iterator_range(beginEffect, endEffect);
for (LLVisualEffect* pEffect : effectRange)
auto itEffect = boost::make_filter_iterator(pred, m_Effects.begin(), m_Effects.end()),
endEffect = boost::make_filter_iterator(pred, m_Effects.end(), m_Effects.end());
for (; itEffect != endEffect; ++itEffect)
{
pEffect->run(pParams);
if (pParams)
pParams->step(itEffect == endEffect);
(*itEffect)->run(pParams);
}
}

View File

@ -48,14 +48,23 @@ enum class EVisualEffectType
struct LLVisualEffectParams
{
virtual void step(bool isLast) = 0;
};
struct LLShaderEffectParams : LLVisualEffectParams
{
explicit LLShaderEffectParams(LLRenderTarget* pSrcBuffer, LLRenderTarget* pDstBuffer) : m_pSrcBuffer(pSrcBuffer), m_pDstBuffer(pDstBuffer) {}
explicit LLShaderEffectParams(LLRenderTarget* pSrcBuffer, LLRenderTarget* pScratchBuffer, bool fBindLast) : m_pSrcBuffer(pScratchBuffer), m_pDstBuffer(pSrcBuffer), m_fBindLast(fBindLast) {}
void step(bool isLast) override
{
LLRenderTarget* pPrevSrc = m_pSrcBuffer, *pPrevDst = m_pDstBuffer;
m_pSrcBuffer = pPrevDst;
m_pDstBuffer = (!isLast || !m_fBindLast) ? pPrevSrc : nullptr;
}
LLRenderTarget* m_pSrcBuffer = nullptr;
LLRenderTarget* m_pDstBuffer = nullptr;
bool m_fBindLast = false;
};
// ============================================================================
@ -156,8 +165,8 @@ public:
LLVisualEffect* getEffect(EVisualEffect eCode) const;
template<typename T> T* getEffect(EVisualEffect eCode) const { return dynamic_cast<T*>(getEffect(eCode)); }
bool removeEffect(const LLUUID& idEffect);
void runEffect(EVisualEffect eCode, const LLVisualEffectParams* pParams = nullptr);
void runEffect(EVisualEffectType eType, const LLVisualEffectParams* pParams = nullptr);
void runEffect(EVisualEffect eCode, LLVisualEffectParams* pParams = nullptr);
void runEffect(EVisualEffectType eType, LLVisualEffectParams* pParams = nullptr);
protected:
/*

View File

@ -3321,7 +3321,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]

View File

@ -8263,7 +8263,7 @@ void LLPipeline::renderFinalize()
// [RLVa:KB] - @setsphere
if (RlvActions::hasBehaviour(RLV_BHVR_SETSPHERE))
{
LLShaderEffectParams params(pRenderBuffer, (multisample) ? &mScreen : nullptr);
LLShaderEffectParams params(pRenderBuffer, &mScreen, !multisample);
LLVfxManager::instance().runEffect(EVisualEffect::RlvSphere, &params);
pRenderBuffer = params.m_pDstBuffer;
}
@ -8357,7 +8357,7 @@ void LLPipeline::renderFinalize()
// [RLVa:KB] - @setsphere
if (RlvActions::hasBehaviour(RLV_BHVR_SETSPHERE))
{
LLShaderEffectParams params(&mScreen, &mDeferredLight);
LLShaderEffectParams params(&mScreen, &mDeferredLight, false);
LLVfxManager::instance().runEffect(EVisualEffect::RlvSphere, &params);
pRenderBuffer = params.m_pDstBuffer;
}

View File

@ -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:
@ -235,6 +232,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);

View File

@ -28,6 +28,7 @@
class LLInventoryCategory;
class LLInventoryItem;
class LLViewerObject;
class LLVOAvatar;
// ============================================================================
// RlvActions class declaration - developer-friendly non-RLVa code facing class, use in lieu of RlvHandler whenever possible
@ -124,8 +125,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; } }
/*

View File

@ -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,

View File

@ -2079,6 +2079,10 @@ void RlvBehaviourToggleHandler<RLV_BHVR_SETOVERLAY>::onCommandToggle(ERlvBehavio
template<> template<>
ERlvCmdRet RlvBehaviourHandler<RLV_BHVR_SETSPHERE>::onCommand(const RlvCommand& rlvCmd, bool& fRefCount)
{
// *TODO: this needs to be done in a cleaner way but FS needs to release ASAP
if (RLV_TYPE_ADD == rlvCmd.getParamType() && gRlvHandler.m_Behaviours[RLV_BHVR_SETSPHERE] >= 6)
return RLV_RET_FAILED_LOCK;
ERlvCmdRet eRet = RlvBehaviourGenericHandler<RLV_OPTION_NONE_OR_MODIFIER>::onCommand(rlvCmd, fRefCount);
if ( (RLV_RET_SUCCESS == eRet) && (!rlvCmd.isModifier()) )
{
@ -2609,28 +2613,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

View File

@ -150,7 +150,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));
@ -455,7 +456,7 @@ ERlvBehaviour RlvBehaviourDictionary::getBehaviourFromString(const std::string&
ERlvLocalBhvrModifier eBhvrModifier;
const RlvBehaviourInfo* pBhvrInfo = getBehaviourInfo(strBhvr, eParamType, pfStrict, &eBhvrModifier);
// Filter out locally scoped modifier commands since they don't actually have a unique behaviour value of their own
return (pBhvrInfo && ERlvLocalBhvrModifier::Unknown != eBhvrModifier) ? pBhvrInfo->getBehaviourType() : RLV_BHVR_UNKNOWN;
return (pBhvrInfo && ERlvLocalBhvrModifier::Unknown == eBhvrModifier) ? pBhvrInfo->getBehaviourType() : RLV_BHVR_UNKNOWN;
}
bool RlvBehaviourDictionary::getCommands(const std::string& strMatch, ERlvParamType eParamType, std::list<std::string>& cmdList) const
@ -741,8 +742,8 @@ RlvCommand::RlvCommand(const LLUUID& idObj, const std::string& strCommand)
RlvCommand::RlvCommand(const RlvCommand& rlvCmd, ERlvParamType eParamType)
: m_fValid(rlvCmd.m_fValid), m_idObj(rlvCmd.m_idObj), m_strBehaviour(rlvCmd.m_strBehaviour), m_pBhvrInfo(rlvCmd.m_pBhvrInfo)
, m_eParamType( (RLV_TYPE_UNKNOWN == eParamType) ? rlvCmd.m_eParamType : eParamType),m_fStrict(rlvCmd.m_fStrict), m_strOption(rlvCmd.m_strOption)
, m_strParam(rlvCmd.m_strParam), m_fRefCounted(rlvCmd.m_fRefCounted)
, m_eParamType( (RLV_TYPE_UNKNOWN == eParamType) ? rlvCmd.m_eParamType : eParamType), m_eBhvrModifier(rlvCmd.m_eBhvrModifier)
, m_fStrict(rlvCmd.m_fStrict), m_strOption(rlvCmd.m_strOption), m_strParam(rlvCmd.m_strParam), m_fRefCounted(rlvCmd.m_fRefCounted)
{
}

View File

@ -136,6 +136,11 @@
<key>value</key>
<string>'[OBJECT]' was denied permission to teleport you due to RLV restrictions</string>
</map>
<key>blocked_scriptdialog</key>
<map>
<key>value</key>
<string>Unable to show script dialog or textbox due to RLV restrictions</string>
</map>
<key>blocked_startim</key>
<map>
<key>value</key>