From 8d94e2af12aaf3cdb170a0b36e9ae36e91a2365d Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 26 Nov 2019 17:36:14 +0200 Subject: SL-12186 Update camera controls if preset was selected from the pulldown menu --- indra/newview/llfloatercamera.cpp | 45 +++++++++++++--------- indra/newview/llpanelpresetscamerapulldown.cpp | 3 +- .../skins/default/xui/en/floater_camera.xml | 6 +-- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index c7eb60e186..d3c1ba764b 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -524,7 +524,11 @@ void LLFloaterCamera::onClickCameraItem(const LLSD& param) { LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance(); if (camera_floater) - camera_floater->switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); + { + camera_floater->switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); + camera_floater->updateItemsSelection(); + camera_floater->fromFreeToPresets(); + } } else { @@ -533,13 +537,6 @@ void LLFloaterCamera::onClickCameraItem(const LLSD& param) camera_floater->switchMode(CAMERA_CTRL_MODE_PAN); switchToPreset(name); } - - LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance(); - if (camera_floater) - { - camera_floater->updateItemsSelection(); - camera_floater->fromFreeToPresets(); - } } /*static*/ @@ -547,20 +544,33 @@ void LLFloaterCamera::switchToPreset(const std::string& name) { sFreeCamera = false; clear_camera_tool(); - if ("rear_view" == name) + if (PRESETS_REAR_VIEW == name) { gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); - LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_REAR_VIEW); } - else if ("group_view" == name) + else if (PRESETS_SIDE_VIEW == name) { gAgentCamera.switchCameraPreset(CAMERA_PRESET_GROUP_VIEW); - LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_SIDE_VIEW); } - else if ("front_view" == name) + else if (PRESETS_FRONT_VIEW == name) { gAgentCamera.switchCameraPreset(CAMERA_PRESET_FRONT_VIEW); - LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_FRONT_VIEW); + } + else + { + gAgentCamera.switchCameraPreset(CAMERA_PRESET_CUSTOM); + } + + if (gSavedSettings.getString("PresetCameraActive") != name) + { + LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, name); + } + + LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance(); + if (camera_floater) + { + camera_floater->updateItemsSelection(); + camera_floater->fromFreeToPresets(); } } @@ -609,11 +619,8 @@ void LLFloaterCamera::onSavePreset() void LLFloaterCamera::onCustomPresetSelected() { std::string selected_preset = mPresetCombo->getSelectedItemLabel(); - if (gSavedSettings.getString("PresetCameraActive") != selected_preset && getString("inactive_combo_text") != selected_preset) + if (getString("inactive_combo_text") != selected_preset) { - gAgentCamera.switchCameraPreset(CAMERA_PRESET_CUSTOM); - updateItemsSelection(); - fromFreeToPresets(); - LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, selected_preset); + switchToPreset(selected_preset); } } diff --git a/indra/newview/llpanelpresetscamerapulldown.cpp b/indra/newview/llpanelpresetscamerapulldown.cpp index 1ac105e1c8..ae3d182f09 100644 --- a/indra/newview/llpanelpresetscamerapulldown.cpp +++ b/indra/newview/llpanelpresetscamerapulldown.cpp @@ -33,6 +33,7 @@ #include "llbutton.h" #include "lltabcontainer.h" +#include "llfloatercamera.h" #include "llfloaterreg.h" #include "llfloaterpreference.h" #include "llpresetsmanager.h" @@ -185,7 +186,7 @@ void LLPanelPresetsCameraPulldown::onRowClick(const LLSD& user_data) std::string name = item->getColumn(1)->getValue().asString(); LL_DEBUGS() << "selected '" << name << "'" << LL_ENDL; - LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, name); + LLFloaterCamera::switchToPreset(name); setVisible(FALSE); } diff --git a/indra/newview/skins/default/xui/en/floater_camera.xml b/indra/newview/skins/default/xui/en/floater_camera.xml index 9408e68c2d..60461c5743 100644 --- a/indra/newview/skins/default/xui/en/floater_camera.xml +++ b/indra/newview/skins/default/xui/en/floater_camera.xml @@ -151,7 +151,7 @@ width="30"> + parameter="Front View" /> + parameter="Side View" /> + parameter="Rear View" />