diff options
| author | andreykproductengine <none@none> | 2017-01-04 10:51:52 +0200 | 
|---|---|---|
| committer | andreykproductengine <none@none> | 2017-01-04 10:51:52 +0200 | 
| commit | c4476c78f189b3b729881a66c263a3a842de1d6d (patch) | |
| tree | 296945fef7b8ac667190c0873ec627c24e29c5da /indra | |
| parent | 9121738b5b13d74dbc75a45605533d5fba31c089 (diff) | |
MAINT-2438 When wearing 2 pair of identical pants, only one pair was editable
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llappearancemgr.cpp | 43 | 
1 files changed, 40 insertions, 3 deletions
| diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index fc4be98fbd..046e829070 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1227,11 +1227,12 @@ void LLWearableHoldingPattern::onWearableAssetFetch(LLViewerWearable *wearable)  		return;  	} +	U32 use_count = 0;  	for (LLWearableHoldingPattern::found_list_t::iterator iter = getFoundList().begin(); -		 iter != getFoundList().end(); ++iter) +		iter != getFoundList().end(); ++iter)  	{  		LLFoundData& data = *iter; -		if(wearable->getAssetID() == data.mAssetID) +		if (wearable->getAssetID() == data.mAssetID)  		{  			// Failing this means inventory or asset server are corrupted in a way we don't handle.  			if ((data.mWearableType >= LLWearableType::WT_COUNT) || (wearable->getType() != data.mWearableType)) @@ -1240,9 +1241,45 @@ void LLWearableHoldingPattern::onWearableAssetFetch(LLViewerWearable *wearable)  				break;  			} -			data.mWearable = wearable; +			if (use_count == 0) +			{ +				data.mWearable = wearable; +				use_count++; +			} +			else if (wearable->getPermissions().allowModifyBy(gAgent.getID())) +			{ +				// We can't edit and do some other interactions with same asset twice, copy it +				LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(wearable, wearable->getName()); +				data.mWearable = new_wearable; +				data.mAssetID = new_wearable->getAssetID(); + +				LLViewerInventoryItem* item = gInventory.getItem(data.mItemID); +				if (item) +				{ +					// Update existing inventory item +					item->setAssetUUID(new_wearable->getAssetID()); +					item->setTransactionID(new_wearable->getTransactionID()); +					gInventory.updateItem(item, LLInventoryObserver::INTERNAL); +					item->updateServer(FALSE); +				} +				use_count++; +			} +			else +			{ +				// Note: technically a bug, LLViewerWearable can identify only one item id at a time, +				// yet we are tying it to multiple items here. +				// LLViewerWearable need to support more then one item. +				LL_WARNS() << "Same LLViewerWearable is used by multiple items! " << wearable->getAssetID() << LL_ENDL; +				data.mWearable = wearable; +			}  		}  	} + +	if (use_count > 1) +	{ +		LL_WARNS() << "Copying wearable, multiple asset id uses! " << wearable->getAssetID() << LL_ENDL; +		gInventory.notifyObservers(); +	}  }  static void onWearableAssetFetch(LLViewerWearable* wearable, void* data) | 
