Merge branch 'rlva/bugfix/visual-effects' into rlva/development

master
Kitty Barnett 2021-07-12 23:19:06 +02:00
commit a610e5528a
7 changed files with 41 additions and 18 deletions

View File

@ -5711,11 +5711,11 @@ void LLPickInfo::fetchResults()
// [RLVa:KB] - Checked: RLVa-2.2 (@setoverlay)
if ( (RlvActions::hasBehaviour(RLV_BHVR_SETOVERLAY)) && (hit_object) && (!hit_object->isHUDAttachment()) )
{
std::list<LLVisualEffect*> effects;
std::list<RlvOverlayEffect*> effects;
LLVfxManager::instance().getEffects<RlvOverlayEffect>(effects);
for (const LLVisualEffect* pEffect : effects)
for (const RlvOverlayEffect* pEffect : effects)
{
if (pEffect->getEnabled() && static_cast<const RlvOverlayEffect*>(pEffect)->hitTest(mMousePt))
if (pEffect->getEnabled() && pEffect->hitTest(mMousePt))
{
hit_object = nullptr;
break;

View File

@ -169,7 +169,7 @@ public:
LLVisualEffect* getEffect(EVisualEffect eCode, const LLUUID& idEffect) const;
template<typename T> T* getEffect(const LLUUID& idEffect) const { return dynamic_cast<T*>(getEffect(T::EffectCode, idEffect)); }
bool getEffects(std::list<LLVisualEffect*>& effectList, std::function<bool(const LLVisualEffect*)> fnFilter);
template<typename T> bool getEffects(std::list<LLVisualEffect*>& effectList) { return getEffects(effectList, [](const LLVisualEffect* pEffect) { return pEffect->getCode() == T::EffectCode; }); }
template<typename T> bool getEffects(std::list<T*>& effectList);
bool hasEffect(EVisualEffect eCode) const;
bool removeEffect(EVisualEffect eCode, const LLUUID& idEffect);
template<typename T> bool removeEffect(const LLUUID& idEffect) { return removeEffect(T::EffectCode, idEffect); }
@ -196,4 +196,23 @@ inline bool LLVfxManager::hasEffect(EVisualEffect eCode) const
return m_Effects.end() != std::find_if(m_Effects.begin(), m_Effects.end(), [eCode](const LLVisualEffect* pEffect) { return pEffect->getCode() == eCode; });
}
template<typename T>
inline bool LLVfxManager::getEffects(std::list<T*>& effectList)
{
effectList.clear();
std::function<bool(const LLVisualEffect*)> fnFilter = [](const LLVisualEffect* pEffect) { return pEffect->getCode() == T::EffectCode; };
auto itEffect = boost::make_filter_iterator(fnFilter, m_Effects.begin(), m_Effects.end()),
endEffect = boost::make_filter_iterator(fnFilter, m_Effects.end(), m_Effects.end());
while (itEffect != endEffect)
{
if (T* pEffect = dynamic_cast<T*>(*itEffect++))
{
effectList.push_back(pEffect);
}
}
return effectList.size();
}
// ============================================================================

View File

@ -252,6 +252,7 @@ enum ERlvBehaviour {
// Effects
RLV_BHVR_SETSPHERE, // Gives an object exclusive control of the 'vision spheres' effect
RLV_BHVR_SETOVERLAY, // Gives an object exclusive control of the overlay
RLV_BHVR_SETOVERLAY_TOUCH, // Determines whether the overlay texture's alpha channel will be used to allow/block world interaction
RLV_BHVR_SETOVERLAY_TWEEN, // Animate between the current overlay settings and the supplied values
RLV_BHVR_COUNT,
@ -292,7 +293,6 @@ enum class ERlvLocalBhvrModifier
OverlayAlpha, // Transparency level of the overlay texture (in addition to the texture's own alpha channel)
OverlayTexture, // Specifies the UUID of the overlay texture
OverlayTint, // The tint that's applied to the overlay texture
OverlayTouch, // Determines whether the overlay texture's alpha channel will be used to allow/block world interaction
// @setsphere
SphereMode, // The type of effect that will apply to any pixel that intersects with the sphere (e.g. blend, blur, ...)
SphereOrigin, // The origin of the sphere can either be the avatar or the camera position

View File

@ -58,15 +58,6 @@ ERlvCmdRet RlvOverlayEffect::onAlphaValueChanged(const LLUUID& idRlvObj, const b
return RLV_RET_SUCCESS;
}
// static
ERlvCmdRet RlvOverlayEffect::onBlockTouchValueChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
{
if (RlvOverlayEffect* pEffect = LLVfxManager::instance().getEffect<RlvOverlayEffect>(idRlvObj))
{
pEffect->m_fBlockTouch = (newValue) ? boost::get<bool>(newValue.value()) : false;
}
return RLV_RET_SUCCESS;
}
// static
ERlvCmdRet RlvOverlayEffect::onColorValueChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
{

View File

@ -39,10 +39,10 @@ public:
public:
bool hitTest(const LLCoordGL& ptMouse) const;
void run(const LLVisualEffectParams*) override;
void setBlockTouch(bool block_touch) { m_fBlockTouch = block_touch; }
void tweenAlpha(float endAlpha, double duration) { m_nAlpha.start(endAlpha, duration); }
void tweenColor(LLColor3 endColor, double duration) { m_Color.start(endColor, duration); }
static ERlvCmdRet onAlphaValueChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue);
static ERlvCmdRet onBlockTouchValueChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue);
static ERlvCmdRet onColorValueChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue);
static ERlvCmdRet onTextureChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue);
protected:

View File

@ -2089,7 +2089,7 @@ ERlvCmdRet RlvBehaviourHandler<RLV_BHVR_SETOVERLAY>::onCommand(const RlvCommand&
}
// Refresh overlay effects according to object hierarchy
std::list<LLVisualEffect*> effects;
std::list<RlvOverlayEffect*> effects;
if (LLVfxManager::instance().getEffects<RlvOverlayEffect>(effects))
{
auto itActiveEffect = std::find_if(effects.begin(), effects.end(), [](const LLVisualEffect* pEffect) { return pEffect->getEnabled(); });
@ -2100,17 +2100,30 @@ ERlvCmdRet RlvBehaviourHandler<RLV_BHVR_SETOVERLAY>::onCommand(const RlvCommand&
}
const LLUUID idActiveRootObj = (effects.end() != itActiveEffect) ? Rlv::getObjectRootId((*itActiveEffect)->getId()) : LLUUID::null;
for (LLVisualEffect* pEffect : effects)
for (RlvOverlayEffect* pEffect : effects)
{
bool isActive = (idActiveRootObj.isNull() && pEffect == effects.front()) || (Rlv::getObjectRootId(pEffect->getId()) == idActiveRootObj);
int nPriority = (isActive) ? 256 - Rlv::getObjectLinkNumber(pEffect->getId()) : pEffect->getPriority();
LLVfxManager::instance().updateEffect(pEffect, isActive, nPriority);
pEffect->setBlockTouch(gRlvHandler.hasBehaviour(pEffect->getId(), RLV_BHVR_SETOVERLAY_TOUCH));
}
}
return eRet;
}
// Handles: @setoverlay_touch=n
template<> template<>
ERlvCmdRet RlvBehaviourHandler<RLV_BHVR_SETOVERLAY_TOUCH>::onCommand(const RlvCommand& rlvCmd, bool& fRefCount)
{
if (RlvOverlayEffect* pOverlayEffect = LLVfxManager::instance().getEffect<RlvOverlayEffect>(rlvCmd.getObjectID()))
{
pOverlayEffect->setBlockTouch( RLV_TYPE_ADD == rlvCmd.getParamType() );
}
return RLV_RET_SUCCESS;
}
// Handles: @setsphere=n|y
template<> template<>
ERlvCmdRet RlvBehaviourHandler<RLV_BHVR_SETSPHERE>::onCommand(const RlvCommand& rlvCmd, bool& fRefCount)

View File

@ -228,8 +228,8 @@ RlvBehaviourDictionary::RlvBehaviourDictionary()
pSetOverlayBhvr->addModifier(ERlvLocalBhvrModifier::OverlayAlpha, typeid(float), "alpha", &RlvOverlayEffect::onAlphaValueChanged);
pSetOverlayBhvr->addModifier(ERlvLocalBhvrModifier::OverlayTexture, typeid(LLUUID), "texture", &RlvOverlayEffect::onTextureChanged);
pSetOverlayBhvr->addModifier(ERlvLocalBhvrModifier::OverlayTint, typeid(LLVector3), "tint", &RlvOverlayEffect::onColorValueChanged);
pSetOverlayBhvr->addModifier(ERlvLocalBhvrModifier::OverlayTouch, typeid(LLVector3), "touch", &RlvOverlayEffect::onBlockTouchValueChanged);
addEntry(pSetOverlayBhvr);
addEntry(new RlvBehaviourProcessor<RLV_BHVR_SETOVERLAY_TOUCH>("setoverlay_touch"));
addEntry(new RlvForceProcessor<RLV_BHVR_SETOVERLAY_TWEEN>("setoverlay_tween"));
// Sphere