RLV locked status of wearables now displayed in inventory panel.

This commit is contained in:
Shyotl
2011-10-09 16:46:52 -05:00
parent 88df12ddb6
commit 50e750d2e9
4 changed files with 115 additions and 11 deletions

View File

@@ -4140,6 +4140,14 @@ std::string LLObjectBridge::getLabelSuffix() const
{
std::string attachment_point_name = avatar->getAttachedPointName(mUUID);
LLStringUtil::toLower(attachment_point_name);
LLViewerObject* pObj = (rlv_handler_t::isEnabled()) ? avatar->getWornAttachment( mUUID ) : NULL;
// [RLVa:KB]
if ( pObj && (gRlvAttachmentLocks.isLockedAttachment(pObj) ||
gRlvAttachmentLocks.isLockedAttachmentPoint(RlvAttachPtLookup::getAttachPointIndex(pObj),RLV_LOCK_REMOVE)))
{
return LLItemBridge::getLabelSuffix() + std::string(" (locked to ") + attachment_point_name + std::string(")");
}
// [/RLVa:KB]
return LLItemBridge::getLabelSuffix() + std::string(" (worn on ") + attachment_point_name + std::string(")");
}
else
@@ -4147,11 +4155,21 @@ std::string LLObjectBridge::getLabelSuffix() const
// <edit> testzone attachpt
if(avatar)
{
std::map<S32, LLUUID>::iterator iter = avatar->mUnsupportedAttachmentPoints.begin();
std::map<S32, LLUUID>::iterator end = avatar->mUnsupportedAttachmentPoints.end();
std::map<S32, std::pair<LLUUID,LLUUID> >::iterator iter = avatar->mUnsupportedAttachmentPoints.begin();
std::map<S32, std::pair<LLUUID,LLUUID> >::iterator end = avatar->mUnsupportedAttachmentPoints.end();
for( ; iter != end; ++iter)
if((*iter).second == mUUID)
if((*iter).second.first == mUUID)
{
// [RLVa:KB]
LLViewerObject* pObj = (rlv_handler_t::isEnabled()) ? gObjectList.findObject((*iter).second.second) : NULL;
if ( pObj && (gRlvAttachmentLocks.isLockedAttachment(pObj) ||
gRlvAttachmentLocks.isLockedAttachmentPoint(RlvAttachPtLookup::getAttachPointIndex(pObj),RLV_LOCK_REMOVE)))
{
return LLItemBridge::getLabelSuffix() + std::string(" (locked to unsupported point %d)", (*iter).first);
}
// [/RLVa:KB]
return LLItemBridge::getLabelSuffix() + llformat(" (worn on unsupported point %d)", (*iter).first);
}
}
// </edit>
return LLItemBridge::getLabelSuffix();
@@ -5215,6 +5233,10 @@ std::string LLWearableBridge::getLabelSuffix() const
{
if (get_is_item_worn(getItem()))
{
if ( (rlv_handler_t::isEnabled()) && (!gRlvWearableLocks.canRemove(getItem())) )
{
return LLItemBridge::getLabelSuffix() + " (locked)";
}
return LLItemBridge::getLabelSuffix() + " (worn)";
}
else

View File

@@ -6858,7 +6858,7 @@ BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object)
}
if(!item_id.isNull())
{
mUnsupportedAttachmentPoints[attachmentID] = item_id;
mUnsupportedAttachmentPoints[attachmentID] = std::pair<LLUUID,LLUUID>(item_id,viewer_object->getID());
if (viewer_object->isSelected())
{
LLSelectMgr::getInstance()->updateSelectionCenter();
@@ -7128,11 +7128,11 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object)
}
if(!item_id.isNull())
{
std::map<S32, LLUUID>::iterator iter = mUnsupportedAttachmentPoints.begin();
std::map<S32, LLUUID>::iterator end = mUnsupportedAttachmentPoints.end();
std::map<S32, std::pair<LLUUID,LLUUID> >::iterator iter = mUnsupportedAttachmentPoints.begin();
std::map<S32, std::pair<LLUUID,LLUUID> >::iterator end = mUnsupportedAttachmentPoints.end();
for( ; iter != end; ++iter)
{
if((*iter).second == item_id)
if((*iter).second.first == item_id)
{
mUnsupportedAttachmentPoints.erase((*iter).first);
if (isSelf())
@@ -7376,10 +7376,10 @@ BOOL LLVOAvatar::isWearingAttachment( const LLUUID& inv_item_id )
// <edit> testzone attachpt
BOOL LLVOAvatar::isWearingUnsupportedAttachment( const LLUUID& inv_item_id )
{
std::map<S32, LLUUID>::iterator end = mUnsupportedAttachmentPoints.end();
for(std::map<S32, LLUUID>::iterator iter = mUnsupportedAttachmentPoints.begin(); iter != end; ++iter)
std::map<S32, std::pair<LLUUID,LLUUID> >::iterator end = mUnsupportedAttachmentPoints.end();
for(std::map<S32, std::pair<LLUUID,LLUUID> >::iterator iter = mUnsupportedAttachmentPoints.begin(); iter != end; ++iter)
{
if((*iter).second == inv_item_id)
if((*iter).second.first == inv_item_id)
{
return TRUE;
}

View File

@@ -805,7 +805,7 @@ public:
const std::string getAttachedPointName(const LLUUID& inv_item_id);
// <edit>
std::map<S32, LLUUID> mUnsupportedAttachmentPoints;
std::map<S32, std::pair<LLUUID/*inv*/,LLUUID/*object*/> > mUnsupportedAttachmentPoints;
// </edit>
/** Wearables

View File

@@ -181,6 +181,11 @@ void RlvAttachmentLocks::addAttachmentLock(const LLUUID& idAttachObj, const LLUU
#endif // RLV_RELEASE
m_AttachObjRem.insert(std::pair<LLUUID, LLUUID>(idAttachObj, idRlvObj));
if(LLViewerObject *pObj = gObjectList.findObject(idAttachObj)) //OK
{
gInventory.addChangedMask(LLInventoryObserver::LABEL, pObj->getAttachmentItemID());
gInventory.notifyObservers();
}
updateLockedHUD();
}
@@ -197,6 +202,27 @@ void RlvAttachmentLocks::addAttachmentPointLock(S32 idxAttachPt, const LLUUID& i
if (eLock & RLV_LOCK_REMOVE)
{
m_AttachPtRem.insert(std::pair<S32, LLUUID>(idxAttachPt, idRlvObj));
LLVOAvatar* pAvatar = gAgentAvatarp;
if (pAvatar)
{
bool need_update = false;
LLVOAvatar::attachment_map_t::iterator iter = pAvatar->mAttachmentPoints.find(idxAttachPt);
if (iter != pAvatar->mAttachmentPoints.end())
{
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = iter->second->mAttachedObjects.begin();
attachment_iter != iter->second->mAttachedObjects.end();++attachment_iter)
{
LLViewerObject* attached_object = (*attachment_iter);
if(attached_object)
{
gInventory.addChangedMask(LLInventoryObserver::LABEL, attached_object->getAttachmentItemID());
need_update = true;
}
}
}
if(need_update)
gInventory.notifyObservers();
}
updateLockedHUD();
}
if (eLock & RLV_LOCK_ADD)
@@ -314,6 +340,11 @@ void RlvAttachmentLocks::removeAttachmentLock(const LLUUID& idAttachObj, const L
if (idRlvObj == itAttachObj->second)
{
m_AttachObjRem.erase(itAttachObj);
if(LLViewerObject *pObj = gObjectList.findObject(idAttachObj)) //OK
{
gInventory.addChangedMask(LLInventoryObserver::LABEL, pObj->getAttachmentItemID());
gInventory.notifyObservers();
}
updateLockedHUD();
break;
}
@@ -331,6 +362,7 @@ void RlvAttachmentLocks::removeAttachmentPointLock(S32 idxAttachPt, const LLUUID
if (eLock & RLV_LOCK_REMOVE)
{
bool removed_entry = false;
RLV_ASSERT( m_AttachPtRem.lower_bound(idxAttachPt) != m_AttachPtRem.upper_bound(idxAttachPt) ); // The lock should always exist
for (rlv_attachptlock_map_t::iterator itAttachPt = m_AttachPtRem.lower_bound(idxAttachPt),
endAttachPt = m_AttachPtRem.upper_bound(idxAttachPt); itAttachPt != endAttachPt; ++itAttachPt)
@@ -338,10 +370,38 @@ void RlvAttachmentLocks::removeAttachmentPointLock(S32 idxAttachPt, const LLUUID
if (idRlvObj == itAttachPt->second)
{
m_AttachPtRem.erase(itAttachPt);
removed_entry = true;
updateLockedHUD();
break;
}
}
if(removed_entry)
{
if(m_AttachPtRem.find(idxAttachPt) == m_AttachPtRem.end())
{
LLVOAvatar* pAvatar = gAgentAvatarp;
if (pAvatar)
{
bool need_update = false;
LLVOAvatar::attachment_map_t::iterator iter = pAvatar->mAttachmentPoints.find(idxAttachPt);
if (iter != pAvatar->mAttachmentPoints.end())
{
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = iter->second->mAttachedObjects.begin();
attachment_iter != iter->second->mAttachedObjects.end();++attachment_iter)
{
LLViewerObject* attached_object = (*attachment_iter);
if(attached_object)
{
gInventory.addChangedMask(LLInventoryObserver::LABEL, attached_object->getAttachmentItemID());
need_update = true;
}
}
if(need_update)
gInventory.notifyObservers();
}
}
}
}
}
if (eLock & RLV_LOCK_ADD)
{
@@ -814,7 +874,15 @@ void RlvWearableLocks::addWearableTypeLock(LLWearableType::EType eType, const LL
// NOTE: m_WearableTypeXXX can contain duplicate <eType, idRlvObj> pairs (ie @remoutfit:shirt=n,remoutfit=n from the same object)
if (eLock & RLV_LOCK_REMOVE)
{
m_WearableTypeRem.insert(std::pair<LLWearableType::EType, LLUUID>(eType, idRlvObj));
LLUUID item_id = gAgentWearables.getWearableItemID(eType);
if(item_id.notNull())
{
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
gInventory.notifyObservers();
}
}
if (eLock & RLV_LOCK_ADD)
m_WearableTypeAdd.insert(std::pair<LLWearableType::EType, LLUUID>(eType, idRlvObj));
}
@@ -889,15 +957,29 @@ void RlvWearableLocks::removeWearableTypeLock(LLWearableType::EType eType, const
if (eLock & RLV_LOCK_REMOVE)
{
RLV_ASSERT( m_WearableTypeRem.lower_bound(eType) != m_WearableTypeRem.upper_bound(eType) ); // The lock should always exist
bool removed_entry = false;
for (rlv_wearabletypelock_map_t::iterator itWearableType = m_WearableTypeRem.lower_bound(eType),
endWearableType = m_WearableTypeRem.upper_bound(eType); itWearableType != endWearableType; ++itWearableType)
{
if (idRlvObj == itWearableType->second)
{
m_WearableTypeRem.erase(itWearableType);
removed_entry = true;
break;
}
}
if(removed_entry)
{
if(m_WearableTypeRem.find(eType) == m_WearableTypeRem.end())
{
LLUUID item_id = gAgentWearables.getWearableItemID(eType);
if(item_id.notNull())
{
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
gInventory.notifyObservers();
}
}
}
}
if (eLock & RLV_LOCK_ADD)
{