Skip to content
Snippets Groups Projects
Commit 18ff702a authored by prep@lindenlab.com's avatar prep@lindenlab.com
Browse files

Fix for SH-3591.

parent 8eef31e4
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "llfloaterreg.h" #include "llfloaterreg.h"
#include "llfloatersidepanelcontainer.h" #include "llfloatersidepanelcontainer.h"
#include "llpaneleditwearable.h"
// newview includes // newview includes
#include "llsidetraypanelcontainer.h" #include "llsidetraypanelcontainer.h"
...@@ -72,7 +73,16 @@ void LLFloaterSidePanelContainer::onClickCloseBtn() ...@@ -72,7 +73,16 @@ void LLFloaterSidePanelContainer::onClickCloseBtn()
panel_appearance->showOutfitsInventoryPanel(); panel_appearance->showOutfitsInventoryPanel();
} }
} }
if ( panel_outfit_edit )
{
LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance*>(getPanel("appearance"));
if ( panel_appearance )
{
panel_appearance->getWearable()->onClose();
panel_appearance->showOutfitsInventoryPanel();
}
}
LLFloater::onClickCloseBtn(); LLFloater::onClickCloseBtn();
} }
......
...@@ -856,6 +856,14 @@ void LLPanelEditWearable::draw() ...@@ -856,6 +856,14 @@ void LLPanelEditWearable::draw()
LLPanel::draw(); LLPanel::draw();
} }
void LLPanelEditWearable::onClose()
{
if ( isDirty() )
{
revertChanges();
}
}
void LLPanelEditWearable::setVisible(BOOL visible) void LLPanelEditWearable::setVisible(BOOL visible)
{ {
if (!visible) if (!visible)
......
...@@ -54,6 +54,7 @@ class LLPanelEditWearable : public LLPanel ...@@ -54,6 +54,7 @@ class LLPanelEditWearable : public LLPanel
/*virtual*/ BOOL postBuild(); /*virtual*/ BOOL postBuild();
/*virtual*/ BOOL isDirty() const; // LLUICtrl /*virtual*/ BOOL isDirty() const; // LLUICtrl
/*virtual*/ void draw(); /*virtual*/ void draw();
void onClose();
// changes camera angle to default for selected subpart // changes camera angle to default for selected subpart
void changeCamera(U8 subpart); void changeCamera(U8 subpart);
......
/** /**
* @file llsidepanelappearance.cpp * @file llsidepanelappearance.cpp
* @brief Side Bar "Appearance" panel * @brief Side Bar "Appearance" panel
* *
* $LicenseInfo:firstyear=2009&license=viewerlgpl$ * $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code * Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc. * Copyright (C) 2010, Linden Research, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; * License as published by the Free Software Foundation;
* version 2.1 of the License only. * version 2.1 of the License only.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#include "llviewerprecompiledheaders.h" #include "llviewerprecompiledheaders.h"
#include "llsidepanelappearance.h" #include "llsidepanelappearance.h"
#include "llaccordionctrltab.h" #include "llaccordionctrltab.h"
#include "llagent.h" #include "llagent.h"
#include "llagentcamera.h" #include "llagentcamera.h"
#include "llagentwearables.h" #include "llagentwearables.h"
#include "llappearancemgr.h" #include "llappearancemgr.h"
#include "llfloatersidepanelcontainer.h" #include "llfloatersidepanelcontainer.h"
#include "llfolderview.h" #include "llfolderview.h"
#include "llinventorypanel.h" #include "llinventorypanel.h"
#include "llfiltereditor.h" #include "llfiltereditor.h"
#include "llfloaterreg.h" #include "llfloaterreg.h"
#include "llfloaterworldmap.h" #include "llfloaterworldmap.h"
#include "llfoldervieweventlistener.h" #include "llfoldervieweventlistener.h"
#include "lloutfitobserver.h" #include "lloutfitobserver.h"
#include "llpaneleditwearable.h" #include "llpaneleditwearable.h"
#include "llpaneloutfitsinventory.h" #include "llpaneloutfitsinventory.h"
#include "lltextbox.h" #include "lltextbox.h"
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llviewerregion.h" #include "llviewerregion.h"
#include "llvoavatarself.h" #include "llvoavatarself.h"
#include "llviewerwearable.h" #include "llviewerwearable.h"
static LLRegisterPanelClassWrapper<LLSidepanelAppearance> t_appearance("sidepanel_appearance"); static LLRegisterPanelClassWrapper<LLSidepanelAppearance> t_appearance("sidepanel_appearance");
class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver
{ {
public: public:
LLCurrentlyWornFetchObserver(const uuid_vec_t &ids, LLCurrentlyWornFetchObserver(const uuid_vec_t &ids,
LLSidepanelAppearance *panel) : LLSidepanelAppearance *panel) :
LLInventoryFetchItemsObserver(ids), LLInventoryFetchItemsObserver(ids),
mPanel(panel) mPanel(panel)
{} {}
~LLCurrentlyWornFetchObserver() {} ~LLCurrentlyWornFetchObserver() {}
virtual void done() virtual void done()
{ {
mPanel->inventoryFetched(); mPanel->inventoryFetched();
gInventory.removeObserver(this); gInventory.removeObserver(this);
delete this; delete this;
} }
private: private:
LLSidepanelAppearance *mPanel; LLSidepanelAppearance *mPanel;
}; };
LLSidepanelAppearance::LLSidepanelAppearance() : LLSidepanelAppearance::LLSidepanelAppearance() :
LLPanel(), LLPanel(),
mFilterSubString(LLStringUtil::null), mFilterSubString(LLStringUtil::null),
mFilterEditor(NULL), mFilterEditor(NULL),
mOutfitEdit(NULL), mOutfitEdit(NULL),
mCurrOutfitPanel(NULL), mCurrOutfitPanel(NULL),
mOpened(false) mOpened(false)
{ {
LLOutfitObserver& outfit_observer = LLOutfitObserver::instance(); LLOutfitObserver& outfit_observer = LLOutfitObserver::instance();
outfit_observer.addBOFReplacedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); outfit_observer.addBOFReplacedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, ""));
outfit_observer.addBOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); outfit_observer.addBOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, ""));
outfit_observer.addCOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); outfit_observer.addCOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, ""));
gAgentWearables.addLoadingStartedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, true)); gAgentWearables.addLoadingStartedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, true));
gAgentWearables.addLoadedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, false)); gAgentWearables.addLoadedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, false));
} }
LLSidepanelAppearance::~LLSidepanelAppearance() LLSidepanelAppearance::~LLSidepanelAppearance()
{ {
} }
// virtual // virtual
BOOL LLSidepanelAppearance::postBuild() BOOL LLSidepanelAppearance::postBuild()
{ {
mOpenOutfitBtn = getChild<LLButton>("openoutfit_btn"); mOpenOutfitBtn = getChild<LLButton>("openoutfit_btn");
mOpenOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onOpenOutfitButtonClicked, this)); mOpenOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onOpenOutfitButtonClicked, this));
mEditAppearanceBtn = getChild<LLButton>("editappearance_btn"); mEditAppearanceBtn = getChild<LLButton>("editappearance_btn");
mEditAppearanceBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditAppearanceButtonClicked, this)); mEditAppearanceBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditAppearanceButtonClicked, this));
childSetAction("edit_outfit_btn", boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); childSetAction("edit_outfit_btn", boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this));
mNewOutfitBtn = getChild<LLButton>("newlook_btn"); mNewOutfitBtn = getChild<LLButton>("newlook_btn");
mNewOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onNewOutfitButtonClicked, this)); mNewOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onNewOutfitButtonClicked, this));
mNewOutfitBtn->setEnabled(false); mNewOutfitBtn->setEnabled(false);
mFilterEditor = getChild<LLFilterEditor>("Filter"); mFilterEditor = getChild<LLFilterEditor>("Filter");
if (mFilterEditor) if (mFilterEditor)
{ {
mFilterEditor->setCommitCallback(boost::bind(&LLSidepanelAppearance::onFilterEdit, this, _2)); mFilterEditor->setCommitCallback(boost::bind(&LLSidepanelAppearance::onFilterEdit, this, _2));
} }
mPanelOutfitsInventory = dynamic_cast<LLPanelOutfitsInventory *>(getChild<LLPanel>("panel_outfits_inventory")); mPanelOutfitsInventory = dynamic_cast<LLPanelOutfitsInventory *>(getChild<LLPanel>("panel_outfits_inventory"));
mOutfitEdit = dynamic_cast<LLPanelOutfitEdit*>(getChild<LLPanel>("panel_outfit_edit")); mOutfitEdit = dynamic_cast<LLPanelOutfitEdit*>(getChild<LLPanel>("panel_outfit_edit"));
if (mOutfitEdit) if (mOutfitEdit)
{ {
LLButton* back_btn = mOutfitEdit->getChild<LLButton>("back_btn"); LLButton* back_btn = mOutfitEdit->getChild<LLButton>("back_btn");
if (back_btn) if (back_btn)
{ {
back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitsInventoryPanel, this)); back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitsInventoryPanel, this));
} }
} }
mEditWearable = dynamic_cast<LLPanelEditWearable*>(getChild<LLPanel>("panel_edit_wearable")); mEditWearable = dynamic_cast<LLPanelEditWearable*>(getChild<LLPanel>("panel_edit_wearable"));
if (mEditWearable) if (mEditWearable)
{ {
LLButton* edit_wearable_back_btn = mEditWearable->getChild<LLButton>("back_btn"); LLButton* edit_wearable_back_btn = mEditWearable->getChild<LLButton>("back_btn");
if (edit_wearable_back_btn) if (edit_wearable_back_btn)
{ {
edit_wearable_back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); edit_wearable_back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this));
} }
} }
mCurrentLookName = getChild<LLTextBox>("currentlook_name"); mCurrentLookName = getChild<LLTextBox>("currentlook_name");
mOutfitStatus = getChild<LLTextBox>("currentlook_status"); mOutfitStatus = getChild<LLTextBox>("currentlook_status");
mCurrOutfitPanel = getChild<LLPanel>("panel_currentlook"); mCurrOutfitPanel = getChild<LLPanel>("panel_currentlook");
setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChange,this,_2)); setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChange,this,_2));
return TRUE; return TRUE;
} }
// virtual // virtual
void LLSidepanelAppearance::onOpen(const LLSD& key) void LLSidepanelAppearance::onOpen(const LLSD& key)
{ {
if (!key.has("type")) if (!key.has("type"))
{ {
// No specific panel requested. // No specific panel requested.
// If we're opened for the first time then show My Outfits. // If we're opened for the first time then show My Outfits.
// Else do nothing. // Else do nothing.
if (!mOpened) if (!mOpened)
{ {
showOutfitsInventoryPanel(); showOutfitsInventoryPanel();
} }
} }
else else
{ {
// Switch to the requested panel. // Switch to the requested panel.
std::string type = key["type"].asString(); std::string type = key["type"].asString();
if (type == "my_outfits") if (type == "my_outfits")
{ {
showOutfitsInventoryPanel(); showOutfitsInventoryPanel();
} }
else if (type == "edit_outfit") else if (type == "edit_outfit")
{ {
showOutfitEditPanel(); showOutfitEditPanel();
} }
else if (type == "edit_shape") else if (type == "edit_shape")
{ {
showWearableEditPanel(); showWearableEditPanel();
} }
} }
mOpened = true; mOpened = true;
} }
void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility) void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility)
{ {
LLSD visibility; LLSD visibility;
visibility["visible"] = new_visibility.asBoolean(); visibility["visible"] = new_visibility.asBoolean();
visibility["reset_accordion"] = false; visibility["reset_accordion"] = false;
updateToVisibility(visibility); updateToVisibility(visibility);
} }
void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility) void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility)
{ {
if (new_visibility["visible"].asBoolean()) if (new_visibility["visible"].asBoolean())
{ {
const BOOL is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible(); const BOOL is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible();
const BOOL is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible(); const BOOL is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible();
if (is_outfit_edit_visible || is_wearable_edit_visible) if (is_outfit_edit_visible || is_wearable_edit_visible)
{ {
const LLViewerWearable *wearable_ptr = mEditWearable->getWearable(); const LLViewerWearable *wearable_ptr = mEditWearable->getWearable();
if (!wearable_ptr) if (!wearable_ptr)
{ {
llwarns << "Visibility change to invalid wearable" << llendl; llwarns << "Visibility change to invalid wearable" << llendl;
return; return;
} }
// Disable camera switch is currently just for WT_PHYSICS type since we don't want to freeze the avatar // Disable camera switch is currently just for WT_PHYSICS type since we don't want to freeze the avatar
// when editing its physics. // when editing its physics.
if (!gAgentCamera.cameraCustomizeAvatar()) if (!gAgentCamera.cameraCustomizeAvatar())
{ {
LLVOAvatarSelf::onCustomizeStart(LLWearableType::getDisableCameraSwitch(wearable_ptr->getType())); LLVOAvatarSelf::onCustomizeStart(LLWearableType::getDisableCameraSwitch(wearable_ptr->getType()));
} }
if (is_wearable_edit_visible) if (is_wearable_edit_visible)
{ {
if (gAgentWearables.getWearableIndex(wearable_ptr) == LLAgentWearables::MAX_CLOTHING_PER_TYPE) if (gAgentWearables.getWearableIndex(wearable_ptr) == LLAgentWearables::MAX_CLOTHING_PER_TYPE)
{ {
// we're no longer wearing the wearable we were last editing, switch back to outfit editor // we're no longer wearing the wearable we were last editing, switch back to outfit editor
showOutfitEditPanel(); showOutfitEditPanel();
} }
} }
if (is_outfit_edit_visible && new_visibility["reset_accordion"].asBoolean()) if (is_outfit_edit_visible && new_visibility["reset_accordion"].asBoolean())
{ {
mOutfitEdit->resetAccordionState(); mOutfitEdit->resetAccordionState();
} }
} }
} }
else else
{ {
if (gAgentCamera.cameraCustomizeAvatar() && gSavedSettings.getBOOL("AppearanceCameraMovement")) if (gAgentCamera.cameraCustomizeAvatar() && gSavedSettings.getBOOL("AppearanceCameraMovement"))
{ {
gAgentCamera.changeCameraToDefault(); gAgentCamera.changeCameraToDefault();
gAgentCamera.resetView(); gAgentCamera.resetView();
} }
}
if ( mEditWearable->getVisible() ) }
{
mEditWearable->revertChanges(); void LLSidepanelAppearance::onFilterEdit(const std::string& search_string)
} {
} if (mFilterSubString != search_string)
} {
mFilterSubString = search_string;
void LLSidepanelAppearance::onFilterEdit(const std::string& search_string)
{ // Searches are case-insensitive
if (mFilterSubString != search_string) // but we don't convert the typed string to upper-case so that it can be fed to the web search as-is.
{
mFilterSubString = search_string; mPanelOutfitsInventory->onSearchEdit(mFilterSubString);
}
// Searches are case-insensitive }
// but we don't convert the typed string to upper-case so that it can be fed to the web search as-is.
void LLSidepanelAppearance::onOpenOutfitButtonClicked()
mPanelOutfitsInventory->onSearchEdit(mFilterSubString); {
} const LLViewerInventoryItem *outfit_link = LLAppearanceMgr::getInstance()->getBaseOutfitLink();
} if (!outfit_link)
return;
void LLSidepanelAppearance::onOpenOutfitButtonClicked() if (!outfit_link->getIsLinkType())
{ return;
const LLViewerInventoryItem *outfit_link = LLAppearanceMgr::getInstance()->getBaseOutfitLink();
if (!outfit_link) LLAccordionCtrlTab* tab_outfits = mPanelOutfitsInventory->findChild<LLAccordionCtrlTab>("tab_outfits");
return; if (tab_outfits)
if (!outfit_link->getIsLinkType()) {
return; tab_outfits->changeOpenClose(FALSE);
LLInventoryPanel *inventory_panel = tab_outfits->findChild<LLInventoryPanel>("outfitslist_tab");
LLAccordionCtrlTab* tab_outfits = mPanelOutfitsInventory->findChild<LLAccordionCtrlTab>("tab_outfits"); if (inventory_panel)
if (tab_outfits) {
{ LLFolderView* root = inventory_panel->getRootFolder();
tab_outfits->changeOpenClose(FALSE); LLFolderViewItem *outfit_folder = root->getItemByID(outfit_link->getLinkedUUID());
LLInventoryPanel *inventory_panel = tab_outfits->findChild<LLInventoryPanel>("outfitslist_tab"); if (outfit_folder)
if (inventory_panel) {
{ outfit_folder->setOpen(!outfit_folder->isOpen());
LLFolderView* root = inventory_panel->getRootFolder(); root->setSelectionFromRoot(outfit_folder,TRUE);
LLFolderViewItem *outfit_folder = root->getItemByID(outfit_link->getLinkedUUID()); root->scrollToShowSelection();
if (outfit_folder) }
{ }
outfit_folder->setOpen(!outfit_folder->isOpen()); }
root->setSelectionFromRoot(outfit_folder,TRUE); }
root->scrollToShowSelection();
} // *TODO: obsolete?
} void LLSidepanelAppearance::onEditAppearanceButtonClicked()
} {
} if (gAgentWearables.areWearablesLoaded())
{
// *TODO: obsolete? LLVOAvatarSelf::onCustomizeStart();
void LLSidepanelAppearance::onEditAppearanceButtonClicked() }
{ }
if (gAgentWearables.areWearablesLoaded())
{ void LLSidepanelAppearance::onNewOutfitButtonClicked()
LLVOAvatarSelf::onCustomizeStart(); {
} if (!mOutfitEdit->getVisible())
} {
mPanelOutfitsInventory->onSave();
void LLSidepanelAppearance::onNewOutfitButtonClicked() }
{ }
if (!mOutfitEdit->getVisible())
{ void LLSidepanelAppearance::showOutfitsInventoryPanel()
mPanelOutfitsInventory->onSave(); {
} toggleWearableEditPanel(FALSE);
} toggleOutfitEditPanel(FALSE);
toggleMyOutfitsPanel(TRUE);
void LLSidepanelAppearance::showOutfitsInventoryPanel() }
{
toggleWearableEditPanel(FALSE); void LLSidepanelAppearance::showOutfitEditPanel()
toggleOutfitEditPanel(FALSE); {
toggleMyOutfitsPanel(TRUE); if (mOutfitEdit && mOutfitEdit->getVisible()) return;
}
// Accordion's state must be reset in all cases except the one when user
void LLSidepanelAppearance::showOutfitEditPanel() // is returning back to the mOutfitEdit panel from the mEditWearable panel.
{ // The simplest way to control this is to check the visibility state of the mEditWearable
if (mOutfitEdit && mOutfitEdit->getVisible()) return; // BEFORE it is changed by the call to the toggleWearableEditPanel(FALSE, NULL, TRUE).
if (mEditWearable != NULL && !mEditWearable->getVisible() && mOutfitEdit != NULL)
// Accordion's state must be reset in all cases except the one when user {
// is returning back to the mOutfitEdit panel from the mEditWearable panel. mOutfitEdit->resetAccordionState();
// The simplest way to control this is to check the visibility state of the mEditWearable }
// BEFORE it is changed by the call to the toggleWearableEditPanel(FALSE, NULL, TRUE).
if (mEditWearable != NULL && !mEditWearable->getVisible() && mOutfitEdit != NULL) // If we're exiting the edit wearable view, and the camera was not focused on the avatar
{ // (e.g. such as if we were editing a physics param), then skip the outfits edit mode since
mOutfitEdit->resetAccordionState(); // otherwise this would trigger the camera focus mode.
} if (mEditWearable != NULL && mEditWearable->getVisible() && !gAgentCamera.cameraCustomizeAvatar())
{
// If we're exiting the edit wearable view, and the camera was not focused on the avatar showOutfitsInventoryPanel();
// (e.g. such as if we were editing a physics param), then skip the outfits edit mode since return;
// otherwise this would trigger the camera focus mode. }
if (mEditWearable != NULL && mEditWearable->getVisible() && !gAgentCamera.cameraCustomizeAvatar())
{ toggleMyOutfitsPanel(FALSE);
showOutfitsInventoryPanel(); toggleWearableEditPanel(FALSE, NULL, TRUE); // don't switch out of edit appearance mode
return; toggleOutfitEditPanel(TRUE);
} }
toggleMyOutfitsPanel(FALSE); void LLSidepanelAppearance::showWearableEditPanel(LLViewerWearable *wearable /* = NULL*/, BOOL disable_camera_switch)
toggleWearableEditPanel(FALSE, NULL, TRUE); // don't switch out of edit appearance mode {
toggleOutfitEditPanel(TRUE); toggleMyOutfitsPanel(FALSE);
} toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode
toggleWearableEditPanel(TRUE, wearable, disable_camera_switch);
void LLSidepanelAppearance::showWearableEditPanel(LLViewerWearable *wearable /* = NULL*/, BOOL disable_camera_switch) }
{
toggleMyOutfitsPanel(FALSE); void LLSidepanelAppearance::toggleMyOutfitsPanel(BOOL visible)
toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode {
toggleWearableEditPanel(TRUE, wearable, disable_camera_switch); if (!mPanelOutfitsInventory || mPanelOutfitsInventory->getVisible() == visible)
} {
// visibility isn't changing, hence nothing to do
void LLSidepanelAppearance::toggleMyOutfitsPanel(BOOL visible) return;
{ }
if (!mPanelOutfitsInventory || mPanelOutfitsInventory->getVisible() == visible)
{ mPanelOutfitsInventory->setVisible(visible);
// visibility isn't changing, hence nothing to do
return; // *TODO: Move these controls to panel_outfits_inventory.xml
} // so that we don't need to toggle them explicitly.
mFilterEditor->setVisible(visible);
mPanelOutfitsInventory->setVisible(visible); mNewOutfitBtn->setVisible(visible);
mCurrOutfitPanel->setVisible(visible);
// *TODO: Move these controls to panel_outfits_inventory.xml
// so that we don't need to toggle them explicitly. if (visible)
mFilterEditor->setVisible(visible); {
mNewOutfitBtn->setVisible(visible); mPanelOutfitsInventory->onOpen(LLSD());
mCurrOutfitPanel->setVisible(visible); }
}
if (visible)
{ void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch)
mPanelOutfitsInventory->onOpen(LLSD()); {
} if (!mOutfitEdit || mOutfitEdit->getVisible() == visible)
} {
// visibility isn't changing, hence nothing to do
void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch) return;
{ }
if (!mOutfitEdit || mOutfitEdit->getVisible() == visible)
{ mOutfitEdit->setVisible(visible);
// visibility isn't changing, hence nothing to do
return; if (visible)
} {
mOutfitEdit->onOpen(LLSD());
mOutfitEdit->setVisible(visible); LLVOAvatarSelf::onCustomizeStart(disable_camera_switch);
}
if (visible) else
{ {
mOutfitEdit->onOpen(LLSD()); if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization.
LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); {
} LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch);
else }
{ }
if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. }
{
LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearable *wearable, BOOL disable_camera_switch)
} {
} if (!mEditWearable || mEditWearable->getVisible() == visible)
} {
// visibility isn't changing, hence nothing to do
void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearable *wearable, BOOL disable_camera_switch) return;
{ }
if (!mEditWearable || mEditWearable->getVisible() == visible)
{ if (!wearable)
// visibility isn't changing, hence nothing to do {
return; wearable = gAgentWearables.getViewerWearable(LLWearableType::WT_SHAPE, 0);
} }
if (!wearable)
if (!wearable) {
{ return;
wearable = gAgentWearables.getViewerWearable(LLWearableType::WT_SHAPE, 0); }
}
if (!wearable) // Toggle panel visibility.
{ mEditWearable->setVisible(visible);
return;
} if (visible)
{
// Toggle panel visibility. LLVOAvatarSelf::onCustomizeStart(disable_camera_switch);
mEditWearable->setVisible(visible); mEditWearable->setWearable(wearable, disable_camera_switch);
mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency
if (visible) }
{ else
LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); {
mEditWearable->setWearable(wearable, disable_camera_switch); // Save changes if closing.
mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency mEditWearable->saveChanges();
} if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization.
else {
{ LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch);
// Save changes if closing. }
mEditWearable->saveChanges(); }
if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. }
{
LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name)
} {
} // Set current outfit status (wearing/unsaved).
} bool dirty = LLAppearanceMgr::getInstance()->isOutfitDirty();
std::string cof_status_str = getString(dirty ? "Unsaved Changes" : "Now Wearing");
void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) mOutfitStatus->setText(cof_status_str);
{
// Set current outfit status (wearing/unsaved). if (name == "")
bool dirty = LLAppearanceMgr::getInstance()->isOutfitDirty(); {
std::string cof_status_str = getString(dirty ? "Unsaved Changes" : "Now Wearing"); std::string outfit_name;
mOutfitStatus->setText(cof_status_str); if (LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name))
{
if (name == "") mCurrentLookName->setText(outfit_name);
{ return;
std::string outfit_name; }
if (LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name))
{ std::string string_name = gAgentWearables.isCOFChangeInProgress() ? "Changing outfits" : "No Outfit";
mCurrentLookName->setText(outfit_name); mCurrentLookName->setText(getString(string_name));
return; mOpenOutfitBtn->setEnabled(FALSE);
} }
else
std::string string_name = gAgentWearables.isCOFChangeInProgress() ? "Changing outfits" : "No Outfit"; {
mCurrentLookName->setText(getString(string_name)); mCurrentLookName->setText(name);
mOpenOutfitBtn->setEnabled(FALSE); // Can't just call update verbs since the folder link may not have been created yet.
} mOpenOutfitBtn->setEnabled(TRUE);
else }
{ }
mCurrentLookName->setText(name);
// Can't just call update verbs since the folder link may not have been created yet. //static
mOpenOutfitBtn->setEnabled(TRUE); void LLSidepanelAppearance::editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch)
} {
} LLFloaterSidePanelContainer::showPanel("appearance", LLSD());
//static LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(data);
void LLSidepanelAppearance::editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch) if (panel)
{ {
LLFloaterSidePanelContainer::showPanel("appearance", LLSD()); panel->showWearableEditPanel(wearable, disable_camera_switch);
}
LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(data); }
if (panel)
{ // Fetch currently worn items and only enable the New Look button after everything's been
panel->showWearableEditPanel(wearable, disable_camera_switch); // fetched. Alternatively, we could stuff this logic into llagentwearables::makeNewOutfitLinks.
} void LLSidepanelAppearance::fetchInventory()
} {
// Fetch currently worn items and only enable the New Look button after everything's been mNewOutfitBtn->setEnabled(false);
// fetched. Alternatively, we could stuff this logic into llagentwearables::makeNewOutfitLinks. uuid_vec_t ids;
void LLSidepanelAppearance::fetchInventory() LLUUID item_id;
{ for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type)
{
mNewOutfitBtn->setEnabled(false); for (U32 index = 0; index < gAgentWearables.getWearableCount((LLWearableType::EType)type); ++index)
uuid_vec_t ids; {
LLUUID item_id; item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type, index);
for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type) if(item_id.notNull())
{ {
for (U32 index = 0; index < gAgentWearables.getWearableCount((LLWearableType::EType)type); ++index) ids.push_back(item_id);
{ }
item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type, index); }
if(item_id.notNull()) }
{
ids.push_back(item_id); if (isAgentAvatarValid())
} {
} for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
} iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
{
if (isAgentAvatarValid()) LLViewerJointAttachment* attachment = iter->second;
{ if (!attachment) continue;
for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter) attachment_iter != attachment->mAttachedObjects.end();
{ ++attachment_iter)
LLViewerJointAttachment* attachment = iter->second; {
if (!attachment) continue; LLViewerObject* attached_object = (*attachment_iter);
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); if (!attached_object) continue;
attachment_iter != attachment->mAttachedObjects.end(); const LLUUID& item_id = attached_object->getAttachmentItemID();
++attachment_iter) if (item_id.isNull()) continue;
{ ids.push_back(item_id);
LLViewerObject* attached_object = (*attachment_iter); }
if (!attached_object) continue; }
const LLUUID& item_id = attached_object->getAttachmentItemID(); }
if (item_id.isNull()) continue;
ids.push_back(item_id); LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(ids, this);
} fetch_worn->startFetch();
} // If no items to be fetched, done will never be triggered.
} // TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition.
if (fetch_worn->isFinished())
LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(ids, this); {
fetch_worn->startFetch(); fetch_worn->done();
// If no items to be fetched, done will never be triggered. }
// TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition. else
if (fetch_worn->isFinished()) {
{ gInventory.addObserver(fetch_worn);
fetch_worn->done(); }
} }
else
{ void LLSidepanelAppearance::inventoryFetched()
gInventory.addObserver(fetch_worn); {
} mNewOutfitBtn->setEnabled(true);
} }
void LLSidepanelAppearance::inventoryFetched() void LLSidepanelAppearance::setWearablesLoading(bool val)
{ {
mNewOutfitBtn->setEnabled(true); getChildView("wearables_loading_indicator")->setVisible( val);
} getChildView("edit_outfit_btn")->setVisible( !val);
void LLSidepanelAppearance::setWearablesLoading(bool val) if (!val)
{ {
getChildView("wearables_loading_indicator")->setVisible( val); // refresh outfit name when COF is already changed.
getChildView("edit_outfit_btn")->setVisible( !val); refreshCurrentOutfitName();
}
if (!val) }
{
// refresh outfit name when COF is already changed. void LLSidepanelAppearance::showDefaultSubpart()
refreshCurrentOutfitName(); {
} if (mEditWearable->getVisible())
} {
mEditWearable->showDefaultSubpart();
void LLSidepanelAppearance::showDefaultSubpart() }
{ }
if (mEditWearable->getVisible())
{ void LLSidepanelAppearance::updateScrollingPanelList()
mEditWearable->showDefaultSubpart(); {
} if (mEditWearable->getVisible())
} {
mEditWearable->updateScrollingPanelList();
void LLSidepanelAppearance::updateScrollingPanelList() }
{ }
if (mEditWearable->getVisible())
{
mEditWearable->updateScrollingPanelList();
}
}
...@@ -47,7 +47,7 @@ class LLSidepanelAppearance : public LLPanel ...@@ -47,7 +47,7 @@ class LLSidepanelAppearance : public LLPanel
virtual ~LLSidepanelAppearance(); virtual ~LLSidepanelAppearance();
/*virtual*/ BOOL postBuild(); /*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onOpen(const LLSD& key);
void refreshCurrentOutfitName(const std::string& name = ""); void refreshCurrentOutfitName(const std::string& name = "");
...@@ -64,6 +64,7 @@ class LLSidepanelAppearance : public LLPanel ...@@ -64,6 +64,7 @@ class LLSidepanelAppearance : public LLPanel
void showDefaultSubpart(); void showDefaultSubpart();
void updateScrollingPanelList(); void updateScrollingPanelList();
void updateToVisibility( const LLSD& new_visibility ); void updateToVisibility( const LLSD& new_visibility );
LLPanelEditWearable* getWearable(){ return mEditWearable; }
private: private:
void onFilterEdit(const std::string& search_string); void onFilterEdit(const std::string& search_string);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment