本文整理汇总了C++中LLInventoryModel::getItem方法的典型用法代码示例。如果您正苦于以下问题:C++ LLInventoryModel::getItem方法的具体用法?C++ LLInventoryModel::getItem怎么用?C++ LLInventoryModel::getItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLInventoryModel
的用法示例。
在下文中一共展示了LLInventoryModel::getItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveInvCache
//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);
}