diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappearancemgr.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llappearancemgr.h | 3 | ||||
-rw-r--r-- | indra/newview/llpaneloutfitedit.cpp | 47 | ||||
-rw-r--r-- | indra/newview/llpaneloutfitedit.h | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_outfit_edit.xml | 15 |
5 files changed, 84 insertions, 17 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 40c1f89f3f..0bd95987d7 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -610,6 +610,38 @@ const LLUUID LLAppearanceMgr::getBaseOutfitUUID() return outfit_cat->getUUID(); } +bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_update) +{ + if (item_id_to_wear.isNull()) return false; + + //only the item from a user's inventory is allowed + if (!gInventory.isObjectDescendentOf(item_id_to_wear, gInventory.getRootFolderID())) return false; + + LLViewerInventoryItem* item_to_wear = gInventory.getItem(item_id_to_wear); + if (!item_to_wear) return false; + + switch (item_to_wear->getType()) + { + case LLAssetType::AT_CLOTHING: + case LLAssetType::AT_BODYPART: + // Don't wear anything until initial wearables are loaded, can + // destroy clothing items. + if (!gAgentWearables.areWearablesLoaded()) + { + LLNotificationsUtil::add("CanNotChangeAppearanceUntilLoaded"); + return false; + } + addCOFItemLink(item_to_wear, do_update); + break; + case LLAssetType::AT_OBJECT: + rez_attachment(item_to_wear, NULL); + break; + default: return false;; + } + + return true; +} + // Update appearance from outfit folder. void LLAppearanceMgr::changeOutfit(bool proceed, const LLUUID& category, bool append) { diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index f0374048c6..befad591bd 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -78,6 +78,9 @@ public: // find the UUID of the currently worn outfit (Base Outfit) const LLUUID getBaseOutfitUUID(); + // Wear/attach an item (from a user's inventory) on the agent + bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_to_wear, bool do_update = true); + // Update the displayed outfit name in UI. void updatePanelOutfitName(const std::string& name); diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 70879cedf5..2e94eabb3f 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -117,7 +117,7 @@ private: LLPanelOutfitEdit::LLPanelOutfitEdit() : LLPanel(), mCurrentOutfitID(), mFetchLook(NULL), mSearchFilter(NULL), -mLookContents(NULL), mInventoryItemsPanel(NULL), mAddToLookBtn(NULL), +mLookContents(NULL), mInventoryItemsPanel(NULL), mAddToOutfitBtn(NULL), mRemoveFromLookBtn(NULL), mLookObserver(NULL) { mSavedFolderState = new LLSaveFolderState(); @@ -175,8 +175,8 @@ BOOL LLPanelOutfitEdit::postBuild() mInventoryItemsPanel = getChild<LLInventoryPanel>("inventory_items"); mInventoryItemsPanel->setFilterTypes(ALL_ITEMS_MASK); mInventoryItemsPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); - // mInventoryItemsPanel->setSelectCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this, _1, _2)); - // mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this, _1, _2)); + mInventoryItemsPanel->setSelectCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this, _1, _2)); + mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this, _1, _2)); LLComboBox* type_filter = getChild<LLComboBox>("inventory_filter"); type_filter->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onTypeFilterChanged, this, _1)); @@ -200,7 +200,8 @@ BOOL LLPanelOutfitEdit::postBuild() mAddToLookBtn->setEnabled(FALSE); mAddToLookBtn->setVisible(FALSE); */ - childSetAction("add_item_btn", boost::bind(&LLPanelOutfitEdit::onAddToLookClicked, this), this); + childSetAction("add_to_outfit_btn", boost::bind(&LLPanelOutfitEdit::onAddToOutfitClicked, this)); + childSetEnabled("add_to_outfit_btn", false); mUpBtn = getChild<LLButton>("up_btn"); mUpBtn->setEnabled(TRUE); @@ -250,12 +251,12 @@ void LLPanelOutfitEdit::showAddWearablesPanel() void LLPanelOutfitEdit::saveOutfit(bool as_new) { - if (!as_new && LLAppearanceMgr::getInstance()->updateBaseOutfit())
- {
- // we don't need to ask for an outfit name, and updateBaseOutfit() successfully saved.
- // If updateBaseOutfit fails, ask for an outfit name anyways
- return;
- }
+ if (!as_new && LLAppearanceMgr::getInstance()->updateBaseOutfit()) + { + // we don't need to ask for an outfit name, and updateBaseOutfit() successfully saved. + // If updateBaseOutfit fails, ask for an outfit name anyways + return; + } LLPanelOutfitsInventory* panel_outfits_inventory = LLPanelOutfitsInventory::findInstance(); if (panel_outfits_inventory) @@ -335,15 +336,18 @@ void LLPanelOutfitEdit::onSearchEdit(const std::string& string) mInventoryItemsPanel->setFilterSubString(mSearchString); } -void LLPanelOutfitEdit::onAddToLookClicked(void) +void LLPanelOutfitEdit::onAddToOutfitClicked(void) { LLFolderViewItem* curr_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem(); if (!curr_item) return; LLFolderViewEventListener* listenerp = curr_item->getListener(); - link_inventory_item(gAgent.getID(), listenerp->getUUID(), mCurrentOutfitID, listenerp->getName(), - LLAssetType::AT_LINK, LLPointer<LLInventoryCallback>(NULL)); - updateLookInfo(); + if (!listenerp) return; + + if (LLAppearanceMgr::getInstance()->wearItemOnAvatar(listenerp->getUUID())) + { + updateLookInfo(); + } } @@ -444,6 +448,21 @@ void LLPanelOutfitEdit::onInventorySelectionChange(const std::deque<LLFolderView { return; } + + LLViewerInventoryItem* item = current_item->getInventoryItem(); + if (!item) return; + + switch (item->getType()) + { + case LLAssetType::AT_CLOTHING: + case LLAssetType::AT_BODYPART: + case LLAssetType::AT_OBJECT: + childSetEnabled("add_to_outfit_btn", true); + break; + default: + childSetEnabled("add_to_outfit_btn", false); + break; + } /* Removing add to look inline button (not part of mvp for viewer 2) LLRect btn_rect(current_item->getLocalRect().mRight - 50, diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h index d09795156e..1a8d7d2bef 100644 --- a/indra/newview/llpaneloutfitedit.h +++ b/indra/newview/llpaneloutfitedit.h @@ -93,7 +93,7 @@ public: void onTypeFilterChanged(LLUICtrl* ctrl); void onSearchEdit(const std::string& string); void onInventorySelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action); - void onAddToLookClicked(void); + void onAddToOutfitClicked(void); void onLookItemSelectionChange(void); void onRemoveFromLookClicked(void); void onEditWearableClicked(void); @@ -116,7 +116,7 @@ private: LLFilterEditor* mSearchFilter; LLSaveFolderState* mSavedFolderState; std::string mSearchString; - LLButton* mAddToLookBtn; + LLButton* mAddToOutfitBtn; LLButton* mRemoveFromLookBtn; LLButton* mUpBtn; LLButton* mEditWearableBtn; diff --git a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml index 3fa3d6d039..a5e6506463 100644 --- a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml +++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml @@ -257,7 +257,7 @@ text_pad_left="25" /> <inventory_panel - allow_multi_select="true" + allow_multi_select="false" border="false" follows="left|top|right|bottom" height="176" @@ -317,6 +317,19 @@ name="list_view_btn" top="1" width="31" /> + <button + follows="bottom|left" + height="25" + image_hover_unselected="Toolbar_Middle_Over" + image_overlay="AddItem_Off" + image_selected="Toolbar_Middle_Selected" + image_unselected="Toolbar_Middle_Off" + label="" + layout="topleft" + left_pad="1" + name="add_to_outfit_btn" + top="1" + width="31" /> </panel> </layout_panel> </layout_stack> |