diff options
Diffstat (limited to 'indra/newview/llappearancemgr.cpp')
| -rw-r--r-- | indra/newview/llappearancemgr.cpp | 56 | 
1 files changed, 24 insertions, 32 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 862c68ecda..a7d90ab8d3 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -951,7 +951,7 @@ const LLUUID LLAppearanceMgr::getBaseOutfitUUID()  	return outfit_cat->getUUID();  } -bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_update, bool replace) +bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_update, bool replace, LLPointer<LLInventoryCallback> cb)  {  	if (item_id_to_wear.isNull()) return false; @@ -995,7 +995,7 @@ bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_up  			{  				removeCOFItemLinks(gAgentWearables.getWearableItemID(item_to_wear->getWearableType(), wearable_count-1), false);  			} -			addCOFItemLink(item_to_wear, do_update); +			addCOFItemLink(item_to_wear, do_update, cb);  		}   		break;  	case LLAssetType::AT_BODYPART: @@ -1005,7 +1005,7 @@ bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_up  		// Remove existing body parts anyway because we must not be able to wear e.g. two skins.  		removeCOFLinksOfType(item_to_wear->getWearableType(), false); -		addCOFItemLink(item_to_wear, do_update); +		addCOFItemLink(item_to_wear, do_update, cb);  		break;  	case LLAssetType::AT_OBJECT:  		rez_attachment(item_to_wear, NULL); @@ -1959,9 +1959,10 @@ bool areMatchingWearables(const LLViewerInventoryItem *a, const LLViewerInventor  class LLDeferredCOFLinkObserver: public LLInventoryObserver  {  public: -	LLDeferredCOFLinkObserver(const LLUUID& item_id, bool do_update): +	LLDeferredCOFLinkObserver(const LLUUID& item_id, bool do_update, LLPointer<LLInventoryCallback> cb = NULL):  		mItemID(item_id), -		mDoUpdate(do_update) +		mDoUpdate(do_update), +		mCallback(cb)  	{  	} @@ -1975,7 +1976,7 @@ public:  		if (item)  		{  			gInventory.removeObserver(this); -			LLAppearanceMgr::instance().addCOFItemLink(item,mDoUpdate); +			LLAppearanceMgr::instance().addCOFItemLink(item,mDoUpdate,mCallback);  			delete this;  		}  	} @@ -1983,26 +1984,27 @@ public:  private:  	const LLUUID mItemID;  	bool mDoUpdate; +	LLPointer<LLInventoryCallback> mCallback;  };  // BAP - note that this runs asynchronously if the item is not already loaded from inventory.  // Dangerous if caller assumes link will exist after calling the function. -void LLAppearanceMgr::addCOFItemLink(const LLUUID &item_id, bool do_update ) +void LLAppearanceMgr::addCOFItemLink(const LLUUID &item_id, bool do_update, LLPointer<LLInventoryCallback> cb)  {  	const LLInventoryItem *item = gInventory.getItem(item_id);  	if (!item)  	{ -		LLDeferredCOFLinkObserver *observer = new LLDeferredCOFLinkObserver(item_id, do_update); +		LLDeferredCOFLinkObserver *observer = new LLDeferredCOFLinkObserver(item_id, do_update, cb);  		gInventory.addObserver(observer);  	}  	else  	{ -		addCOFItemLink(item, do_update); +		addCOFItemLink(item, do_update, cb);  	}  } -void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update ) +void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update, LLPointer<LLInventoryCallback> cb)  {		  	const LLViewerInventoryItem *vitem = dynamic_cast<const LLViewerInventoryItem*>(item);  	if (!vitem) @@ -2063,7 +2065,10 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update  	}  	else  	{ -		LLPointer<LLInventoryCallback> cb = do_update ? new ModifiedCOFCallback : 0; +		if(do_update && cb.isNull()) +		{ +			cb = new ModifiedCOFCallback; +		}  		const std::string description = vitem->getIsLinkType() ? vitem->getDescription() : "";  		link_inventory_item( gAgent.getID(),  							 vitem->getLinkedUUID(), @@ -2174,17 +2179,19 @@ void LLAppearanceMgr::updateIsDirty()  	}  	else  	{ +		LLIsOfAssetType collector = LLIsOfAssetType(LLAssetType::AT_LINK); +  		LLInventoryModel::cat_array_t cof_cats;  		LLInventoryModel::item_array_t cof_items; -		gInventory.collectDescendents(cof, cof_cats, cof_items, -									  LLInventoryModel::EXCLUDE_TRASH); +		gInventory.collectDescendentsIf(cof, cof_cats, cof_items, +									  LLInventoryModel::EXCLUDE_TRASH, collector);  		LLInventoryModel::cat_array_t outfit_cats;  		LLInventoryModel::item_array_t outfit_items; -		gInventory.collectDescendents(base_outfit, outfit_cats, outfit_items, -									  LLInventoryModel::EXCLUDE_TRASH); +		gInventory.collectDescendentsIf(base_outfit, outfit_cats, outfit_items, +									  LLInventoryModel::EXCLUDE_TRASH, collector); -		if(outfit_items.count() != cof_items.count() -1) +		if(outfit_items.count() != cof_items.count())  		{  			// Current outfit folder should have one more item than the outfit folder.  			// this one item is the link back to the outfit folder itself. @@ -2192,16 +2199,6 @@ void LLAppearanceMgr::updateIsDirty()  			return;  		} -		//getting rid of base outfit folder link to simplify comparison -		for (LLInventoryModel::item_array_t::iterator it = cof_items.begin(); it != cof_items.end(); ++it) -		{ -			if (*it == base_outfit_item) -			{ -				cof_items.erase(it); -				break; -			} -		} -  		//"dirty" - also means a difference in linked UUIDs and/or a difference in wearables order (links' descriptions)  		std::sort(cof_items.begin(), cof_items.end(), sort_by_linked_uuid);  		std::sort(outfit_items.begin(), outfit_items.end(), sort_by_linked_uuid); @@ -2502,12 +2499,7 @@ void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove)  	// since sever don't sends message _PREHASH_KillObject in that case.  	// Also we can't check is link was successfully removed from COF since in case  	// deleting attachment link removing performs asynchronously in process_kill_object callback. -	LLViewerInventoryItem* item =  gInventory.getItem(id_to_remove); -	if (item != NULL) -	{ -		gInventory.purgeObject(id_to_remove); -		gInventory.notifyObservers(); -	} +	removeCOFItemLinks(id_to_remove,false);  }  bool LLAppearanceMgr::moveWearable(LLViewerInventoryItem* item, bool closer_to_body)  | 
