summaryrefslogtreecommitdiff
path: root/indra/newview/llsidepanelappearance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llsidepanelappearance.cpp')
-rw-r--r--indra/newview/llsidepanelappearance.cpp54
1 files changed, 38 insertions, 16 deletions
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index 1999f14828..16729f045a 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -183,25 +183,38 @@ void LLSidepanelAppearance::onOpen(const LLSD& key)
void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility)
{
- updateToVisibility(new_visibility);
+ LLSD visibility;
+ visibility["visible"] = new_visibility.asBoolean();
+ visibility["reset_accordion"] = false;
+ updateToVisibility(visibility);
}
void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility)
{
- if (new_visibility.asBoolean())
+ if (new_visibility["visible"].asBoolean())
{
- bool is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible();
- bool is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible();
+ const BOOL is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible();
+ const BOOL is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible();
if (is_outfit_edit_visible || is_wearable_edit_visible)
{
- if (!gAgentCamera.cameraCustomizeAvatar() && gSavedSettings.getBOOL("AppearanceCameraMovement"))
+ const LLWearable *wearable_ptr = mEditWearable->getWearable();
+ if (!wearable_ptr)
+ {
+ llwarns << "Visibility change to invalid wearable" << llendl;
+ return;
+ }
+ // Disable camera switch is currently just for WT_PHYSICS type since we don't want to freeze the avatar
+ // when editing its physics.
+ const BOOL disable_camera_motion = LLWearableType::getDisableCameraSwitch(wearable_ptr->getType());
+ if (!gAgentCamera.cameraCustomizeAvatar() &&
+ !disable_camera_motion &&
+ gSavedSettings.getBOOL("AppearanceCameraMovement"))
{
gAgentCamera.changeCameraToCustomizeAvatar();
}
if (is_wearable_edit_visible)
{
- LLWearable *wearable_ptr = mEditWearable->getWearable();
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
@@ -209,7 +222,7 @@ void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility)
}
}
- if (is_outfit_edit_visible)
+ if (is_outfit_edit_visible && new_visibility["reset_accordion"].asBoolean())
{
mOutfitEdit->resetAccordionState();
}
@@ -286,7 +299,7 @@ void LLSidepanelAppearance::showOutfitsInventoryPanel()
{
toggleWearableEditPanel(FALSE);
toggleOutfitEditPanel(FALSE);
- togglMyOutfitsPanel(TRUE);
+ toggleMyOutfitsPanel(TRUE);
}
void LLSidepanelAppearance::showOutfitEditPanel()
@@ -302,19 +315,28 @@ void LLSidepanelAppearance::showOutfitEditPanel()
mOutfitEdit->resetAccordionState();
}
- togglMyOutfitsPanel(FALSE);
+ // 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
+ // otherwise this would trigger the camera focus mode.
+ if (mEditWearable != NULL && mEditWearable->getVisible() && !gAgentCamera.cameraCustomizeAvatar())
+ {
+ showOutfitsInventoryPanel();
+ return;
+ }
+
+ toggleMyOutfitsPanel(FALSE);
toggleWearableEditPanel(FALSE, NULL, TRUE); // don't switch out of edit appearance mode
toggleOutfitEditPanel(TRUE);
}
-void LLSidepanelAppearance::showWearableEditPanel(LLWearable *wearable /* = NULL*/)
+void LLSidepanelAppearance::showWearableEditPanel(LLWearable *wearable /* = NULL*/, BOOL disable_camera_switch)
{
- togglMyOutfitsPanel(FALSE);
+ toggleMyOutfitsPanel(FALSE);
toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode
- toggleWearableEditPanel(TRUE, wearable);
+ toggleWearableEditPanel(TRUE, wearable, disable_camera_switch);
}
-void LLSidepanelAppearance::togglMyOutfitsPanel(BOOL visible)
+void LLSidepanelAppearance::toggleMyOutfitsPanel(BOOL visible)
{
if (!mPanelOutfitsInventory || mPanelOutfitsInventory->getVisible() == visible)
{
@@ -387,7 +409,7 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *we
{
gAgentCamera.changeCameraToCustomizeAvatar();
}
- mEditWearable->setWearable(wearable);
+ mEditWearable->setWearable(wearable, disable_camera_switch);
mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency
}
else
@@ -431,14 +453,14 @@ void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name)
}
//static
-void LLSidepanelAppearance::editWearable(LLWearable *wearable, LLView *data)
+void LLSidepanelAppearance::editWearable(LLWearable *wearable, LLView *data, BOOL disable_camera_switch)
{
LLSideTray::getInstance()->showPanel("sidepanel_appearance");
LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(data);
if (panel)
{
- panel->showWearableEditPanel(wearable);
+ panel->showWearableEditPanel(wearable, disable_camera_switch);
}
}