- fixed : LLPipeline::sShowHUDAttachments isn't reset to TRUE when an attachment is worn on an empty RLV_LOCK_REMOVE locked HUD attachment point

-> @remattach:top=n (with no current attachment on "top" or any other locked HUD attachments)
    -> uncheck "Show HUD Attachments" (allowed because RlvAttachmentLocks::hasLockedHUD() will return FALSE when there are no locked HUDs)
    -> attach HUD attachment to top => invisible
- fixed : HUD zoom level should be restricted when a HUD attachment is non-detachable
- fixed : wireframe should be disabled when a HUD attachment is non-detachable

--HG--
branch : RLVa
meow-7.2.2
Kitty Barnett 2010-08-22 18:41:57 +02:00
parent aa4ac83eef
commit 8c32b5fe60
6 changed files with 62 additions and 44 deletions

View File

@ -77,6 +77,9 @@
#include "llwlparammanager.h"
#include "llwaterparammanager.h"
#include "llpostprocess.h"
// [RLVa:KB] - Checked: 2010-08-22 (RLVa-1.2.1a)
#include "rlvhandler.h"
// [/RLVa:KB]
extern LLPointer<LLViewerTexture> gStartTexture;
@ -914,14 +917,10 @@ void render_hud_attachments()
// clamp target zoom level to reasonable values
// gAgentCamera.mHUDTargetZoom = llclamp(gAgentCamera.mHUDTargetZoom, 0.1f, 1.f);
// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c)
gAgentCamera.mHUDTargetZoom = llclamp(gAgentCamera.mHUDTargetZoom, 0.1f, 1.f);
/*
// TODO-RLVa: while hasLockedHUD() isn't slow this is called per frame so find a better way
gAgent.mHUDTargetZoom = llclamp(gAgent.mHUDTargetZoom,
( (!rlv_handler_t::isEnabled()) || (!gRlvHandler.hasLockedHUD()) ) ? 0.1f : 0.85f, 1.f);
*/
// [RLVa:KB] - Checked: 2010-08-22 (RLVa-1.2.1a) | Modified: RLVa-1.0.0c
gAgentCamera.mHUDTargetZoom = llclamp(gAgentCamera.mHUDTargetZoom, (!gRlvAttachmentLocks.hasLockedHUD()) ? 0.1f : 0.85f, 1.f);
// [/RLVa:KB]
// smoothly interpolate current zoom level
gAgentCamera.mHUDCurZoom = lerp(gAgentCamera.mHUDCurZoom, gAgentCamera.mHUDTargetZoom, LLCriticalDamp::getInterpolant(0.03f));

View File

@ -1080,7 +1080,10 @@ class LLAdvancedToggleWireframe : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
gUseWireframe = !(gUseWireframe);
// gUseWireframe = !(gUseWireframe);
// [RLVa:KB] - Checked: 2010-08-22 (RLVa-1.2.1a) | Added: RLVa-1.2.1a
gUseWireframe = (!gUseWireframe) && (!gRlvAttachmentLocks.hasLockedHUD());
// [/RLVa:KB]
return true;
}
};
@ -7777,7 +7780,7 @@ class LLViewShowHUDAttachments : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
// [RLVa:KB] - Checked: 2010-04-19 (RLVa-1.2.0f) | Modified: RLVa-1.0.0c
// [RLVa:KB] - Checked: 2010-04-19 (RLVa-1.2.1a) | Modified: RLVa-1.0.0c
if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedHUD()) && (LLPipeline::sShowHUDAttachments) )
return true;
// [/RLVa:KB]

View File

@ -1085,12 +1085,15 @@ const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *view
const LLUUID& attachment_id = viewer_object->getItemID();
LLAppearanceMgr::instance().registerAttachment(attachment_id);
// [RLVa:KB] - Checked: 2010-03-05 (RLVa-1.2.0a) | Added: RLVa-1.2.0a
// [RLVa:KB] - Checked: 2010-08-22 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a
// NOTE: RLVa event handlers should be invoked *after* LLVOAvatar::attachObject() calls LLViewerJointAttachment::addObject()
if (rlv_handler_t::isEnabled())
{
RlvAttachmentLockWatchdog::instance().onAttach(viewer_object, attachment);
gRlvHandler.onAttach(viewer_object, attachment);
if ( (attachment->getIsHUDAttachment()) && (!gRlvAttachmentLocks.hasLockedHUD()) )
gRlvAttachmentLocks.updateLockedHUD();
}
// [/RLVa:KB]
}
@ -1151,6 +1154,11 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object)
LLAppearanceMgr::instance().unregisterAttachment(attachment_id);
}
// [RLVa:KB] - Checked: 2010-08-22 (RLVa-1.2.1a) | Added: RLVa-1.2.1a
if ( (rlv_handler_t::isEnabled()) && (viewer_object->isHUDAttachment()) && (gRlvAttachmentLocks.hasLockedHUD()) )
gRlvAttachmentLocks.updateLockedHUD();
// [/RLVa:KB]
return TRUE;
}
return FALSE;

View File

@ -16,13 +16,13 @@
#include "llviewerprecompiledheaders.h"
#include "llagentwearables.h"
#include "llappviewer.h"
#include "llcallbacklist.h"
#include "llviewermessage.h"
#include "llviewerobjectlist.h"
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
#include "llworld.h"
#include "pipeline.h"
#include "rlvhandler.h"
#include "rlvinventory.h"
@ -412,12 +412,7 @@ void RlvHandler::onAttach(const LLViewerObject* pAttachObj, const LLViewerJointA
// We need to check this object for an active "@detach=n" and actually lock it down now that it's been attached somewhere
if (itObj->second.hasBehaviour(RLV_BHVR_DETACH, false))
{
// (Copy/paste from processAddCommand)
gRlvAttachmentLocks.addAttachmentLock(pAttachObj->getID(), itObj->second.m_UUID);
if (pAttachObj->isHUDAttachment())
LLPipeline::sShowHUDAttachments = TRUE; // Prevents hiding of locked HUD attachments
}
}
}
}
@ -525,11 +520,7 @@ bool RlvHandler::onGC()
// -> if it does run it likely means that there's a @detach=n in a *child* prim that we couldn't look up in onAttach()
// -> since RLV doesn't currently support @detach=n from child prims it's actually not such a big deal right now but still
if ( (pObj->isAttachment()) && (itCurObj->second.hasBehaviour(RLV_BHVR_DETACH, false)) )
{
gRlvAttachmentLocks.addAttachmentLock(pObj->getID(), itCurObj->second.m_UUID);
if (pObj->isHUDAttachment())
LLPipeline::sShowHUDAttachments = TRUE;
}
}
}
}
@ -1290,10 +1281,6 @@ ERlvCmdRet RlvHandler::onAddRemAttach(const LLUUID& idObj, const RlvCommand& rlv
}
}
// Refresh HUD visibility if needed
if ( (RLV_BHVR_REMATTACH == rlvCmd.getBehaviourType()) && (gRlvAttachmentLocks.hasLockedHUD()) )
LLPipeline::sShowHUDAttachments = TRUE;
fRefCount = rlvCmd.getOption().empty(); // Only reference count global locks
return RLV_RET_SUCCESS;
}
@ -1333,10 +1320,6 @@ ERlvCmdRet RlvHandler::onAddRemDetach(const LLUUID& idObj, const RlvCommand& rlv
gRlvAttachmentLocks.removeAttachmentPointLock(idxAttachPt, idObj, (ERlvLockMask)(RLV_LOCK_ADD | RLV_LOCK_REMOVE));
}
// Refresh HUD visibility if needed
if ( (RLV_TYPE_ADD == rlvCmd.getParamType()) && (gRlvAttachmentLocks.hasLockedHUD()) )
LLPipeline::sShowHUDAttachments = TRUE;
fRefCount = false; // Don't reference count @detach[:<option>]=n
return RLV_RET_SUCCESS;
}

View File

@ -17,6 +17,7 @@
#include "llviewerprecompiledheaders.h"
#include "llnotifications.h"
#include "llviewerobjectlist.h"
#include "pipeline.h"
#include "rlvhelper.h"
#include "rlvlocks.h"
@ -177,6 +178,7 @@ void RlvAttachmentLocks::addAttachmentLock(const LLUUID& idAttachObj, const LLUU
#endif // RLV_RELEASE
m_AttachObjRem.insert(std::pair<LLUUID, LLUUID>(idAttachObj, idRlvObj));
updateLockedHUD();
}
// Checked: 2010-02-28 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a
@ -190,7 +192,10 @@ void RlvAttachmentLocks::addAttachmentPointLock(S32 idxAttachPt, const LLUUID& i
// NOTE: m_AttachPtXXX can contain duplicate <idxAttachPt, idRlvObj> pairs (ie @detach:spine=n,detach=n from an attachment on spine)
if (eLock & RLV_LOCK_REMOVE)
{
m_AttachPtRem.insert(std::pair<S32, LLUUID>(idxAttachPt, idRlvObj));
updateLockedHUD();
}
if (eLock & RLV_LOCK_ADD)
m_AttachPtAdd.insert(std::pair<S32, LLUUID>(idxAttachPt, idRlvObj));
}
@ -235,21 +240,6 @@ bool RlvAttachmentLocks::hasLockedAttachment(const LLViewerJointAttachment* pAtt
return false;
}
bool RlvAttachmentLocks::hasLockedHUD() const
{
if (!isAgentAvatarValid())
return false;
for (LLVOAvatar::attachment_map_t::const_iterator itAttachPt = gAgentAvatarp->mAttachmentPoints.begin();
itAttachPt != gAgentAvatarp->mAttachmentPoints.end(); ++itAttachPt)
{
const LLViewerJointAttachment* pAttachPt = itAttachPt->second;
if ( (pAttachPt) && (pAttachPt->getIsHUDAttachment()) && (hasLockedAttachment(pAttachPt)) )
return true; // At least one of our locked attachments is a HUD
}
return false; // None of our locked attachments is a HUD
}
// Checked: 2010-03-19 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a
bool RlvAttachmentLocks::isLockedAttachmentExcept(const LLViewerObject* pObj, const LLUUID& idRlvObj) const
{
@ -321,6 +311,7 @@ void RlvAttachmentLocks::removeAttachmentLock(const LLUUID& idAttachObj, const L
if (idRlvObj == itAttachObj->second)
{
m_AttachObjRem.erase(itAttachObj);
updateLockedHUD();
break;
}
}
@ -344,6 +335,7 @@ void RlvAttachmentLocks::removeAttachmentPointLock(S32 idxAttachPt, const LLUUID
if (idRlvObj == itAttachPt->second)
{
m_AttachPtRem.erase(itAttachPt);
updateLockedHUD();
break;
}
}
@ -363,6 +355,32 @@ void RlvAttachmentLocks::removeAttachmentPointLock(S32 idxAttachPt, const LLUUID
}
}
// Checked: 2010-08-22 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a
void RlvAttachmentLocks::updateLockedHUD()
{
if (!isAgentAvatarValid())
return;
m_fHasLockedHUD = false;
for (LLVOAvatar::attachment_map_t::const_iterator itAttachPt = gAgentAvatarp->mAttachmentPoints.begin();
itAttachPt != gAgentAvatarp->mAttachmentPoints.end(); ++itAttachPt)
{
const LLViewerJointAttachment* pAttachPt = itAttachPt->second;
if ( (pAttachPt) && (pAttachPt->getIsHUDAttachment()) && (hasLockedAttachment(pAttachPt)) )
{
m_fHasLockedHUD = true;
break;
}
}
// Reset HUD visibility and wireframe options if at least one HUD attachment is locked
if (m_fHasLockedHUD)
{
LLPipeline::sShowHUDAttachments = TRUE;
gUseWireframe = FALSE;
}
}
// Checked: 2010-03-11 (RLVa-1.2.0a) | Added: RLVa-1.2.0a
bool RlvAttachmentLocks::verifyAttachmentLocks()
{

View File

@ -63,6 +63,9 @@ private:
// TODO-RLVa: [RLVa-1.2.1] Once everything is working for SL-2.0 thin out the member functions since a few of them are duplicates/unneeded
class RlvAttachmentLocks
{
public:
RlvAttachmentLocks() : m_fHasLockedHUD(false) {}
public:
// Adds an RLV_LOCK_REMOVE lock (held by idRlvObj) for the attachment
void addAttachmentLock(const LLUUID& idAttachObj, const LLUUID& idRlvObj);
@ -75,7 +78,7 @@ public:
// - RLV_LOCK_REMOVE: specific attachment locked *or* any attachment point locked (regardless of whether it currently has attachments)
bool hasLockedAttachmentPoint(ERlvLockMask eLock) const;
// Returns TRUE if there is at least 1 non-detachable HUD attachment
bool hasLockedHUD() const;
bool hasLockedHUD() const { return m_fHasLockedHUD; }
// Returns TRUE if the attachment is RLV_LOCK_REMOVE locked
bool isLockedAttachment(const LLViewerObject* pObj) const;
@ -91,6 +94,8 @@ public:
// Removes an eLock type lock (held by idRlvObj) for the attachment point
void removeAttachmentPointLock(S32 idxAttachPt, const LLUUID& idRlvObj, ERlvLockMask eLock);
// Refreshes locked HUD attachment state
void updateLockedHUD();
// Iterates over all current attachment and attachment point locks and verifies their status (returns TRUE if verification succeeded)
bool verifyAttachmentLocks();
@ -125,6 +130,8 @@ private:
rlv_attachptlock_map_t m_AttachPtAdd; // Map of attachment points that can't be attached to (idxAttachPt -> idObj)
rlv_attachptlock_map_t m_AttachPtRem; // Map of attachment points whose attachments can't be detached (idxAttachPt -> idObj)
rlv_attachobjlock_map_t m_AttachObjRem; // Map of attachments that can't be detached (idAttachObj -> idObj)
bool m_fHasLockedHUD;
};
extern RlvAttachmentLocks gRlvAttachmentLocks;