From 5c4ae5b11a44ab4711f0148cb721f35be9f18100 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 23 Feb 2017 17:50:36 -0500 Subject: STORM-2145 Camera Presets -- some initial work --- indra/llui/llfloater.cpp | 12 +- indra/newview/CMakeLists.txt | 2 + indra/newview/app_settings/settings.xml | 52 ++++ indra/newview/llagentcamera.cpp | 2 + indra/newview/llagentcamera.h | 5 +- indra/newview/llfloatercamera.cpp | 20 ++ indra/newview/llfloatercamera.h | 2 + indra/newview/llfloaterdeleteprefpreset.cpp | 12 +- indra/newview/llfloaterpreference.cpp | 110 +++++++- indra/newview/llfloaterpreference.h | 15 +- indra/newview/llpanelpresetscamerapulldown.cpp | 236 +++++++++++++++++ indra/newview/llpanelpresetscamerapulldown.h | 62 +++++ indra/newview/llpanelpresetspulldown.cpp | 2 +- indra/newview/llpresetsmanager.cpp | 291 +++++++++++++++------ indra/newview/llpresetsmanager.h | 19 +- indra/newview/llstatusbar.cpp | 44 +++- indra/newview/llstatusbar.h | 6 +- .../skins/default/textures/icons/Presets_Icon.png | Bin 366 -> 0 bytes .../default/textures/icons/Presets_Icon_Camera.png | Bin 0 -> 1381 bytes .../textures/icons/Presets_Icon_Graphic.png | Bin 0 -> 366 bytes indra/newview/skins/default/textures/textures.xml | 3 +- .../skins/default/xui/en/floater_camera.xml | 38 ++- .../skins/default/xui/en/floater_preferences.xml | 2 +- .../default/xui/en/panel_preferences_graphics1.xml | 16 +- .../default/xui/en/panel_preferences_move.xml | 123 +++++++-- .../xui/en/panel_presets_camera_pulldown.xml | 69 +++++ .../skins/default/xui/en/panel_status_bar.xml | 14 +- 27 files changed, 1023 insertions(+), 134 deletions(-) create mode 100644 indra/newview/llpanelpresetscamerapulldown.cpp create mode 100644 indra/newview/llpanelpresetscamerapulldown.h delete mode 100644 indra/newview/skins/default/textures/icons/Presets_Icon.png create mode 100644 indra/newview/skins/default/textures/icons/Presets_Icon_Camera.png create mode 100644 indra/newview/skins/default/textures/icons/Presets_Icon_Graphic.png create mode 100644 indra/newview/skins/default/xui/en/panel_presets_camera_pulldown.xml (limited to 'indra') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 4f664a1ccc..8b0e19e4f6 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1839,7 +1839,7 @@ void LLFloater::onClickCloseBtn(bool app_quitting) // virtual void LLFloater::draw() { - const F32 alpha = getCurrentTransparency(); + F32 alpha = getCurrentTransparency(); // draw background if( isBackgroundVisible() ) @@ -1854,6 +1854,16 @@ void LLFloater::draw() LLUIImage* image = NULL; LLColor4 color; LLColor4 overlay_color; + std::string help_topic; + if (this->findHelpTopic(help_topic)) + { + if("camera_floater" == help_topic) + { + alpha = llmin(LLCachedControl(gSavedSettings, "CameraOpacity"), + LLCachedControl(gSavedSettings, "ActiveFloaterTransparency")); + } + } + if (isBackgroundOpaque()) { // NOTE: image may not be set diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index d6d7d2c563..395aa785bf 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -460,6 +460,7 @@ set(viewer_SOURCE_FILES llpanelplaceprofile.cpp llpanelplaces.cpp llpanelplacestab.cpp + llpanelpresetscamerapulldown.cpp llpanelpresetspulldown.cpp llpanelprimmediacontrols.cpp llpanelprofile.cpp @@ -1070,6 +1071,7 @@ set(viewer_HEADER_FILES llpanelplaceprofile.h llpanelplaces.h llpanelplacestab.h + llpanelpresetscamerapulldown.h llpanelpresetspulldown.h llpanelprimmediacontrols.h llpanelprofile.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6621b9e269..541a5d070d 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -15975,6 +15975,58 @@ Value 0 + CameraOpacity + + Comment + Opacity of the Camera Controls floater + Persist + 1 + Type + F32 + Value + 1.0 + + PresetCameraActive + + Comment + Name of currently selected preference + Persist + 1 + Type + String + Value + + + CameraOffsetCustom0 + + Comment + Customized camera offset from avatar + Persist + 1 + Type + Vector3 + Value + + -3.0 + 0.0 + 0.75 + + + FocusOffsetCustom0 + + Comment + Custom focus point offset relative to avatar (x-axis is forward) + Persist + 1 + Type + Vector3D + Value + + 1.0 + 0.0 + 1.0 + + diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index e335eabd1a..1b006a2311 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -208,10 +208,12 @@ void LLAgentCamera::init() mCameraOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("CameraOffsetRearView"); mCameraOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("CameraOffsetFrontView"); mCameraOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("CameraOffsetGroupView"); + mCameraOffsetInitial[CAMERA_PRESET_CUSTOM0] = gSavedSettings.getControl("CameraOffsetCustom0"); mFocusOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("FocusOffsetRearView"); mFocusOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("FocusOffsetFrontView"); mFocusOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("FocusOffsetGroupView"); + mFocusOffsetInitial[CAMERA_PRESET_CUSTOM0] = gSavedSettings.getControl("FocusOffsetCustom0"); mCameraCollidePlane.clearVec(); mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"); diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index ab793ff316..29a1891d82 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -56,7 +56,10 @@ enum ECameraPreset CAMERA_PRESET_FRONT_VIEW, /** "Above and to the left, over the shoulder, pulled back a little on the zoom" */ - CAMERA_PRESET_GROUP_VIEW + CAMERA_PRESET_GROUP_VIEW, + + /** Current view when a preset is saved */ + CAMERA_PRESET_CUSTOM0 }; //------------------------------------------------------------------------ diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 20d650fa37..777963bec5 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -42,6 +42,7 @@ #include "llslider.h" #include "llfirstuse.h" #include "llhints.h" +#include "lltabcontainer.h" static LLDefaultChildRegistry::Register r("panel_camera_item"); @@ -353,6 +354,7 @@ LLFloaterCamera::LLFloaterCamera(const LLSD& val) { LLHints::registerHintTarget("view_popup", getHandle()); mCommitCallbackRegistrar.add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2)); + mCommitCallbackRegistrar.add("Presets.GoViewPrefs", boost::bind(&LLFloaterCamera::onViewButtonClick, this, _2)); } // virtual @@ -376,6 +378,24 @@ BOOL LLFloaterCamera::postBuild() return LLFloater::postBuild(); } +void LLFloaterCamera::onViewButtonClick(const LLSD& user_data) +{ + // bring up the prefs floater + LLFloater* prefsfloater = LLFloaterReg::showInstance("preferences"); + if (prefsfloater) + { + // grab the 'view' panel from the preferences floater and + // bring it the front! + LLTabContainer* tabcontainer = prefsfloater->getChild("pref core"); + LLPanel* graphicspanel = prefsfloater->getChild("move"); + if (tabcontainer && graphicspanel) + { + tabcontainer->selectTabPanel(graphicspanel); + } + } +} + + void LLFloaterCamera::fillFlatlistFromPanel (LLFlatListView* list, LLPanel* panel) { // copying child list and then iterating over a copy, because list itself diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index 4d6d03f22d..3601813bc1 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -91,6 +91,8 @@ private: /*virtual*/ BOOL postBuild(); + void onViewButtonClick(const LLSD& user_data); + ECameraControlMode determineMode(); /* resets to the previous mode */ diff --git a/indra/newview/llfloaterdeleteprefpreset.cpp b/indra/newview/llfloaterdeleteprefpreset.cpp index 7dedbbf984..bd62849b42 100644 --- a/indra/newview/llfloaterdeleteprefpreset.cpp +++ b/indra/newview/llfloaterdeleteprefpreset.cpp @@ -60,13 +60,15 @@ void LLFloaterDeletePrefPreset::onOpen(const LLSD& key) { mSubdirectory = key.asString(); std::string floater_title = getString(std::string("title_") + mSubdirectory); - setTitle(floater_title); LLComboBox* combo = getChild("preset_combo"); - EDefaultOptions option = DEFAULT_HIDE; - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); + bool action; + action = LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); + + LLButton* delete_btn = getChild("delete"); + delete_btn->setEnabled(action); } void LLFloaterDeletePrefPreset::onBtnDelete() @@ -87,12 +89,10 @@ void LLFloaterDeletePrefPreset::onBtnDelete() void LLFloaterDeletePrefPreset::onPresetsListChange() { LLComboBox* combo = getChild("preset_combo"); - LLButton* delete_btn = getChild("delete"); EDefaultOptions option = DEFAULT_HIDE; - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); - delete_btn->setEnabled(0 != combo->getItemCount()); + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); } void LLFloaterDeletePrefPreset::onBtnCancel() diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 100ee5ab72..6e5a773c33 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -768,7 +768,8 @@ void LLFloaterPreference::onOpen(const LLSD& key) saveSettings(); // Make sure there is a default preference file - LLPresetsManager::getInstance()->createMissingDefault(); + LLPresetsManager::getInstance()->createMissingDefault(PRESETS_CAMERA); + LLPresetsManager::getInstance()->createMissingDefault(PRESETS_GRAPHIC); bool started = (LLStartUp::getStartupState() == STATE_STARTED); @@ -776,9 +777,23 @@ void LLFloaterPreference::onOpen(const LLSD& key) LLButton* save_btn = findChild("PrefSaveButton"); LLButton* delete_btn = findChild("PrefDeleteButton"); - load_btn->setEnabled(started); - save_btn->setEnabled(started); - delete_btn->setEnabled(started); + if (load_btn && save_btn && delete_btn) + { + load_btn->setEnabled(started); + save_btn->setEnabled(started); + delete_btn->setEnabled(started); + } + + LLButton* load_camera_btn = findChild("PrefCameraLoadButton"); + LLButton* save_camera_btn = findChild("PrefCameraSaveButton"); + LLButton* delete_camera_btn = findChild("PrefCameraDeleteButton"); + + if (load_camera_btn && save_camera_btn && delete_camera_btn) + { + load_camera_btn->setEnabled(started); + save_camera_btn->setEnabled(started); + delete_camera_btn->setEnabled(started); + } } void LLFloaterPreference::onVertexShaderEnable() @@ -2128,6 +2143,11 @@ void LLFloaterPreference::changed() } +void LLFloaterPreference::saveCameraPreset(std::string& preset) +{ + mSavedCameraPreset = preset; +} + void LLFloaterPreference::saveGraphicsPreset(std::string& preset) { mSavedGraphicsPreset = preset; @@ -2474,6 +2494,86 @@ private: static LLPanelInjector t_pref_graph("panel_preference_graphics"); static LLPanelInjector t_pref_privacy("panel_preference_privacy"); +static LLPanelInjector t_pref_view("panel_preference_view"); + +BOOL LLPanelPreferenceView::postBuild() +{ + setPresetText(); + + LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); + if (presetsMgr) + { + presetsMgr->setPresetListChangeCameraCallback(boost::bind(&LLPanelPreferenceView::onPresetsListChangeCamera, this)); + presetsMgr->createMissingDefault(PRESETS_CAMERA); // a no-op after the first time, but that's ok + } + + return LLPanelPreference::postBuild(); +} + +void LLPanelPreferenceView::onPresetsListChangeCamera() +{ + LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); + if (presetsMgr) + { + presetsMgr->setCameraDirty(false); + } + + setPresetText(); + + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance && !gSavedSettings.getString("PresetCameraActive").empty()) + { + instance->saveSettings(); //make cancel work correctly after changing the preset + } +} + +void LLPanelPreferenceView::draw() +{ + setPresetText(); + LLPanelPreference::draw(); +} + +void LLPanelPreferenceView::setPresetText() +{ + LLTextBox* preset_text = getChild("preset_camera_text"); + + std::string preset_camera_active = gSavedSettings.getString("PresetCameraActive"); + + if (!preset_camera_active.empty() && preset_camera_active != preset_text->getText()) + { + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->saveCameraPreset(preset_camera_active); + } + } + + LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); + if (presetsMgr) + { + if (presetsMgr->isCameraDirty() && !preset_camera_active.empty()) + { + gSavedSettings.setString("PresetCameraActive", ""); + preset_camera_active.clear(); + // This doesn't seem to cause an infinite recursion. This trigger is needed to cause the pulldown + // panel to update. + LLPresetsManager::getInstance()->triggerChangeCameraSignal(); + } + } + + if (!preset_camera_active.empty()) + { + if (preset_camera_active == PRESETS_DEFAULT) + { + preset_camera_active = LLTrans::getString(PRESETS_DEFAULT); + } + preset_text->setText(preset_camera_active); + } + else + { + preset_text->setText(LLTrans::getString("none_paren_cap")); + } +} BOOL LLPanelPreferenceGraphics::postBuild() { @@ -2497,7 +2597,7 @@ BOOL LLPanelPreferenceGraphics::postBuild() LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); presetsMgr->setPresetListChangeCallback(boost::bind(&LLPanelPreferenceGraphics::onPresetsListChange, this)); - presetsMgr->createMissingDefault(); // a no-op after the first time, but that's ok + presetsMgr->createMissingDefault(PRESETS_GRAPHIC); // a no-op after the first time, but that's ok return LLPanelPreference::postBuild(); } diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index fa0c09e97a..ea3a1fc98c 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -174,6 +174,7 @@ public: void buildPopupLists(); static void refreshSkin(void* data); void selectPanel(const LLSD& name); + void saveCameraPreset(std::string& preset); void saveGraphicsPreset(std::string& preset); private: @@ -196,6 +197,7 @@ private: std::string mDirectoryVisibility; LLAvatarData mAvatarProperties; + std::string mSavedCameraPreset; std::string mSavedGraphicsPreset; LOG_CLASS(LLFloaterPreference); }; @@ -244,6 +246,18 @@ private: LOG_CLASS(LLPanelPreference); }; +class LLPanelPreferenceView : public LLPanelPreference +{ +public: + BOOL postBuild(); + void draw(); + void setPresetText(); + +private: + void onPresetsListChangeCamera(); + LOG_CLASS(LLPanelPreferenceView); +}; + class LLPanelPreferenceGraphics : public LLPanelPreference { public: @@ -261,7 +275,6 @@ protected: bool hasDirtyChilds(); private: - void onPresetsListChange(); LOG_CLASS(LLPanelPreferenceGraphics); }; diff --git a/indra/newview/llpanelpresetscamerapulldown.cpp b/indra/newview/llpanelpresetscamerapulldown.cpp new file mode 100644 index 0000000000..2c95c06c31 --- /dev/null +++ b/indra/newview/llpanelpresetscamerapulldown.cpp @@ -0,0 +1,236 @@ +/** + * @file llpanelpresetscamerapulldown.cpp + * @brief A panel showing a quick way to pick camera presets + * + * $LicenseInfo:firstyear=2017&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2017, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llpanelpresetscamerapulldown.h" + +#include "llviewercontrol.h" +#include "llstatusbar.h" + +#include "llbutton.h" +#include "lltabcontainer.h" +#include "llfloaterreg.h" +#include "llfloaterpreference.h" +#include "llpresetsmanager.h" +#include "llsliderctrl.h" +#include "llscrolllistctrl.h" +#include "lltrans.h" + +/* static */ const F32 LLPanelPresetsCameraPulldown::sAutoCloseFadeStartTimeSec = 2.0f; +/* static */ const F32 LLPanelPresetsCameraPulldown::sAutoCloseTotalTimeSec = 3.0f; + +///---------------------------------------------------------------------------- +/// Class LLPanelPresetsCameraPulldown +///---------------------------------------------------------------------------- + +// Default constructor +LLPanelPresetsCameraPulldown::LLPanelPresetsCameraPulldown() +{ + mHoverTimer.stop(); + + mCommitCallbackRegistrar.add("Presets.GoViewPrefs", boost::bind(&LLPanelPresetsCameraPulldown::onViewButtonClick, this, _2)); + mCommitCallbackRegistrar.add("PresetsCamera.RowClick", boost::bind(&LLPanelPresetsCameraPulldown::onRowClick, this, _2)); + + buildFromFile( "panel_presets_camera_pulldown.xml"); +} + +BOOL LLPanelPresetsCameraPulldown::postBuild() +{ + LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); + if (presetsMgr) + { + presetsMgr->setPresetListChangeCameraCallback(boost::bind(&LLPanelPresetsCameraPulldown::populatePanel, this)); +LL_WARNS() << "DBG pulldown" << LL_ENDL; + // Make sure there is a default preference file + presetsMgr->createMissingDefault(PRESETS_CAMERA); + presetsMgr->startWatching(PRESETS_CAMERA); + } + + populatePanel(); + + return LLPanel::postBuild(); +} + +void LLPanelPresetsCameraPulldown::populatePanel() +{ + std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_CAMERA); + LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_TOP); + + LLScrollListCtrl* scroll = getChild("preset_camera_list"); + + if (scroll && mPresetNames.begin() != mPresetNames.end()) + { + scroll->clearRows(); + + std::string active_preset = gSavedSettings.getString("PresetCameraActive"); + if (active_preset == PRESETS_DEFAULT) + { + active_preset = LLTrans::getString(PRESETS_DEFAULT); + } + + for (std::list::const_iterator it = mPresetNames.begin(); it != mPresetNames.end(); ++it) + { + const std::string& name = *it; + LL_DEBUGS() << "adding '" << name << "'" << LL_ENDL; + + LLSD row; + row["columns"][0]["column"] = "preset_name"; + row["columns"][0]["value"] = name; + + bool is_selected_preset = false; + if (name == active_preset) + { + row["columns"][1]["column"] = "icon"; + row["columns"][1]["type"] = "icon"; + row["columns"][1]["value"] = "Check_Mark"; + + is_selected_preset = true; + } + + LLScrollListItem* new_item = scroll->addElement(row); + new_item->setSelected(is_selected_preset); + } + } +} + +/*virtual*/ +void LLPanelPresetsCameraPulldown::onMouseEnter(S32 x, S32 y, MASK mask) +{ + mHoverTimer.stop(); + LLPanel::onMouseEnter(x,y,mask); +} + +/*virtual*/ +void LLPanelPresetsCameraPulldown::onTopLost() +{ + setVisible(FALSE); +} + +/*virtual*/ +BOOL LLPanelPresetsCameraPulldown::handleMouseDown(S32 x, S32 y, MASK mask) +{ + LLPanel::handleMouseDown(x,y,mask); + return TRUE; +} + +/*virtual*/ +BOOL LLPanelPresetsCameraPulldown::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + LLPanel::handleRightMouseDown(x, y, mask); + return TRUE; +} + +/*virtual*/ +BOOL LLPanelPresetsCameraPulldown::handleDoubleClick(S32 x, S32 y, MASK mask) +{ + LLPanel::handleDoubleClick(x, y, mask); + return TRUE; +} + +/*virtual*/ +void LLPanelPresetsCameraPulldown::onMouseLeave(S32 x, S32 y, MASK mask) +{ + mHoverTimer.start(); + LLPanel::onMouseLeave(x,y,mask); +} + +/*virtual*/ +void LLPanelPresetsCameraPulldown::onVisibilityChange ( BOOL new_visibility ) +{ + if (new_visibility) + { + mHoverTimer.start(); // timer will be stopped when mouse hovers over panel + } + else + { + mHoverTimer.stop(); + + } +} + +void LLPanelPresetsCameraPulldown::onRowClick(const LLSD& user_data) +{ + LLScrollListCtrl* scroll = getChild("preset_camera_list"); + + if (scroll) + { + LLScrollListItem* item = scroll->getFirstSelected(); + if (item) + { + std::string name = item->getColumn(1)->getValue().asString(); + + LL_DEBUGS() << "selected '" << name << "'" << LL_ENDL; + LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, name); + + setVisible(FALSE); + } + else + { + LL_DEBUGS() << "none selected" << LL_ENDL; + } + } + else + { + LL_DEBUGS() << "no scroll" << LL_ENDL; + } +} + +void LLPanelPresetsCameraPulldown::onViewButtonClick(const LLSD& user_data) +{ + // close the minicontrol, we're bringing up the big one + setVisible(FALSE); + + // bring up the prefs floater + LLFloater* prefsfloater = LLFloaterReg::showInstance("preferences"); + if (prefsfloater) + { + // grab the 'view' panel from the preferences floater and + // bring it the front! + LLTabContainer* tabcontainer = prefsfloater->getChild("pref core"); + LLPanel* graphicspanel = prefsfloater->getChild("move"); + if (tabcontainer && graphicspanel) + { + tabcontainer->selectTabPanel(graphicspanel); + } + } +} + +//virtual +void LLPanelPresetsCameraPulldown::draw() +{ + F32 alpha = mHoverTimer.getStarted() + ? clamp_rescale(mHoverTimer.getElapsedTimeF32(), sAutoCloseFadeStartTimeSec, sAutoCloseTotalTimeSec, 1.f, 0.f) + : 1.0f; + LLViewDrawContext context(alpha); + + LLPanel::draw(); + + if (alpha == 0.f) + { + setVisible(FALSE); + } +} diff --git a/indra/newview/llpanelpresetscamerapulldown.h b/indra/newview/llpanelpresetscamerapulldown.h new file mode 100644 index 0000000000..12d9bc26ec --- /dev/null +++ b/indra/newview/llpanelpresetscamerapulldown.h @@ -0,0 +1,62 @@ +/** + * @file llpanelpresetscamerapulldown.h + * @brief A panel showing a quick way to pick camera presets + * + * $LicenseInfo:firstyear=2017&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2017, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPANELPRESETSCAMERAPULLDOWN_H +#define LL_LLPANELPRESETSCAMERAPULLDOWN_H + +#include "linden_common.h" + +#include "llpanel.h" + +class LLFrameTimer; + +class LLPanelPresetsCameraPulldown : public LLPanel +{ + public: + LLPanelPresetsCameraPulldown(); + /*virtual*/ void draw(); + /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask); + /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ void onTopLost(); + /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); + /*virtual*/ BOOL postBuild(); + void populatePanel(); + + private: + void onViewButtonClick(const LLSD& user_data); + void onRowClick(const LLSD& user_data); + + std::list mPresetNames; + LLFrameTimer mHoverTimer; + static const F32 sAutoCloseFadeStartTimeSec; + static const F32 sAutoCloseTotalTimeSec; + LOG_CLASS(LLPanelPresetsCameraPulldown); +}; + +#endif // LL_LLPANELPRESETSCAMERAPULLDOWN_H diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index 9b4dc5474a..0bbf1781a5 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -63,7 +63,7 @@ BOOL LLPanelPresetsPulldown::postBuild() LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); presetsMgr->setPresetListChangeCallback(boost::bind(&LLPanelPresetsPulldown::populatePanel, this)); // Make sure there is a default preference file - presetsMgr->createMissingDefault(); + presetsMgr->createMissingDefault(PRESETS_GRAPHIC); populatePanel(); diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 836f63bffa..16721a6efc 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -39,6 +39,7 @@ #include "llfloaterpreference.h" #include "llfloaterreg.h" #include "llfeaturemanager.h" +#include "llagentcamera.h" LLPresetsManager::LLPresetsManager() { @@ -46,6 +47,12 @@ LLPresetsManager::LLPresetsManager() LLPresetsManager::~LLPresetsManager() { + mCameraChangedSignal.disconnect(); +} + +void LLPresetsManager::triggerChangeCameraSignal() +{ + mPresetListChangeCameraSignal(); } void LLPresetsManager::triggerChangeSignal() @@ -53,15 +60,16 @@ void LLPresetsManager::triggerChangeSignal() mPresetListChangeSignal(); } -void LLPresetsManager::createMissingDefault() +void LLPresetsManager::createMissingDefault(const std::string& subdirectory) { - std::string default_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, PRESETS_GRAPHIC, PRESETS_DEFAULT + ".xml"); + std::string default_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, + subdirectory, PRESETS_DEFAULT + ".xml"); if (!gDirUtilp->fileExists(default_file)) { LL_INFOS() << "No default preset found -- creating one at " << default_file << LL_ENDL; - // Write current graphic settings as the default - savePreset(PRESETS_GRAPHIC, PRESETS_DEFAULT, true); + // Write current settings as the default + savePreset(subdirectory, PRESETS_DEFAULT, true); } else { @@ -69,6 +77,34 @@ void LLPresetsManager::createMissingDefault() } } +void LLPresetsManager::startWatching(const std::string& subdirectory) +{ + if (PRESETS_CAMERA == subdirectory) + { + std::vector name_list; + getControlNames(name_list); + + for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) + { + std::string ctrl_name = *it; +LL_WARNS() << "DBG starting watch on " << ctrl_name << LL_ENDL; + if (gSavedSettings.controlExists(ctrl_name)) + { + LLPointer cntrl_ptr = gSavedSettings.getControl(ctrl_name); + if (cntrl_ptr.isNull()) + { + LL_WARNS("Init") << "Unable to set signal on global setting '" << ctrl_name + << "'" << LL_ENDL; + } + else + { + mCameraChangedSignal = cntrl_ptr->getCommitSignal()->connect(boost::bind(&settingChanged)); + } + } + } + } +} + std::string LLPresetsManager::getPresetsDir(const std::string& subdirectory) { std::string presets_path = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR); @@ -134,6 +170,49 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam presets = mPresetNames; } +bool LLPresetsManager::mCameraDirty = false; + +void LLPresetsManager::setCameraDirty(bool dirty) +{ + mCameraDirty = dirty; +} + +bool LLPresetsManager::isCameraDirty() +{ + return mCameraDirty; +} + +void LLPresetsManager::settingChanged() +{ +LL_WARNS() << "DBG setting changed" << LL_ENDL; + setCameraDirty(true); +} + +void LLPresetsManager::getControlNames(std::vector& names) +{ + names = boost::assign::list_of + ("CameraOffsetCustom0") + ("FocusOffsetCustom0") + // From panel_preferences_move.xml + ("CameraAngle") + ("CameraOffsetScale") + ("CameraOpacity") + ("EditCameraMovement") + ("AppearanceCameraMovement") + // From llagentcamera.cpp + ("RenderFarClip") + ("CameraOffsetBuild") + ("CameraPreset") + ("CameraOffsetRearView") + ("CameraOffsetFrontView") + ("CameraOffsetGroupView") + ("FocusOffsetRearView") + ("FocusOffsetFrontView") + ("FocusOffsetGroupView") + ("CameraOffsetScale") + ("TrackFocusObject"); +} + bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string name, bool createDefault) { if (LLTrans::getString(PRESETS_DEFAULT) == name) @@ -149,94 +228,110 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); if (instance && !createDefault) { - gSavedSettings.setString("PresetGraphicActive", name); + gSavedSettings.setString("PresetGraphicActive", name); instance->getControlNames(name_list); - LL_DEBUGS() << "saving preset '" << name << "'; " << name_list.size() << " names" << LL_ENDL; + LL_DEBUGS() << "saving preset '" << name << "'; " << name_list.size() << " names" << LL_ENDL; name_list.push_back("PresetGraphicActive"); } - else + else { - LL_WARNS() << "preferences floater instance not found" << LL_ENDL; - } + LL_WARNS() << "preferences floater instance not found" << LL_ENDL; + } } - else if(PRESETS_CAMERA == subdirectory) + else if(PRESETS_CAMERA == subdirectory) { - name_list = boost::assign::list_of - ("Placeholder"); + gSavedSettings.setString("PresetGraphicActive", name); +// gSavedSettings.setU32("CameraPreset", CAMERA_PRESET_CUSTOM0); + +// gSavedSettings.setVector3d("CameraOffsetCustom0", gAgentCamera.calcCameraPositionTargetGlobal()); +// gSavedSettings.setVector3d("FocusOffsetCustom0", gAgentCamera.calcFocusPositionTargetGlobal()); + + getControlNames(name_list); + name_list.push_back("PresetCameraActive"); } - else - { - LL_ERRS() << "Invalid presets directory '" << subdirectory << "'" << LL_ENDL; - } - - if (name_list.size() > 1 // if the active preset name is the only thing in the list, don't save the list - || (createDefault && name == PRESETS_DEFAULT && subdirectory == PRESETS_GRAPHIC)) // or create a default graphics preset from hw recommended settings - { - // make an empty llsd - LLSD paramsData(LLSD::emptyMap()); + else + { + LL_ERRS() << "Invalid presets directory '" << subdirectory << "'" << LL_ENDL; + } + + // make an empty llsd + LLSD paramsData(LLSD::emptyMap()); - if (createDefault) - { - paramsData = LLFeatureManager::getInstance()->getRecommendedSettingsMap(); - if (gSavedSettings.getU32("RenderAvatarMaxComplexity") == 0) - { - // use the recommended setting as an initial one (MAINT-6435) - gSavedSettings.setU32("RenderAvatarMaxComplexity", paramsData["RenderAvatarMaxComplexity"]["Value"].asInteger()); - } - } - else - { - for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) - { - std::string ctrl_name = *it; - LLControlVariable* ctrl = gSavedSettings.getControl(ctrl_name).get(); - std::string comment = ctrl->getComment(); - std::string type = LLControlGroup::typeEnumToString(ctrl->type()); - LLSD value = ctrl->getValue(); - - paramsData[ctrl_name]["Comment"] = comment; - paramsData[ctrl_name]["Persist"] = 1; - paramsData[ctrl_name]["Type"] = type; - paramsData[ctrl_name]["Value"] = value; - } - } - - std::string pathName(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); - - // write to file - llofstream presetsXML(pathName.c_str()); - if (presetsXML.is_open()) - { - - LLPointer formatter = new LLSDXMLFormatter(); - formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); - presetsXML.close(); - saved = true; + // Create a default graphics preset from hw recommended settings + if (createDefault && name == PRESETS_DEFAULT && subdirectory == PRESETS_GRAPHIC) + { + paramsData = LLFeatureManager::getInstance()->getRecommendedSettingsMap(); + if (gSavedSettings.getU32("RenderAvatarMaxComplexity") == 0) + { + // use the recommended setting as an initial one (MAINT-6435) + gSavedSettings.setU32("RenderAvatarMaxComplexity", paramsData["RenderAvatarMaxComplexity"]["Value"].asInteger()); + } + } + else + { + for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) + { + std::string ctrl_name = *it; + LLControlVariable* ctrl = gSavedSettings.getControl(ctrl_name).get(); + std::string comment = ctrl->getComment(); + std::string type = LLControlGroup::typeEnumToString(ctrl->type()); + LLSD value = ctrl->getValue(); + + paramsData[ctrl_name]["Comment"] = comment; + paramsData[ctrl_name]["Persist"] = 1; + paramsData[ctrl_name]["Type"] = type; + paramsData[ctrl_name]["Value"] = value; + } + } + + std::string pathName(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); + + // If the active preset name is the only thing in the list, don't save the list + if (paramsData.size() > 1) + { + // write to file + llofstream presetsXML(pathName.c_str()); + if (presetsXML.is_open()) + { + LLPointer formatter = new LLSDXMLFormatter(); + formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); + presetsXML.close(); + saved = true; - LL_DEBUGS() << "saved preset '" << name << "'; " << paramsData.size() << " parameters" << LL_ENDL; - - if (!createDefault) - { - gSavedSettings.setString("PresetGraphicActive", name); - // signal interested parties - triggerChangeSignal(); - } - } - else - { - LL_WARNS("Presets") << "Cannot open for output preset file " << pathName << LL_ENDL; - } - } + LL_DEBUGS() << "saved preset '" << name << "'; " << paramsData.size() << " parameters" << LL_ENDL; + + if (subdirectory == PRESETS_GRAPHIC) + { + gSavedSettings.setString("PresetGraphicActive", name); + // signal interested parties + triggerChangeSignal(); + } + + if (subdirectory == PRESETS_CAMERA) + { + gSavedSettings.setString("PresetCameraActive", name); + setCameraDirty(false); + // signal interested parties + triggerChangeCameraSignal(); + } + } + else + { + LL_WARNS("Presets") << "Cannot open for output preset file " << pathName << LL_ENDL; + } + } else - { - LL_INFOS() << "No settings found; preferences floater has not yet been created" << LL_ENDL; - } + { + LL_INFOS() << "No settings available to be saved" << LL_ENDL; + } return saved; } -void LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option) +bool LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option) { + bool sts = true; + combo->clearRows(); std::string presets_dir = getPresetsDir(subdirectory); @@ -259,8 +354,10 @@ void LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, else { combo->setLabel(LLTrans::getString("preset_combo_label")); + sts = false; } } + return sts; } void LLPresetsManager::loadPreset(const std::string& subdirectory, std::string name) @@ -279,14 +376,19 @@ void LLPresetsManager::loadPreset(const std::string& subdirectory, std::string n if(PRESETS_GRAPHIC == subdirectory) { gSavedSettings.setString("PresetGraphicActive", name); - } - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->refreshEnabledGraphics(); + } + triggerChangeSignal(); + } + if(PRESETS_CAMERA == subdirectory) { - instance->refreshEnabledGraphics(); + gSavedSettings.setString("PresetCameraActive", name); + triggerChangeCameraSignal(); } - triggerChangeSignal(); } else { @@ -317,17 +419,34 @@ bool LLPresetsManager::deletePreset(const std::string& subdirectory, std::string } // If you delete the preset that is currently marked as loaded then also indicate that no preset is loaded. - if (gSavedSettings.getString("PresetGraphicActive") == name) + if(PRESETS_GRAPHIC == subdirectory) { - gSavedSettings.setString("PresetGraphicActive", ""); + if (gSavedSettings.getString("PresetGraphicActive") == name) + { + gSavedSettings.setString("PresetGraphicActive", ""); + } + // signal interested parties + triggerChangeSignal(); } - // signal interested parties - triggerChangeSignal(); + if(PRESETS_CAMERA == subdirectory) + { + if (gSavedSettings.getString("PresetCameraActive") == name) + { + gSavedSettings.setString("PresetCameraActive", ""); + } + // signal interested parties + triggerChangeCameraSignal(); + } return sts; } +boost::signals2::connection LLPresetsManager::setPresetListChangeCameraCallback(const preset_list_signal_t::slot_type& cb) +{ + return mPresetListChangeCameraSignal.connect(cb); +} + boost::signals2::connection LLPresetsManager::setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb) { return mPresetListChangeSignal.connect(cb); diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 21f9885f27..71ec4736b2 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -51,16 +51,21 @@ public: typedef std::list preset_name_list_t; typedef boost::signals2::signal preset_list_signal_t; - void createMissingDefault(); + void createMissingDefault(const std::string& subdirectory); + void startWatching(const std::string& subdirectory); + void triggerChangeCameraSignal(); void triggerChangeSignal(); static std::string getPresetsDir(const std::string& subdirectory); - void setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option); + bool setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option); void loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets, EDefaultOptions default_option); bool savePreset(const std::string& subdirectory, std::string name, bool createDefault = false); void loadPreset(const std::string& subdirectory, std::string name); bool deletePreset(const std::string& subdirectory, std::string name); + bool isCameraDirty(); + static void setCameraDirty(bool dirty); // Emitted when a preset gets loaded, deleted, or saved. + boost::signals2::connection setPresetListChangeCameraCallback(const preset_list_signal_t::slot_type& cb); boost::signals2::connection setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb); // Emitted when a preset gets loaded or saved. @@ -70,10 +75,18 @@ public: LLPresetsManager(); ~LLPresetsManager(); + preset_list_signal_t mPresetListChangeCameraSignal; preset_list_signal_t mPresetListChangeSignal; private: - LOG_CLASS(LLPresetsManager); + LOG_CLASS(LLPresetsManager); + + void getControlNames(std::vector& names); + static void LLPresetsManager::settingChanged(); + + boost::signals2::connection mCameraChangedSignal; + + static bool mCameraDirty; }; #endif // LL_PRESETSMANAGER_H diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 041eae4b3c..702b9a8484 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -38,6 +38,7 @@ #include "llfloaterbuycurrency.h" #include "llbuycurrencyhtml.h" #include "llpanelnearbymedia.h" +#include "llpanelpresetscamerapulldown.h" #include "llpanelpresetspulldown.h" #include "llpanelvolumepulldown.h" #include "llfloaterregioninfo.h" @@ -171,8 +172,11 @@ BOOL LLStatusBar::postBuild() mBtnStats = getChildView("stat_btn"); - mIconPresets = getChild( "presets_icon" ); - mIconPresets->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterPresets, this)); + mIconPresetsCamera = getChild( "presets_icon_camera" ); + mIconPresetsCamera->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterPresetsCamera, this)); + + mIconPresetsGraphic = getChild( "presets_icon_graphic" ); + mIconPresetsGraphic->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterPresets, this)); mBtnVolume = getChild( "volume_btn" ); mBtnVolume->setClickedCallback( onClickVolume, this ); @@ -227,6 +231,11 @@ BOOL LLStatusBar::postBuild() mSGPacketLoss = LLUICtrlFactory::create(pgp); addChild(mSGPacketLoss); + mPanelPresetsCameraPulldown = new LLPanelPresetsCameraPulldown(); + addChild(mPanelPresetsCameraPulldown); + mPanelPresetsCameraPulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); + mPanelPresetsCameraPulldown->setVisible(FALSE); + mPanelPresetsPulldown = new LLPanelPresetsPulldown(); addChild(mPanelPresetsPulldown); mPanelPresetsPulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); @@ -325,7 +334,8 @@ void LLStatusBar::setVisibleForMouselook(bool visible) mSGBandwidth->setVisible(visible); mSGPacketLoss->setVisible(visible); setBackgroundVisible(visible); - mIconPresets->setVisible(visible); + mIconPresetsCamera->setVisible(visible); + mIconPresetsGraphic->setVisible(visible); } void LLStatusBar::debitBalance(S32 debit) @@ -470,10 +480,34 @@ void LLStatusBar::onClickBuyCurrency() LLFirstUse::receiveLindens(false); } +void LLStatusBar::onMouseEnterPresetsCamera() +{ + LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); + LLIconCtrl* icon = getChild( "presets_icon_camera" ); + LLRect icon_rect = icon->getRect(); + LLRect pulldown_rect = mPanelPresetsCameraPulldown->getRect(); + pulldown_rect.setLeftTopAndSize(icon_rect.mLeft - + (pulldown_rect.getWidth() - icon_rect.getWidth()), + icon_rect.mBottom, + pulldown_rect.getWidth(), + pulldown_rect.getHeight()); + + pulldown_rect.translate(popup_holder->getRect().getWidth() - pulldown_rect.mRight, 0); + mPanelPresetsCameraPulldown->setShape(pulldown_rect); + + // show the master presets pull-down + LLUI::clearPopups(); + LLUI::addPopup(mPanelPresetsCameraPulldown); + mPanelNearByMedia->setVisible(FALSE); + mPanelVolumePulldown->setVisible(FALSE); + mPanelPresetsPulldown->setVisible(FALSE); + mPanelPresetsCameraPulldown->setVisible(TRUE); +} + void LLStatusBar::onMouseEnterPresets() { LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); - LLIconCtrl* icon = getChild( "presets_icon" ); + LLIconCtrl* icon = getChild( "presets_icon_graphic" ); LLRect icon_rect = icon->getRect(); LLRect pulldown_rect = mPanelPresetsPulldown->getRect(); pulldown_rect.setLeftTopAndSize(icon_rect.mLeft - @@ -512,6 +546,7 @@ void LLStatusBar::onMouseEnterVolume() // show the master volume pull-down LLUI::clearPopups(); LLUI::addPopup(mPanelVolumePulldown); + mPanelPresetsCameraPulldown->setVisible(FALSE); mPanelPresetsPulldown->setVisible(FALSE); mPanelNearByMedia->setVisible(FALSE); mPanelVolumePulldown->setVisible(TRUE); @@ -536,6 +571,7 @@ void LLStatusBar::onMouseEnterNearbyMedia() LLUI::clearPopups(); LLUI::addPopup(mPanelNearByMedia); + mPanelPresetsCameraPulldown->setVisible(FALSE); mPanelPresetsPulldown->setVisible(FALSE); mPanelVolumePulldown->setVisible(FALSE); mPanelNearByMedia->setVisible(TRUE); diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h index 277f039f20..507afcd147 100644 --- a/indra/newview/llstatusbar.h +++ b/indra/newview/llstatusbar.h @@ -41,6 +41,7 @@ class LLUICtrl; class LLUUID; class LLFrameTimer; class LLStatGraph; +class LLPanelPresetsCameraPulldown; class LLPanelPresetsPulldown; class LLPanelVolumePulldown; class LLPanelNearByMedia; @@ -91,6 +92,7 @@ private: void onClickBuyCurrency(); void onVolumeChanged(const LLSD& newvalue); + void onMouseEnterPresetsCamera(); void onMouseEnterPresets(); void onMouseEnterVolume(); void onMouseEnterNearbyMedia(); @@ -106,7 +108,8 @@ private: LLStatGraph *mSGPacketLoss; LLView *mBtnStats; - LLIconCtrl *mIconPresets; + LLIconCtrl *mIconPresetsCamera; + LLIconCtrl *mIconPresetsGraphic; LLButton *mBtnVolume; LLTextBox *mBoxBalance; LLButton *mMediaToggle; @@ -119,6 +122,7 @@ private: S32 mSquareMetersCommitted; LLFrameTimer* mBalanceTimer; LLFrameTimer* mHealthTimer; + LLPanelPresetsCameraPulldown* mPanelPresetsCameraPulldown; LLPanelPresetsPulldown* mPanelPresetsPulldown; LLPanelVolumePulldown* mPanelVolumePulldown; LLPanelNearByMedia* mPanelNearByMedia; diff --git a/indra/newview/skins/default/textures/icons/Presets_Icon.png b/indra/newview/skins/default/textures/icons/Presets_Icon.png deleted file mode 100644 index 5a6628816b..0000000000 Binary files a/indra/newview/skins/default/textures/icons/Presets_Icon.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/Presets_Icon_Camera.png b/indra/newview/skins/default/textures/icons/Presets_Icon_Camera.png new file mode 100644 index 0000000000..8cb51cdc8e Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Presets_Icon_Camera.png differ diff --git a/indra/newview/skins/default/textures/icons/Presets_Icon_Graphic.png b/indra/newview/skins/default/textures/icons/Presets_Icon_Graphic.png new file mode 100644 index 0000000000..5a6628816b Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Presets_Icon_Graphic.png differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index f2da22256c..de9ed4d479 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -205,7 +205,8 @@ with the same filename but different name - + + diff --git a/indra/newview/skins/default/xui/en/floater_camera.xml b/indra/newview/skins/default/xui/en/floater_camera.xml index 521389d7b3..4eec922915 100644 --- a/indra/newview/skins/default/xui/en/floater_camera.xml +++ b/indra/newview/skins/default/xui/en/floater_camera.xml @@ -150,8 +150,26 @@ left="0" mouse_opaque="false" name="zoom" - top="20" + top="0" width="226"> + + + + diff --git a/indra/newview/skins/default/xui/en/floater_preferences.xml b/indra/newview/skins/default/xui/en/floater_preferences.xml index 9a9101e0da..cbaeae5b94 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences.xml @@ -79,7 +79,7 @@ help_topic="preferences_chat_tab" name="chat" /> + +[https://community.secondlife.com/t5/Featured-News/Why-are-all-these-people-made-of-colored-jelly/ba-p/3031255 What's this?] + + + - min_val="0.125" + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_presets_camera_pulldown.xml b/indra/newview/skins/default/xui/en/panel_presets_camera_pulldown.xml new file mode 100644 index 0000000000..dc37270751 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_presets_camera_pulldown.xml @@ -0,0 +1,69 @@ + + + + Camera Presets + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml index 998f1ce599..c6a42ea612 100644 --- a/indra/newview/skins/default/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml @@ -35,7 +35,7 @@ + - - - diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml index c6a42ea612..299f019145 100644 --- a/indra/newview/skins/default/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml @@ -108,7 +108,7 @@ Date: Sat, 13 Jan 2018 12:18:40 -0500 Subject: STORM-2145 Added a small floater --- indra/llui/llfloater.cpp | 2 + indra/newview/CMakeLists.txt | 2 + indra/newview/app_settings/settings.xml | 31 ----- indra/newview/llagentcamera.cpp | 2 - indra/newview/llfloaterpreference.cpp | 2 +- indra/newview/llfloaterpreferencemoveadvanced.cpp | 151 +++++++++++++++++++++ indra/newview/llfloaterpreferencemoveadvanced.h | 58 ++++++++ indra/newview/llpanelpresetscamerapulldown.cpp | 2 +- indra/newview/llpresetsmanager.cpp | 10 -- indra/newview/llviewerfloaterreg.cpp | 2 + .../xui/en/floater_preferences_move_advanced.xml | 140 +++++++++++++++++++ .../default/xui/en/panel_preferences_move.xml | 14 ++ 12 files changed, 371 insertions(+), 45 deletions(-) create mode 100644 indra/newview/llfloaterpreferencemoveadvanced.cpp create mode 100644 indra/newview/llfloaterpreferencemoveadvanced.h create mode 100644 indra/newview/skins/default/xui/en/floater_preferences_move_advanced.xml (limited to 'indra') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index e5fe6967d1..663d96bdd4 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -64,6 +64,8 @@ // use this to control "jumping" behavior when Ctrl-Tabbing const S32 TABBED_FLOATER_OFFSET = 0; +extern LLControlGroup gSavedSettings; + namespace LLInitParam { void TypeValues::declareValues() diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 658c3c56fc..7de4e85316 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -277,6 +277,7 @@ set(viewer_SOURCE_FILES llfloaterperms.cpp llfloaterpostprocess.cpp llfloaterpreference.cpp + llfloaterpreferencemoveadvanced.cpp llfloaterpreviewtrash.cpp llfloaterproperties.cpp llfloaterregiondebugconsole.cpp @@ -901,6 +902,7 @@ set(viewer_HEADER_FILES llfloaterperms.h llfloaterpostprocess.h llfloaterpreference.h + llfloaterpreferencemoveadvanced.h llfloaterpreviewtrash.h llfloaterproperties.h llfloaterregiondebugconsole.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9b5b614111..bcce87dc13 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16176,36 +16176,5 @@ Value - CameraOffsetCustom0 - - Comment - Customized camera offset from avatar - Persist - 1 - Type - Vector3 - Value - - -3.0 - 0.0 - 0.75 - - - FocusOffsetCustom0 - - Comment - Custom focus point offset relative to avatar (x-axis is forward) - Persist - 1 - Type - Vector3D - Value - - 1.0 - 0.0 - 1.0 - - - diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index e0ade4d395..5b9f1b9d4f 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -208,12 +208,10 @@ void LLAgentCamera::init() mCameraOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("CameraOffsetRearView"); mCameraOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("CameraOffsetFrontView"); mCameraOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("CameraOffsetGroupView"); - mCameraOffsetInitial[CAMERA_PRESET_CUSTOM0] = gSavedSettings.getControl("CameraOffsetCustom0"); mFocusOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("FocusOffsetRearView"); mFocusOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("FocusOffsetFrontView"); mFocusOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("FocusOffsetGroupView"); - mFocusOffsetInitial[CAMERA_PRESET_CUSTOM0] = gSavedSettings.getControl("FocusOffsetCustom0"); mCameraCollidePlane.clearVec(); mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"); diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 212cb922f2..872e961a70 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -661,7 +661,7 @@ void LLFloaterPreference::cancel() // hide spellchecker settings folder LLFloaterReg::hideInstance("prefs_spellchecker"); - // hide advancede floater + // hide advanced graphics floater LLFloaterReg::hideInstance("prefs_graphics_advanced"); // reverts any changes to current skin diff --git a/indra/newview/llfloaterpreferencemoveadvanced.cpp b/indra/newview/llfloaterpreferencemoveadvanced.cpp new file mode 100644 index 0000000000..3ff19147b1 --- /dev/null +++ b/indra/newview/llfloaterpreferencemoveadvanced.cpp @@ -0,0 +1,151 @@ +/** + * @file llfloaterpreferencemoveadvanced.cpp + * @brief floater for adjusting camera position + * + * $LicenseInfo:firstyear=2018&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2018, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llfloaterpreferencemoveadvanced.h" +#include "llfloater.h" +#include "llfloaterreg.h" +#include "lluictrlfactory.h" +#include "llspinctrl.h" +#include "llviewercontrol.h" + + +LLFloaterPreferenceMoveAdvanced::LLFloaterPreferenceMoveAdvanced(const LLSD& key) +: LLFloater(key) +{ + mCommitCallbackRegistrar.add("Cancel", boost::bind(&LLFloaterPreferenceMoveAdvanced::onClickCancel, this)); + mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterPreferenceMoveAdvanced::onCommitSettings, this)); + mCommitCallbackRegistrar.add("Ok", boost::bind(&LLFloaterPreferenceMoveAdvanced::onClickOk, this)); + +} + +LLFloaterPreferenceMoveAdvanced::~LLFloaterPreferenceMoveAdvanced() +{} + +void LLFloaterPreferenceMoveAdvanced::onClickOk() +{ + closeFloater(); +} + +void LLFloaterPreferenceMoveAdvanced::onClickCancel() +{ + gSavedSettings.setVector3("CameraOffsetRearView", mCameraSaved); + gSavedSettings.setVector3d("FocusOffsetRearView", mFocusSaved); + + updateCameraControl(mCameraSaved); + updateFocusControl(mFocusSaved); +} + +BOOL LLFloaterPreferenceMoveAdvanced::postBuild() +{ + mCameraSaved = gSavedSettings.getVector3("CameraOffsetRearView"); + mFocusSaved = gSavedSettings.getVector3d("FocusOffsetRearView"); + + updateCameraControl(mCameraSaved); + updateFocusControl(mFocusSaved); + + return TRUE; +} + +void LLFloaterPreferenceMoveAdvanced::updateCameraControl(LLVector3 vector) +{ + LLSpinCtrl* spinnerx = getChild("camera_x"); + LLSpinCtrl* spinnery = getChild("camera_y"); + LLSpinCtrl* spinnerz = getChild("camera_z"); + + if (!spinnerx || !spinnery || !spinnerz) + { + LL_WARNS() << "Could not find all desired UI camera elements" + << LL_ENDL; + return; + } + + if (!spinnerx->hasFocus()) + { + spinnerx->setValue(vector[VX]); + } + + if (!spinnery->hasFocus()) + { + spinnery->setValue(vector[VY]); + } + + if (!spinnerz->hasFocus()) + { + spinnerz->setValue(vector[VZ]); + } +} + +void LLFloaterPreferenceMoveAdvanced::updateFocusControl(LLVector3d vector3d) +{ + LLSpinCtrl* spinnerx = getChild("focus_x"); + LLSpinCtrl* spinnery = getChild("focus_y"); + LLSpinCtrl* spinnerz = getChild("focus_z"); + + if (!spinnerx || !spinnery || !spinnerz) + { + LL_WARNS() << "Could not find all desired UI focus elements" + << LL_ENDL; + return; + } + + if (!spinnerx->hasFocus()) + { + spinnerx->setValue(vector3d[VX]); + } + + if (!spinnery->hasFocus()) + { + spinnery->setValue(vector3d[VY]); + } + + if (!spinnerz->hasFocus()) + { + spinnerz->setValue(vector3d[VZ]); + } +} + + void LLFloaterPreferenceMoveAdvanced::draw() +{ +// updateControl(); + LLFloater::draw(); +} + +void LLFloaterPreferenceMoveAdvanced::onCommitSettings() +{ + LLVector3 vector; + LLVector3d vector3d; + + vector.mV[VX] = (F32)getChild("camera_x")->getValue().asReal(); + vector.mV[VY] = (F32)getChild("camera_y")->getValue().asReal(); + vector.mV[VZ] = (F32)getChild("camera_z")->getValue().asReal(); + gSavedSettings.setVector3("CameraOffsetRearView", vector); + + vector3d.mdV[VX] = (F32)getChild("focus_x")->getValue().asReal(); + vector3d.mdV[VY] = (F32)getChild("focus_y")->getValue().asReal(); + vector3d.mdV[VZ] = (F32)getChild("focus_z")->getValue().asReal(); + gSavedSettings.setVector3d("FocusOffsetRearView", vector3d); +} diff --git a/indra/newview/llfloaterpreferencemoveadvanced.h b/indra/newview/llfloaterpreferencemoveadvanced.h new file mode 100644 index 0000000000..98648af19e --- /dev/null +++ b/indra/newview/llfloaterpreferencemoveadvanced.h @@ -0,0 +1,58 @@ +/** + * @file llfloaterpreferencemoveadvanced.h + * @brief floater for adjusting camera position + * + * $LicenseInfo:firstyear=2018&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2018, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LLFLOATERPREFERENCEMOVEADVANCED_H +#define LLFLOATERPREFERENCEMOVEADVANCED_H + +#include "llcontrol.h" +#include "llfloater.h" + +class LLFloaterPreferenceMoveAdvanced +: public LLFloater +{ + friend class LLFloaterReg; + +public: + LLFloaterPreferenceMoveAdvanced(const LLSD& key); + virtual BOOL postBuild(); + virtual void draw(); + + void onCommitSettings(); + void onClickCancel(); + void onClickOk(); + void updateCameraControl(LLVector3 vector); + void updateFocusControl(LLVector3d vector3d); + +private: + virtual ~LLFloaterPreferenceMoveAdvanced(); + + LLVector3 mCameraSaved; + LLVector3d mFocusSaved; + +}; + +#endif //LLFLOATERPREFERENCEMOVEADVANCED_H + diff --git a/indra/newview/llpanelpresetscamerapulldown.cpp b/indra/newview/llpanelpresetscamerapulldown.cpp index 2c95c06c31..ffdfc445ce 100644 --- a/indra/newview/llpanelpresetscamerapulldown.cpp +++ b/indra/newview/llpanelpresetscamerapulldown.cpp @@ -64,9 +64,9 @@ BOOL LLPanelPresetsCameraPulldown::postBuild() if (presetsMgr) { presetsMgr->setPresetListChangeCameraCallback(boost::bind(&LLPanelPresetsCameraPulldown::populatePanel, this)); -LL_WARNS() << "DBG pulldown" << LL_ENDL; // Make sure there is a default preference file presetsMgr->createMissingDefault(PRESETS_CAMERA); + presetsMgr->startWatching(PRESETS_CAMERA); } diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 80386b61f7..3daa6894f0 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -92,7 +92,6 @@ void LLPresetsManager::startWatching(const std::string& subdirectory) for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) { std::string ctrl_name = *it; -LL_WARNS() << "DBG starting watch on " << ctrl_name << LL_ENDL; if (gSavedSettings.controlExists(ctrl_name)) { LLPointer cntrl_ptr = gSavedSettings.getControl(ctrl_name); @@ -189,23 +188,18 @@ bool LLPresetsManager::isCameraDirty() void LLPresetsManager::settingChanged() { -LL_WARNS() << "DBG setting changed" << LL_ENDL; setCameraDirty(true); } void LLPresetsManager::getControlNames(std::vector& names) { names = boost::assign::list_of - ("CameraOffsetCustom0") - ("FocusOffsetCustom0") // From panel_preferences_move.xml ("CameraAngle") ("CameraOffsetScale") - ("CameraOpacity") ("EditCameraMovement") ("AppearanceCameraMovement") // From llagentcamera.cpp - ("RenderFarClip") ("CameraOffsetBuild") ("CameraPreset") ("CameraOffsetRearView") @@ -246,10 +240,6 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n else if(PRESETS_CAMERA == subdirectory) { gSavedSettings.setString("PresetGraphicActive", name); -// gSavedSettings.setU32("CameraPreset", CAMERA_PRESET_CUSTOM0); - -// gSavedSettings.setVector3d("CameraOffsetCustom0", gAgentCamera.calcCameraPositionTargetGlobal()); -// gSavedSettings.setVector3d("FocusOffsetCustom0", gAgentCamera.calcFocusPositionTargetGlobal()); getControlNames(name_list); name_list.push_back("PresetCameraActive"); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 0ebacddd9b..440bf46b1e 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -104,6 +104,7 @@ #include "llfloaterperms.h" #include "llfloaterpostprocess.h" #include "llfloaterpreference.h" +#include "llfloaterpreferencemoveadvanced.h" #include "llfloaterpreviewtrash.h" #include "llfloaterproperties.h" #include "llfloaterregiondebugconsole.h" @@ -295,6 +296,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("places", "floater_places.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_graphics_advanced", "floater_preferences_graphics_advanced.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("prefs_move_advanced", "floater_preferences_move_advanced.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_proxy", "floater_preferences_proxy.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_spellchecker_import", "floater_spellcheck_import.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_translation", "floater_translation_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/floater_preferences_move_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_move_advanced.xml new file mode 100644 index 0000000000..28e5d2c607 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_preferences_move_advanced.xml @@ -0,0 +1,140 @@ + + + + + Camera offset: + + + + + + + + + + + + + + + + Focus offset: + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_preferences_move.xml b/indra/newview/skins/default/xui/en/panel_preferences_move.xml index e4a5f5e283..d832dac4ff 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_move.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_move.xml @@ -127,6 +127,20 @@ tool_tip="Use automatic camera positioning while in edit mode" width="242" /> + + - - diff --git a/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml new file mode 100644 index 0000000000..5b2cbee914 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml @@ -0,0 +1,140 @@ + + + + + Camera offset: + + + + + + + + + + + + + + + + Focus offset: + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml b/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml index 7dee28eff3..a9cda26f0b 100644 --- a/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml +++ b/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml @@ -4,7 +4,7 @@ height="145" help_topic="floater_save_preset" layout="topleft" - name="Save Pref Preset" + name="save_pref_preset" save_rect="true" title="SAVE PREF PRESET" width="300"> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_move.xml b/indra/newview/skins/default/xui/en/panel_preferences_move.xml index d832dac4ff..8d8441695f 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_move.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_move.xml @@ -138,7 +138,7 @@ width="115"> + parameter="prefs_view_advanced" /> - - - - - - - - - + + + + + + Preset in use: + + + + (None) + + + + + + Automatic position for: + + + + + + + + + + + + + + + -- cgit v1.2.3 From 7bf2a8c0a8b3baeade7ce5c828c4cfec41bef085 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 30 Jan 2018 11:28:24 -0500 Subject: replace space in "Pennys Gamer" settings with an underscore --- indra/newview/app_settings/camera/Pennys Gamer.xml | 115 --------------------- indra/newview/app_settings/camera/Pennys_Gamer.xml | 115 +++++++++++++++++++++ 2 files changed, 115 insertions(+), 115 deletions(-) delete mode 100644 indra/newview/app_settings/camera/Pennys Gamer.xml create mode 100644 indra/newview/app_settings/camera/Pennys_Gamer.xml (limited to 'indra') diff --git a/indra/newview/app_settings/camera/Pennys Gamer.xml b/indra/newview/app_settings/camera/Pennys Gamer.xml deleted file mode 100644 index 5d249153a0..0000000000 --- a/indra/newview/app_settings/camera/Pennys Gamer.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - AppearanceCameraMovement - - Comment - When entering appearance editing mode, camera zooms in on currently selected portion of avatar - Persist - 1 - Type - Boolean - Value - 1 - - CameraAngle - - Comment - Camera field of view angle (Radians) - Persist - 1 - Type - F32 - Value - 1.047197551 - - CameraOffsetBuild - - Comment - Default camera position relative to focus point when entering build mode - Persist - 1 - Type - Vector3 - Value - - -6 - 0 - 6 - - - CameraOffsetRearView - - Comment - Initial camera offset from avatar in Rear View - Persist - 1 - Type - Vector3 - Value - - -3.0 - 0.0 - -0.2 - - - CameraOffsetScale - - Comment - Scales the default offset - Persist - 1 - Type - F32 - Value - 1 - - EditCameraMovement - - Comment - When entering build mode, camera moves up above avatar - Persist - 1 - Type - Boolean - Value - 0 - - FocusOffsetRearView - - Comment - Initial focus point offset relative to avatar for the camera preset Rear View (x-axis is forward) - Persist - 1 - Type - Vector3D - Value - - 0.9 - 0.0 - 0.2 - - - PresetCameraActive - - Comment - Name of currently selected preference - Persist - 1 - Type - String - Value - Default - - TrackFocusObject - - Comment - Camera tracks last object zoomed on - Persist - 1 - Type - Boolean - Value - 1 - - - diff --git a/indra/newview/app_settings/camera/Pennys_Gamer.xml b/indra/newview/app_settings/camera/Pennys_Gamer.xml new file mode 100644 index 0000000000..5d249153a0 --- /dev/null +++ b/indra/newview/app_settings/camera/Pennys_Gamer.xml @@ -0,0 +1,115 @@ + + + AppearanceCameraMovement + + Comment + When entering appearance editing mode, camera zooms in on currently selected portion of avatar + Persist + 1 + Type + Boolean + Value + 1 + + CameraAngle + + Comment + Camera field of view angle (Radians) + Persist + 1 + Type + F32 + Value + 1.047197551 + + CameraOffsetBuild + + Comment + Default camera position relative to focus point when entering build mode + Persist + 1 + Type + Vector3 + Value + + -6 + 0 + 6 + + + CameraOffsetRearView + + Comment + Initial camera offset from avatar in Rear View + Persist + 1 + Type + Vector3 + Value + + -3.0 + 0.0 + -0.2 + + + CameraOffsetScale + + Comment + Scales the default offset + Persist + 1 + Type + F32 + Value + 1 + + EditCameraMovement + + Comment + When entering build mode, camera moves up above avatar + Persist + 1 + Type + Boolean + Value + 0 + + FocusOffsetRearView + + Comment + Initial focus point offset relative to avatar for the camera preset Rear View (x-axis is forward) + Persist + 1 + Type + Vector3D + Value + + 0.9 + 0.0 + 0.2 + + + PresetCameraActive + + Comment + Name of currently selected preference + Persist + 1 + Type + String + Value + Default + + TrackFocusObject + + Comment + Camera tracks last object zoomed on + Persist + 1 + Type + Boolean + Value + 1 + + + -- cgit v1.2.3 From bff875d25f03501ddad9a2be7cc45d1c949d83e0 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 2 Feb 2018 10:39:59 -0500 Subject: STORM-2145 Camera controls opacity is now working --- indra/llui/lluictrl.h | 3 ++- indra/newview/llfloatercamera.cpp | 9 +++++++++ indra/newview/llfloatercamera.h | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 550bee5c70..e53ecd30c2 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -212,7 +212,8 @@ public: virtual void setColor(const LLColor4& color); - F32 getCurrentTransparency(); + // Ansariel: Changed to virtual. We might want to change the transparency ourself! + virtual F32 getCurrentTransparency(); void setTransparencyType(ETypeTransparency type); ETypeTransparency getTransparencyType() const {return mTransparencyType;} diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 5bebebf21f..c12ccb386e 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -378,6 +378,15 @@ BOOL LLFloaterCamera::postBuild() return LLFloater::postBuild(); } +F32 LLFloaterCamera::getCurrentTransparency() +{ + + static LLCachedControl camera_opacity(gSavedSettings, "CameraOpacity"); + static LLCachedControl active_floater_transparency(gSavedSettings, "ActiveFloaterTransparency"); + return llmin(camera_opacity(), active_floater_transparency()); + +} + void LLFloaterCamera::onViewButtonClick(const LLSD& user_data) { // bring up the prefs floater diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index 3601813bc1..481e9aec1b 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -91,6 +91,8 @@ private: /*virtual*/ BOOL postBuild(); + F32 getCurrentTransparency(); + void onViewButtonClick(const LLSD& user_data); ECameraControlMode determineMode(); -- cgit v1.2.3 From f0ae109b696671c5773a5084a7329d0b164b7735 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 2 Feb 2018 12:36:15 -0500 Subject: STORM-2145 Tiny optimizations --- indra/newview/llfloaterpreferenceviewadvanced.cpp | 60 +++-------------------- indra/newview/llfloaterpreferenceviewadvanced.h | 4 +- 2 files changed, 10 insertions(+), 54 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterpreferenceviewadvanced.cpp b/indra/newview/llfloaterpreferenceviewadvanced.cpp index 055c6f2232..791ff79d87 100644 --- a/indra/newview/llfloaterpreferenceviewadvanced.cpp +++ b/indra/newview/llfloaterpreferenceviewadvanced.cpp @@ -70,62 +70,18 @@ BOOL LLFloaterPreferenceViewAdvanced::postBuild() return TRUE; } -void LLFloaterPreferenceViewAdvanced::updateCameraControl(LLVector3 vector) +void LLFloaterPreferenceViewAdvanced::updateCameraControl(const LLVector3& vector) { - LLSpinCtrl* spinnerx = getChild("camera_x"); - LLSpinCtrl* spinnery = getChild("camera_y"); - LLSpinCtrl* spinnerz = getChild("camera_z"); - - if (!spinnerx || !spinnery || !spinnerz) - { - LL_WARNS() << "Could not find all desired UI camera elements" - << LL_ENDL; - return; - } - - if (!spinnerx->hasFocus()) - { - spinnerx->setValue(vector[VX]); - } - - if (!spinnery->hasFocus()) - { - spinnery->setValue(vector[VY]); - } - - if (!spinnerz->hasFocus()) - { - spinnerz->setValue(vector[VZ]); - } + getChild("camera_x")->setValue(vector[VX]); + getChild("camera_y")->setValue(vector[VY]); + getChild("camera_z")->setValue(vector[VZ]); } -void LLFloaterPreferenceViewAdvanced::updateFocusControl(LLVector3d vector3d) +void LLFloaterPreferenceViewAdvanced::updateFocusControl(const LLVector3d& vector3d) { - LLSpinCtrl* spinnerx = getChild("focus_x"); - LLSpinCtrl* spinnery = getChild("focus_y"); - LLSpinCtrl* spinnerz = getChild("focus_z"); - - if (!spinnerx || !spinnery || !spinnerz) - { - LL_WARNS() << "Could not find all desired UI focus elements" - << LL_ENDL; - return; - } - - if (!spinnerx->hasFocus()) - { - spinnerx->setValue(vector3d[VX]); - } - - if (!spinnery->hasFocus()) - { - spinnery->setValue(vector3d[VY]); - } - - if (!spinnerz->hasFocus()) - { - spinnerz->setValue(vector3d[VZ]); - } + getChild("focus_x")->setValue(vector3d[VX]); + getChild("focus_y")->setValue(vector3d[VY]); + getChild("focus_z")->setValue(vector3d[VZ]); } void LLFloaterPreferenceViewAdvanced::draw() diff --git a/indra/newview/llfloaterpreferenceviewadvanced.h b/indra/newview/llfloaterpreferenceviewadvanced.h index 5b63770059..8f4b594605 100644 --- a/indra/newview/llfloaterpreferenceviewadvanced.h +++ b/indra/newview/llfloaterpreferenceviewadvanced.h @@ -43,8 +43,8 @@ public: void onCommitSettings(); void onClickCancel(); void onClickOk(); - void updateCameraControl(LLVector3 vector); - void updateFocusControl(LLVector3d vector3d); + void updateCameraControl(const LLVector3& vector); + void updateFocusControl(const LLVector3d& vector3d); private: virtual ~LLFloaterPreferenceViewAdvanced(); -- cgit v1.2.3