summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2009-11-19 12:06:26 -0500
committerLoren Shih <seraph@lindenlab.com>2009-11-19 12:06:26 -0500
commitd974ad39347e75241f8b6ccc9fce8caf835c453e (patch)
tree1bdd7b03dc51ad294f71573df931fff70f1d180a
parent5b2c91598dffe7d5c9d676dd866f438d3adb9989 (diff)
EXT-2562 : Somehow show cnotents of what I'm wearing
Added appearanceSP button to toggle folder closed/open state. Also fixed up some bugs with current outfit title placement in appearanceSP.xml Also added a generic call for getting the current outfit folder link
-rw-r--r--indra/newview/llappearancemgr.cpp43
-rw-r--r--indra/newview/llappearancemgr.h3
-rw-r--r--indra/newview/llsidepanelappearance.cpp76
-rw-r--r--indra/newview/llsidepanelappearance.h7
-rw-r--r--indra/newview/skins/default/xui/en/sidepanel_appearance.xml35
5 files changed, 112 insertions, 52 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index d6265a85f6..1050deaa27 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -363,6 +363,35 @@ LLUUID LLAppearanceManager::getCOF()
return gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
}
+
+const LLViewerInventoryItem* LLAppearanceManager::getCurrentOutfitLink()
+{
+ const LLUUID& current_outfit_cat = getCOF();
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+ // Can't search on FT_OUTFIT since links to categories return FT_CATEGORY for type since they don't
+ // return preferred type.
+ LLIsType is_category( LLAssetType::AT_CATEGORY );
+ gInventory.collectDescendentsIf(current_outfit_cat,
+ cat_array,
+ item_array,
+ false,
+ is_category,
+ false);
+ for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin();
+ iter != item_array.end();
+ iter++)
+ {
+ const LLViewerInventoryItem *item = (*iter);
+ const LLViewerInventoryCategory *cat = item->getLinkedCategory();
+ if (cat && cat->getPreferredType() == LLFolderType::FT_OUTFIT)
+ {
+ return item;
+ }
+ }
+ return NULL;
+}
+
// Update appearance from outfit folder.
void LLAppearanceManager::changeOutfit(bool proceed, const LLUUID& category, bool append)
{
@@ -531,20 +560,28 @@ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append)
linkAll(cof, gest_items, link_waiter);
// Add link to outfit if category is an outfit.
- LLViewerInventoryCategory* catp = gInventory.getCategory(category);
+ const LLViewerInventoryCategory* catp = gInventory.getCategory(category);
+ LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance *>(LLSideTray::getInstance()->getPanel("sidepanel_appearance"));
+
if (!append && catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT)
{
link_inventory_item(gAgent.getID(), category, cof, catp->getName(),
LLAssetType::AT_LINK_FOLDER, link_waiter);
// Update the current outfit name of the appearance sidepanel.
- LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance *>(LLSideTray::getInstance()->getPanel("sidepanel_appearance"));
if (panel_appearance)
{
panel_appearance->refreshCurrentOutfitName(catp->getName());
}
}
-
+ else
+ {
+ // Update the current outfit name of the appearance sidepanel.
+ if (panel_appearance)
+ {
+ panel_appearance->refreshCurrentOutfitName();
+ }
+ }
}
void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder, bool append)
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 5daa6d067b..7038d1a35b 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -61,6 +61,9 @@ public:
// Find the Current Outfit folder.
LLUUID getCOF();
+ // Finds the folder link to the currently worn outfit
+ const LLViewerInventoryItem *getCurrentOutfitLink();
+
void updateAgentWearables(LLWearableHoldingPattern* holder, bool append);
// For debugging - could be moved elsewhere.
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index aeab3e2876..0f8e86cb3c 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -34,9 +34,12 @@
#include "llagent.h"
#include "llagentwearables.h"
+#include "llappearancemgr.h"
+#include "llinventorypanel.h"
#include "llfiltereditor.h"
#include "llfloaterreg.h"
#include "llfloaterworldmap.h"
+#include "llfoldervieweventlistener.h"
#include "llpaneleditwearable.h"
#include "llpaneloutfitsinventory.h"
#include "lltextbox.h"
@@ -68,7 +71,7 @@ LLSidepanelAppearance::LLSidepanelAppearance() :
mFilterSubString(LLStringUtil::null),
mFilterEditor(NULL),
mLookInfo(NULL),
- mCurrLookPanel(NULL)
+ mCurrOutfitPanel(NULL)
{
//LLUICtrlFactory::getInstance()->buildPanel(this, "panel_appearance.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder()
mFetchWorn = new LLCurrentlyWornFetchObserver(this);
@@ -81,6 +84,9 @@ LLSidepanelAppearance::~LLSidepanelAppearance()
// virtual
BOOL LLSidepanelAppearance::postBuild()
{
+ mOpenOutfitBtn = getChild<LLButton>("openoutfit_btn");
+ mOpenOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onOpenOutfitButtonClicked, this));
+
mEditAppearanceBtn = getChild<LLButton>("editappearance_btn");
mEditAppearanceBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditAppearanceButtonClicked, this));
@@ -90,11 +96,9 @@ BOOL LLSidepanelAppearance::postBuild()
mEditBtn = getChild<LLButton>("edit_btn");
mEditBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditButtonClicked, this));
- mNewLookBtn = getChild<LLButton>("newlook_btn");
- mNewLookBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onNewOutfitButtonClicked, this));
- mNewLookBtn->setEnabled(false);
-
- mOverflowBtn = getChild<LLButton>("overflow_btn");
+ mNewOutfitBtn = getChild<LLButton>("newlook_btn");
+ mNewOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onNewOutfitButtonClicked, this));
+ mNewOutfitBtn->setEnabled(false);
mFilterEditor = getChild<LLFilterEditor>("Filter");
if (mFilterEditor)
@@ -114,8 +118,6 @@ BOOL LLSidepanelAppearance::postBuild()
back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onBackButtonClicked, this));
}
- // *TODO: Assign the action to an appropriate event.
- // mOverflowBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::toggleMediaPanel, this));
}
mEditWearable = dynamic_cast<LLPanelEditWearable*>(getChild<LLPanel>("panel_edit_wearable"));
@@ -130,7 +132,7 @@ BOOL LLSidepanelAppearance::postBuild()
mCurrentLookName = getChild<LLTextBox>("currentlook_name");
- mCurrLookPanel = getChild<LLPanel>("panel_currentlook");
+ mCurrOutfitPanel = getChild<LLPanel>("panel_currentlook");
return TRUE;
}
@@ -179,6 +181,27 @@ void LLSidepanelAppearance::onWearButtonClicked()
}
}
+void LLSidepanelAppearance::onOpenOutfitButtonClicked()
+{
+ const LLViewerInventoryItem *outfit_link = LLAppearanceManager::getInstance()->getCurrentOutfitLink();
+ if (!outfit_link)
+ return;
+ if (!outfit_link->getIsLinkType())
+ return;
+ LLInventoryPanel *inventory_panel = mPanelOutfitsInventory->getActivePanel();
+ if (inventory_panel)
+ {
+ LLFolderView *folder = inventory_panel->getRootFolder();
+ LLFolderViewItem *outfit_folder = folder->getItemByID(outfit_link->getLinkedUUID());
+ if (outfit_folder)
+ {
+ outfit_folder->setOpen(!outfit_folder->isOpen());
+ folder->setSelectionFromRoot(outfit_folder,TRUE);
+ folder->scrollToShowSelection();
+ }
+ }
+}
+
void LLSidepanelAppearance::onEditAppearanceButtonClicked()
{
if (gAgentWearables.areWearablesLoaded())
@@ -231,9 +254,8 @@ void LLSidepanelAppearance::toggleLookInfoPanel(BOOL visible)
mFilterEditor->setVisible(!visible);
mWearBtn->setVisible(!visible);
mEditBtn->setVisible(!visible);
- mNewLookBtn->setVisible(!visible);
- mOverflowBtn->setVisible(!visible);
- mCurrLookPanel->setVisible(!visible);
+ mNewOutfitBtn->setVisible(!visible);
+ mCurrOutfitPanel->setVisible(!visible);
}
void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *wearable)
@@ -255,7 +277,6 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *we
void LLSidepanelAppearance::updateVerbs()
{
bool is_look_info_visible = mLookInfo->getVisible();
- mOverflowBtn->setEnabled(false);
if (!is_look_info_visible)
{
@@ -274,35 +295,24 @@ void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string name)
{
if (name == "")
{
- const LLUUID current_outfit_cat = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
- LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
- // Can't search on AT_OUTFIT since links to categories return AT_CATEGORY for type since they don't
- // return preferred type.
- LLIsType is_category( LLAssetType::AT_CATEGORY );
- gInventory.collectDescendentsIf(current_outfit_cat,
- cat_array,
- item_array,
- false,
- is_category,
- false);
- for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin();
- iter != item_array.end();
- iter++)
+ const LLViewerInventoryItem *outfit_link = LLAppearanceManager::getInstance()->getCurrentOutfitLink();
+ if (outfit_link)
{
- const LLViewerInventoryItem *item = (*iter);
- const LLViewerInventoryCategory *cat = item->getLinkedCategory();
+ const LLViewerInventoryCategory *cat = outfit_link->getLinkedCategory();
if (cat && cat->getPreferredType() == LLFolderType::FT_OUTFIT)
{
mCurrentLookName->setText(cat->getName());
return;
}
}
- mCurrentLookName->setText(std::string(""));
+ mCurrentLookName->setText(getString("No Outfit"));
+ mOpenOutfitBtn->setEnabled(FALSE);
}
else
{
mCurrentLookName->setText(name);
+ // Can't just call update verbs since the folder link may not have been created yet.
+ mOpenOutfitBtn->setEnabled(TRUE);
}
}
@@ -319,7 +329,7 @@ void LLSidepanelAppearance::editWearable(LLWearable *wearable, void *data)
void LLSidepanelAppearance::fetchInventory()
{
- mNewLookBtn->setEnabled(false);
+ mNewOutfitBtn->setEnabled(false);
LLInventoryFetchObserver::item_ref_t ids;
LLUUID item_id;
for(S32 type = (S32)WT_SHAPE; type < (S32)WT_COUNT; ++type)
@@ -368,5 +378,5 @@ void LLSidepanelAppearance::fetchInventory()
void LLSidepanelAppearance::inventoryFetched()
{
- mNewLookBtn->setEnabled(true);
+ mNewOutfitBtn->setEnabled(true);
}
diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h
index 496a1fef72..b335fd910d 100644
--- a/indra/newview/llsidepanelappearance.h
+++ b/indra/newview/llsidepanelappearance.h
@@ -64,6 +64,7 @@ public:
private:
void onFilterEdit(const std::string& search_string);
+ void onOpenOutfitButtonClicked();
void onEditAppearanceButtonClicked();
void onWearButtonClicked();
void onEditButtonClicked();
@@ -78,12 +79,12 @@ private:
LLPanelLookInfo* mLookInfo;
LLPanelEditWearable* mEditWearable;
+ LLButton* mOpenOutfitBtn;
LLButton* mEditAppearanceBtn;
LLButton* mWearBtn;
LLButton* mEditBtn;
- LLButton* mNewLookBtn;
- LLButton* mOverflowBtn;
- LLPanel* mCurrLookPanel;
+ LLButton* mNewOutfitBtn;
+ LLPanel* mCurrOutfitPanel;
LLTextBox* mCurrentLookName;
diff --git a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
index 2ce156cfda..14530518d8 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
@@ -9,9 +9,9 @@
min_width="240"
name="appearance panel"
width="333">
- <string
- name="looks_tab_title"
- value="Outfits" />
+ <string
+ name="No Outfit"
+ value="No Outfit" />
<panel
left="5" width="320" height="55"
background_visible="true"
@@ -19,25 +19,34 @@
bg_alpha_color="0.2 0.2 0.2 1.0"
name="panel_currentlook"
follows="left|top|right">
+ <button
+ follows="left|right|top"
+ font="SansSerif"
+ top="28" right="-10" width="60" height="20"
+ layout="topleft"
+ label="Edit"
+ name="editappearance_btn"/>
+ <button
+ follows="left|right|top"
+ top="28" left="5" width="25" height="22"
+ image_overlay="Inv_LookFolderOpen"
+ layout="topleft"
+ name="openoutfit_btn"
+ picture_style="true" />
<text
- top="-5" width="200" left="5" height="10" follows="left|right|top"
+ top="10" width="150" left="5" height="15" follows="left|right|top"
+ layout="topleft"
font="SansSerif" text_color="LtGray" word_wrap="true"
mouse_opaque="false" name="currentlook_title">
- Current Outfit
+ Current Outfit:
</text>
<text
- top="-30" left="8" height="10" follows="left|right|top"
+ top="32" width="150" left="32" height="15" follows="left|right|top"
+ layout="topleft"
font="SansSerifBold" text_color="white" word_wrap="true"
mouse_opaque="false" name="currentlook_name" >
MyOutfit
</text>
- <button
- follows="left|right|top"
- font="SansSerif"
- top="28" right="-105" width="60" height="20"
- layout="topleft"
- label="Edit"
- name="editappearance_btn"/>
</panel>
<filter_editor