summaryrefslogtreecommitdiff
path: root/indra/newview/llpaneloutfitedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpaneloutfitedit.cpp')
-rw-r--r--indra/newview/llpaneloutfitedit.cpp62
1 files changed, 41 insertions, 21 deletions
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index ea7d233333..54776ca2f7 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -564,7 +564,8 @@ void LLPanelOutfitEdit::onSearchEdit(const std::string& string)
void LLPanelOutfitEdit::onPlusBtnClicked(void)
{
- LLUUID selected_id = getSelectedItemUUID();
+ LLUUID selected_id;
+ getCurrentItemUUID(selected_id);
if (selected_id.isNull()) return;
@@ -651,30 +652,31 @@ void LLPanelOutfitEdit::onEditWearableClicked(void)
void LLPanelOutfitEdit::onInventorySelectionChange()
{
- LLUUID item_uuid = getSelectedItemUUID();
- if (item_uuid.isNull())
+ uuid_vec_t selected_items;
+ getSelectedItemsUUID(selected_items);
+ if (selected_items.empty())
{
return;
}
+ uuid_vec_t::iterator worn_item = std::find_if(selected_items.begin(), selected_items.end(), boost::bind(&get_is_item_worn, _1));
+ bool can_add = ( worn_item == selected_items.end() );
- LLViewerInventoryItem* item(gInventory.getItem(item_uuid));
- if (!item)
- {
- return;
- }
+ mPlusBtn->setEnabled(can_add);
- switch (item->getType())
+ LLViewerInventoryItem* first_item(gInventory.getItem(selected_items.front()));
+
+ if (can_add &&
+ first_item &&
+ selected_items.size() == 1 &&
+ first_item->getType() == LLAssetType::AT_BODYPART)
{
- case LLAssetType::AT_BODYPART:
mPlusBtn->setToolTip(getString("replace_body_part"));
- break;
- case LLAssetType::AT_CLOTHING:
- case LLAssetType::AT_OBJECT:
+ }
+ else
+ {
mPlusBtn->setToolTip(LLStringUtil::null);
- default:
- break;
}
-
+
/* Removing add to look inline button (not part of mvp for viewer 2)
LLRect btn_rect(current_item->getLocalRect().mRight - 50,
current_item->getLocalRect().mTop,
@@ -931,16 +933,15 @@ void LLPanelOutfitEdit::onOutfitChanging(bool started)
indicator->setVisible(started);
}
-LLUUID LLPanelOutfitEdit::getSelectedItemUUID()
+void LLPanelOutfitEdit::getCurrentItemUUID(LLUUID& selected_id)
{
- LLUUID selected_id;
if (mInventoryItemsPanel->getVisible())
{
LLFolderViewItem* curr_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem();
- if (!curr_item) return selected_id;
+ if (!curr_item) return;
LLFolderViewEventListener* listenerp = curr_item->getListener();
- if (!listenerp) return selected_id;
+ if (!listenerp) return;
selected_id = listenerp->getUUID();
}
@@ -948,8 +949,27 @@ LLUUID LLPanelOutfitEdit::getSelectedItemUUID()
{
selected_id = mWearableItemsList->getSelectedUUID();
}
+}
+
+
+void LLPanelOutfitEdit::getSelectedItemsUUID(uuid_vec_t& uuid_list)
+{
+ if (mInventoryItemsPanel->getVisible())
+ {
+ std::set<LLUUID> item_set = mInventoryItemsPanel->getRootFolder()->getSelectionList();
+
+ std::for_each(item_set.begin(), item_set.end(), boost::bind( &uuid_vec_t::push_back, &uuid_list, _1));
+ }
+ else if (mWearablesListViewPanel->getVisible())
+ {
+ std::vector<LLSD> item_set;
+ mWearableItemsList->getSelectedValues(item_set);
+
+ std::for_each(item_set.begin(), item_set.end(), boost::bind( &uuid_vec_t::push_back, &uuid_list, boost::bind(&LLSD::asUUID, _1 )));
+
+ }
- return selected_id;
+// return selected_id;
}