//static void LLLocalInventory::saveInvCache(std::string filename, LLFolderView* folder) { LLInventoryModel* model = &gInventory; std::set<LLUUID> selected_items; folder->getSelectionList(selected_items); if(selected_items.size() < 1) { // No items selected? Wtfboom return; } LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; // Make complete lists of child categories and items std::set<LLUUID>::iterator sel_iter = selected_items.begin(); std::set<LLUUID>::iterator sel_end = selected_items.end(); for( ; sel_iter != sel_end; ++sel_iter) { LLInventoryCategory* cat = model->getCategory(*sel_iter); if(cat) { climb(cat, cats, items); } } // And what about items inside a folder that wasn't selected? // I guess I will just add selected items, so long as they aren't already added for(sel_iter = selected_items.begin(); sel_iter != sel_end; ++sel_iter) { LLInventoryItem* item = model->getItem(*sel_iter); if(item) { if(std::find(items.begin(), items.end(), item) == items.end()) { items.push_back(LLPointer<LLViewerInventoryItem>((LLViewerInventoryItem*)item)); LLInventoryCategory* parent = model->getCategory(item->getParentUUID()); if(std::find(cats.begin(), cats.end(), parent) == cats.end()) { cats.push_back(LLPointer<LLViewerInventoryCategory>((LLViewerInventoryCategory*)parent)); } } } } LLInventoryModel::saveToFile(filename, cats, items); }
// Checked: 2010-08-30 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c bool RlvInventory::getPath(const uuid_vec_t& idItems, LLInventoryModel::cat_array_t& folders) const { // Sanity check - can't do anything without a shared root const LLViewerInventoryCategory* pRlvRoot = RlvInventory::instance().getSharedRoot(); if (!pRlvRoot) return false; folders.clear(); for (uuid_vec_t::const_iterator itItem = idItems.begin(); itItem != idItems.end(); ++itItem) { const LLInventoryItem* pItem = gInventory.getItem(*itItem); if ( (pItem) && (gInventory.isObjectDescendentOf(pItem->getUUID(), pRlvRoot->getUUID())) ) { // If the containing folder is a folded folder we need its parent LLViewerInventoryCategory* pFolder = gInventory.getCategory(pItem->getParentUUID()); if (RlvInventory::instance().isFoldedFolder(pFolder, true)) pFolder = gInventory.getCategory(pFolder->getParentUUID()); folders.push_back(pFolder); } } return (folders.count() != 0); }