diff options
| -rw-r--r-- | indra/newview/llappearancemgr.cpp | 37 | ||||
| -rw-r--r-- | indra/newview/llinventorybridge.cpp | 14 | 
2 files changed, 39 insertions, 12 deletions
| diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index f686eccf37..f6509a8016 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1130,6 +1130,22 @@ void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder,  //	dec_busy_count();  } +static void remove_non_link_items(LLInventoryModel::item_array_t &items) +{ +	LLInventoryModel::item_array_t pruned_items; +	for (LLInventoryModel::item_array_t::const_iterator iter = items.begin(); +		 iter != items.end(); +		 ++iter) +	{ + 		const LLViewerInventoryItem *item = (*iter); +		if (item && item->getIsLinkType()) +		{ +			pruned_items.push_back((*iter)); +		} +	} +	items = pruned_items; +} +  void LLAppearanceManager::updateAppearanceFromCOF()  {  	// update dirty flag to see if the state of the COF matches @@ -1143,13 +1159,17 @@ void LLAppearanceManager::updateAppearanceFromCOF()  	bool follow_folder_links = true;  	LLUUID current_outfit_id = getCOF(); -	// Find all the wearables that are in the COF's subtree.	 +	// Find all the wearables that are in the COF's subtree.  	lldebugs << "LLAppearanceManager::updateFromCOF()" << llendl;  	LLInventoryModel::item_array_t wear_items;  	LLInventoryModel::item_array_t obj_items;  	LLInventoryModel::item_array_t gest_items;  	getUserDescendents(current_outfit_id, wear_items, obj_items, gest_items, follow_folder_links); -	 +	// Get rid of non-links in case somehow the COF was corrupted. +	remove_non_link_items(wear_items); +	remove_non_link_items(obj_items); +	remove_non_link_items(gest_items); +  	if(!wear_items.count())  	{  		LLNotificationsUtil::add("CouldNotPutOnOutfit"); @@ -1173,7 +1193,7 @@ void LLAppearanceManager::updateAppearanceFromCOF()  	{  		LLViewerInventoryItem *item = wear_items.get(i);  		LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL; -		if (item && linked_item) +		if (item && item->getIsLinkType() && linked_item)  		{  			LLFoundData found(linked_item->getUUID(),  							  linked_item->getAssetUUID(), @@ -1200,11 +1220,11 @@ void LLAppearanceManager::updateAppearanceFromCOF()  		{  			if (!item)  			{ -				llwarns << "attempt to wear a null item " << llendl; +				llwarns << "Attempt to wear a null item " << llendl;  			}  			else if (!linked_item)  			{ -				llwarns << "attempt to wear a broken link " << item->getName() << llendl; +				llwarns << "Attempt to wear a broken link [ name:" << item->getName() << " ] " << llendl;  			}  		}  	} @@ -1734,6 +1754,13 @@ BOOL LLAppearanceManager::getIsProtectedCOFItem(const LLUUID& obj_id) const  {  	if (!getIsInCOF(obj_id)) return FALSE; +	// If a non-link somehow ended up in COF, allow deletion. +	const LLInventoryObject *obj = gInventory.getObject(obj_id); +	if (obj && !obj->getIsLinkType()) +	{ +		return FALSE; +	} +  	// For now, don't allow direct deletion from the COF.  Instead, force users  	// to choose "Detach" or "Take Off".  	return TRUE; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 27a40c6ba0..ceeffea1c9 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -683,14 +683,15 @@ void LLInvFVBridge::addTrashContextMenuOptions(menuentry_vec_t &items,  void LLInvFVBridge::addDeleteContextMenuOptions(menuentry_vec_t &items,  												menuentry_vec_t &disabled_items)  { + +	const LLInventoryObject *obj = getInventoryObject(); +  	// Don't allow delete as a direct option from COF folder. -	if (isCOFFolder()) +	if (obj && obj->getIsLinkType() && isCOFFolder())  	{  		return;  	} -	const LLInventoryObject *obj = getInventoryObject(); -  	// "Remove link" and "Delete" are the same operation.  	if (obj && obj->getIsLinkType() && !get_is_item_worn(mUUID))  	{ @@ -2689,8 +2690,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)  		LLViewerInventoryCategory *cat =  getCategory();  		// BAP removed protected check to re-enable standard ops in untyped folders.  		// Not sure what the right thing is to do here. -		if (!isCOFFolder() && cat && cat->getPreferredType()!=LLFolderType::FT_OUTFIT /*&& -			LLAssetType::lookupIsProtectedCategoryType(cat->getPreferredType())*/) +		if (!isCOFFolder() && cat && (cat->getPreferredType() != LLFolderType::FT_OUTFIT))  		{  			// Do not allow to create 2-level subfolder in the Calling Card/Friends folder. EXT-694.  			if (!LLFriendCardsManager::instance().isCategoryInFriendFolder(cat)) @@ -4276,7 +4276,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)  				items.push_back(std::string("Attach Separator"));  				items.push_back(std::string("Detach From Yourself"));  			} -			else if (!isItemInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing()) +			else if (!isItemInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing() && !isCOFFolder())  			{  				items.push_back(std::string("Attach Separator"));  				items.push_back(std::string("Object Wear")); @@ -4702,7 +4702,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)  			disabled_items.push_back(std::string("Wearable Edit"));  		}  		// Don't allow items to be worn if their baseobj is in the trash. -		if (isLinkedObjectInTrash() || isLinkedObjectMissing()) +		if (isLinkedObjectInTrash() || isLinkedObjectMissing() || isCOFFolder())  		{  			disabled_items.push_back(std::string("Wearable Wear"));  			disabled_items.push_back(std::string("Wearable Add")); | 
