// Checked: 2010-02-28 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a void RlvAttachmentLocks::removeAttachmentLock(const LLUUID& idAttachObj, const LLUUID& idRlvObj) { /* // Sanity check - make sure it's an object we know about if ( (m_Objects.find(idRlvObj) == m_Objects.end()) || (!idxAttachPt) ) return; // If (idxAttachPt) == 0 then: (pObj == NULL) || (pObj->isAttachment() == FALSE) */ #ifndef RLV_RELEASE // NOTE: pObj *can* be NULL [see comments for @detach=n in RlvHandler::onAddRemDetach()] const LLViewerObject* pDbgObj = gObjectList.findObject(idAttachObj); // Assertion: if the object exists then it's an attachment and always specifies the root RLV_VERIFY( (!pDbgObj) || ((pDbgObj->isAttachment()) && (pDbgObj == pDbgObj->getRootEdit())) ); #endif // RLV_RELEASE // NOTE: try to remove the lock even if pObj isn't an attachment (ie in case the user was able to "Drop" it) RLV_ASSERT( m_AttachObjRem.lower_bound(idAttachObj) != m_AttachObjRem.upper_bound(idAttachObj) ); // The lock should always exist for (rlv_attachobjlock_map_t::iterator itAttachObj = m_AttachObjRem.lower_bound(idAttachObj), endAttachObj = m_AttachObjRem.upper_bound(idAttachObj); itAttachObj != endAttachObj; ++itAttachObj) { if (idRlvObj == itAttachObj->second) { m_AttachObjRem.erase(itAttachObj); updateLockedHUD(); break; } } }
// Checked: 2010-02-28 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a void RlvAttachmentLocks::addAttachmentLock(const LLUUID& idAttachObj, const LLUUID& idRlvObj) { /* // Sanity check - make sure it's an object we know about if ( (m_Objects.find(idRlvObj) == m_Objects.end()) || (!idxAttachPt) ) return; // If (idxAttachPt) == 0 then: (pObj == NULL) || (pObj->isAttachment() == FALSE) */ #ifndef RLV_RELEASE LLViewerObject* pDbgObj = gObjectList.findObject(idAttachObj); // Assertion: the object specified by idAttachObj exists/is rezzed, is an attachment and always specifies the root RLV_VERIFY( (pDbgObj) && (pDbgObj->isAttachment()) && (pDbgObj == pDbgObj->getRootEdit()) ); #endif // RLV_RELEASE m_AttachObjRem.insert(std::pair<LLUUID, LLUUID>(idAttachObj, idRlvObj)); updateLockedHUD(); }
// Checked: 2010-09-18 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a void RlvForceWear::done() { // Sanity check - don't go through all the motions below only to find out there's nothing to actually do if ( (m_remWearables.empty()) && (m_remAttachments.empty()) && (m_remGestures.empty()) && (m_addWearables.empty()) && (m_addAttachments.empty()) && (m_addGestures.empty()) ) { return; } // // Process removals // // Wearables if (m_remWearables.size()) { for (std::list<const LLWearable*>::const_iterator itWearable = m_remWearables.begin(); itWearable != m_remWearables.end(); ++itWearable) gAgent.removeWearable((*itWearable)->getType()); m_remWearables.clear(); } // Gestures if (m_remGestures.size()) { for (S32 idxGesture = 0, cntGesture = m_remGestures.count(); idxGesture < cntGesture; idxGesture++) { LLViewerInventoryItem* pItem = m_remGestures.get(idxGesture); gGestureManager.deactivateGesture(pItem->getUUID()); gInventory.updateItem(pItem); gInventory.notifyObservers(); } m_remGestures.clear(); } // Attachments if (m_remAttachments.size()) { // Don't bother with COF if all we're doing is detaching some attachments (keeps people from rebaking on every @remattach=force) gMessageSystem->newMessage("ObjectDetach"); gMessageSystem->nextBlockFast(_PREHASH_AgentData); gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); for (std::list<const LLViewerObject*>::const_iterator itAttachObj = m_remAttachments.begin(); itAttachObj != m_remAttachments.end(); ++itAttachObj) { gMessageSystem->nextBlockFast(_PREHASH_ObjectData); gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, (*itAttachObj)->getLocalID()); } gMessageSystem->sendReliable(gAgent.getRegionHost()); m_remAttachments.clear(); } // // Process additions // // Process wearables if (m_addWearables.size()) { // [See wear_inventory_category_on_avatar_step2()] LLWearableHoldingPattern* pWearData = new LLWearableHoldingPattern(TRUE); // We need to populate 'pWearData->mFoundList' before doing anything else because (some of) the assets might already be available for (addwearables_map_t::const_iterator itAddWearables = m_addWearables.begin(); itAddWearables != m_addWearables.end(); ++itAddWearables) { const LLInventoryModel::item_array_t& wearItems = itAddWearables->second; RLV_VERIFY(1 == wearItems.count()); if (wearItems.count() > 0) { LLViewerInventoryItem* pItem = wearItems.get(0); if ( (pItem) && ((LLAssetType::AT_BODYPART == pItem->getType()) || (LLAssetType::AT_CLOTHING == pItem->getType())) ) { LLFoundData* pFound = new LLFoundData(pItem->getUUID(), pItem->getAssetUUID(), pItem->getName(), pItem->getType()); pWearData->mFoundList.push_front(pFound); } } } if (!pWearData->mFoundList.size()) { delete pWearData; return; } // If all the assets are available locally then "pWearData" will be freed *before* the last "gWearableList.getAsset()" call returns bool fContinue = true; LLWearableHoldingPattern::found_list_t::const_iterator itWearable = pWearData->mFoundList.begin(); while ( (fContinue) && (itWearable != pWearData->mFoundList.end()) ) { const LLFoundData* pFound = *itWearable; ++itWearable; fContinue = (itWearable != pWearData->mFoundList.end()); gWearableList.getAsset(pFound->mAssetID, pFound->mName, pFound->mAssetType, wear_inventory_category_on_avatar_loop, (void*)pWearData); } m_addWearables.clear(); } // Until LL provides a way for updateCOF to selectively attach add/replace we have to deal with attachments ourselves for (addattachments_map_t::const_iterator itAddAttachments = m_addAttachments.begin(); itAddAttachments != m_addAttachments.end(); ++itAddAttachments) { const LLInventoryModel::item_array_t& wearItems = itAddAttachments->second; for (S32 idxItem = 0, cntItem = wearItems.count(); idxItem < cntItem; idxItem++) { const LLUUID& idItem = wearItems.get(idxItem)->getLinkedUUID(); // if (gAgentAvatarp->attachmentWasRequested(idItem)) // continue; // gAgentAvatarp->addAttachmentRequest(idItem); LLAttachmentsMgr::instance().addAttachment(idItem, itAddAttachments->first & ~ATTACHMENT_ADD, itAddAttachments->first & ATTACHMENT_ADD); } } m_addAttachments.clear(); // Process gestures if (m_addGestures.size()) { gGestureManager.activateGestures(m_addGestures); for (S32 idxGesture = 0, cntGesture = m_addGestures.count(); idxGesture < cntGesture; idxGesture++) gInventory.updateItem(m_addGestures.get(idxGesture)); gInventory.notifyObservers(); m_addGestures.clear(); } // Since RlvForceWear is a singleton now we want to be sure there aren't any leftovers RLV_ASSERT( (m_remWearables.empty()) && (m_remAttachments.empty()) && (m_remGestures.empty()) ); RLV_ASSERT( (m_addWearables.empty()) && (m_addAttachments.empty()) && (m_addGestures.empty()) ); }