void LLFloaterGesture::addToCurrentOutFit() { uuid_vec_t ids; getSelectedIds(ids); LLAppearanceMgr* am = LLAppearanceMgr::getInstance(); for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++) { am->addCOFItemLink(*it); } }
void LLFloaterGesture::addToCurrentOutFit() { uuid_vec_t ids; getSelectedIds(ids); LLAppearanceMgr* am = LLAppearanceMgr::getInstance(); LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy; for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++) { am->addCOFItemLink(*it, cb); } }
// Checked: 2010-09-18 (RLVa-1.2.1) 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; } LLAppearanceMgr* pAppearanceMgr = LLAppearanceMgr::getInstance(); // // Process removals // // Wearables if (m_remWearables.size()) { for (std::list<const LLViewerWearable*>::const_iterator itWearable = m_remWearables.begin(); itWearable != m_remWearables.end(); ++itWearable) pAppearanceMgr->removeItemFromAvatar((*itWearable)->getItemID()); m_remWearables.clear(); } // Gestures if (m_remGestures.size()) { // NOTE: LLGestureMgr::deactivateGesture() will call LLAppearanceMgr::removeCOFItemLinks() for us for (S32 idxItem = 0, cntItem = m_remGestures.count(); idxItem < cntItem; idxItem++) LLGestureMgr::instance().deactivateGesture(m_remGestures.get(idxItem)->getUUID()); 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) LLAgentWearables::userRemoveMultipleAttachments(m_remAttachments); for (std::vector<LLViewerObject*>::const_iterator itAttachObj = m_remAttachments.begin(); itAttachObj != m_remAttachments.end(); ++itAttachObj) { pAppearanceMgr->removeCOFItemLinks((*itAttachObj)->getAttachmentItemID()); } m_remAttachments.clear(); } // // Process additions // // Wearables need to be split into AT_BODYPART and AT_CLOTHING for COF LLInventoryModel::item_array_t addBodyParts, addClothing; for (addwearables_map_t::const_iterator itAddWearables = m_addWearables.begin(); itAddWearables != m_addWearables.end(); ++itAddWearables) { const LLInventoryModel::item_array_t& wearItems = itAddWearables->second; for (S32 idxItem = 0, cntItem = wearItems.count(); idxItem < cntItem; idxItem++) { LLViewerInventoryItem* pItem = wearItems.get(idxItem); if (!pAppearanceMgr->isLinkInCOF(pItem->getUUID())) // It's important to examine COF here and *not* gAgentWearables { if (LLAssetType::AT_BODYPART == pItem->getType()) addBodyParts.push_back(pItem); else addClothing.push_back(pItem); } } } 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(); // If there are additions we need to call LLAppearanceManager::updateCOF(), otherwise LLAppearanceManager::updateAppearanceFromCOF() if ( (!addBodyParts.empty()) || (!addClothing.empty()) || (!m_addGestures.empty()) ) { LLInventoryModel::item_array_t addAttachments; pAppearanceMgr->updateCOF(addBodyParts, addClothing, addAttachments, m_addGestures, true); 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()) ); }