summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorVadim Savchuk <vsavchuk@productengine.com>2010-07-23 18:06:49 +0300
committerVadim Savchuk <vsavchuk@productengine.com>2010-07-23 18:06:49 +0300
commitde81d9d8a7d2b12626c3929817a8ccdf20ba16c7 (patch)
tree4fe9d9b74f2f9c09908cbd2e3d3374b10a7a0a0e /indra/newview
parentc136e575e2bb9551d1ec0d19157a948e7bb9cede (diff)
EXT-8481 FIXED Wear button in My Outfits being enabled when worn item is selected.
- Fixed condition for enabling the Wear button in My Outfits. - The button was always enabled when when COF change completes, I fixed that as well. Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/800/ --HG-- branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lloutfitslist.cpp49
-rw-r--r--indra/newview/lloutfitslist.h5
-rw-r--r--indra/newview/llpaneloutfitsinventory.cpp2
3 files changed, 54 insertions, 2 deletions
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index 63ffb80ff2..146684288b 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -665,7 +665,18 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata)
}
if (command_name == "wear")
{
- return !gAgentWearables.isCOFChangeInProgress();
+ if (gAgentWearables.isCOFChangeInProgress())
+ {
+ return false;
+ }
+
+ if (hasItemSelected())
+ {
+ return canWearSelected();
+ }
+
+ // outfit selected
+ return LLAppearanceMgr::getCanAddToCOF(mSelectedOutfitUUID);
}
if (command_name == "take_off")
{
@@ -677,6 +688,7 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata)
if (command_name == "wear_add")
{
+ // *TODO: do we ever get here?
if (gAgentWearables.isCOFChangeInProgress())
{
return false;
@@ -984,6 +996,41 @@ bool LLOutfitsList::canTakeOffSelected()
return false;
}
+bool LLOutfitsList::canWearSelected()
+{
+ uuid_vec_t selected_items;
+ getSelectedItemsUUIDs(selected_items);
+
+ for (uuid_vec_t::const_iterator it = selected_items.begin(); it != selected_items.end(); ++it)
+ {
+ const LLUUID& id = *it;
+
+ // Find links to the current item in COF.
+ // *TODO: share this?
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLLinkedItemIDMatches find_links(gInventory.getLinkedItemID(id));
+ gInventory.collectDescendentsIf(LLAppearanceMgr::instance().getCOF(),
+ cats,
+ items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ find_links);
+ if (!items.empty())
+ {
+ return false;
+ }
+
+ // Check whether the item is worn.
+ if (!get_can_item_be_worn(id))
+ {
+ return false;
+ }
+ }
+
+ // All selected items can be worn.
+ return true;
+}
+
void LLOutfitsList::onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id)
{
LLAccordionCtrlTab* tab = dynamic_cast<LLAccordionCtrlTab*>(ctrl);
diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h
index d7cf8a8c08..206854b232 100644
--- a/indra/newview/lloutfitslist.h
+++ b/indra/newview/lloutfitslist.h
@@ -183,6 +183,11 @@ private:
*/
bool canTakeOffSelected();
+ /**
+ * Returns true if all selected items can be worn.
+ */
+ bool canWearSelected();
+
void onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id);
void onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y);
void onCOFChanged();
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index ca5679d5b0..16ef7998b3 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -337,7 +337,7 @@ bool LLPanelOutfitsInventory::isCOFPanelActive() const
void LLPanelOutfitsInventory::setWearablesLoading(bool val)
{
- mListCommands->childSetEnabled("wear_btn", !val);
+ updateVerbs();
}
void LLPanelOutfitsInventory::onWearablesLoaded()