void LLMakeOutfitDialog::getIncludedItems(LLInventoryModel::item_array_t& item_list)
{
	LLInventoryModel::cat_array_t *cats;
	LLInventoryModel::item_array_t *items;
	gInventory.getDirectDescendentsOf(LLAppearanceMgr::instance().getCOF(), cats, items);
	for (LLInventoryModel::item_array_t::const_iterator iter = items->begin(); iter != items->end(); ++iter)
	{
		LLViewerInventoryItem* item = (*iter);
		if (!item)
			continue;
		if (item->isWearableType())
		{
			LLWearableType::EType type = item->getWearableType();
			if (type < LLWearableType::WT_COUNT && childGetValue(mCheckBoxList[type].first).asBoolean())
			{
				item_list.push_back(item);
			}
		}
		else
		{
			LLViewerJointAttachment* attachment = gAgentAvatarp->getWornAttachmentPoint(item->getLinkedUUID());
			if (attachment && childGetValue(std::string("checkbox_")+attachment->getName()).asBoolean())
			{
				item_list.push_back(item);
			}
		}
	}
}
예제 #2
0
// static
void LLLocalInventory::climb(LLInventoryCategory* cat,
                             LLInventoryModel::cat_array_t& cats,
                             LLInventoryModel::item_array_t& items)
{
    LLInventoryModel* model = &gInventory;

    // Add this category
    cats.push_back(LLPointer<LLViewerInventoryCategory>((LLViewerInventoryCategory*)cat));

    LLInventoryModel::cat_array_t *direct_cats;
    LLInventoryModel::item_array_t *direct_items;
    model->getDirectDescendentsOf(cat->getUUID(), direct_cats, direct_items);

    // Add items
    LLInventoryModel::item_array_t::iterator item_iter = direct_items->begin();
    LLInventoryModel::item_array_t::iterator item_end = direct_items->end();
    for( ; item_iter != item_end; ++item_iter)
    {
        items.push_back(*item_iter);
    }

    // Do subcategories
    LLInventoryModel::cat_array_t::iterator cat_iter = direct_cats->begin();
    LLInventoryModel::cat_array_t::iterator cat_end = direct_cats->end();
    for( ; cat_iter != cat_end; ++cat_iter)
    {
        climb(*cat_iter, cats, items);
    }
}
예제 #3
0
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());
}
예제 #4
0
//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);
}
예제 #5
0
// Checked: 2010-03-14 (RLVa-1.1.3a) | Added: RLVa-1.2.0a
void RlvRenameOnWearObserver::doneIdle()
{
	const LLViewerInventoryCategory* pRlvRoot = NULL; LLVOAvatar* pAvatar = gAgentAvatarp;
	if ( (RlvSettings::getEnableSharedWear()) || (!RlvSettings::getSharedInvAutoRename()) || (LLStartUp::getStartupState() < STATE_STARTED) || 
		 (!pAvatar) || ((pRlvRoot = RlvInventory::instance().getSharedRoot()) == NULL) )
	{
		delete this;
		return;
	}

	const LLViewerJointAttachment* pAttachPt = NULL; S32 idxAttachPt = 0;
//	RLV_ASSERT(mComplete.size() > 0);	// Catch instances where we forgot to call startFetch()
	for (uuid_vec_t::const_iterator itItem = mComplete.begin(); itItem != mComplete.end(); ++itItem)
	{
		const LLUUID& idAttachItem = *itItem;

		// If the item resides under #RLV we'll rename it directly; otherwise settle for "renaming" all of its links residing under #RLV
		LLInventoryModel::item_array_t items;
		if (gInventory.isObjectDescendentOf(idAttachItem, pRlvRoot->getUUID()))
			items.push_back(gInventory.getItem(idAttachItem));
		else
			items = gInventory.collectLinkedItems(idAttachItem, pRlvRoot->getUUID());
		if (items.empty())
			continue;

		if ( ((pAttachPt = pAvatar->getWornAttachmentPoint(idAttachItem)) == NULL) ||
			 ((idxAttachPt = RlvAttachPtLookup::getAttachPointIndex(pAttachPt)) == 0) )
		{
//			RLV_ASSERT(false);
			continue;
		}

		static const std::string &new_category_name = LLViewerFolderType::lookupNewCategoryName(LLFolderType::FT_NONE);
		for (S32 idxItem = 0, cntItem = items.count(); idxItem < cntItem; idxItem++)
		{
			LLViewerInventoryItem* pItem = items.get(idxItem);
			if (!pItem)
				continue;

			S32 idxAttachPtItem = RlvAttachPtLookup::getAttachPointIndex(pItem);
			if ( (idxAttachPt == idxAttachPtItem) || (idxAttachPtItem) )
				continue;

			std::string strAttachPt = pAttachPt->getName();
			LLStringUtil::toLower(strAttachPt);

			// If we can modify the item then we rename it directly, otherwise we create a new folder and move it
			if (pItem->getPermissions().allowModifyBy(gAgent.getID()))
			{
				std::string strName = pItem->getName();
				LLStringUtil::truncate(strName, DB_INV_ITEM_NAME_STR_LEN - strAttachPt.length() - 3);

				strName += " (" + strAttachPt + ")";

				pItem->rename(strName);
				pItem->updateServer(FALSE);
				gInventory.addChangedMask(LLInventoryObserver::LABEL, pItem->getUUID());
			}
			else
			{
				// Don't do anything if the item is a direct descendant of the shared root, or a folded folder
				LLViewerInventoryCategory* pFolder = gInventory.getCategory(pItem->getParentUUID());
				if ( (pFolder) && (pFolder->getUUID() != pRlvRoot->getUUID()) && (!RlvInventory::isFoldedFolder(pFolder, false)) )
				{
					std::string strFolderName = ".(" + strAttachPt + ")";

					// Rename the item's parent folder if it's called "New Folder", isn't directly under #RLV and contains exactly 1 object
					if ( (new_category_name == pFolder->getName()) && 
						 (pFolder->getParentUUID() != pRlvRoot->getUUID()) && 
						 (1 == RlvInventory::getDirectDescendentsCount(pFolder, LLAssetType::AT_OBJECT)) )
					{
						pFolder->rename(strFolderName);
						pFolder->updateServer(FALSE);
						gInventory.addChangedMask(LLInventoryObserver::LABEL, pFolder->getUUID());
					}
					else
					{
						// "No modify" item with a non-renameable parent: create a new folder named and move the item into it
						LLUUID idAttachFolder = gInventory.createNewCategory(pFolder->getUUID(), LLFolderType::FT_NONE, strFolderName);
						move_inventory_item(gAgent.getID(), gAgent.getSessionID(), pItem->getUUID(), idAttachFolder, std::string(), NULL);
					}
				}
			}
		}
	}
	gInventory.notifyObservers();

	delete this;
}