From b15e2beabfc2987ba8d17b74014074ba313b5db7 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Thu, 22 Apr 2010 15:48:48 +0300 Subject: Implemented EXT-6724(normal task) - Implement flat list view of filtered inventory for "add wearables" panel of outfit editor 1. Modified LLInventoryItemsList - implemented delayed item construction. Items are added during draw, not more than 50 items will be added in single draw. This lets us reduce system overload during multiple panel construction. 2. Implemented LLFilteredWearableListManager to populate inventory flat list with data. This class filters entire inventory according to specified filter and populates specified inventory list with data. 3. Created LLCommonUtil::computeDifference() to avoid code copy-pasting(will use it in all appropriate places in next review request) Reviewed by Mike Antipov - https://codereview.productengine.com/secondlife/r/301/ --HG-- branch : product-engine --- indra/newview/llpaneloutfitedit.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpaneloutfitedit.cpp') diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index ce17e1d624..e139cb31d6 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -38,7 +38,9 @@ #include "llagent.h" #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llfilteredwearablelist.h" #include "llinventory.h" +#include "llinventoryitemslist.h" #include "llviewercontrol.h" #include "llui.h" #include "llfloater.h" @@ -164,6 +166,7 @@ BOOL LLPanelOutfitEdit::postBuild() childSetCommitCallback("add_btn", boost::bind(&LLPanelOutfitEdit::showAddWearablesPanel, this), NULL); childSetCommitCallback("filter_button", boost::bind(&LLPanelOutfitEdit::showWearablesFilter, this), NULL); + childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::showFilteredWearablesPanel, this), NULL); mLookContents = getChild("look_items_list"); mLookContents->sortByColumn("look_item_sort", TRUE); @@ -229,6 +232,9 @@ BOOL LLPanelOutfitEdit::postBuild() save_registar.add("Outfit.SaveAsNew.Action", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, true)); mSaveMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_save_outfit.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + mWearableListManager = new LLFilteredWearableListManager( + getChild("filtered_wearables_list"), ALL_ITEMS_MASK); + return TRUE; } @@ -242,6 +248,11 @@ void LLPanelOutfitEdit::showWearablesFilter() childSetVisible("filter_combobox_panel", childGetValue("filter_button")); } +void LLPanelOutfitEdit::showFilteredWearablesPanel() +{ + childSetVisible("filtered_wearables_panel", !childIsVisible("filtered_wearables_panel")); +} + void LLPanelOutfitEdit::saveOutfit(bool as_new) { if (!as_new && LLAppearanceMgr::getInstance()->updateBaseOutfit()) @@ -275,6 +286,7 @@ void LLPanelOutfitEdit::onTypeFilterChanged(LLUICtrl* ctrl) { U32 curr_filter_type = type_filter->getCurrentIndex(); mInventoryItemsPanel->setFilterTypes(mLookItemTypes[curr_filter_type].inventoryMask); + mWearableListManager->setFilterMask(mLookItemTypes[curr_filter_type].inventoryMask); } mSavedFolderState->setApply(TRUE); @@ -577,4 +589,4 @@ void LLPanelOutfitEdit::displayCurrentOutfit() updateLookInfo(); } - +// EOF -- cgit v1.2.3 From 181315db32165d71f2e1baec66caca24cd74ced7 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Fri, 23 Apr 2010 14:35:24 +0300 Subject: completed EXT-6721 (Enable UI for user modification of wearable order) - added functionality to change order of wearables - added ad-hoc up and down buttons on a button bar ("up" means closer to the body) - https://jira.secondlife.com/secure/attachment/38464/screenshot-1.jpg - added displaying wearables as sorted by order on the Edit Outfit panel (top list) Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/280/ --HG-- branch : product-engine --- indra/newview/llpaneloutfitedit.cpp | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpaneloutfitedit.cpp') diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index ce17e1d624..ef6161de85 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -71,6 +71,9 @@ const U64 WEARABLE_MASK = (1LL << LLInventoryType::IT_WEARABLE); const U64 ATTACHMENT_MASK = (1LL << LLInventoryType::IT_ATTACHMENT) | (1LL << LLInventoryType::IT_OBJECT); const U64 ALL_ITEMS_MASK = WEARABLE_MASK | ATTACHMENT_MASK; +static const std::string SAVE_BTN("save_btn"); +static const std::string REVERT_BTN("revert_btn"); + class LLInventoryLookObserver : public LLInventoryObserver { public: @@ -218,10 +221,9 @@ BOOL LLPanelOutfitEdit::postBuild() mEditWearableBtn->setVisible(FALSE); mEditWearableBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onEditWearableClicked, this)); - childSetAction("revert_btn", boost::bind(&LLAppearanceMgr::wearBaseOutfit, LLAppearanceMgr::getInstance())); + childSetAction(REVERT_BTN, boost::bind(&LLAppearanceMgr::wearBaseOutfit, LLAppearanceMgr::getInstance())); - childSetAction("save_btn", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false)); - childSetAction("save_as_btn", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, true)); + childSetAction(SAVE_BTN, boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false)); childSetAction("save_flyout_btn", boost::bind(&LLPanelOutfitEdit::showSaveMenu, this)); LLUICtrl::CommitCallbackRegistry::ScopedRegistrar save_registar; @@ -229,9 +231,21 @@ BOOL LLPanelOutfitEdit::postBuild() save_registar.add("Outfit.SaveAsNew.Action", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, true)); mSaveMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_save_outfit.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + childSetAction("move_closer_btn", boost::bind(&LLPanelOutfitEdit::moveWearable, this, true)); + childSetAction("move_further_btn", boost::bind(&LLPanelOutfitEdit::moveWearable, this, false)); + return TRUE; } +void LLPanelOutfitEdit::moveWearable(bool closer_to_body) +{ + LLViewerInventoryItem* wearable_to_move = gInventory.getItem(mLookContents->getSelectionInterface()->getCurrentID()); + LLAppearanceMgr::getInstance()->moveWearable(wearable_to_move, closer_to_body); + + //*TODO why not to listen to inventory? + updateLookInfo(); +} + void LLPanelOutfitEdit::showAddWearablesPanel() { childSetVisible("add_wearables_panel", childGetValue("add_btn")); @@ -256,6 +270,8 @@ void LLPanelOutfitEdit::saveOutfit(bool as_new) { panel_outfits_inventory->onSave(); } + + //*TODO how to get to know when base outfit is updated or new outfit is created? } void LLPanelOutfitEdit::showSaveMenu() @@ -530,10 +546,12 @@ void LLPanelOutfitEdit::lookFetched(void) columns[0]["value"] = item->getName(); columns[1]["column"] = "look_item_sort"; columns[1]["type"] = "text"; // TODO: multi-wearable sort "type" should go here. - columns[1]["value"] = "BAR"; // TODO: Multi-wearable sort index should go here + columns[1]["value"] = item->LLInventoryItem::getDescription(); mLookContents->addElement(row); } + + updateVerbs(); } void LLPanelOutfitEdit::updateLookInfo() @@ -577,4 +595,14 @@ void LLPanelOutfitEdit::displayCurrentOutfit() updateLookInfo(); } +//private +void LLPanelOutfitEdit::updateVerbs() +{ + bool outfit_is_dirty = LLAppearanceMgr::getInstance()->isOutfitDirty(); + + childSetEnabled(SAVE_BTN, outfit_is_dirty); + childSetEnabled(REVERT_BTN, outfit_is_dirty); + + mSaveMenu->setItemEnabled("save_outfit", outfit_is_dirty); +} -- cgit v1.2.3 From 2696e375097c2e45102bede0e7d33175feea080b Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Tue, 27 Apr 2010 15:23:07 +0300 Subject: partial implementation of EXT-6723 Create specialized view of inventory for "clothing" accordion tab of outfit editor Initial implementation (no sorting, no grayed items from Base outfit) Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/322 --HG-- branch : product-engine --- indra/newview/llpaneloutfitedit.cpp | 123 +++++++----------------------------- 1 file changed, 22 insertions(+), 101 deletions(-) (limited to 'indra/newview/llpaneloutfitedit.cpp') diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index ae181e2819..dbccd243da 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -38,6 +38,7 @@ #include "llagent.h" #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llcofwearables.h" #include "llfilteredwearablelist.h" #include "llinventory.h" #include "llinventoryitemslist.h" @@ -121,9 +122,15 @@ private: LLPanelOutfitEdit::LLPanelOutfitEdit() -: LLPanel(), mCurrentOutfitID(), mFetchLook(NULL), mSearchFilter(NULL), -mLookContents(NULL), mInventoryItemsPanel(NULL), mAddToOutfitBtn(NULL), -mRemoveFromOutfitBtn(NULL), mLookObserver(NULL) +: LLPanel(), + mCurrentOutfitID(), + mFetchLook(NULL), + mSearchFilter(NULL), + mCOFWearables(NULL), + mInventoryItemsPanel(NULL), + mAddToOutfitBtn(NULL), + mRemoveFromOutfitBtn(NULL), + mLookObserver(NULL) { mSavedFolderState = new LLSaveFolderState(); mSavedFolderState->setApply(FALSE); @@ -171,9 +178,8 @@ BOOL LLPanelOutfitEdit::postBuild() childSetCommitCallback("filter_button", boost::bind(&LLPanelOutfitEdit::showWearablesFilter, this), NULL); childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::showFilteredWearablesPanel, this), NULL); - mLookContents = getChild("look_items_list"); - mLookContents->sortByColumn("look_item_sort", TRUE); - mLookContents->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onOutfitItemSelectionChange, this)); + mCOFWearables = getChild("cof_wearables_list"); + mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onOutfitItemSelectionChange, this)); mInventoryItemsPanel = getChild("inventory_items"); mInventoryItemsPanel->setFilterTypes(ALL_ITEMS_MASK); @@ -206,15 +212,6 @@ BOOL LLPanelOutfitEdit::postBuild() childSetAction("add_to_outfit_btn", boost::bind(&LLPanelOutfitEdit::onAddToOutfitClicked, this)); childSetEnabled("add_to_outfit_btn", false); - mUpBtn = getChild("up_btn"); - mUpBtn->setEnabled(TRUE); - mUpBtn->setClickedCallback(boost::bind(&LLPanelOutfitEdit::onUpClicked, this)); - - //*TODO rename mLookContents to mOutfitContents - mLookContents = getChild("look_items_list"); - mLookContents->sortByColumn("look_item_sort", TRUE); - mLookContents->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onOutfitItemSelectionChange, this)); - mRemoveFromOutfitBtn = getChild("remove_from_outfit_btn"); mRemoveFromOutfitBtn->setEnabled(FALSE); mRemoveFromOutfitBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onRemoveFromOutfitClicked, this)); @@ -245,7 +242,10 @@ BOOL LLPanelOutfitEdit::postBuild() void LLPanelOutfitEdit::moveWearable(bool closer_to_body) { - LLViewerInventoryItem* wearable_to_move = gInventory.getItem(mLookContents->getSelectionInterface()->getCurrentID()); + LLUUID item_id = mCOFWearables->getSelectedUUID(); + if (item_id.isNull()) return; + + LLViewerInventoryItem* wearable_to_move = gInventory.getItem(item_id); LLAppearanceMgr::getInstance()->moveWearable(wearable_to_move, closer_to_body); //*TODO why not to listen to inventory? @@ -374,7 +374,7 @@ void LLPanelOutfitEdit::onAddToOutfitClicked(void) void LLPanelOutfitEdit::onRemoveFromOutfitClicked(void) { - LLUUID id_to_remove = mLookContents->getSelectionInterface()->getCurrentID(); + LLUUID id_to_remove = mCOFWearables->getSelectedUUID(); LLAppearanceMgr::getInstance()->removeItemFromAvatar(id_to_remove); @@ -384,41 +384,9 @@ void LLPanelOutfitEdit::onRemoveFromOutfitClicked(void) } -void LLPanelOutfitEdit::onUpClicked(void) -{ - LLUUID inv_id = mLookContents->getSelectionInterface()->getCurrentID(); - if (inv_id.isNull()) - { - //nothing selected, do nothing - return; - } - - LLViewerInventoryItem *link_item = gInventory.getItem(inv_id); - if (!link_item) - { - llwarns << "could not find inventory item based on currently worn link." << llendl; - return; - } - - - LLUUID asset_id = link_item->getAssetUUID(); - if (asset_id.isNull()) - { - llwarns << "inventory link has null Asset ID. could not get object reference" << llendl; - } - - static const std::string empty = ""; - LLWearableList::instance().getAsset(asset_id, - empty, // don't care about wearable name - link_item->getActualType(), - LLSidepanelAppearance::editWearable, - (void*)getParentUICtrl()); -} - - void LLPanelOutfitEdit::onEditWearableClicked(void) { - LLUUID id_to_edit = mLookContents->getSelectionInterface()->getCurrentID(); + LLUUID id_to_edit = mCOFWearables->getSelectedUUID(); LLViewerInventoryItem * item_to_edit = gInventory.getItem(id_to_edit); if (item_to_edit) @@ -491,29 +459,11 @@ void LLPanelOutfitEdit::onInventorySelectionChange(const std::dequegetLastSelectedItem(); - if (!item) - return; + LLUUID item_id = mCOFWearables->getSelectedUUID(); - LLRect item_rect; - mLookContents->localRectToOtherView(item->getRect(), &item_rect, this); + //*TODO show Edit Wearable Button - // TODO button(and item list) should be removed (when new widget is ready) - LLRect btn_rect = mEditWearableBtn->getRect(); - btn_rect.set(item_rect.mRight - btn_rect.getWidth(), item_rect.mTop, item_rect.mRight, item_rect.mBottom); - - mEditWearableBtn->setShape(btn_rect); - sendChildToFront(mEditWearableBtn); - - mEditWearableBtn->setEnabled(TRUE); - if (!mEditWearableBtn->getVisible()) - { - mEditWearableBtn->setVisible(TRUE); - } - - - const LLUUID& id_item_to_remove = item->getUUID(); - LLViewerInventoryItem* item_to_remove = gInventory.getItem(id_item_to_remove); + LLViewerInventoryItem* item_to_remove = gInventory.getItem(item_id); if (!item_to_remove) return; switch (item_to_remove->getType()) @@ -534,34 +484,7 @@ void LLPanelOutfitEdit::changed(U32 mask) void LLPanelOutfitEdit::lookFetched(void) { - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t item_array; - - // collectDescendentsIf takes non-const reference: - LLFindCOFValidItems is_cof_valid; - gInventory.collectDescendentsIf(mCurrentOutfitID, - cat_array, - item_array, - LLInventoryModel::EXCLUDE_TRASH, - is_cof_valid); - for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin(); - iter != item_array.end(); - iter++) - { - const LLViewerInventoryItem *item = (*iter); - - LLSD row; - row["id"] = item->getUUID(); - LLSD& columns = row["columns"]; - columns[0]["column"] = "look_item"; - columns[0]["type"] = "text"; - columns[0]["value"] = item->getName(); - columns[1]["column"] = "look_item_sort"; - columns[1]["type"] = "text"; // TODO: multi-wearable sort "type" should go here. - columns[1]["value"] = item->LLInventoryItem::getDescription(); - - mLookContents->addElement(row); - } + mCOFWearables->refresh(); updateVerbs(); } @@ -570,8 +493,6 @@ void LLPanelOutfitEdit::updateLookInfo() { if (getVisible()) { - mLookContents->clearRows(); - mFetchLook->setFetchID(mCurrentOutfitID); mFetchLook->startFetch(); if (mFetchLook->isFinished()) -- cgit v1.2.3