void LLCOFMgr::updateAttachments() { /*const*/ LLVOAvatar* pAvatar = gAgentAvatarp; if (!pAvatar) return; const LLUUID idCOF = getCOF(); // Grab all attachment links currently in COF LLInventoryModel::item_array_t items; getDescendentsOfAssetType(idCOF, items, LLAssetType::AT_OBJECT, true); // Include attachments which should be in COF but don't have their link created yet uuid_vec_t::iterator itPendingAttachLink = m_PendingAttachLinks.begin(); while (itPendingAttachLink != m_PendingAttachLinks.end()) { const LLUUID& idItem = *itPendingAttachLink; if ( (!pAvatar->isWearingAttachment(idItem)) || (isLinkInCOF(idItem)) ) { itPendingAttachLink = m_PendingAttachLinks.erase(itPendingAttachLink); continue; } LLViewerInventoryItem* pItem = gInventory.getItem(idItem); if (pItem) items.push_back(pItem); ++itPendingAttachLink; } // Don't remove attachments until avatar is fully loaded (should reduce random attaching/detaching/reattaching at log-on) LLAgentWearables::userUpdateAttachments(items, !pAvatar->isFullyLoaded()); }
bool isworn(LLUUID item) { LLVOAvatar* avatar = gAgent.getAvatarObject(); if(avatar && avatar->isWearingAttachment(item) ) { return true; } return false; }