diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index c802287400..720c9b7cac 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -403,11 +403,11 @@ LLSidepanelAppearance* LLPanelOutfitsInventory::getAppearanceSP() } // Show avatar complexity in appearance floater -void LLPanelOutfitsInventory::updateAvatarComplexity(U32 complexity) +void LLPanelOutfitsInventory::updateAvatarComplexity(U32 complexity, const std::map& item_complexity) { mOutfitGalleryPanel->updateAvatarComplexity(complexity); mMyOutfitsPanel->updateAvatarComplexity(complexity); - mCurrentOutfitPanel->updateAvatarComplexity(complexity); + mCurrentOutfitPanel->updateAvatarComplexity(complexity, item_complexity); } // diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h index 9e9ba1cf6e..b528bebd57 100644 --- a/indra/newview/llpaneloutfitsinventory.h +++ b/indra/newview/llpaneloutfitsinventory.h @@ -67,7 +67,7 @@ public: static LLPanelOutfitsInventory* findInstance(); // Show avatar complexity in appearance floater - void updateAvatarComplexity(U32 complexity); + void updateAvatarComplexity(U32 complexity, const std::map& item_complexity); protected: void updateVerbs(); diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp index f44797a01d..1d8770fbc3 100644 --- a/indra/newview/llpanelwearing.cpp +++ b/indra/newview/llpanelwearing.cpp @@ -623,13 +623,15 @@ void LLPanelWearing::copyToClipboard() } // Show avatar complexity in appearance floater -void LLPanelWearing::updateAvatarComplexity(U32 complexity) +void LLPanelWearing::updateAvatarComplexity(U32 complexity, const std::map& item_complexity) { std::string complexity_string; LLLocale locale(""); LLResMgr::getInstance()->getIntegerString(complexity_string, complexity); mAvatarComplexityLabel->setTextArg("[WEIGHT]", complexity_string); + + mCOFItemsList->updateItemComplexity(item_complexity); } // // EOF diff --git a/indra/newview/llpanelwearing.h b/indra/newview/llpanelwearing.h index fe0b6169bb..0780ca8bda 100644 --- a/indra/newview/llpanelwearing.h +++ b/indra/newview/llpanelwearing.h @@ -85,7 +85,7 @@ public: void onRemoveAttachment(); // Show avatar complexity in appearance floater - void updateAvatarComplexity(U32 complexity); + void updateAvatarComplexity(U32 complexity, const std::map& item_complexity); private: void onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y); diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index e202ac7412..f0f41f2b7e 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -574,12 +574,12 @@ bool LLSidepanelAppearance::isWearableEditPanelVisible() const // Show avatar complexity in appearance floater // static -void LLSidepanelAppearance::updateAvatarComplexity(U32 complexity) +void LLSidepanelAppearance::updateAvatarComplexity(U32 complexity, const std::map& item_complexity) { LLSidepanelAppearance* instance = LLFloaterSidePanelContainer::getPanel("appearance"); if (instance->mLastAvatarComplexity != complexity) { - instance->mPanelOutfitsInventory->updateAvatarComplexity(complexity); + instance->mPanelOutfitsInventory->updateAvatarComplexity(complexity, item_complexity); instance->mOutfitEdit->updateAvatarComplexity(complexity); } instance->mLastAvatarComplexity = complexity; diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h index 9b4812c8d3..7121bda930 100644 --- a/indra/newview/llsidepanelappearance.h +++ b/indra/newview/llsidepanelappearance.h @@ -79,7 +79,7 @@ public: // [/RLVa:KB] // Show avatar complexity in appearance floater - static void updateAvatarComplexity(U32 complexity); + static void updateAvatarComplexity(U32 complexity, const std::map& item_complexity); private: void onFilterEdit(const std::string& search_string); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 91c5cdc796..6c50d3e36c 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -10014,6 +10014,8 @@ void LLVOAvatar::calculateUpdateRenderComplexity() // Disable useless diagnostics //static std::set all_textures; + std::map item_complexity; // Show per-item complexity in COF + if (mVisualComplexityStale) { U32 cost = VISUAL_COMPLEXITY_UNKNOWN; @@ -10100,6 +10102,13 @@ void LLVOAvatar::calculateUpdateRenderComplexity() << LL_ENDL; // Limit attachment complexity to avoid signed integer flipping of the wearer's ACI cost += (U32)llclamp(attachment_total_cost, MIN_ATTACHMENT_COMPLEXITY, max_attachment_complexity); + + // Show per-item complexity in COF + if (isSelf()) + { + item_complexity.insert(std::make_pair(attached_object->getAttachmentItemID(), (U32)attachment_total_cost)); + } + // } } } @@ -10235,7 +10244,7 @@ void LLVOAvatar::calculateUpdateRenderComplexity() // Show avatar complexity in appearance floater if (isSelf()) { - LLSidepanelAppearance::updateAvatarComplexity(mVisualComplexity); + LLSidepanelAppearance::updateAvatarComplexity(mVisualComplexity, item_complexity); } // } diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index 2c7c34d19f..576f98e33f 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -46,6 +46,8 @@ #include "rlvactions.h" #include "rlvlocks.h" // [/RLVa:KB] +#include "lltextbox.h" +#include "llresmgr.h" class LLFindOutfitItems : public LLInventoryCollectFunctor { @@ -386,6 +388,72 @@ void LLPanelAttachmentListItem::updateItem(const std::string& name, LLPanelInventoryListItemBase::updateItem(title_joint, item_state); } +// Show per-item complexity in COF +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +static LLWidgetNameRegistry::StaticRegistrar sRegisterPanelCOFWearableOutfitListItem(&typeid(FSPanelCOFWearableOutfitListItem::Params), "cof_wearable_list_item"); + +FSPanelCOFWearableOutfitListItem::Params::Params() +: item_weight("item_weight") +{} + +// static +FSPanelCOFWearableOutfitListItem* FSPanelCOFWearableOutfitListItem::create(LLViewerInventoryItem* item, + bool worn_indication_enabled, U32 weight) +{ + FSPanelCOFWearableOutfitListItem* list_item = NULL; + if(item) + { + const Params& params = LLUICtrlFactory::getDefaultParams(); + list_item = new FSPanelCOFWearableOutfitListItem(item, worn_indication_enabled, params); + list_item->initFromParams(params); + list_item->postBuild(); + list_item->updateItemWeight(weight); + } + return list_item; +} + + +FSPanelCOFWearableOutfitListItem::FSPanelCOFWearableOutfitListItem(LLViewerInventoryItem* item, + bool worn_indication_enabled, + const FSPanelCOFWearableOutfitListItem::Params& params) +: LLPanelWearableOutfitItem(item, worn_indication_enabled, params) +, mWeightCtrl(NULL) +{ + LLTextBox::Params weight_params = params.item_weight; + applyXUILayout(weight_params, this); + addChild(LLUICtrlFactory::create(weight_params)); +} + +BOOL FSPanelCOFWearableOutfitListItem::postBuild() +{ + mWeightCtrl = getChild("item_weight"); + + LLPanelWearableOutfitItem::postBuild(); + + addWidgetToRightSide("item_weight"); + + // Reserve space for 'delete' button event if it is invisible. + setRightWidgetsWidth(mWeightCtrl->getRect().getWidth() + 5); + + reshapeWidgets(); + + return TRUE; +} + +void FSPanelCOFWearableOutfitListItem::updateItemWeight(U32 item_weight) +{ + std::string complexity_string; + if (item_weight > 0) + { + LLLocale locale(""); + LLResMgr::getInstance()->getIntegerString(complexity_string, item_weight); + } + mWeightCtrl->setText(complexity_string); +} +// + ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -664,6 +732,7 @@ LLWearableItemsList::Params::Params() : standalone("standalone", true) , worn_indication_enabled("worn_indication_enabled", true) , show_create_new("show_create_new", true) // Optional "Create new" menu item +, show_complexity("show_complexity", false) // Show per-item complexity in COF {} LLWearableItemsList::LLWearableItemsList(const LLWearableItemsList::Params& p) @@ -678,6 +747,7 @@ LLWearableItemsList::LLWearableItemsList(const LLWearableItemsList::Params& p) } mWornIndicationEnabled = p.worn_indication_enabled; mShowCreateNew = p.show_create_new; // Optional "Create new" menu item + mShowComplexity = p.show_complexity; // Show per-item complexity in COF setNoItemsCommentText(LLTrans::getString("LoadingData")); } @@ -695,7 +765,19 @@ LLPanel* LLWearableItemsList::createNewItem(LLViewerInventoryItem* item) return NULL; } - return LLPanelWearableOutfitItem::create(item, mWornIndicationEnabled); + // Show per-item complexity in COF + //return LLPanelWearableOutfitItem::create(item, mWornIndicationEnabled); + if (!mShowComplexity) + { + return LLPanelWearableOutfitItem::create(item, mWornIndicationEnabled); + } + else + { + LLUUID linked_item_id = item->getLinkedUUID(); + mLinkedItemsMap[linked_item_id] = item->getUUID(); + return FSPanelCOFWearableOutfitListItem::create(item, mWornIndicationEnabled, mItemComplexityMap[linked_item_id]); + } + // } void LLWearableItemsList::updateList(const LLUUID& category_id) @@ -800,6 +882,31 @@ void LLWearableItemsList::setSortOrder(ESortOrder sort_order, bool sort_now) } } +// Show per-item complexity in COF +void LLWearableItemsList::updateItemComplexity(const std::map& item_complexity) +{ + if (mShowComplexity) + { + mItemComplexityMap = item_complexity; + updateComplexity(); + } +} + +void LLWearableItemsList::updateComplexity() +{ + for (std::map::const_iterator it = mItemComplexityMap.begin(); it != mItemComplexityMap.end(); ++it) + { + LLUUID id = mLinkedItemsMap[it->first]; + LLPanel* panel = getItemByValue(id); + if (panel) + { + FSPanelCOFWearableOutfitListItem* list_item = static_cast(panel); + list_item->updateItemWeight(it->second); + } + } +} +// + ////////////////////////////////////////////////////////////////////////// /// ContextMenu ////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h index 4115e4b681..dab4609111 100644 --- a/indra/newview/llwearableitemslist.h +++ b/indra/newview/llwearableitemslist.h @@ -210,6 +210,42 @@ protected: }; +// Show per-item complexity in COF +/** + * @class FSPanelCOFWearableOutfitListItem + * + * Outfit item for "Wearing" list. + * Extends LLPanelWearableOutfitItem with showing the + * render weight of the item. + */ +class FSPanelCOFWearableOutfitListItem : public LLPanelWearableOutfitItem +{ + LOG_CLASS(FSPanelCOFWearableOutfitListItem); +public: + struct Params : public LLInitParam::Block + { + Optional item_weight; + + Params(); + }; + + static FSPanelCOFWearableOutfitListItem* create(LLViewerInventoryItem* item, + bool worn_indication_enabled, U32 weight); + + /*virtual*/ BOOL postBuild(); + + void updateItemWeight(U32 item_weight); + +protected: + FSPanelCOFWearableOutfitListItem(LLViewerInventoryItem* item, + bool worn_indication_enabled, const Params& params); + +private: + LLTextBox* mWeightCtrl; +}; +// + + /** * @class LLPanelDummyClothingListItem * @@ -440,6 +476,7 @@ public: Optional standalone; Optional worn_indication_enabled; Optional show_create_new; // Optional "Create new" menu item + Optional show_complexity; // Show per-item complexity in COF Params(); }; @@ -472,6 +509,8 @@ public: bool showCreateNew() const { return mShowCreateNew; } // Optional "Create new" menu item + void updateItemComplexity(const std::map& item_complexity); // Show per-item complexity in COF + protected: friend class LLUICtrlFactory; LLWearableItemsList(const LLWearableItemsList::Params& p); @@ -481,8 +520,16 @@ protected: bool mIsStandalone; bool mWornIndicationEnabled; bool mShowCreateNew; // Optional "Create new" menu item + bool mShowComplexity; // Show per-item complexity in COF ESortOrder mSortOrder; + + // Show per-item complexity in COF + void updateComplexity(); + + std::map mLinkedItemsMap; + std::map mItemComplexityMap; + // }; #endif //LL_LLWEARABLEITEMSLIST_H diff --git a/indra/newview/skins/ansastorm/xui/en/panel_outfits_wearing.xml b/indra/newview/skins/ansastorm/xui/en/panel_outfits_wearing.xml index 3d36123692..bca5ab8da9 100644 --- a/indra/newview/skins/ansastorm/xui/en/panel_outfits_wearing.xml +++ b/indra/newview/skins/ansastorm/xui/en/panel_outfits_wearing.xml @@ -35,6 +35,7 @@ standalone="false" top="0" width="309" + show_complexity="true" worn_indication_enabled="false" /> + + + + + diff --git a/indra/newview/skins/firestorm/xui/en/panel_outfits_wearing.xml b/indra/newview/skins/firestorm/xui/en/panel_outfits_wearing.xml index 8a785e24a5..31884429d2 100644 --- a/indra/newview/skins/firestorm/xui/en/panel_outfits_wearing.xml +++ b/indra/newview/skins/firestorm/xui/en/panel_outfits_wearing.xml @@ -37,6 +37,7 @@ standalone="false" top="0" width="309" + show_complexity="true" worn_indication_enabled="false" />