summaryrefslogtreecommitdiff
path: root/indra/newview/llcofwearables.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llcofwearables.cpp')
-rw-r--r--indra/newview/llcofwearables.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp
index dfc203111a..ee366f4e3c 100644
--- a/indra/newview/llcofwearables.cpp
+++ b/indra/newview/llcofwearables.cpp
@@ -43,6 +43,8 @@
#include "llmenugl.h"
#include "llviewermenu.h"
#include "llwearableitemslist.h"
+#include "llpaneloutfitedit.h"
+#include "llsidetray.h"
static LLRegisterPanelClassWrapper<LLCOFAccordionListAdaptor> t_cof_accodion_list_adaptor("accordion_list_adaptor");
@@ -135,8 +137,10 @@ protected:
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
LLUUID selected_id = mUUIDs.back();
- registrar.add("BodyPart.Replace", boost::bind(&LLAppearanceMgr::wearItemOnAvatar,
- LLAppearanceMgr::getInstance(), selected_id, true, true));
+ // *HACK* need to pass pointer to LLPanelOutfitEdit instead of LLSideTray::getInstance()->getPanel().
+ // LLSideTray::getInstance()->getPanel() is rather slow variant
+ LLPanelOutfitEdit* panel_oe = dynamic_cast<LLPanelOutfitEdit*>(LLSideTray::getInstance()->getPanel("panel_outfit_edit"));
+ registrar.add("BodyPart.Replace", boost::bind(&LLPanelOutfitEdit::onReplaceBodyPartMenuItemClicked, panel_oe, selected_id));
registrar.add("BodyPart.Edit", boost::bind(LLAgentWearables::editWearable, selected_id));
enable_registrar.add("BodyPart.OnEnable", boost::bind(&CofBodyPartContextMenu::onEnable, this, _2));
@@ -308,13 +312,15 @@ void LLCOFWearables::populateAttachmentsAndBodypartsLists(const LLInventoryModel
LLPanelClothingListItem* LLCOFWearables::buildClothingListItem(LLViewerInventoryItem* item, bool first, bool last)
{
llassert(item);
-
+ if (!item) return NULL;
LLPanelClothingListItem* item_panel = LLPanelClothingListItem::create(item);
if (!item_panel) return NULL;
//updating verbs
//we don't need to use permissions of a link but of an actual/linked item
if (item->getLinkedItem()) item = item->getLinkedItem();
+ llassert(item);
+ if (!item) return NULL;
bool allow_modify = item->getPermissions().allowModifyBy(gAgentID);
@@ -340,14 +346,15 @@ LLPanelClothingListItem* LLCOFWearables::buildClothingListItem(LLViewerInventory
LLPanelBodyPartsListItem* LLCOFWearables::buildBodypartListItem(LLViewerInventoryItem* item)
{
llassert(item);
-
+ if (!item) return NULL;
LLPanelBodyPartsListItem* item_panel = LLPanelBodyPartsListItem::create(item);
if (!item_panel) return NULL;
//updating verbs
//we don't need to use permissions of a link but of an actual/linked item
if (item->getLinkedItem()) item = item->getLinkedItem();
-
+ llassert(item);
+ if (!item) return NULL;
bool allow_modify = item->getPermissions().allowModifyBy(gAgentID);
item_panel->setShowLockButton(!allow_modify);
item_panel->setShowEditButton(allow_modify);
@@ -416,6 +423,7 @@ void LLCOFWearables::addClothingTypesDummies(const LLAppearanceMgr::wearables_by
LLWearableType::EType w_type = static_cast<LLWearableType::EType>(type);
LLPanelInventoryListItemBase* item_panel = LLPanelDummyClothingListItem::create(w_type);
if(!item_panel) continue;
+ item_panel->childSetAction("btn_add", mCOFCallbacks.mAddWearable);
mClothing->addItem(item_panel, LLUUID::null, ADD_BOTTOM, false);
}
}
@@ -435,6 +443,13 @@ bool LLCOFWearables::getSelectedUUIDs(uuid_vec_t& selected_ids)
return selected_ids.size() != 0;
}
+LLPanel* LLCOFWearables::getSelectedItem()
+{
+ if (!mLastSelectedList) return NULL;
+
+ return mLastSelectedList->getSelectedItem();
+}
+
void LLCOFWearables::clear()
{
mAttachments->clear();