From 202f16cdf81fe590a7b40334016a7374e0bbdad7 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 19 Apr 2010 16:35:38 -0600 Subject: trival: remove some redundant code from llviewertexture.cpp. --- indra/newview/llviewertexture.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index a5adb11c53..c883087cf2 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1564,10 +1564,6 @@ F32 LLViewerFetchedTexture::calcDecodePriority() // larger mips are corrupted priority = -3.0f; } - else if (cur_discard <= mDesiredDiscardLevel) - { - priority = -4.0f; - } else { // priority range = 100,000 - 500,000 -- cgit v1.2.3 From ccd0418ddf75dabe7101d2faa16c39213e344925 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Wed, 21 Apr 2010 12:43:03 +0300 Subject: completed EXT-6719 Utilize the "description" field of outfit wearable links to store order information - COF items get checked for correct ordering when COF is loaded (LLAppearanceMgr::updateAppearanceFromCOF..., LLAppearanceMgr::updateClothingOrderingInfo() ), and also when COF is saved to a new outfit, base outfit. - wearables are arranged in LLAgentWearables in a proper order * updateClothingOrderingInfo() [struggling with naming] does integrity checking and updates "invalid" items (items with wrong, gapped descriptions) * moved LLAgentWearables::makeNewOutfitLinks(...) and LLShowCreatedOutfit to a more natural place (llappearancemgr.cpp), because they use LLAppearanceMgr's methods a lot * changed link_inventory_item(...), added the "new_description" parameter Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/268/ --HG-- branch : product-engine --- indra/newview/llagentwearables.cpp | 18 --- indra/newview/llagentwearables.h | 3 +- indra/newview/llagentwearablesfetch.cpp | 2 + indra/newview/llappearancemgr.cpp | 216 +++++++++++++++++++++++++++--- indra/newview/llappearancemgr.h | 11 ++ indra/newview/llinventorybridge.cpp | 2 + indra/newview/llpaneloutfitsinventory.cpp | 2 +- indra/newview/llviewerinventory.cpp | 4 +- indra/newview/llviewerinventory.h | 1 + 9 files changed, 218 insertions(+), 41 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 7f248eee30..7a088fc7bf 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1361,24 +1361,6 @@ private: LLUUID mFolderID; }; -LLUUID LLAgentWearables::makeNewOutfitLinks(const std::string& new_folder_name) -{ - if (!isAgentAvatarValid()) return LLUUID::null; - - // First, make a folder in the My Outfits directory. - const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); - LLUUID folder_id = gInventory.createNewCategory( - parent_id, - LLFolderType::FT_OUTFIT, - new_folder_name); - - LLPointer cb = new LLShowCreatedOutfit(folder_id); - LLAppearanceMgr::instance().shallowCopyCategoryContents(LLAppearanceMgr::instance().getCOF(),folder_id, cb); - LLAppearanceMgr::instance().createBaseOutfitLink(folder_id, cb); - - return folder_id; -} - void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index) { LLUUID first_item_id = getWearableItemID((EWearableType)type, index); diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index b76367324c..585fd3f8b3 100644 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -169,8 +169,7 @@ public: const LLDynamicArray& wearables_to_include, const LLDynamicArray& attachments_to_include, BOOL rename_clothing); - - LLUUID makeNewOutfitLinks(const std::string& new_folder_name); + // Should only be called if we *know* we've never done so before, since users may // not want the Library outfits to stay in their quick outfit selector and can delete them. diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index 08d8ccfd23..03d09a3798 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -119,6 +119,7 @@ public: item->getLinkedUUID(), LLAppearanceMgr::instance().getCOF(), item->getName(), + item->getDescription(), LLAssetType::AT_LINK, link_waiter); } @@ -507,6 +508,7 @@ void LLLibraryOutfitsFetch::contentsDone() item->getLinkedUUID(), new_outfit_folder_id, item->getName(), + item->getDescription(), LLAssetType::AT_LINK, NULL); } diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 4d18ff57fe..9e02886e4f 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -32,6 +32,7 @@ #include "llviewerprecompiledheaders.h" +#include "llaccordionctrltab.h" #include "llagent.h" #include "llagentwearables.h" #include "llappearancemgr.h" @@ -42,6 +43,7 @@ #include "llinventoryfunctions.h" #include "llinventoryobserver.h" #include "llnotificationsutil.h" +#include "llpaneloutfitsinventory.h" #include "llselectmgr.h" #include "llsidepanelappearance.h" #include "llsidetray.h" @@ -51,6 +53,8 @@ #include "llviewerregion.h" #include "llwearablelist.h" +char ORDER_NUMBER_SEPARATOR('@'); + LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id, const std::string& name) { LLInventoryModel::cat_array_t cat_array; @@ -400,6 +404,7 @@ public: item_id, LLAppearanceMgr::instance().getCOF(), itemp->getName(), + itemp->getDescription(), LLAssetType::AT_LINK, cb); } @@ -691,10 +696,13 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL { case LLAssetType::AT_LINK: { + //LLInventoryItem::getDescription() is used for a new description + //to propagate ordering information saved in descriptions of links link_inventory_item(gAgent.getID(), item->getLinkedUUID(), dst_id, item->getName(), + item->LLInventoryItem::getDescription(), LLAssetType::AT_LINK, cb); break; } @@ -708,6 +716,7 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL item->getLinkedUUID(), dst_id, item->getName(), + item->getDescription(), LLAssetType::AT_LINK_FOLDER, cb); } break; @@ -811,20 +820,7 @@ void LLAppearanceMgr::filterWearableItems( { // Divvy items into arrays by wearable type. std::vector items_by_type(WT_COUNT); - for (S32 i=0; iisWearableType()) - continue; - EWearableType type = item->getWearableType(); - if(type < 0 || type >= WT_COUNT) - { - LL_WARNS("Appearance") << "Invalid wearable type. Inventory type does not match wearable flag bitfield." << LL_ENDL; - continue; - } - items_by_type[type].push_back(item); - } + divvyWearablesByType(items, items_by_type); // rebuild items list, retaining the last max_per_type of each array items.clear(); @@ -853,6 +849,7 @@ void LLAppearanceMgr::linkAll(const LLUUID& category, item->getLinkedUUID(), category, item->getName(), + item->LLInventoryItem::getDescription(), LLAssetType::AT_LINK, cb); } @@ -956,7 +953,7 @@ void LLAppearanceMgr::createBaseOutfitLink(const LLUUID& category, LLPointergetPreferredType() == LLFolderType::FT_OUTFIT) { - link_inventory_item(gAgent.getID(), category, cof, catp->getName(), + link_inventory_item(gAgent.getID(), category, cof, catp->getName(), "", LLAssetType::AT_LINK_FOLDER, link_waiter); new_outfit_name = catp->getName(); } @@ -1016,6 +1013,18 @@ static void remove_non_link_items(LLInventoryModel::item_array_t &items) items = pruned_items; } +//a predicate for sorting inventory items by actual descriptions +bool sort_by_description(const LLInventoryItem* item1, const LLInventoryItem* item2) +{ + if (!item1 || !item2) + { + llwarning("either item1 or item2 is NULL", 0); + return true; + } + + return item1->LLInventoryItem::getDescription() < item2->LLInventoryItem::getDescription(); +} + void LLAppearanceMgr::updateAppearanceFromCOF() { // update dirty flag to see if the state of the COF matches @@ -1026,6 +1035,8 @@ void LLAppearanceMgr::updateAppearanceFromCOF() dumpCat(getCOF(),"COF, start"); + updateClothingOrderingInfo(); + bool follow_folder_links = true; LLUUID current_outfit_id = getCOF(); @@ -1046,6 +1057,9 @@ void LLAppearanceMgr::updateAppearanceFromCOF() return; } + //preparing the list of wearables in the correct order for LLAgentWearables + std::sort(wear_items.begin(), wear_items.end(), sort_by_description); + LLWearableHoldingPattern* holder = new LLWearableHoldingPattern; holder->mObjItems = obj_items; @@ -1079,8 +1093,8 @@ void LLAppearanceMgr::updateAppearanceFromCOF() } #endif - - holder->mFoundList.push_front(found); + //pushing back, not front, to preserve order of wearables for LLAgentWearables + holder->mFoundList.push_back(found); } else { @@ -1407,7 +1421,7 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update // Are these links to different items of the same wearable // type? If so, new item will replace old. // MULTI-WEARABLES: revisit if more than one per type is allowed. - else if (areMatchingWearables(vitem,inv_item)) + else if (FALSE/*areMatchingWearables(vitem,inv_item)*/) { if (inv_item->getIsLinkType()) { @@ -1430,6 +1444,7 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update vitem->getLinkedUUID(), getCOF(), vitem->getName(), + vitem->getDescription(), LLAssetType::AT_LINK, cb); } @@ -1446,6 +1461,7 @@ void LLAppearanceMgr::addEnsembleLink( LLInventoryCategory* cat, bool do_update cat->getLinkedUUID(), getCOF(), cat->getName(), + cat->getDescription(), LLAssetType::AT_LINK_FOLDER, cb); #endif @@ -1572,6 +1588,8 @@ bool LLAppearanceMgr::updateBaseOutfit() const LLUUID base_outfit_id = getBaseOutfitUUID(); if (base_outfit_id.isNull()) return false; + updateClothingOrderingInfo(); + // in a Base Outfit we do not remove items, only links purgeCategory(base_outfit_id, false); @@ -1581,6 +1599,168 @@ bool LLAppearanceMgr::updateBaseOutfit() return true; } +void LLAppearanceMgr::divvyWearablesByType(const LLInventoryModel::item_array_t& items, wearables_by_type_t& items_by_type) +{ + items_by_type.reserve(WT_COUNT); + if (items.empty()) return; + + for (S32 i=0; iisWearableType()) + continue; + EWearableType type = item->getWearableType(); + if(type < 0 || type >= WT_COUNT) + { + LL_WARNS("Appearance") << "Invalid wearable type. Inventory type does not match wearable flag bitfield." << LL_ENDL; + continue; + } + items_by_type[type].push_back(item); + } +} + +std::string build_order_string(EWearableType type, U32 i) +{ + std::ostringstream order_num; + order_num << ORDER_NUMBER_SEPARATOR << type * 100 + i; + return order_num.str(); +} + +struct WearablesOrderComparator +{ + WearablesOrderComparator(const EWearableType type) + { + mControlSize = build_order_string(type, 0).size(); + }; + + bool operator()(const LLInventoryItem* item1, const LLInventoryItem* item2) + { + if (!item1 || !item2) + { + llwarning("either item1 or item2 is NULL", 0); + return true; + } + + const std::string& desc1 = item1->LLInventoryItem::getDescription(); + const std::string& desc2 = item2->LLInventoryItem::getDescription(); + + bool item1_valid = (desc1.size() == mControlSize) && (ORDER_NUMBER_SEPARATOR == desc1[0]); + bool item2_valid = (desc2.size() == mControlSize) && (ORDER_NUMBER_SEPARATOR == desc2[0]); + + if (item1_valid && item2_valid) + return desc1 < desc2; + + //we need to sink down invalid items: items with empty descriptions, items with "Broken link" descriptions, + //items with ordering information but not for the associated wearables type + if (!item1_valid && item2_valid) + return false; + + return true; + } + + U32 mControlSize; +}; + +void LLAppearanceMgr::updateClothingOrderingInfo() +{ + LLInventoryModel::item_array_t wear_items; + getDescendentsOfAssetType(getCOF(), wear_items, LLAssetType::AT_CLOTHING, false); + + wearables_by_type_t items_by_type(WT_COUNT); + divvyWearablesByType(wear_items, items_by_type); + + bool inventory_changed = false; + for (U32 type = WT_SHIRT; type < WT_COUNT; type++) + { + + U32 size = items_by_type[type].size(); + if (!size) continue; + + //sinking down invalid items which need reordering + std::sort(items_by_type[type].begin(), items_by_type[type].end(), WearablesOrderComparator((EWearableType) type)); + + //requesting updates only for those links which don't have "valid" descriptions + for (U32 i = 0; i < size; i++) + { + LLViewerInventoryItem* item = items_by_type[type][i]; + if (!item) continue; + + std::string new_order_str = build_order_string((EWearableType)type, i); + if (new_order_str == item->LLInventoryItem::getDescription()) continue; + + item->setDescription(new_order_str); + item->setComplete(TRUE); + item->updateServer(FALSE); + gInventory.updateItem(item); + inventory_changed = true; + } + } + + //*TODO do we really need to notify observers? + if (inventory_changed) gInventory.notifyObservers(); +} + + + + +class LLShowCreatedOutfit: public LLInventoryCallback +{ +public: + LLShowCreatedOutfit(LLUUID& folder_id): mFolderID(folder_id) + {} + + virtual ~LLShowCreatedOutfit() + { + LLSD key; + LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key); + LLPanelOutfitsInventory *outfit_panel = + dynamic_cast(LLSideTray::getInstance()->getPanel("panel_outfits_inventory")); + if (outfit_panel) + { + outfit_panel->getRootFolder()->clearSelection(); + outfit_panel->getRootFolder()->setSelectionByID(mFolderID, TRUE); + } + + LLAccordionCtrlTab* tab_outfits = outfit_panel ? outfit_panel->findChild("tab_outfits") : 0; + if (tab_outfits && !tab_outfits->getDisplayChildren()) + { + tab_outfits->changeOpenClose(tab_outfits->getDisplayChildren()); + } + + LLAppearanceMgr::getInstance()->updateIsDirty(); + LLAppearanceMgr::getInstance()->updatePanelOutfitName(""); + } + + virtual void fire(const LLUUID&) + {} + +private: + LLUUID mFolderID; +}; + +LLUUID LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name) +{ + if (!isAgentAvatarValid()) return LLUUID::null; + + // First, make a folder in the My Outfits directory. + const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); + LLUUID folder_id = gInventory.createNewCategory( + parent_id, + LLFolderType::FT_OUTFIT, + new_folder_name); + + updateClothingOrderingInfo(); + + LLPointer cb = new LLShowCreatedOutfit(folder_id); + shallowCopyCategoryContents(getCOF(),folder_id, cb); + createBaseOutfitLink(folder_id, cb); + + dumpCat(folder_id,"COF, new outfit"); + + return folder_id; +} + void LLAppearanceMgr::wearBaseOutfit() { const LLUUID& base_outfit_id = getBaseOutfitUUID(); diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 7e35919892..efb5274c5b 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -138,12 +138,23 @@ public: //Remove clothing or detach an object from the agent (a bodypart cannot be removed) void removeItemFromAvatar(const LLUUID& item_id); + + LLUUID makeNewOutfitLinks(const std::string& new_folder_name); + protected: LLAppearanceMgr(); ~LLAppearanceMgr(); private: + typedef std::vector wearables_by_type_t; + + //Divvy items into arrays by wearable type + static void divvyWearablesByType(const LLInventoryModel::item_array_t& items, wearables_by_type_t& items_by_type); + + //Check ordering information on wearables stored in links' descriptions and update if it is invalid + void updateClothingOrderingInfo(); + void filterWearableItems(LLInventoryModel::item_array_t& items, S32 max_per_type); void getDescendentsOfAssetType(const LLUUID& category, diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index b85bf0d518..b4a1bf2758 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2520,6 +2520,7 @@ void LLFolderBridge::pasteLinkFromClipboard() item->getLinkedUUID(), parent_id, item->getName(), + item->getDescription(), LLAssetType::AT_LINK, LLPointer(NULL)); } @@ -3166,6 +3167,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, inv_item->getLinkedUUID(), mUUID, inv_item->getName(), + inv_item->getDescription(), LLAssetType::AT_LINK, cb); } diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index b78268da7b..367ce46ce6 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -216,7 +216,7 @@ bool LLPanelOutfitsInventory::onSaveCommit(const LLSD& notification, const LLSD& LLStringUtil::trim(outfit_name); if( !outfit_name.empty() ) { - LLUUID outfit_folder = gAgentWearables.makeNewOutfitLinks(outfit_name); + LLUUID outfit_folder = LLAppearanceMgr::getInstance()->makeNewOutfitLinks(outfit_name); LLSidepanelAppearance* panel_appearance = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 8a891b1462..f434d15843 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -923,6 +923,7 @@ void link_inventory_item( const LLUUID& item_id, const LLUUID& parent_id, const std::string& new_name, + const std::string& new_description, const LLAssetType::EType asset_type, LLPointer cb) { @@ -948,7 +949,6 @@ void link_inventory_item( } LLUUID transaction_id; - std::string desc = "Broken link"; // This should only show if the object can't find its baseobj. LLInventoryType::EType inv_type = LLInventoryType::IT_NONE; if (dynamic_cast(baseobj)) { @@ -979,7 +979,7 @@ void link_inventory_item( msg->addS8Fast(_PREHASH_Type, (S8)asset_type); msg->addS8Fast(_PREHASH_InvType, (S8)inv_type); msg->addStringFast(_PREHASH_Name, new_name); - msg->addStringFast(_PREHASH_Description, desc); + msg->addStringFast(_PREHASH_Description, new_description); } gAgent.sendReliableMessage(); } diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 9d449399e8..f296ce35ff 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -339,6 +339,7 @@ void link_inventory_item( const LLUUID& item_id, const LLUUID& parent_id, const std::string& new_name, + const std::string& new_description, const LLAssetType::EType asset_type, LLPointer cb); -- cgit v1.2.3 From 94791f7b276fe4cb2bf6c488333c9e3eca3b9dee Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Wed, 21 Apr 2010 13:42:35 +0300 Subject: Fixed normal bug EXT-5220 (Remove Edit Appearance button from Me panel) - the button and respective code were removed. Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/283/. --HG-- branch : product-engine --- indra/newview/llpanelme.cpp | 9 --------- indra/newview/llpanelme.h | 1 - indra/newview/skins/default/xui/en/panel_my_profile.xml | 8 -------- indra/newview/skins/default/xui/en/panel_profile.xml | 8 -------- 4 files changed, 26 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp index 35acf8edcc..3f620869e0 100644 --- a/indra/newview/llpanelme.cpp +++ b/indra/newview/llpanelme.cpp @@ -63,7 +63,6 @@ BOOL LLPanelMe::postBuild() LLPanelProfile::postBuild(); getTabContainer()[PANEL_PROFILE]->childSetAction("edit_profile_btn", boost::bind(&LLPanelMe::onEditProfileClicked, this), this); - getTabContainer()[PANEL_PROFILE]->childSetAction("edit_appearance_btn", boost::bind(&LLPanelMe::onEditAppearanceClicked, this), this); return TRUE; } @@ -141,14 +140,6 @@ void LLPanelMe::onEditProfileClicked() togglePanel(mEditPanel, getAvatarId()); // open } -void LLPanelMe::onEditAppearanceClicked() -{ - if (gAgentWearables.areWearablesLoaded()) - { - gAgentCamera.changeCameraToCustomizeAvatar(); - } -} - void LLPanelMe::onSaveChangesClicked() { LLAvatarData data = LLAvatarData(); diff --git a/indra/newview/llpanelme.h b/indra/newview/llpanelme.h index 1325192bbf..f2b38de3d6 100644 --- a/indra/newview/llpanelme.h +++ b/indra/newview/llpanelme.h @@ -63,7 +63,6 @@ private: void buildEditPanel(); void onEditProfileClicked(); - void onEditAppearanceClicked(); void onSaveChangesClicked(); void onCancelClicked(); diff --git a/indra/newview/skins/default/xui/en/panel_my_profile.xml b/indra/newview/skins/default/xui/en/panel_my_profile.xml index 5e41d65720..841a4f5713 100644 --- a/indra/newview/skins/default/xui/en/panel_my_profile.xml +++ b/indra/newview/skins/default/xui/en/panel_my_profile.xml @@ -401,14 +401,6 @@ name="edit_profile_btn" tool_tip="Edit your personal information" width="152" /> -