summaryrefslogtreecommitdiff
path: root/indra/newview/llpaneloutfitedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpaneloutfitedit.cpp')
-rw-r--r--indra/newview/llpaneloutfitedit.cpp75
1 files changed, 40 insertions, 35 deletions
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index ccd1bfe224..cf04ab378f 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -113,9 +113,9 @@ private:
LLPanelOutfitEdit::LLPanelOutfitEdit()
-: LLPanel(), mLookID(), mFetchLook(NULL), mSearchFilter(NULL),
+: LLPanel(), mCurrentOutfitID(), mFetchLook(NULL), mSearchFilter(NULL),
mLookContents(NULL), mInventoryItemsPanel(NULL), mAddToLookBtn(NULL),
-mRemoveFromLookBtn(NULL), mLookObserver(NULL), mNumItemsInLook(0)
+mRemoveFromLookBtn(NULL), mLookObserver(NULL)
{
mSavedFolderState = new LLSaveFolderState();
mSavedFolderState->setApply(FALSE);
@@ -157,7 +157,7 @@ BOOL LLPanelOutfitEdit::postBuild()
{
// gInventory.isInventoryUsable() no longer needs to be tested per Richard's fix for race conditions between inventory and panels
- mLookName = getChild<LLTextBox>("curr_look_name");
+ mCurrentOutfitName = getChild<LLTextBox>("curr_outfit_name");
childSetCommitCallback("add_btn", boost::bind(&LLPanelOutfitEdit::showAddWearablesPanel, this), NULL);
@@ -206,7 +206,7 @@ BOOL LLPanelOutfitEdit::postBuild()
mLookContents = getChild<LLScrollListCtrl>("look_items_list");
mLookContents->sortByColumn("look_item_sort", TRUE);
mLookContents->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onLookItemSelectionChange, this));
-
+
/*
LLButton::Params remove_params;
remove_params.name("remove_from_look");
@@ -220,12 +220,12 @@ BOOL LLPanelOutfitEdit::postBuild()
//childSetAction("remove_from_look_btn", boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this), this);
mRemoveFromLookBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this));
//getChild<LLPanel>("look_info_group_bar")->addChild(mRemoveFromLookBtn); remove_item_btn
-
+
mEditWearableBtn = getChild<LLButton>("edit_wearable_btn");
mEditWearableBtn->setEnabled(FALSE);
mEditWearableBtn->setVisible(FALSE);
mEditWearableBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onEditWearableClicked, this));
-
+
childSetAction("remove_item_btn", boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this), this);
return TRUE;
@@ -302,7 +302,7 @@ void LLPanelOutfitEdit::onAddToLookClicked(void)
{
LLFolderViewItem* curr_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem();
LLFolderViewEventListener* listenerp = curr_item->getListener();
- link_inventory_item(gAgent.getID(), listenerp->getUUID(), mLookID, listenerp->getName(),
+ link_inventory_item(gAgent.getID(), listenerp->getUUID(), mCurrentOutfitID, listenerp->getName(),
LLAssetType::AT_LINK, LLPointer<LLInventoryCallback>(NULL));
updateLookInfo();
}
@@ -367,19 +367,32 @@ void LLPanelOutfitEdit::onUpClicked(void)
void LLPanelOutfitEdit::onEditWearableClicked(void)
{
LLUUID id_to_edit = mLookContents->getSelectionInterface()->getCurrentID();
-
LLViewerInventoryItem * item_to_edit = gInventory.getItem(id_to_edit);
if (item_to_edit)
{
// returns null if not a wearable (attachment, etc).
LLWearable* wearable_to_edit = gAgentWearables.getWearableFromAssetID(item_to_edit->getAssetUUID());
- if (!wearable_to_edit || !wearable_to_edit->getPermissions().allowModifyBy(gAgent.getID()) )
- {
- LLSidepanelAppearance::editWearable(wearable_to_edit, getParent());
- if (mEditWearableBtn->getVisible())
+ if(wearable_to_edit)
+ {
+ bool can_modify = false;
+ bool is_complete = item_to_edit->isComplete();
+ // if item_to_edit is a link, its properties are not appropriate,
+ // lets get original item with actual properties
+ LLViewerInventoryItem* original_item = gInventory.getItem(wearable_to_edit->getItemID());
+ if(original_item)
{
- mEditWearableBtn->setVisible(FALSE);
+ can_modify = original_item->getPermissions().allowModifyBy(gAgentID);
+ is_complete = original_item->isComplete();
+ }
+
+ if (can_modify && is_complete)
+ {
+ LLSidepanelAppearance::editWearable(wearable_to_edit, getParent());
+ if (mEditWearableBtn->getVisible())
+ {
+ mEditWearableBtn->setVisible(FALSE);
+ }
}
}
}
@@ -445,7 +458,7 @@ void LLPanelOutfitEdit::lookFetched(void)
// collectDescendentsIf takes non-const reference:
LLFindCOFValidItems is_cof_valid;
- gInventory.collectDescendentsIf(mLookID,
+ gInventory.collectDescendentsIf(mCurrentOutfitID,
cat_array,
item_array,
LLInventoryModel::EXCLUDE_TRASH,
@@ -468,12 +481,6 @@ void LLPanelOutfitEdit::lookFetched(void)
mLookContents->addElement(row);
}
-
- if (mLookContents->getItemCount() != mNumItemsInLook)
- {
- mNumItemsInLook = mLookContents->getItemCount();
- LLAppearanceMgr::instance().updateCOF(mLookID);
- }
}
void LLPanelOutfitEdit::updateLookInfo()
@@ -483,7 +490,7 @@ void LLPanelOutfitEdit::updateLookInfo()
mLookContents->clearRows();
uuid_vec_t folders;
- folders.push_back(mLookID);
+ folders.push_back(mCurrentOutfitID);
mFetchLook->fetch(folders);
if (mFetchLook->isEverythingComplete())
{
@@ -496,28 +503,26 @@ void LLPanelOutfitEdit::updateLookInfo()
}
}
-void LLPanelOutfitEdit::displayLookInfo(const LLInventoryCategory* pLook)
+void LLPanelOutfitEdit::displayCurrentOutfit()
{
- if (!pLook)
- {
- return;
- }
-
if (!getVisible())
{
setVisible(TRUE);
}
- if (mLookID != pLook->getUUID())
+ mCurrentOutfitID = LLAppearanceMgr::getInstance()->getCOF();
+
+ std::string current_outfit_name;
+ if (LLAppearanceMgr::getInstance()->getBaseOutfitName(current_outfit_name))
{
- mLookID = pLook->getUUID();
- mLookName->setText(pLook->getName());
- updateLookInfo();
+ mCurrentOutfitName->setText(current_outfit_name);
+ }
+ else
+ {
+ mCurrentOutfitName->setText(getString("No Outfit"));
}
-}
-void LLPanelOutfitEdit::reset()
-{
- mLookID.setNull();
+ updateLookInfo();
}
+