Ejemplo n.º 1
0
void LLInitialWearablesFetch::processContents()
{
	// Fetch the wearable items from the Current Outfit Folder
	LLInventoryModel::cat_array_t cat_array;
	LLInventoryModel::item_array_t wearable_array;
	LLFindWearables is_wearable;
	gInventory.collectDescendentsIf(mComplete.front(), cat_array, wearable_array, 
									LLInventoryModel::EXCLUDE_TRASH, is_wearable);

	LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
	if (wearable_array.count() > 0)
	{
		gAgentWearables.notifyLoadingStarted();
		LLAppearanceMgr::instance().updateAppearanceFromCOF();
	}
	else
	{
		// if we're constructing the COF from the wearables message, we don't have a proper outfit link
		LLAppearanceMgr::instance().setOutfitDirty(true);
		processWearablesMessage();
	}
	delete this;
}
void LLInitialWearablesFetch::processContents()
{
	if(!gAgentAvatarp) //no need to process wearables if the agent avatar is deleted.
	{
		delete this;
		return ;
	}

	// Fetch the wearable items from the Current Outfit Folder
	LLInventoryModel::cat_array_t cat_array;
	LLInventoryModel::item_array_t wearable_array;
	LLFindWearables is_wearable;
	llassert(mComplete.size() != 0);
	gInventory.collectDescendentsIf(mComplete.front(), cat_array, wearable_array, 
									LLInventoryModel::EXCLUDE_TRASH, is_wearable);

// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-05-18 (Catznip-3.0.0a) | Modified: Catznip-2.0.0h
	// NOTE: don't use the current COF contents if 'wearable_array' is empty (ie first logon with 2.0 or some other problem)
	bool fUpdateFromCOF = !wearable_array.empty();
	if ( (fUpdateFromCOF) && (gSavedSettings.getBOOL("VerifyInitialWearables")) )
	{
		LLAppearanceMgr::wearables_by_type_t items_by_type(LLWearableType::WT_COUNT);
		LLAppearanceMgr::sortItemsByActualDescription(wearable_array);
		LLAppearanceMgr::divvyWearablesByType(wearable_array, items_by_type);

		// Compare the COF wearables against the initial wearables
		for (initial_wearable_data_vec_t::const_iterator itWearableData = mAgentInitialWearables.begin();
				(itWearableData != mAgentInitialWearables.end()) && (fUpdateFromCOF);  ++itWearableData)
		{
			const LLUUID& idItem = itWearableData->mItemID; bool fFound = false;
			for (S32 idxItem = 0, cntItem = items_by_type[itWearableData->mType].size(); idxItem < cntItem; idxItem++)
			{
				const LLViewerInventoryItem* pCOFItem = items_by_type[itWearableData->mType].get(idxItem);
				if (idItem == pCOFItem->getLinkedUUID())
				{
					fFound = true;
					break;
				}
			}
			if (!fFound)
				fUpdateFromCOF = false;
		}
	}
// [/SL:KB]

	LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
//	if (wearable_array.count() > 0)
// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-04-28 (Catznip-3.0.0a) | Modified: Catznip-2.0.0e
	if (fUpdateFromCOF)
// [/SL:KB]
	{
		gAgentWearables.notifyLoadingStarted();
		LLAppearanceMgr::instance().updateAppearanceFromCOF();
	}
	else
	{
		// if we're constructing the COF from the wearables message, we don't have a proper outfit link
		LLAppearanceMgr::instance().setOutfitDirty(true);
		processWearablesMessage();
	}
	delete this;
}