Commits

Seth ProductEngine  committed 5d94552

EXT-8014 FIXED Enabled "Take off" in My Outfits gear menu if any of selected items can be taken off or selected outfit contains items that can be taken off.

Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/649/.

  • Participants
  • Parent commits 7d7ec04
  • Branches product-engine

Comments (0)

Files changed (2)

File indra/newview/lloutfitslist.cpp

 	}
 	if (command_name == "take_off")
 	{
-		// Enable "Take Off" only if a worn item or base outfit is selected.
-		return ( !hasItemSelected()
-				 && LLAppearanceMgr::getInstance()->getBaseOutfitUUID() == mSelectedOutfitUUID )
-				|| hasWornItemSelected();
+		// Enable "Take Off" if any of selected items can be taken off
+		// or the selected outfit contains items that can be taken off.
+		return ( hasItemSelected() && canTakeOffSelected() )
+				|| ( !hasItemSelected() && LLAppearanceMgr::getCanRemoveFromCOF(mSelectedOutfitUUID) );
 	}
 
 	if (command_name == "wear_add")
 	}
 }
 
-bool LLOutfitsList::hasWornItemSelected()
+bool LLOutfitsList::canTakeOffSelected()
 {
 	uuid_vec_t selected_uuids;
 	getSelectedItemsUUIDs(selected_uuids);
 
+	LLFindWearablesEx is_worn(/*is_worn=*/ true, /*include_body_parts=*/ false);
+
 	for (uuid_vec_t::const_iterator it=selected_uuids.begin(); it != selected_uuids.end(); ++it)
 	{
-		if (get_is_item_worn(*it)) return true;
+		LLViewerInventoryItem* item = gInventory.getItem(*it);
+		if (!item) continue;
+
+		if (is_worn(NULL, item)) return true;
 	}
 	return false;
 }

File indra/newview/lloutfitslist.h

 	void applyFilterToTab(const LLUUID& category_id, LLAccordionCtrlTab* tab, const std::string& filter_substring);
 
 	/**
-	 * Returns true if there are any worn items among currently selected, otherwise false.
+	 * Returns true if there are any items that can be taken off among currently selected, otherwise false.
 	 */
-	bool hasWornItemSelected();
+	bool canTakeOffSelected();
 
 	void onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id);
 	void onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y);