// Checked: 2010-03-19 (RLVa-1.2.0a) | Added: RLVa-1.2.0a void RlvForceWear::forceDetach(const LLViewerJointAttachment* pAttachPt) { for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator itAttachObj = pAttachPt->mAttachedObjects.begin(); itAttachObj != pAttachPt->mAttachedObjects.end(); ++itAttachObj) { forceDetach(*itAttachObj); } }
// Checked: 2009-10-12 (RLVa-1.0.5b) | Modified: RLVa-1.0.5b void RlvAttachmentManager::onAttach(LLViewerJointAttachment* pAttachPt) { S32 idxAttachPt = gRlvHandler.getAttachPointIndex(pAttachPt->getObject()); if (!idxAttachPt) return; // If the attachment point has a pending "reattach" then we don't want to do anything rlv_attach_map_t::iterator itAttach = m_PendingAttach.find(idxAttachPt); if (itAttach != m_PendingAttach.end()) { if (pAttachPt->getItemID() == itAttach->second.idItem) m_PendingAttach.erase(itAttach); return; } // Check if the attach is the result of a user action (="Wear") rlv_wear_map_t::iterator itWear = m_PendingWear.find(pAttachPt->getItemID()); if (itWear != m_PendingWear.end()) { // We need to return the attachment point to its previous state if it's non-attachable if (gRlvHandler.isLockedAttachment(idxAttachPt, RLV_LOCK_ADD)) { // Get the state of the attachment point at the time the user picked "Wear" (if we don't have one it wasn't "add locked" then) std::map<S32, LLUUID>::iterator itAttachPrev = itWear->second.attachPts.find(idxAttachPt); if ( (itAttachPrev != itWear->second.attachPts.end()) && (pAttachPt->getItemID() != itAttachPrev->second) ) { // If it was empty we need to force detach the new attachment; if it wasn't we need to reattach the old one if (itAttachPrev->second.isNull()) { forceDetach(pAttachPt); m_PendingDetach.insert(std::pair<S32, LLUUID>(idxAttachPt, pAttachPt->getItemID())); } else if (m_PendingAttach.find(idxAttachPt) == m_PendingAttach.end()) // (only if we're not reattaching something else there) { m_PendingAttach.insert(std::pair<S32, RlvReattachInfo>(idxAttachPt, RlvReattachInfo(itAttachPrev->second))); } } } m_PendingWear.erase(itWear); // No need to start the timer since it should be running already if '!m_PendingWear.empty()' } }