diff options
| author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-08-04 11:53:28 +0100 | 
|---|---|---|
| committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-08-04 11:53:28 +0100 | 
| commit | dea12663707b5c88c34bafd95c345e806702bc03 (patch) | |
| tree | 7ab03f0f890a122bcf68bb3d4e26370af62fe1a1 | |
| parent | 08b74c369f0dccaa97a4c893c952d0afe1e5b041 (diff) | |
| parent | e3a33b068dca4cf12a35da8785d2a7c90b621728 (diff) | |
merge from PE's viewer-release
| -rw-r--r-- | indra/newview/llappearancemgr.cpp | 31 | ||||
| -rw-r--r-- | indra/newview/llappearancemgr.h | 3 | ||||
| -rw-r--r-- | indra/newview/llcofwearables.cpp | 8 | ||||
| -rw-r--r-- | indra/newview/lloutfitslist.cpp | 10 | ||||
| -rw-r--r-- | indra/newview/llpaneloutfitedit.cpp | 4 | ||||
| -rw-r--r-- | indra/newview/llpaneloutfitedit.h | 2 | 
6 files changed, 43 insertions, 15 deletions
| diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 78edcb3e25..2729053390 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1275,6 +1275,11 @@ bool LLAppearanceMgr::getCanRemoveFromCOF(const LLUUID& outfit_cat_id)  // static  bool LLAppearanceMgr::getCanAddToCOF(const LLUUID& outfit_cat_id)  { +	if (gAgentWearables.isCOFChangeInProgress()) +	{ +		return false; +	} +  	LLInventoryModel::cat_array_t cats;  	LLInventoryModel::item_array_t items;  	LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ false); @@ -1286,6 +1291,32 @@ bool LLAppearanceMgr::getCanAddToCOF(const LLUUID& outfit_cat_id)  	return items.size() > 0;  } +bool LLAppearanceMgr::getCanReplaceCOF(const LLUUID& outfit_cat_id) +{ +	// Don't allow wearing anything while we're changing appearance. +	if (gAgentWearables.isCOFChangeInProgress()) +	{ +		return false; +	} + +	// Check whether it's the base outfit. +	if (outfit_cat_id.isNull() || outfit_cat_id == getBaseOutfitUUID()) +	{ +		return false; +	} + +	// Check whether the outfit contains any non-worn wearables. +	LLInventoryModel::cat_array_t cats; +	LLInventoryModel::item_array_t items; +	LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ true); +	gInventory.collectDescendentsIf(outfit_cat_id, +		cats, +		items, +		LLInventoryModel::EXCLUDE_TRASH, +		not_worn); +	return items.size() > 0; +} +  void LLAppearanceMgr::purgeBaseOutfitLink(const LLUUID& category)  {  	LLInventoryModel::cat_array_t cats; diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 9f554dbdef..eb495bd274 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -84,6 +84,9 @@ public:  	// Determine whether we can add anything (but body parts) from the outfit contents to COF.  	static bool getCanAddToCOF(const LLUUID& outfit_cat_id); +	// Determine whether we can replace current outfit with the given one. +	bool getCanReplaceCOF(const LLUUID& outfit_cat_id); +  	// Copy all items in a category.  	void shallowCopyCategoryContents(const LLUUID& src_id, const LLUUID& dst_id,  									 LLPointer<LLInventoryCallback> cb); diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index 893400185c..eb950bf6c1 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -163,7 +163,7 @@ public:  	}  protected: -	static void replaceWearable() +	static void replaceWearable(const LLUUID& item_id)  	{  		// *TODO: Most probable that accessing to LLPanelOutfitEdit instance should be:  		// LLSideTray::getInstance()->getSidepanelAppearance()->getPanelOutfitEdit() @@ -175,7 +175,7 @@ protected:  								"panel_outfit_edit"));  		if (panel_outfit_edit != NULL)  		{ -			panel_outfit_edit->showAddWearablesPanel(true); +			panel_outfit_edit->onReplaceMenuItemClicked(item_id);  		}  	} @@ -187,7 +187,7 @@ protected:  		functor_t take_off = boost::bind(&LLAppearanceMgr::removeItemFromAvatar, LLAppearanceMgr::getInstance(), _1);  		registrar.add("Clothing.TakeOff", boost::bind(handleMultiple, take_off, mUUIDs)); -		registrar.add("Clothing.Replace", boost::bind(replaceWearable)); +		registrar.add("Clothing.Replace", boost::bind(replaceWearable, selected_id));  		registrar.add("Clothing.Edit", boost::bind(LLAgentWearables::editWearable, selected_id));  		registrar.add("Clothing.Create", boost::bind(&CofClothingContextMenu::createNew, this, selected_id)); @@ -244,7 +244,7 @@ protected:  		// *HACK* need to pass pointer to LLPanelOutfitEdit instead of LLSideTray::getInstance()->getPanel().  		// LLSideTray::getInstance()->getPanel() is rather slow variant  		LLPanelOutfitEdit* panel_oe = dynamic_cast<LLPanelOutfitEdit*>(LLSideTray::getInstance()->getPanel("panel_outfit_edit")); -		registrar.add("BodyPart.Replace", boost::bind(&LLPanelOutfitEdit::onReplaceBodyPartMenuItemClicked, panel_oe, selected_id)); +		registrar.add("BodyPart.Replace", boost::bind(&LLPanelOutfitEdit::onReplaceMenuItemClicked, panel_oe, selected_id));  		registrar.add("BodyPart.Edit", boost::bind(LLAgentWearables::editWearable, selected_id));  		registrar.add("BodyPart.Create", boost::bind(&CofBodyPartContextMenu::createNew, this, selected_id)); diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 8147a97317..f921bca623 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -275,11 +275,10 @@ protected:  		}  		else if ("wear_replace" == param)  		{ -			return !gAgentWearables.isCOFChangeInProgress(); +			return LLAppearanceMgr::instance().getCanReplaceCOF(outfit_cat_id);  		}  		else if ("wear_add" == param)  		{ -			if (gAgentWearables.isCOFChangeInProgress()) return false;  			return LLAppearanceMgr::getCanAddToCOF(outfit_cat_id);  		}  		else if ("take_off" == param) @@ -676,7 +675,7 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata)  		}  		// outfit selected -		return LLAppearanceMgr::getCanAddToCOF(mSelectedOutfitUUID); +		return LLAppearanceMgr::instance().getCanReplaceCOF(mSelectedOutfitUUID);  	}  	if (command_name == "take_off")  	{ @@ -689,11 +688,6 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata)  	if (command_name == "wear_add")  	{  		// *TODO: do we ever get here? -		if (gAgentWearables.isCOFChangeInProgress()) -		{ -			return false; -		} -  		return LLAppearanceMgr::getCanAddToCOF(mSelectedOutfitUUID);  	} diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 8b9baef54a..c12f1fbe99 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -609,11 +609,11 @@ void LLPanelOutfitEdit::onAddWearableClicked(void)  	}  } -void LLPanelOutfitEdit::onReplaceBodyPartMenuItemClicked(LLUUID selected_item_id) +void LLPanelOutfitEdit::onReplaceMenuItemClicked(LLUUID selected_item_id)  {  	LLViewerInventoryItem* item = gInventory.getLinkedItem(selected_item_id); -	if (item && item->getType() == LLAssetType::AT_BODYPART) +	if (item)  	{  		showFilteredWearablesListView(item->getWearableType());  	} diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h index 0efc6dc189..5ce707e6eb 100644 --- a/indra/newview/llpaneloutfitedit.h +++ b/indra/newview/llpaneloutfitedit.h @@ -164,7 +164,7 @@ public:  	void onRemoveFromOutfitClicked(void);  	void onEditWearableClicked(void);  	void onAddWearableClicked(void); -	void onReplaceBodyPartMenuItemClicked(LLUUID selected_item_id); +	void onReplaceMenuItemClicked(LLUUID selected_item_id);  	void onShopButtonClicked();  	void displayCurrentOutfit(); | 
