FIRE-21078: Show per-item complexity in COF
parent
0750b107f7
commit
9575765bd2
|
|
@ -403,11 +403,11 @@ LLSidepanelAppearance* LLPanelOutfitsInventory::getAppearanceSP()
|
|||
}
|
||||
|
||||
// <FS:Ansariel> Show avatar complexity in appearance floater
|
||||
void LLPanelOutfitsInventory::updateAvatarComplexity(U32 complexity)
|
||||
void LLPanelOutfitsInventory::updateAvatarComplexity(U32 complexity, const std::map<LLUUID, U32>& item_complexity)
|
||||
{
|
||||
mOutfitGalleryPanel->updateAvatarComplexity(complexity);
|
||||
mMyOutfitsPanel->updateAvatarComplexity(complexity);
|
||||
mCurrentOutfitPanel->updateAvatarComplexity(complexity);
|
||||
mCurrentOutfitPanel->updateAvatarComplexity(complexity, item_complexity);
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public:
|
|||
static LLPanelOutfitsInventory* findInstance();
|
||||
|
||||
// <FS:Ansariel> Show avatar complexity in appearance floater
|
||||
void updateAvatarComplexity(U32 complexity);
|
||||
void updateAvatarComplexity(U32 complexity, const std::map<LLUUID, U32>& item_complexity);
|
||||
|
||||
protected:
|
||||
void updateVerbs();
|
||||
|
|
|
|||
|
|
@ -623,13 +623,15 @@ void LLPanelWearing::copyToClipboard()
|
|||
}
|
||||
|
||||
// <FS:Ansariel> Show avatar complexity in appearance floater
|
||||
void LLPanelWearing::updateAvatarComplexity(U32 complexity)
|
||||
void LLPanelWearing::updateAvatarComplexity(U32 complexity, const std::map<LLUUID, U32>& item_complexity)
|
||||
{
|
||||
std::string complexity_string;
|
||||
LLLocale locale("");
|
||||
LLResMgr::getInstance()->getIntegerString(complexity_string, complexity);
|
||||
|
||||
mAvatarComplexityLabel->setTextArg("[WEIGHT]", complexity_string);
|
||||
|
||||
mCOFItemsList->updateItemComplexity(item_complexity);
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
// EOF
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public:
|
|||
void onRemoveAttachment();
|
||||
|
||||
// <FS:Ansariel> Show avatar complexity in appearance floater
|
||||
void updateAvatarComplexity(U32 complexity);
|
||||
void updateAvatarComplexity(U32 complexity, const std::map<LLUUID, U32>& item_complexity);
|
||||
|
||||
private:
|
||||
void onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y);
|
||||
|
|
|
|||
|
|
@ -574,12 +574,12 @@ bool LLSidepanelAppearance::isWearableEditPanelVisible() const
|
|||
|
||||
// <FS:Ansariel> Show avatar complexity in appearance floater
|
||||
// static
|
||||
void LLSidepanelAppearance::updateAvatarComplexity(U32 complexity)
|
||||
void LLSidepanelAppearance::updateAvatarComplexity(U32 complexity, const std::map<LLUUID, U32>& item_complexity)
|
||||
{
|
||||
LLSidepanelAppearance* instance = LLFloaterSidePanelContainer::getPanel<LLSidepanelAppearance>("appearance");
|
||||
if (instance->mLastAvatarComplexity != complexity)
|
||||
{
|
||||
instance->mPanelOutfitsInventory->updateAvatarComplexity(complexity);
|
||||
instance->mPanelOutfitsInventory->updateAvatarComplexity(complexity, item_complexity);
|
||||
instance->mOutfitEdit->updateAvatarComplexity(complexity);
|
||||
}
|
||||
instance->mLastAvatarComplexity = complexity;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public:
|
|||
// [/RLVa:KB]
|
||||
|
||||
// <FS:Ansariel> Show avatar complexity in appearance floater
|
||||
static void updateAvatarComplexity(U32 complexity);
|
||||
static void updateAvatarComplexity(U32 complexity, const std::map<LLUUID, U32>& item_complexity);
|
||||
|
||||
private:
|
||||
void onFilterEdit(const std::string& search_string);
|
||||
|
|
|
|||
|
|
@ -10014,6 +10014,8 @@ void LLVOAvatar::calculateUpdateRenderComplexity()
|
|||
// <FS:Ansariel> Disable useless diagnostics
|
||||
//static std::set<LLUUID> all_textures;
|
||||
|
||||
std::map<LLUUID, U32> item_complexity; // <FS:Ansariel> 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);
|
||||
|
||||
// <FS:Ansariel> Show per-item complexity in COF
|
||||
if (isSelf())
|
||||
{
|
||||
item_complexity.insert(std::make_pair(attached_object->getAttachmentItemID(), (U32)attachment_total_cost));
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10235,7 +10244,7 @@ void LLVOAvatar::calculateUpdateRenderComplexity()
|
|||
// <FS:Ansariel> Show avatar complexity in appearance floater
|
||||
if (isSelf())
|
||||
{
|
||||
LLSidepanelAppearance::updateAvatarComplexity(mVisualComplexity);
|
||||
LLSidepanelAppearance::updateAvatarComplexity(mVisualComplexity, item_complexity);
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
// <FS:Ansariel> 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<FSPanelCOFWearableOutfitListItem>();
|
||||
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<LLTextBox>(weight_params));
|
||||
}
|
||||
|
||||
BOOL FSPanelCOFWearableOutfitListItem::postBuild()
|
||||
{
|
||||
mWeightCtrl = getChild<LLTextBox>("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);
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -664,6 +732,7 @@ LLWearableItemsList::Params::Params()
|
|||
: standalone("standalone", true)
|
||||
, worn_indication_enabled("worn_indication_enabled", true)
|
||||
, show_create_new("show_create_new", true) // <FS:Ansariel> Optional "Create new" menu item
|
||||
, show_complexity("show_complexity", false) // <FS:Ansariel> 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; // <FS:Ansariel> Optional "Create new" menu item
|
||||
mShowComplexity = p.show_complexity; // <FS:Ansariel> 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);
|
||||
// <FS:Ansariel> 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]);
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
}
|
||||
|
||||
void LLWearableItemsList::updateList(const LLUUID& category_id)
|
||||
|
|
@ -800,6 +882,31 @@ void LLWearableItemsList::setSortOrder(ESortOrder sort_order, bool sort_now)
|
|||
}
|
||||
}
|
||||
|
||||
// <FS:Ansariel> Show per-item complexity in COF
|
||||
void LLWearableItemsList::updateItemComplexity(const std::map<LLUUID, U32>& item_complexity)
|
||||
{
|
||||
if (mShowComplexity)
|
||||
{
|
||||
mItemComplexityMap = item_complexity;
|
||||
updateComplexity();
|
||||
}
|
||||
}
|
||||
|
||||
void LLWearableItemsList::updateComplexity()
|
||||
{
|
||||
for (std::map<LLUUID, U32>::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<FSPanelCOFWearableOutfitListItem*>(panel);
|
||||
list_item->updateItemWeight(it->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// ContextMenu
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -210,6 +210,42 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
// <FS:Ansariel> 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<Params, LLPanelWearableListItem::Params>
|
||||
{
|
||||
Optional<LLTextBox::Params> 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;
|
||||
};
|
||||
// </FS:Ansariel>
|
||||
|
||||
|
||||
/**
|
||||
* @class LLPanelDummyClothingListItem
|
||||
*
|
||||
|
|
@ -440,6 +476,7 @@ public:
|
|||
Optional<bool> standalone;
|
||||
Optional<bool> worn_indication_enabled;
|
||||
Optional<bool> show_create_new; // <FS:Ansariel> Optional "Create new" menu item
|
||||
Optional<bool> show_complexity; // <FS:Ansariel> Show per-item complexity in COF
|
||||
|
||||
Params();
|
||||
};
|
||||
|
|
@ -472,6 +509,8 @@ public:
|
|||
|
||||
bool showCreateNew() const { return mShowCreateNew; } // <FS:Ansariel> Optional "Create new" menu item
|
||||
|
||||
void updateItemComplexity(const std::map<LLUUID, U32>& item_complexity); // <FS:Ansariel> 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; // <FS:Ansariel> Optional "Create new" menu item
|
||||
bool mShowComplexity; // <FS:Ansariel> Show per-item complexity in COF
|
||||
|
||||
ESortOrder mSortOrder;
|
||||
|
||||
// <FS:Ansariel> Show per-item complexity in COF
|
||||
void updateComplexity();
|
||||
|
||||
std::map<LLUUID, LLUUID> mLinkedItemsMap;
|
||||
std::map<LLUUID, U32> mItemComplexityMap;
|
||||
// </FS:Ansariel>
|
||||
};
|
||||
|
||||
#endif //LL_LLWEARABLEITEMSLIST_H
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
standalone="false"
|
||||
top="0"
|
||||
width="309"
|
||||
show_complexity="true"
|
||||
worn_indication_enabled="false" />
|
||||
</accordion_tab>
|
||||
<accordion_tab
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
standalone="false"
|
||||
top="0"
|
||||
width="309"
|
||||
show_complexity="true"
|
||||
worn_indication_enabled="false" />
|
||||
</accordion_tab>
|
||||
<accordion_tab
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<cof_wearable_list_item
|
||||
follows="top|right|left"
|
||||
height="23"
|
||||
layout="topleft"
|
||||
left="0"
|
||||
name="cof_wearable_item"
|
||||
bottom="0"
|
||||
width="380">
|
||||
<item_icon
|
||||
height="16"
|
||||
follows="top|left"
|
||||
image_name="Inv_Object"
|
||||
layout="topleft"
|
||||
left="24"
|
||||
name="item_icon"
|
||||
top="2"
|
||||
width="16" />
|
||||
<item_name
|
||||
follows="left|right"
|
||||
height="16"
|
||||
layout="topleft"
|
||||
left="45"
|
||||
parse_urls="false"
|
||||
use_ellipses="true"
|
||||
name="item_name"
|
||||
text_color="white"
|
||||
top="4"
|
||||
value="..."
|
||||
width="359" />
|
||||
<item_weight
|
||||
follows="top|right"
|
||||
height="20"
|
||||
layout="topleft"
|
||||
right="-2"
|
||||
parse_urls="false"
|
||||
use_ellipses="true"
|
||||
name="item_weight"
|
||||
halign="right"
|
||||
text_color="white"
|
||||
top="4"
|
||||
value="..."
|
||||
width="70" />
|
||||
</cof_wearable_list_item>
|
||||
|
|
@ -37,6 +37,7 @@
|
|||
standalone="false"
|
||||
top="0"
|
||||
width="309"
|
||||
show_complexity="true"
|
||||
worn_indication_enabled="false" />
|
||||
</accordion_tab>
|
||||
<accordion_tab
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
standalone="false"
|
||||
top="0"
|
||||
width="309"
|
||||
show_complexity="true"
|
||||
worn_indication_enabled="false" />
|
||||
</accordion_tab>
|
||||
<accordion_tab
|
||||
|
|
|
|||
Loading…
Reference in New Issue