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/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 +- 26 files changed, 1012 insertions(+), 133 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/newview') 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/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 ++ 11 files changed, 369 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/newview') 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/newview') 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/newview/llfloatercamera.cpp | 9 +++++++++ indra/newview/llfloatercamera.h | 2 ++ 2 files changed, 11 insertions(+) (limited to 'indra/newview') 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/newview') 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 From 34d595716bb9224cc4f173bd968db86bc88cbaed Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 21 Jun 2018 20:07:59 +0100 Subject: Fix mismerge of main CMakeLists.txt which dropped new floaterviewadvanced .cpp --- indra/newview/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 87783c224e..789112c819 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -278,6 +278,7 @@ set(viewer_SOURCE_FILES llfloaterperms.cpp llfloaterpostprocess.cpp llfloaterpreference.cpp + llfloaterpreferenceviewadvanced.cpp llfloaterpreviewtrash.cpp llfloaterproperties.cpp llfloaterregiondebugconsole.cpp @@ -466,6 +467,7 @@ set(viewer_SOURCE_FILES llpanelplaceprofile.cpp llpanelplaces.cpp llpanelplacestab.cpp + llpanelpresetscamerapulldown.cpp llpanelpresetspulldown.cpp llpanelprimmediacontrols.cpp llpanelprofile.cpp -- cgit v1.2.3 From 4789fb3819a54954c9912a6c8442d8a37b594d28 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 3 Aug 2018 19:25:54 +0100 Subject: Fix merge fail in llagentcamera.cpp --- indra/newview/llagentcamera.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index bc92b5e1d9..bbe1354fc3 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -76,6 +76,8 @@ const F32 AVATAR_ZOOM_MIN_Y_FACTOR = 0.7f; const F32 AVATAR_ZOOM_MIN_Z_FACTOR = 1.15f; const F32 MAX_CAMERA_DISTANCE_FROM_AGENT = 50.f; +const F32 MAX_CAMERA_DISTANCE_FROM_OBJECT = 496.f; +const F32 CAMERA_FUDGE_FROM_OBJECT = 16.f; const F32 MAX_CAMERA_SMOOTH_DISTANCE = 50.0f; @@ -738,10 +740,7 @@ F32 LLAgentCamera::getCameraZoomFraction() else { F32 min_zoom; - const F32 DIST_FUDGE = 16.f; // meters - F32 max_zoom = llmin(mDrawDistance - DIST_FUDGE, - LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE, - MAX_CAMERA_DISTANCE_FROM_AGENT); + F32 max_zoom = getCameraMaxZoomDistance(); F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); if (mFocusObject.notNull()) @@ -787,10 +786,7 @@ void LLAgentCamera::setCameraZoomFraction(F32 fraction) else { F32 min_zoom = LAND_MIN_ZOOM; - const F32 DIST_FUDGE = 16.f; // meters - F32 max_zoom = llmin(mDrawDistance - DIST_FUDGE, - LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE, - MAX_CAMERA_DISTANCE_FROM_AGENT); + F32 max_zoom = getCameraMaxZoomDistance(); if (mFocusObject.notNull()) { @@ -909,10 +905,7 @@ void LLAgentCamera::cameraZoomIn(const F32 fraction) new_distance = llmax(new_distance, min_zoom); - // Don't zoom too far back - const F32 DIST_FUDGE = 16.f; // meters - F32 max_distance = llmin(mDrawDistance - DIST_FUDGE, - LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE ); + F32 max_distance = getCameraMaxZoomDistance(); max_distance = llmin(max_distance, current_distance * 4.f); //Scaled max relative to current distance. MAINT-3154 @@ -978,10 +971,7 @@ void LLAgentCamera::cameraOrbitIn(const F32 meters) new_distance = llmax(new_distance, min_zoom); - // Don't zoom too far back - const F32 DIST_FUDGE = 16.f; // meters - F32 max_distance = llmin(mDrawDistance - DIST_FUDGE, - LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE ); + F32 max_distance = getCameraMaxZoomDistance(); if (new_distance > max_distance) { -- cgit v1.2.3 From 2069891d736544da3c1460a5b63113b75fe7d61e Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 28 Nov 2018 14:33:10 -0800 Subject: Remove windows pragma for optimization disable. --- indra/newview/lldrawpoolwater.cpp | 4 ---- indra/newview/llvosky.cpp | 4 ---- 2 files changed, 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 9316890156..df06ad31e6 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -48,10 +48,6 @@ #include "llviewershadermgr.h" #include "llwaterparammanager.h" -#if LL_WINDOWS -#pragma optimize("", off) -#endif - const LLUUID TRANSPARENT_WATER_TEXTURE("2bfd3884-7e27-69b9-ba3a-3e673f680004"); const LLUUID OPAQUE_WATER_TEXTURE("43c32285-d658-1793-c123-bf86315de055"); diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 54ec238fde..c131cb886f 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -54,10 +54,6 @@ #undef min #undef max -#if LL_WINDOWS -#pragma optimize("", off) -#endif - static const S32 NUM_TILES_X = 8; static const S32 NUM_TILES_Y = 4; static const S32 NUM_TILES = NUM_TILES_X * NUM_TILES_Y; -- cgit v1.2.3 From 3e560022459bf3534b873a7f6499dfb5eb75a7d9 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 11 Mar 2019 08:11:09 -0700 Subject: Tabs -> spaces. --- indra/newview/llagentcamera.cpp | 4578 ++++++++++----------- indra/newview/llagentcamera.h | 564 +-- indra/newview/lldrawpoolwater.cpp | 1178 +++--- indra/newview/llfloatercamera.cpp | 670 +-- indra/newview/llfloatercamera.h | 166 +- indra/newview/llfloaterdeleteprefpreset.cpp | 66 +- indra/newview/llfloaterloadprefpreset.cpp | 50 +- indra/newview/llfloaterpreference.cpp | 4160 +++++++++---------- indra/newview/llfloaterpreference.h | 474 +-- indra/newview/llfloaterpreferenceviewadvanced.cpp | 74 +- indra/newview/llfloaterpreferenceviewadvanced.h | 28 +- indra/newview/llfloatersaveprefpreset.cpp | 86 +- indra/newview/llnavigationbar.h | 178 +- indra/newview/llpanelpresetscamerapulldown.cpp | 192 +- indra/newview/llpanelpresetscamerapulldown.h | 30 +- indra/newview/llpresetsmanager.cpp | 648 +-- indra/newview/llpresetsmanager.h | 62 +- indra/newview/llstatusbar.cpp | 752 ++-- indra/newview/llstatusbar.h | 118 +- indra/newview/llviewerfloaterreg.cpp | 360 +- 20 files changed, 7217 insertions(+), 7217 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index bbe1354fc3..7b395491e6 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -60,8 +60,8 @@ const F32 MIN_ZOOM_FRACTION = 0.25f; const F32 INITIAL_ZOOM_FRACTION = 1.f; const F32 MAX_ZOOM_FRACTION = 8.f; -const F32 CAMERA_ZOOM_HALF_LIFE = 0.07f; // seconds -const F32 FOV_ZOOM_HALF_LIFE = 0.07f; // seconds +const F32 CAMERA_ZOOM_HALF_LIFE = 0.07f; // seconds +const F32 FOV_ZOOM_HALF_LIFE = 0.07f; // seconds const F32 CAMERA_FOCUS_HALF_LIFE = 0.f;//0.02f; const F32 CAMERA_LAG_HALF_LIFE = 0.25f; @@ -107,83 +107,83 @@ LLAgentCamera gAgentCamera; // LLAgentCamera() //----------------------------------------------------------------------------- LLAgentCamera::LLAgentCamera() : - mInitialized(false), - - mDrawDistance( DEFAULT_FAR_PLANE ), - - mLookAt(NULL), - mPointAt(NULL), - - mHUDTargetZoom(1.f), - mHUDCurZoom(1.f), - - mForceMouselook(FALSE), - - mCameraMode( CAMERA_MODE_THIRD_PERSON ), - mLastCameraMode( CAMERA_MODE_THIRD_PERSON ), - - mCameraPreset(CAMERA_PRESET_REAR_VIEW), - - mCameraAnimating( FALSE ), - mAnimationCameraStartGlobal(), - mAnimationFocusStartGlobal(), - mAnimationTimer(), - mAnimationDuration(0.33f), - - mCameraFOVZoomFactor(0.f), - mCameraCurrentFOVZoomFactor(0.f), - mCameraFocusOffset(), - mCameraFOVDefault(DEFAULT_FIELD_OF_VIEW), - - mCameraCollidePlane(), - - mCurrentCameraDistance(2.f), // meters, set in init() - mTargetCameraDistance(2.f), - mCameraZoomFraction(1.f), // deprecated - mThirdPersonHeadOffset(0.f, 0.f, 1.f), - mSitCameraEnabled(FALSE), - mCameraSmoothingLastPositionGlobal(), - mCameraSmoothingLastPositionAgent(), - mCameraSmoothingStop(false), - - mCameraUpVector(LLVector3::z_axis), // default is straight up - - mFocusOnAvatar(TRUE), - mAllowChangeToFollow(FALSE), - mFocusGlobal(), - mFocusTargetGlobal(), - mFocusObject(NULL), - mFocusObjectDist(0.f), - mFocusObjectOffset(), - mFocusDotRadius( 0.1f ), // meters - mTrackFocusObject(TRUE), - - mAtKey(0), // Either 1, 0, or -1... indicates that movement-key is pressed - mWalkKey(0), // like AtKey, but causes less forward thrust - mLeftKey(0), - mUpKey(0), - mYawKey(0.f), - mPitchKey(0.f), - - mOrbitLeftKey(0.f), - mOrbitRightKey(0.f), - mOrbitUpKey(0.f), - mOrbitDownKey(0.f), - mOrbitInKey(0.f), - mOrbitOutKey(0.f), - - mPanUpKey(0.f), - mPanDownKey(0.f), - mPanLeftKey(0.f), - mPanRightKey(0.f), - mPanInKey(0.f), - mPanOutKey(0.f) + mInitialized(false), + + mDrawDistance( DEFAULT_FAR_PLANE ), + + mLookAt(NULL), + mPointAt(NULL), + + mHUDTargetZoom(1.f), + mHUDCurZoom(1.f), + + mForceMouselook(FALSE), + + mCameraMode( CAMERA_MODE_THIRD_PERSON ), + mLastCameraMode( CAMERA_MODE_THIRD_PERSON ), + + mCameraPreset(CAMERA_PRESET_REAR_VIEW), + + mCameraAnimating( FALSE ), + mAnimationCameraStartGlobal(), + mAnimationFocusStartGlobal(), + mAnimationTimer(), + mAnimationDuration(0.33f), + + mCameraFOVZoomFactor(0.f), + mCameraCurrentFOVZoomFactor(0.f), + mCameraFocusOffset(), + mCameraFOVDefault(DEFAULT_FIELD_OF_VIEW), + + mCameraCollidePlane(), + + mCurrentCameraDistance(2.f), // meters, set in init() + mTargetCameraDistance(2.f), + mCameraZoomFraction(1.f), // deprecated + mThirdPersonHeadOffset(0.f, 0.f, 1.f), + mSitCameraEnabled(FALSE), + mCameraSmoothingLastPositionGlobal(), + mCameraSmoothingLastPositionAgent(), + mCameraSmoothingStop(false), + + mCameraUpVector(LLVector3::z_axis), // default is straight up + + mFocusOnAvatar(TRUE), + mAllowChangeToFollow(FALSE), + mFocusGlobal(), + mFocusTargetGlobal(), + mFocusObject(NULL), + mFocusObjectDist(0.f), + mFocusObjectOffset(), + mFocusDotRadius( 0.1f ), // meters + mTrackFocusObject(TRUE), + + mAtKey(0), // Either 1, 0, or -1... indicates that movement-key is pressed + mWalkKey(0), // like AtKey, but causes less forward thrust + mLeftKey(0), + mUpKey(0), + mYawKey(0.f), + mPitchKey(0.f), + + mOrbitLeftKey(0.f), + mOrbitRightKey(0.f), + mOrbitUpKey(0.f), + mOrbitDownKey(0.f), + mOrbitInKey(0.f), + mOrbitOutKey(0.f), + + mPanUpKey(0.f), + mPanDownKey(0.f), + mPanLeftKey(0.f), + mPanRightKey(0.f), + mPanInKey(0.f), + mPanOutKey(0.f) { - mFollowCam.setMaxCameraDistantFromSubject( MAX_CAMERA_DISTANCE_FROM_AGENT ); + mFollowCam.setMaxCameraDistantFromSubject( MAX_CAMERA_DISTANCE_FROM_AGENT ); - clearGeneralKeys(); - clearOrbitKeys(); - clearPanKeys(); + clearGeneralKeys(); + clearOrbitKeys(); + clearPanKeys(); } // Requires gSavedSettings to be initialized. @@ -192,36 +192,36 @@ LLAgentCamera::LLAgentCamera() : //----------------------------------------------------------------------------- void LLAgentCamera::init() { - // *Note: this is where LLViewerCamera::getInstance() used to be constructed. + // *Note: this is where LLViewerCamera::getInstance() used to be constructed. - mDrawDistance = gSavedSettings.getF32("RenderFarClip"); + mDrawDistance = gSavedSettings.getF32("RenderFarClip"); - LLViewerCamera::getInstance()->setView(DEFAULT_FIELD_OF_VIEW); - // Leave at 0.1 meters until we have real near clip management - LLViewerCamera::getInstance()->setNear(0.1f); - LLViewerCamera::getInstance()->setFar(mDrawDistance); // if you want to change camera settings, do so in camera.h - LLViewerCamera::getInstance()->setAspect( gViewerWindow->getWorldViewAspectRatio() ); // default, overridden in LLViewerWindow::reshape - LLViewerCamera::getInstance()->setViewHeightInPixels(768); // default, overridden in LLViewerWindow::reshape + LLViewerCamera::getInstance()->setView(DEFAULT_FIELD_OF_VIEW); + // Leave at 0.1 meters until we have real near clip management + LLViewerCamera::getInstance()->setNear(0.1f); + LLViewerCamera::getInstance()->setFar(mDrawDistance); // if you want to change camera settings, do so in camera.h + LLViewerCamera::getInstance()->setAspect( gViewerWindow->getWorldViewAspectRatio() ); // default, overridden in LLViewerWindow::reshape + LLViewerCamera::getInstance()->setViewHeightInPixels(768); // default, overridden in LLViewerWindow::reshape - mCameraFocusOffsetTarget = LLVector4(gSavedSettings.getVector3("CameraOffsetBuild")); - - mCameraPreset = (ECameraPreset) gSavedSettings.getU32("CameraPreset"); + mCameraFocusOffsetTarget = LLVector4(gSavedSettings.getVector3("CameraOffsetBuild")); + + mCameraPreset = (ECameraPreset) gSavedSettings.getU32("CameraPreset"); - 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_REAR_VIEW] = gSavedSettings.getControl("CameraOffsetRearView"); + mCameraOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("CameraOffsetFrontView"); + mCameraOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("CameraOffsetGroupView"); - 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_REAR_VIEW] = gSavedSettings.getControl("FocusOffsetRearView"); + mFocusOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("FocusOffsetFrontView"); + mFocusOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("FocusOffsetGroupView"); - mCameraCollidePlane.clearVec(); - mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"); - mTargetCameraDistance = mCurrentCameraDistance; - mCameraZoomFraction = 1.f; - mTrackFocusObject = gSavedSettings.getBOOL("TrackFocusObject"); + mCameraCollidePlane.clearVec(); + mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"); + mTargetCameraDistance = mCurrentCameraDistance; + mCameraZoomFraction = 1.f; + mTrackFocusObject = gSavedSettings.getBOOL("TrackFocusObject"); - mInitialized = true; + mInitialized = true; } //----------------------------------------------------------------------------- @@ -229,40 +229,40 @@ void LLAgentCamera::init() //----------------------------------------------------------------------------- void LLAgentCamera::cleanup() { - setSitCamera(LLUUID::null); - - if(mLookAt) - { - mLookAt->markDead() ; - mLookAt = NULL; - } - if(mPointAt) - { - mPointAt->markDead() ; - mPointAt = NULL; - } - setFocusObject(NULL); + setSitCamera(LLUUID::null); + + if(mLookAt) + { + mLookAt->markDead() ; + mLookAt = NULL; + } + if(mPointAt) + { + mPointAt->markDead() ; + mPointAt = NULL; + } + setFocusObject(NULL); } void LLAgentCamera::setAvatarObject(LLVOAvatarSelf* avatar) { - if (!mLookAt) - { - mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT); - } - if (!mPointAt) - { - mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT); - } - - if (!mLookAt.isNull()) - { - mLookAt->setSourceObject(avatar); - } - if (!mPointAt.isNull()) - { - mPointAt->setSourceObject(avatar); - } + if (!mLookAt) + { + mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT); + } + if (!mPointAt) + { + mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT); + } + + if (!mLookAt.isNull()) + { + mLookAt->setSourceObject(avatar); + } + if (!mPointAt.isNull()) + { + mPointAt->setSourceObject(avatar); + } } //----------------------------------------------------------------------------- @@ -270,9 +270,9 @@ void LLAgentCamera::setAvatarObject(LLVOAvatarSelf* avatar) //----------------------------------------------------------------------------- LLAgentCamera::~LLAgentCamera() { - cleanup(); + cleanup(); - // *Note: this is where LLViewerCamera::getInstance() used to be deleted. + // *Note: this is where LLViewerCamera::getInstance() used to be deleted. } // Change camera back to third person, stop the autopilot, @@ -282,74 +282,74 @@ LLAgentCamera::~LLAgentCamera() //----------------------------------------------------------------------------- void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera) { - if (gAgent.getAutoPilot()) - { - gAgent.stopAutoPilot(TRUE); - } - - LLSelectMgr::getInstance()->unhighlightAll(); - - // By popular request, keep land selection while walking around. JC - // LLViewerParcelMgr::getInstance()->deselectLand(); - - // force deselect when walking and attachment is selected - // this is so people don't wig out when their avatar moves without animating - if (LLSelectMgr::getInstance()->getSelection()->isAttachment()) - { - LLSelectMgr::getInstance()->deselectAll(); - } - - if (gMenuHolder != NULL) - { - // Hide all popup menus - gMenuHolder->hideMenus(); - } - - if (change_camera && !gSavedSettings.getBOOL("FreezeTime")) - { - changeCameraToDefault(); - - if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { - handle_toggle_flycam(); - } - - // reset avatar mode from eventual residual motion - if (LLToolMgr::getInstance()->inBuildMode()) - { - LLViewerJoystick::getInstance()->moveAvatar(true); - } - - //Camera Tool is needed for Free Camera Control Mode - if (!LLFloaterCamera::inFreeCameraMode()) - { - LLFloaterReg::hideInstance("build"); - - // Switch back to basic toolset - LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); - } - - gViewerWindow->showCursor(); - } - - - if (reset_camera && !gSavedSettings.getBOOL("FreezeTime")) - { - if (!gViewerWindow->getLeftMouseDown() && cameraThirdPerson()) - { - // leaving mouse-steer mode - LLVector3 agent_at_axis = gAgent.getAtAxis(); - agent_at_axis -= projected_vec(agent_at_axis, gAgent.getReferenceUpVector()); - agent_at_axis.normalize(); - gAgent.resetAxes(lerp(gAgent.getAtAxis(), agent_at_axis, LLSmoothInterpolation::getInterpolant(0.3f))); - } - - setFocusOnAvatar(TRUE, ANIMATE); - - mCameraFOVZoomFactor = 0.f; - } - - mHUDTargetZoom = 1.f; + if (gAgent.getAutoPilot()) + { + gAgent.stopAutoPilot(TRUE); + } + + LLSelectMgr::getInstance()->unhighlightAll(); + + // By popular request, keep land selection while walking around. JC + // LLViewerParcelMgr::getInstance()->deselectLand(); + + // force deselect when walking and attachment is selected + // this is so people don't wig out when their avatar moves without animating + if (LLSelectMgr::getInstance()->getSelection()->isAttachment()) + { + LLSelectMgr::getInstance()->deselectAll(); + } + + if (gMenuHolder != NULL) + { + // Hide all popup menus + gMenuHolder->hideMenus(); + } + + if (change_camera && !gSavedSettings.getBOOL("FreezeTime")) + { + changeCameraToDefault(); + + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + handle_toggle_flycam(); + } + + // reset avatar mode from eventual residual motion + if (LLToolMgr::getInstance()->inBuildMode()) + { + LLViewerJoystick::getInstance()->moveAvatar(true); + } + + //Camera Tool is needed for Free Camera Control Mode + if (!LLFloaterCamera::inFreeCameraMode()) + { + LLFloaterReg::hideInstance("build"); + + // Switch back to basic toolset + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + } + + gViewerWindow->showCursor(); + } + + + if (reset_camera && !gSavedSettings.getBOOL("FreezeTime")) + { + if (!gViewerWindow->getLeftMouseDown() && cameraThirdPerson()) + { + // leaving mouse-steer mode + LLVector3 agent_at_axis = gAgent.getAtAxis(); + agent_at_axis -= projected_vec(agent_at_axis, gAgent.getReferenceUpVector()); + agent_at_axis.normalize(); + gAgent.resetAxes(lerp(gAgent.getAtAxis(), agent_at_axis, LLSmoothInterpolation::getInterpolant(0.3f))); + } + + setFocusOnAvatar(TRUE, ANIMATE); + + mCameraFOVZoomFactor = 0.f; + } + + mHUDTargetZoom = 1.f; } // Allow camera to be moved somewhere other than behind avatar. @@ -358,14 +358,14 @@ void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera) //----------------------------------------------------------------------------- void LLAgentCamera::unlockView() { - if (getFocusOnAvatar()) - { - if (isAgentAvatarValid()) - { - setFocusGlobal(LLVector3d::zero, gAgentAvatarp->mID); - } - setFocusOnAvatar(FALSE, FALSE); // no animation - } + if (getFocusOnAvatar()) + { + if (isAgentAvatarValid()) + { + setFocusGlobal(LLVector3d::zero, gAgentAvatarp->mID); + } + setFocusOnAvatar(FALSE, FALSE); // no animation + } } //----------------------------------------------------------------------------- @@ -373,10 +373,10 @@ void LLAgentCamera::unlockView() //----------------------------------------------------------------------------- void LLAgentCamera::slamLookAt(const LLVector3 &look_at) { - LLVector3 look_at_norm = look_at; - look_at_norm.mV[VZ] = 0.f; - look_at_norm.normalize(); - gAgent.resetAxes(look_at_norm); + LLVector3 look_at_norm = look_at; + look_at_norm.mV[VZ] = 0.f; + look_at_norm.normalize(); + gAgent.resetAxes(look_at_norm); } //----------------------------------------------------------------------------- @@ -384,169 +384,169 @@ void LLAgentCamera::slamLookAt(const LLVector3 &look_at) //----------------------------------------------------------------------------- LLVector3 LLAgentCamera::calcFocusOffset(LLViewerObject *object, LLVector3 original_focus_point, S32 x, S32 y) { - LLMatrix4 obj_matrix = object->getRenderMatrix(); - LLQuaternion obj_rot = object->getRenderRotation(); - LLVector3 obj_pos = object->getRenderPosition(); - - BOOL is_avatar = object->isAvatar(); - // if is avatar - don't do any funk heuristics to position the focal point - // see DEV-30589 - if (is_avatar) - { - return original_focus_point - obj_pos; - } - - LLQuaternion inv_obj_rot = ~obj_rot; // get inverse of rotation - LLVector3 object_extents = object->getScale(); - - // make sure they object extents are non-zero - object_extents.clamp(0.001f, F32_MAX); - - // obj_to_cam_ray is unit vector pointing from object center to camera, in the coordinate frame of the object - LLVector3 obj_to_cam_ray = obj_pos - LLViewerCamera::getInstance()->getOrigin(); - obj_to_cam_ray.rotVec(inv_obj_rot); - obj_to_cam_ray.normalize(); - - // obj_to_cam_ray_proportions are the (positive) ratios of - // the obj_to_cam_ray x,y,z components with the x,y,z object dimensions. - LLVector3 obj_to_cam_ray_proportions; - obj_to_cam_ray_proportions.mV[VX] = llabs(obj_to_cam_ray.mV[VX] / object_extents.mV[VX]); - obj_to_cam_ray_proportions.mV[VY] = llabs(obj_to_cam_ray.mV[VY] / object_extents.mV[VY]); - obj_to_cam_ray_proportions.mV[VZ] = llabs(obj_to_cam_ray.mV[VZ] / object_extents.mV[VZ]); - - // find the largest ratio stored in obj_to_cam_ray_proportions - // this corresponds to the object's local axial plane (XY, YZ, XZ) that is *most* facing the camera - LLVector3 longest_object_axis; - // is x-axis longest? - if (obj_to_cam_ray_proportions.mV[VX] > obj_to_cam_ray_proportions.mV[VY] - && obj_to_cam_ray_proportions.mV[VX] > obj_to_cam_ray_proportions.mV[VZ]) - { - // then grab it - longest_object_axis.setVec(obj_matrix.getFwdRow4()); - } - // is y-axis longest? - else if (obj_to_cam_ray_proportions.mV[VY] > obj_to_cam_ray_proportions.mV[VZ]) - { - // then grab it - longest_object_axis.setVec(obj_matrix.getLeftRow4()); - } - // otherwise, use z axis - else - { - longest_object_axis.setVec(obj_matrix.getUpRow4()); - } - - // Use this axis as the normal to project mouse click on to plane with that normal, at the object center. - // This generates a point behind the mouse cursor that is approximately in the middle of the object in - // terms of depth. - // We do this to allow the camera rotation tool to "tumble" the object by rotating the camera. - // If the focus point were the object surface under the mouse, camera rotation would introduce an undesirable - // eccentricity to the object orientation - LLVector3 focus_plane_normal(longest_object_axis); - focus_plane_normal.normalize(); - - LLVector3d focus_pt_global; - gViewerWindow->mousePointOnPlaneGlobal(focus_pt_global, x, y, gAgent.getPosGlobalFromAgent(obj_pos), focus_plane_normal); - LLVector3 focus_pt = gAgent.getPosAgentFromGlobal(focus_pt_global); - - // find vector from camera to focus point in object space - LLVector3 camera_to_focus_vec = focus_pt - LLViewerCamera::getInstance()->getOrigin(); - camera_to_focus_vec.rotVec(inv_obj_rot); - - // find vector from object origin to focus point in object coordinates - LLVector3 focus_offset_from_object_center = focus_pt - obj_pos; - // convert to object-local space - focus_offset_from_object_center.rotVec(inv_obj_rot); - - // We need to project the focus point back into the bounding box of the focused object. - // Do this by calculating the XYZ scale factors needed to get focus offset back in bounds along the camera_focus axis - LLVector3 clip_fraction; - - // for each axis... - for (U32 axis = VX; axis <= VZ; axis++) - { - //...calculate distance that focus offset sits outside of bounding box along that axis... - //NOTE: dist_out_of_bounds keeps the sign of focus_offset_from_object_center - F32 dist_out_of_bounds; - if (focus_offset_from_object_center.mV[axis] > 0.f) - { - dist_out_of_bounds = llmax(0.f, focus_offset_from_object_center.mV[axis] - (object_extents.mV[axis] * 0.5f)); - } - else - { - dist_out_of_bounds = llmin(0.f, focus_offset_from_object_center.mV[axis] + (object_extents.mV[axis] * 0.5f)); - } - - //...then calculate the scale factor needed to push camera_to_focus_vec back in bounds along current axis - if (llabs(camera_to_focus_vec.mV[axis]) < 0.0001f) - { - // don't divide by very small number - clip_fraction.mV[axis] = 0.f; - } - else - { - clip_fraction.mV[axis] = dist_out_of_bounds / camera_to_focus_vec.mV[axis]; - } - } - - LLVector3 abs_clip_fraction = clip_fraction; - abs_clip_fraction.abs(); - - // find axis of focus offset that is *most* outside the bounding box and use that to - // rescale focus offset to inside object extents - if (abs_clip_fraction.mV[VX] > abs_clip_fraction.mV[VY] - && abs_clip_fraction.mV[VX] > abs_clip_fraction.mV[VZ]) - { - focus_offset_from_object_center -= clip_fraction.mV[VX] * camera_to_focus_vec; - } - else if (abs_clip_fraction.mV[VY] > abs_clip_fraction.mV[VZ]) - { - focus_offset_from_object_center -= clip_fraction.mV[VY] * camera_to_focus_vec; - } - else - { - focus_offset_from_object_center -= clip_fraction.mV[VZ] * camera_to_focus_vec; - } - - // convert back to world space - focus_offset_from_object_center.rotVec(obj_rot); - - // now, based on distance of camera from object relative to object size - // push the focus point towards the near surface of the object when (relatively) close to the objcet - // or keep the focus point in the object middle when (relatively) far - // NOTE: leave focus point in middle of avatars, since the behavior you want when alt-zooming on avatars - // is almost always "tumble about middle" and not "spin around surface point" - if (!is_avatar) - { - LLVector3 obj_rel = original_focus_point - object->getRenderPosition(); - - //now that we have the object relative position, we should bias toward the center of the object - //based on the distance of the camera to the focus point vs. the distance of the camera to the focus - - F32 relDist = llabs(obj_rel * LLViewerCamera::getInstance()->getAtAxis()); - F32 viewDist = dist_vec(obj_pos + obj_rel, LLViewerCamera::getInstance()->getOrigin()); - - - LLBBox obj_bbox = object->getBoundingBoxAgent(); - F32 bias = 0.f; - - // virtual_camera_pos is the camera position we are simulating by backing the camera off - // and adjusting the FOV - LLVector3 virtual_camera_pos = gAgent.getPosAgentFromGlobal(mFocusTargetGlobal + (getCameraPositionGlobal() - mFocusTargetGlobal) / (1.f + mCameraFOVZoomFactor)); - - // if the camera is inside the object (large, hollow objects, for example) - // leave focus point all the way to destination depth, away from object center - if(!obj_bbox.containsPointAgent(virtual_camera_pos)) - { - // perform magic number biasing of focus point towards surface vs. planar center - bias = clamp_rescale(relDist/viewDist, 0.1f, 0.7f, 0.0f, 1.0f); - obj_rel = lerp(focus_offset_from_object_center, obj_rel, bias); - } - - focus_offset_from_object_center = obj_rel; - } - - return focus_offset_from_object_center; + LLMatrix4 obj_matrix = object->getRenderMatrix(); + LLQuaternion obj_rot = object->getRenderRotation(); + LLVector3 obj_pos = object->getRenderPosition(); + + BOOL is_avatar = object->isAvatar(); + // if is avatar - don't do any funk heuristics to position the focal point + // see DEV-30589 + if (is_avatar) + { + return original_focus_point - obj_pos; + } + + LLQuaternion inv_obj_rot = ~obj_rot; // get inverse of rotation + LLVector3 object_extents = object->getScale(); + + // make sure they object extents are non-zero + object_extents.clamp(0.001f, F32_MAX); + + // obj_to_cam_ray is unit vector pointing from object center to camera, in the coordinate frame of the object + LLVector3 obj_to_cam_ray = obj_pos - LLViewerCamera::getInstance()->getOrigin(); + obj_to_cam_ray.rotVec(inv_obj_rot); + obj_to_cam_ray.normalize(); + + // obj_to_cam_ray_proportions are the (positive) ratios of + // the obj_to_cam_ray x,y,z components with the x,y,z object dimensions. + LLVector3 obj_to_cam_ray_proportions; + obj_to_cam_ray_proportions.mV[VX] = llabs(obj_to_cam_ray.mV[VX] / object_extents.mV[VX]); + obj_to_cam_ray_proportions.mV[VY] = llabs(obj_to_cam_ray.mV[VY] / object_extents.mV[VY]); + obj_to_cam_ray_proportions.mV[VZ] = llabs(obj_to_cam_ray.mV[VZ] / object_extents.mV[VZ]); + + // find the largest ratio stored in obj_to_cam_ray_proportions + // this corresponds to the object's local axial plane (XY, YZ, XZ) that is *most* facing the camera + LLVector3 longest_object_axis; + // is x-axis longest? + if (obj_to_cam_ray_proportions.mV[VX] > obj_to_cam_ray_proportions.mV[VY] + && obj_to_cam_ray_proportions.mV[VX] > obj_to_cam_ray_proportions.mV[VZ]) + { + // then grab it + longest_object_axis.setVec(obj_matrix.getFwdRow4()); + } + // is y-axis longest? + else if (obj_to_cam_ray_proportions.mV[VY] > obj_to_cam_ray_proportions.mV[VZ]) + { + // then grab it + longest_object_axis.setVec(obj_matrix.getLeftRow4()); + } + // otherwise, use z axis + else + { + longest_object_axis.setVec(obj_matrix.getUpRow4()); + } + + // Use this axis as the normal to project mouse click on to plane with that normal, at the object center. + // This generates a point behind the mouse cursor that is approximately in the middle of the object in + // terms of depth. + // We do this to allow the camera rotation tool to "tumble" the object by rotating the camera. + // If the focus point were the object surface under the mouse, camera rotation would introduce an undesirable + // eccentricity to the object orientation + LLVector3 focus_plane_normal(longest_object_axis); + focus_plane_normal.normalize(); + + LLVector3d focus_pt_global; + gViewerWindow->mousePointOnPlaneGlobal(focus_pt_global, x, y, gAgent.getPosGlobalFromAgent(obj_pos), focus_plane_normal); + LLVector3 focus_pt = gAgent.getPosAgentFromGlobal(focus_pt_global); + + // find vector from camera to focus point in object space + LLVector3 camera_to_focus_vec = focus_pt - LLViewerCamera::getInstance()->getOrigin(); + camera_to_focus_vec.rotVec(inv_obj_rot); + + // find vector from object origin to focus point in object coordinates + LLVector3 focus_offset_from_object_center = focus_pt - obj_pos; + // convert to object-local space + focus_offset_from_object_center.rotVec(inv_obj_rot); + + // We need to project the focus point back into the bounding box of the focused object. + // Do this by calculating the XYZ scale factors needed to get focus offset back in bounds along the camera_focus axis + LLVector3 clip_fraction; + + // for each axis... + for (U32 axis = VX; axis <= VZ; axis++) + { + //...calculate distance that focus offset sits outside of bounding box along that axis... + //NOTE: dist_out_of_bounds keeps the sign of focus_offset_from_object_center + F32 dist_out_of_bounds; + if (focus_offset_from_object_center.mV[axis] > 0.f) + { + dist_out_of_bounds = llmax(0.f, focus_offset_from_object_center.mV[axis] - (object_extents.mV[axis] * 0.5f)); + } + else + { + dist_out_of_bounds = llmin(0.f, focus_offset_from_object_center.mV[axis] + (object_extents.mV[axis] * 0.5f)); + } + + //...then calculate the scale factor needed to push camera_to_focus_vec back in bounds along current axis + if (llabs(camera_to_focus_vec.mV[axis]) < 0.0001f) + { + // don't divide by very small number + clip_fraction.mV[axis] = 0.f; + } + else + { + clip_fraction.mV[axis] = dist_out_of_bounds / camera_to_focus_vec.mV[axis]; + } + } + + LLVector3 abs_clip_fraction = clip_fraction; + abs_clip_fraction.abs(); + + // find axis of focus offset that is *most* outside the bounding box and use that to + // rescale focus offset to inside object extents + if (abs_clip_fraction.mV[VX] > abs_clip_fraction.mV[VY] + && abs_clip_fraction.mV[VX] > abs_clip_fraction.mV[VZ]) + { + focus_offset_from_object_center -= clip_fraction.mV[VX] * camera_to_focus_vec; + } + else if (abs_clip_fraction.mV[VY] > abs_clip_fraction.mV[VZ]) + { + focus_offset_from_object_center -= clip_fraction.mV[VY] * camera_to_focus_vec; + } + else + { + focus_offset_from_object_center -= clip_fraction.mV[VZ] * camera_to_focus_vec; + } + + // convert back to world space + focus_offset_from_object_center.rotVec(obj_rot); + + // now, based on distance of camera from object relative to object size + // push the focus point towards the near surface of the object when (relatively) close to the objcet + // or keep the focus point in the object middle when (relatively) far + // NOTE: leave focus point in middle of avatars, since the behavior you want when alt-zooming on avatars + // is almost always "tumble about middle" and not "spin around surface point" + if (!is_avatar) + { + LLVector3 obj_rel = original_focus_point - object->getRenderPosition(); + + //now that we have the object relative position, we should bias toward the center of the object + //based on the distance of the camera to the focus point vs. the distance of the camera to the focus + + F32 relDist = llabs(obj_rel * LLViewerCamera::getInstance()->getAtAxis()); + F32 viewDist = dist_vec(obj_pos + obj_rel, LLViewerCamera::getInstance()->getOrigin()); + + + LLBBox obj_bbox = object->getBoundingBoxAgent(); + F32 bias = 0.f; + + // virtual_camera_pos is the camera position we are simulating by backing the camera off + // and adjusting the FOV + LLVector3 virtual_camera_pos = gAgent.getPosAgentFromGlobal(mFocusTargetGlobal + (getCameraPositionGlobal() - mFocusTargetGlobal) / (1.f + mCameraFOVZoomFactor)); + + // if the camera is inside the object (large, hollow objects, for example) + // leave focus point all the way to destination depth, away from object center + if(!obj_bbox.containsPointAgent(virtual_camera_pos)) + { + // perform magic number biasing of focus point towards surface vs. planar center + bias = clamp_rescale(relDist/viewDist, 0.1f, 0.7f, 0.0f, 1.0f); + obj_rel = lerp(focus_offset_from_object_center, obj_rel, bias); + } + + focus_offset_from_object_center = obj_rel; + } + + return focus_offset_from_object_center; } //----------------------------------------------------------------------------- @@ -554,260 +554,260 @@ LLVector3 LLAgentCamera::calcFocusOffset(LLViewerObject *object, LLVector3 origi //----------------------------------------------------------------------------- BOOL LLAgentCamera::calcCameraMinDistance(F32 &obj_min_distance) { - BOOL soft_limit = FALSE; // is the bounding box to be treated literally (volumes) or as an approximation (avatars) - - if (!mFocusObject || mFocusObject->isDead() || - mFocusObject->isMesh() || - gSavedSettings.getBOOL("DisableCameraConstraints")) - { - obj_min_distance = 0.f; - return TRUE; - } - - if (mFocusObject->mDrawable.isNull()) - { + BOOL soft_limit = FALSE; // is the bounding box to be treated literally (volumes) or as an approximation (avatars) + + if (!mFocusObject || mFocusObject->isDead() || + mFocusObject->isMesh() || + gSavedSettings.getBOOL("DisableCameraConstraints")) + { + obj_min_distance = 0.f; + return TRUE; + } + + if (mFocusObject->mDrawable.isNull()) + { #ifdef LL_RELEASE_FOR_DOWNLOAD - LL_WARNS() << "Focus object with no drawable!" << LL_ENDL; + LL_WARNS() << "Focus object with no drawable!" << LL_ENDL; #else - mFocusObject->dump(); - LL_ERRS() << "Focus object with no drawable!" << LL_ENDL; + mFocusObject->dump(); + LL_ERRS() << "Focus object with no drawable!" << LL_ENDL; #endif - obj_min_distance = 0.f; - return TRUE; - } - - LLQuaternion inv_object_rot = ~mFocusObject->getRenderRotation(); - LLVector3 target_offset_origin = mFocusObjectOffset; - LLVector3 camera_offset_target(getCameraPositionAgent() - gAgent.getPosAgentFromGlobal(mFocusTargetGlobal)); - - // convert offsets into object local space - camera_offset_target.rotVec(inv_object_rot); - target_offset_origin.rotVec(inv_object_rot); - - // push around object extents based on target offset - LLVector3 object_extents = mFocusObject->getScale(); - if (mFocusObject->isAvatar()) - { - // fudge factors that lets you zoom in on avatars a bit more (which don't do FOV zoom) - object_extents.mV[VX] *= AVATAR_ZOOM_MIN_X_FACTOR; - object_extents.mV[VY] *= AVATAR_ZOOM_MIN_Y_FACTOR; - object_extents.mV[VZ] *= AVATAR_ZOOM_MIN_Z_FACTOR; - soft_limit = TRUE; - } - LLVector3 abs_target_offset = target_offset_origin; - abs_target_offset.abs(); - - LLVector3 target_offset_dir = target_offset_origin; - - BOOL target_outside_object_extents = FALSE; - - for (U32 i = VX; i <= VZ; i++) - { - if (abs_target_offset.mV[i] * 2.f > object_extents.mV[i] + OBJECT_EXTENTS_PADDING) - { - target_outside_object_extents = TRUE; - } - if (camera_offset_target.mV[i] > 0.f) - { - object_extents.mV[i] -= target_offset_origin.mV[i] * 2.f; - } - else - { - object_extents.mV[i] += target_offset_origin.mV[i] * 2.f; - } - } - - // don't shrink the object extents so far that the object inverts - object_extents.clamp(0.001f, F32_MAX); - - // move into first octant - LLVector3 camera_offset_target_abs_norm = camera_offset_target; - camera_offset_target_abs_norm.abs(); - // make sure offset is non-zero - camera_offset_target_abs_norm.clamp(0.001f, F32_MAX); - camera_offset_target_abs_norm.normalize(); - - // find camera position relative to normalized object extents - LLVector3 camera_offset_target_scaled = camera_offset_target_abs_norm; - camera_offset_target_scaled.mV[VX] /= object_extents.mV[VX]; - camera_offset_target_scaled.mV[VY] /= object_extents.mV[VY]; - camera_offset_target_scaled.mV[VZ] /= object_extents.mV[VZ]; - - if (camera_offset_target_scaled.mV[VX] > camera_offset_target_scaled.mV[VY] && - camera_offset_target_scaled.mV[VX] > camera_offset_target_scaled.mV[VZ]) - { - if (camera_offset_target_abs_norm.mV[VX] < 0.001f) - { - obj_min_distance = object_extents.mV[VX] * 0.5f; - } - else - { - obj_min_distance = object_extents.mV[VX] * 0.5f / camera_offset_target_abs_norm.mV[VX]; - } - } - else if (camera_offset_target_scaled.mV[VY] > camera_offset_target_scaled.mV[VZ]) - { - if (camera_offset_target_abs_norm.mV[VY] < 0.001f) - { - obj_min_distance = object_extents.mV[VY] * 0.5f; - } - else - { - obj_min_distance = object_extents.mV[VY] * 0.5f / camera_offset_target_abs_norm.mV[VY]; - } - } - else - { - if (camera_offset_target_abs_norm.mV[VZ] < 0.001f) - { - obj_min_distance = object_extents.mV[VZ] * 0.5f; - } - else - { - obj_min_distance = object_extents.mV[VZ] * 0.5f / camera_offset_target_abs_norm.mV[VZ]; - } - } - - LLVector3 object_split_axis; - LLVector3 target_offset_scaled = target_offset_origin; - target_offset_scaled.abs(); - target_offset_scaled.normalize(); - target_offset_scaled.mV[VX] /= object_extents.mV[VX]; - target_offset_scaled.mV[VY] /= object_extents.mV[VY]; - target_offset_scaled.mV[VZ] /= object_extents.mV[VZ]; - - if (target_offset_scaled.mV[VX] > target_offset_scaled.mV[VY] && - target_offset_scaled.mV[VX] > target_offset_scaled.mV[VZ]) - { - object_split_axis = LLVector3::x_axis; - } - else if (target_offset_scaled.mV[VY] > target_offset_scaled.mV[VZ]) - { - object_split_axis = LLVector3::y_axis; - } - else - { - object_split_axis = LLVector3::z_axis; - } - - LLVector3 camera_offset_object(getCameraPositionAgent() - mFocusObject->getPositionAgent()); - - - F32 camera_offset_clip = camera_offset_object * object_split_axis; - F32 target_offset_clip = target_offset_dir * object_split_axis; - - // target has moved outside of object extents - // check to see if camera and target are on same side - if (target_outside_object_extents) - { - if (camera_offset_clip > 0.f && target_offset_clip > 0.f) - { - return FALSE; - } - else if (camera_offset_clip < 0.f && target_offset_clip < 0.f) - { - return FALSE; - } - } - - // clamp obj distance to diagonal of 10 by 10 cube - obj_min_distance = llmin(obj_min_distance, 10.f * F_SQRT3); - - obj_min_distance += LLViewerCamera::getInstance()->getNear() + (soft_limit ? 0.1f : 0.2f); - - return TRUE; + obj_min_distance = 0.f; + return TRUE; + } + + LLQuaternion inv_object_rot = ~mFocusObject->getRenderRotation(); + LLVector3 target_offset_origin = mFocusObjectOffset; + LLVector3 camera_offset_target(getCameraPositionAgent() - gAgent.getPosAgentFromGlobal(mFocusTargetGlobal)); + + // convert offsets into object local space + camera_offset_target.rotVec(inv_object_rot); + target_offset_origin.rotVec(inv_object_rot); + + // push around object extents based on target offset + LLVector3 object_extents = mFocusObject->getScale(); + if (mFocusObject->isAvatar()) + { + // fudge factors that lets you zoom in on avatars a bit more (which don't do FOV zoom) + object_extents.mV[VX] *= AVATAR_ZOOM_MIN_X_FACTOR; + object_extents.mV[VY] *= AVATAR_ZOOM_MIN_Y_FACTOR; + object_extents.mV[VZ] *= AVATAR_ZOOM_MIN_Z_FACTOR; + soft_limit = TRUE; + } + LLVector3 abs_target_offset = target_offset_origin; + abs_target_offset.abs(); + + LLVector3 target_offset_dir = target_offset_origin; + + BOOL target_outside_object_extents = FALSE; + + for (U32 i = VX; i <= VZ; i++) + { + if (abs_target_offset.mV[i] * 2.f > object_extents.mV[i] + OBJECT_EXTENTS_PADDING) + { + target_outside_object_extents = TRUE; + } + if (camera_offset_target.mV[i] > 0.f) + { + object_extents.mV[i] -= target_offset_origin.mV[i] * 2.f; + } + else + { + object_extents.mV[i] += target_offset_origin.mV[i] * 2.f; + } + } + + // don't shrink the object extents so far that the object inverts + object_extents.clamp(0.001f, F32_MAX); + + // move into first octant + LLVector3 camera_offset_target_abs_norm = camera_offset_target; + camera_offset_target_abs_norm.abs(); + // make sure offset is non-zero + camera_offset_target_abs_norm.clamp(0.001f, F32_MAX); + camera_offset_target_abs_norm.normalize(); + + // find camera position relative to normalized object extents + LLVector3 camera_offset_target_scaled = camera_offset_target_abs_norm; + camera_offset_target_scaled.mV[VX] /= object_extents.mV[VX]; + camera_offset_target_scaled.mV[VY] /= object_extents.mV[VY]; + camera_offset_target_scaled.mV[VZ] /= object_extents.mV[VZ]; + + if (camera_offset_target_scaled.mV[VX] > camera_offset_target_scaled.mV[VY] && + camera_offset_target_scaled.mV[VX] > camera_offset_target_scaled.mV[VZ]) + { + if (camera_offset_target_abs_norm.mV[VX] < 0.001f) + { + obj_min_distance = object_extents.mV[VX] * 0.5f; + } + else + { + obj_min_distance = object_extents.mV[VX] * 0.5f / camera_offset_target_abs_norm.mV[VX]; + } + } + else if (camera_offset_target_scaled.mV[VY] > camera_offset_target_scaled.mV[VZ]) + { + if (camera_offset_target_abs_norm.mV[VY] < 0.001f) + { + obj_min_distance = object_extents.mV[VY] * 0.5f; + } + else + { + obj_min_distance = object_extents.mV[VY] * 0.5f / camera_offset_target_abs_norm.mV[VY]; + } + } + else + { + if (camera_offset_target_abs_norm.mV[VZ] < 0.001f) + { + obj_min_distance = object_extents.mV[VZ] * 0.5f; + } + else + { + obj_min_distance = object_extents.mV[VZ] * 0.5f / camera_offset_target_abs_norm.mV[VZ]; + } + } + + LLVector3 object_split_axis; + LLVector3 target_offset_scaled = target_offset_origin; + target_offset_scaled.abs(); + target_offset_scaled.normalize(); + target_offset_scaled.mV[VX] /= object_extents.mV[VX]; + target_offset_scaled.mV[VY] /= object_extents.mV[VY]; + target_offset_scaled.mV[VZ] /= object_extents.mV[VZ]; + + if (target_offset_scaled.mV[VX] > target_offset_scaled.mV[VY] && + target_offset_scaled.mV[VX] > target_offset_scaled.mV[VZ]) + { + object_split_axis = LLVector3::x_axis; + } + else if (target_offset_scaled.mV[VY] > target_offset_scaled.mV[VZ]) + { + object_split_axis = LLVector3::y_axis; + } + else + { + object_split_axis = LLVector3::z_axis; + } + + LLVector3 camera_offset_object(getCameraPositionAgent() - mFocusObject->getPositionAgent()); + + + F32 camera_offset_clip = camera_offset_object * object_split_axis; + F32 target_offset_clip = target_offset_dir * object_split_axis; + + // target has moved outside of object extents + // check to see if camera and target are on same side + if (target_outside_object_extents) + { + if (camera_offset_clip > 0.f && target_offset_clip > 0.f) + { + return FALSE; + } + else if (camera_offset_clip < 0.f && target_offset_clip < 0.f) + { + return FALSE; + } + } + + // clamp obj distance to diagonal of 10 by 10 cube + obj_min_distance = llmin(obj_min_distance, 10.f * F_SQRT3); + + obj_min_distance += LLViewerCamera::getInstance()->getNear() + (soft_limit ? 0.1f : 0.2f); + + return TRUE; } F32 LLAgentCamera::getCameraZoomFraction() { - // 0.f -> camera zoomed all the way out - // 1.f -> camera zoomed all the way in - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - // already [0,1] - return mHUDTargetZoom; - } - else if (mFocusOnAvatar && cameraThirdPerson()) - { - return clamp_rescale(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION, 1.f, 0.f); - } - else if (cameraCustomizeAvatar()) - { - F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); - return clamp_rescale(distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM, 1.f, 0.f ); - } - else - { - F32 min_zoom; - F32 max_zoom = getCameraMaxZoomDistance(); - - F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); - if (mFocusObject.notNull()) - { - if (mFocusObject->isAvatar()) - { - min_zoom = AVATAR_MIN_ZOOM; - } - else - { - min_zoom = OBJECT_MIN_ZOOM; - } - } - else - { - min_zoom = LAND_MIN_ZOOM; - } - - return clamp_rescale(distance, min_zoom, max_zoom, 1.f, 0.f); - } + // 0.f -> camera zoomed all the way out + // 1.f -> camera zoomed all the way in + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + // already [0,1] + return mHUDTargetZoom; + } + else if (mFocusOnAvatar && cameraThirdPerson()) + { + return clamp_rescale(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION, 1.f, 0.f); + } + else if (cameraCustomizeAvatar()) + { + F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); + return clamp_rescale(distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM, 1.f, 0.f ); + } + else + { + F32 min_zoom; + F32 max_zoom = getCameraMaxZoomDistance(); + + F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); + if (mFocusObject.notNull()) + { + if (mFocusObject->isAvatar()) + { + min_zoom = AVATAR_MIN_ZOOM; + } + else + { + min_zoom = OBJECT_MIN_ZOOM; + } + } + else + { + min_zoom = LAND_MIN_ZOOM; + } + + return clamp_rescale(distance, min_zoom, max_zoom, 1.f, 0.f); + } } void LLAgentCamera::setCameraZoomFraction(F32 fraction) { - // 0.f -> camera zoomed all the way out - // 1.f -> camera zoomed all the way in - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - - if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - mHUDTargetZoom = fraction; - } - else if (mFocusOnAvatar && cameraThirdPerson()) - { - mCameraZoomFraction = rescale(fraction, 0.f, 1.f, MAX_ZOOM_FRACTION, MIN_ZOOM_FRACTION); - } - else if (cameraCustomizeAvatar()) - { - LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; - camera_offset_dir.normalize(); - mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, APPEARANCE_MAX_ZOOM, APPEARANCE_MIN_ZOOM); - } - else - { - F32 min_zoom = LAND_MIN_ZOOM; - F32 max_zoom = getCameraMaxZoomDistance(); - - if (mFocusObject.notNull()) - { - if (mFocusObject.notNull()) - { - if (mFocusObject->isAvatar()) - { - min_zoom = AVATAR_MIN_ZOOM; - } - else - { - min_zoom = OBJECT_MIN_ZOOM; - } - } - } - - LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; - camera_offset_dir.normalize(); - mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, max_zoom, min_zoom); - } - startCameraAnimation(); + // 0.f -> camera zoomed all the way out + // 1.f -> camera zoomed all the way in + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + + if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + mHUDTargetZoom = fraction; + } + else if (mFocusOnAvatar && cameraThirdPerson()) + { + mCameraZoomFraction = rescale(fraction, 0.f, 1.f, MAX_ZOOM_FRACTION, MIN_ZOOM_FRACTION); + } + else if (cameraCustomizeAvatar()) + { + LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; + camera_offset_dir.normalize(); + mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, APPEARANCE_MAX_ZOOM, APPEARANCE_MIN_ZOOM); + } + else + { + F32 min_zoom = LAND_MIN_ZOOM; + F32 max_zoom = getCameraMaxZoomDistance(); + + if (mFocusObject.notNull()) + { + if (mFocusObject.notNull()) + { + if (mFocusObject->isAvatar()) + { + min_zoom = AVATAR_MIN_ZOOM; + } + else + { + min_zoom = OBJECT_MIN_ZOOM; + } + } + } + + LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; + camera_offset_dir.normalize(); + mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, max_zoom, min_zoom); + } + startCameraAnimation(); } @@ -816,21 +816,21 @@ void LLAgentCamera::setCameraZoomFraction(F32 fraction) //----------------------------------------------------------------------------- void LLAgentCamera::cameraOrbitAround(const F32 radians) { - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - // do nothing for hud selection - } - else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON || mCameraMode == CAMERA_MODE_FOLLOW)) - { - gAgent.yaw(radians); - } - else - { - mCameraFocusOffsetTarget.rotVec(radians, 0.f, 0.f, 1.f); - - cameraZoomIn(1.f); - } + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + // do nothing for hud selection + } + else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON || mCameraMode == CAMERA_MODE_FOLLOW)) + { + gAgent.yaw(radians); + } + else + { + mCameraFocusOffsetTarget.rotVec(radians, 0.f, 0.f, 1.f); + + cameraZoomIn(1.f); + } } @@ -839,29 +839,29 @@ void LLAgentCamera::cameraOrbitAround(const F32 radians) //----------------------------------------------------------------------------- void LLAgentCamera::cameraOrbitOver(const F32 angle) { - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - // do nothing for hud selection - } - else if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON) - { - gAgent.pitch(angle); - } - else - { - LLVector3 camera_offset_unit(mCameraFocusOffsetTarget); - camera_offset_unit.normalize(); - - F32 angle_from_up = acos( camera_offset_unit * gAgent.getReferenceUpVector() ); - - LLVector3d left_axis; - left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); - F32 new_angle = llclamp(angle_from_up - angle, 1.f * DEG_TO_RAD, 179.f * DEG_TO_RAD); - mCameraFocusOffsetTarget.rotVec(angle_from_up - new_angle, left_axis); - - cameraZoomIn(1.f); - } + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + // do nothing for hud selection + } + else if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON) + { + gAgent.pitch(angle); + } + else + { + LLVector3 camera_offset_unit(mCameraFocusOffsetTarget); + camera_offset_unit.normalize(); + + F32 angle_from_up = acos( camera_offset_unit * gAgent.getReferenceUpVector() ); + + LLVector3d left_axis; + left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); + F32 new_angle = llclamp(angle_from_up - angle, 1.f * DEG_TO_RAD, 179.f * DEG_TO_RAD); + mCameraFocusOffsetTarget.rotVec(angle_from_up - new_angle, left_axis); + + cameraZoomIn(1.f); + } } //----------------------------------------------------------------------------- @@ -869,65 +869,65 @@ void LLAgentCamera::cameraOrbitOver(const F32 angle) //----------------------------------------------------------------------------- void LLAgentCamera::cameraZoomIn(const F32 fraction) { - if (gDisconnected) - { - return; - } - - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - if (LLToolMgr::getInstance()->inBuildMode() && selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - // just update hud zoom level - mHUDTargetZoom /= fraction; - return; - } - - - LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); - F32 min_zoom = LAND_MIN_ZOOM; - F32 current_distance = (F32)camera_offset_unit.normalize(); - F32 new_distance = current_distance * fraction; - - // Don't move through focus point - if (mFocusObject) - { - LLVector3 camera_offset_dir((F32)camera_offset_unit.mdV[VX], (F32)camera_offset_unit.mdV[VY], (F32)camera_offset_unit.mdV[VZ]); - - if (mFocusObject->isAvatar()) - { - calcCameraMinDistance(min_zoom); - } - else - { - min_zoom = OBJECT_MIN_ZOOM; - } - } - - new_distance = llmax(new_distance, min_zoom); - - F32 max_distance = getCameraMaxZoomDistance(); + if (gDisconnected) + { + return; + } + + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + if (LLToolMgr::getInstance()->inBuildMode() && selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + // just update hud zoom level + mHUDTargetZoom /= fraction; + return; + } + + + LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); + F32 min_zoom = LAND_MIN_ZOOM; + F32 current_distance = (F32)camera_offset_unit.normalize(); + F32 new_distance = current_distance * fraction; + + // Don't move through focus point + if (mFocusObject) + { + LLVector3 camera_offset_dir((F32)camera_offset_unit.mdV[VX], (F32)camera_offset_unit.mdV[VY], (F32)camera_offset_unit.mdV[VZ]); + + if (mFocusObject->isAvatar()) + { + calcCameraMinDistance(min_zoom); + } + else + { + min_zoom = OBJECT_MIN_ZOOM; + } + } + + new_distance = llmax(new_distance, min_zoom); + + F32 max_distance = getCameraMaxZoomDistance(); max_distance = llmin(max_distance, current_distance * 4.f); //Scaled max relative to current distance. MAINT-3154 - if (new_distance > max_distance) - { - new_distance = max_distance; - - /* - // Unless camera is unlocked - if (!LLViewerCamera::sDisableCameraConstraints) - { - return; - } - */ - } - - if(cameraCustomizeAvatar()) - { - new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); - } - - mCameraFocusOffsetTarget = new_distance * camera_offset_unit; + if (new_distance > max_distance) + { + new_distance = max_distance; + + /* + // Unless camera is unlocked + if (!LLViewerCamera::sDisableCameraConstraints) + { + return; + } + */ + } + + if(cameraCustomizeAvatar()) + { + new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); + } + + mCameraFocusOffsetTarget = new_distance * camera_offset_unit; } //----------------------------------------------------------------------------- @@ -935,62 +935,62 @@ void LLAgentCamera::cameraZoomIn(const F32 fraction) //----------------------------------------------------------------------------- void LLAgentCamera::cameraOrbitIn(const F32 meters) { - if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON) - { - F32 camera_offset_dist = llmax(0.001f, getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale")); - - mCameraZoomFraction = (mTargetCameraDistance - meters) / camera_offset_dist; - - if (!gSavedSettings.getBOOL("FreezeTime") && mCameraZoomFraction < MIN_ZOOM_FRACTION && meters > 0.f) - { - // No need to animate, camera is already there. - changeCameraToMouselook(FALSE); - } - - mCameraZoomFraction = llclamp(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION); - } - else - { - LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); - F32 current_distance = (F32)camera_offset_unit.normalize(); - F32 new_distance = current_distance - meters; - F32 min_zoom = LAND_MIN_ZOOM; - - // Don't move through focus point - if (mFocusObject.notNull()) - { - if (mFocusObject->isAvatar()) - { - min_zoom = AVATAR_MIN_ZOOM; - } - else - { - min_zoom = OBJECT_MIN_ZOOM; - } - } - - new_distance = llmax(new_distance, min_zoom); - - F32 max_distance = getCameraMaxZoomDistance(); - - if (new_distance > max_distance) - { - // Unless camera is unlocked - if (!gSavedSettings.getBOOL("DisableCameraConstraints")) - { - return; - } - } - - if( CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode() ) - { - new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); - } - - // Compute new camera offset - mCameraFocusOffsetTarget = new_distance * camera_offset_unit; - cameraZoomIn(1.f); - } + if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON) + { + F32 camera_offset_dist = llmax(0.001f, getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale")); + + mCameraZoomFraction = (mTargetCameraDistance - meters) / camera_offset_dist; + + if (!gSavedSettings.getBOOL("FreezeTime") && mCameraZoomFraction < MIN_ZOOM_FRACTION && meters > 0.f) + { + // No need to animate, camera is already there. + changeCameraToMouselook(FALSE); + } + + mCameraZoomFraction = llclamp(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION); + } + else + { + LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); + F32 current_distance = (F32)camera_offset_unit.normalize(); + F32 new_distance = current_distance - meters; + F32 min_zoom = LAND_MIN_ZOOM; + + // Don't move through focus point + if (mFocusObject.notNull()) + { + if (mFocusObject->isAvatar()) + { + min_zoom = AVATAR_MIN_ZOOM; + } + else + { + min_zoom = OBJECT_MIN_ZOOM; + } + } + + new_distance = llmax(new_distance, min_zoom); + + F32 max_distance = getCameraMaxZoomDistance(); + + if (new_distance > max_distance) + { + // Unless camera is unlocked + if (!gSavedSettings.getBOOL("DisableCameraConstraints")) + { + return; + } + } + + if( CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode() ) + { + new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); + } + + // Compute new camera offset + mCameraFocusOffsetTarget = new_distance * camera_offset_unit; + cameraZoomIn(1.f); + } } @@ -999,15 +999,15 @@ void LLAgentCamera::cameraOrbitIn(const F32 meters) //----------------------------------------------------------------------------- void LLAgentCamera::cameraPanIn(F32 meters) { - LLVector3d at_axis; - at_axis.setVec(LLViewerCamera::getInstance()->getAtAxis()); - - mFocusTargetGlobal += meters * at_axis; - mFocusGlobal = mFocusTargetGlobal; - // don't enforce zoom constraints as this is the only way for users to get past them easily - updateFocusOffset(); - // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx - mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); + LLVector3d at_axis; + at_axis.setVec(LLViewerCamera::getInstance()->getAtAxis()); + + mFocusTargetGlobal += meters * at_axis; + mFocusGlobal = mFocusTargetGlobal; + // don't enforce zoom constraints as this is the only way for users to get past them easily + updateFocusOffset(); + // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx + mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); } //----------------------------------------------------------------------------- @@ -1015,19 +1015,19 @@ void LLAgentCamera::cameraPanIn(F32 meters) //----------------------------------------------------------------------------- void LLAgentCamera::cameraPanLeft(F32 meters) { - LLVector3d left_axis; - left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); - - mFocusTargetGlobal += meters * left_axis; - mFocusGlobal = mFocusTargetGlobal; - - // disable smoothing for camera pan, which causes some residents unhappiness - mCameraSmoothingStop = true; - - cameraZoomIn(1.f); - updateFocusOffset(); - // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind - Nyx - mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); + LLVector3d left_axis; + left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); + + mFocusTargetGlobal += meters * left_axis; + mFocusGlobal = mFocusTargetGlobal; + + // disable smoothing for camera pan, which causes some residents unhappiness + mCameraSmoothingStop = true; + + cameraZoomIn(1.f); + updateFocusOffset(); + // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind - Nyx + mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); } //----------------------------------------------------------------------------- @@ -1035,19 +1035,19 @@ void LLAgentCamera::cameraPanLeft(F32 meters) //----------------------------------------------------------------------------- void LLAgentCamera::cameraPanUp(F32 meters) { - LLVector3d up_axis; - up_axis.setVec(LLViewerCamera::getInstance()->getUpAxis()); + LLVector3d up_axis; + up_axis.setVec(LLViewerCamera::getInstance()->getUpAxis()); - mFocusTargetGlobal += meters * up_axis; - mFocusGlobal = mFocusTargetGlobal; + mFocusTargetGlobal += meters * up_axis; + mFocusGlobal = mFocusTargetGlobal; - // disable smoothing for camera pan, which causes some residents unhappiness - mCameraSmoothingStop = true; + // disable smoothing for camera pan, which causes some residents unhappiness + mCameraSmoothingStop = true; - cameraZoomIn(1.f); - updateFocusOffset(); - // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx - mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); + cameraZoomIn(1.f); + updateFocusOffset(); + // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx + mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); } //----------------------------------------------------------------------------- @@ -1055,67 +1055,67 @@ void LLAgentCamera::cameraPanUp(F32 meters) //----------------------------------------------------------------------------- void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y) { - static LLVector3 last_at_axis; - - if (!isAgentAvatarValid()) return; - - LLQuaternion av_inv_rot = ~gAgentAvatarp->mRoot->getWorldRotation(); - LLVector3 root_at = LLVector3::x_axis * gAgentAvatarp->mRoot->getWorldRotation(); - - if (LLTrace::get_frame_recording().getLastRecording().getLastValue(*gViewerWindow->getMouseVelocityStat()) < 0.01f - && (root_at * last_at_axis > 0.95f)) - { - LLVector3 vel = gAgentAvatarp->getVelocity(); - if (vel.magVecSquared() > 4.f) - { - setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, vel * av_inv_rot); - } - else - { - // *FIX: rotate mframeagent by sit object's rotation? - LLQuaternion look_rotation = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); // use camera's current rotation - LLVector3 look_offset = LLVector3(2.f, 0.f, 0.f) * look_rotation * av_inv_rot; - setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, look_offset); - } - last_at_axis = root_at; - return; - } - - last_at_axis = root_at; - - if (CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode()) - { - setLookAt(LOOKAT_TARGET_NONE, gAgentAvatarp, LLVector3(-2.f, 0.f, 0.f)); - } - else - { - // Move head based on cursor position - ELookAtType lookAtType = LOOKAT_TARGET_NONE; - LLVector3 headLookAxis; - LLCoordFrame frameCamera = *((LLCoordFrame*)LLViewerCamera::getInstance()); - - if (cameraMouselook()) - { - lookAtType = LOOKAT_TARGET_MOUSELOOK; - } - else if (cameraThirdPerson()) - { - // range from -.5 to .5 - F32 x_from_center = - ((F32) mouse_x / (F32) gViewerWindow->getWorldViewWidthScaled() ) - 0.5f; - F32 y_from_center = - ((F32) mouse_y / (F32) gViewerWindow->getWorldViewHeightScaled() ) - 0.5f; - - frameCamera.yaw( - x_from_center * gSavedSettings.getF32("YawFromMousePosition") * DEG_TO_RAD); - frameCamera.pitch( - y_from_center * gSavedSettings.getF32("PitchFromMousePosition") * DEG_TO_RAD); - lookAtType = LOOKAT_TARGET_FREELOOK; - } - - headLookAxis = frameCamera.getAtAxis(); - // RN: we use world-space offset for mouselook and freelook - //headLookAxis = headLookAxis * av_inv_rot; - setLookAt(lookAtType, gAgentAvatarp, headLookAxis); - } + static LLVector3 last_at_axis; + + if (!isAgentAvatarValid()) return; + + LLQuaternion av_inv_rot = ~gAgentAvatarp->mRoot->getWorldRotation(); + LLVector3 root_at = LLVector3::x_axis * gAgentAvatarp->mRoot->getWorldRotation(); + + if (LLTrace::get_frame_recording().getLastRecording().getLastValue(*gViewerWindow->getMouseVelocityStat()) < 0.01f + && (root_at * last_at_axis > 0.95f)) + { + LLVector3 vel = gAgentAvatarp->getVelocity(); + if (vel.magVecSquared() > 4.f) + { + setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, vel * av_inv_rot); + } + else + { + // *FIX: rotate mframeagent by sit object's rotation? + LLQuaternion look_rotation = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); // use camera's current rotation + LLVector3 look_offset = LLVector3(2.f, 0.f, 0.f) * look_rotation * av_inv_rot; + setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, look_offset); + } + last_at_axis = root_at; + return; + } + + last_at_axis = root_at; + + if (CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode()) + { + setLookAt(LOOKAT_TARGET_NONE, gAgentAvatarp, LLVector3(-2.f, 0.f, 0.f)); + } + else + { + // Move head based on cursor position + ELookAtType lookAtType = LOOKAT_TARGET_NONE; + LLVector3 headLookAxis; + LLCoordFrame frameCamera = *((LLCoordFrame*)LLViewerCamera::getInstance()); + + if (cameraMouselook()) + { + lookAtType = LOOKAT_TARGET_MOUSELOOK; + } + else if (cameraThirdPerson()) + { + // range from -.5 to .5 + F32 x_from_center = + ((F32) mouse_x / (F32) gViewerWindow->getWorldViewWidthScaled() ) - 0.5f; + F32 y_from_center = + ((F32) mouse_y / (F32) gViewerWindow->getWorldViewHeightScaled() ) - 0.5f; + + frameCamera.yaw( - x_from_center * gSavedSettings.getF32("YawFromMousePosition") * DEG_TO_RAD); + frameCamera.pitch( - y_from_center * gSavedSettings.getF32("PitchFromMousePosition") * DEG_TO_RAD); + lookAtType = LOOKAT_TARGET_FREELOOK; + } + + headLookAxis = frameCamera.getAtAxis(); + // RN: we use world-space offset for mouselook and freelook + //headLookAxis = headLookAxis * av_inv_rot; + setLookAt(lookAtType, gAgentAvatarp, headLookAxis); + } } static LLTrace::BlockTimerStatHandle FTM_UPDATE_CAMERA("Camera"); @@ -1125,373 +1125,373 @@ static LLTrace::BlockTimerStatHandle FTM_UPDATE_CAMERA("Camera"); //----------------------------------------------------------------------------- void LLAgentCamera::updateCamera() { - LL_RECORD_BLOCK_TIME(FTM_UPDATE_CAMERA); - - // - changed camera_skyward to the new global "mCameraUpVector" - mCameraUpVector = LLVector3::z_axis; - //LLVector3 camera_skyward(0.f, 0.f, 1.f); - - U32 camera_mode = mCameraAnimating ? mLastCameraMode : mCameraMode; - - validateFocusObject(); - - if (isAgentAvatarValid() && - gAgentAvatarp->isSitting() && - camera_mode == CAMERA_MODE_MOUSELOOK) - { - //changed camera_skyward to the new global "mCameraUpVector" - mCameraUpVector = mCameraUpVector * gAgentAvatarp->getRenderRotation(); - } - - if (cameraThirdPerson() && (mFocusOnAvatar || mAllowChangeToFollow) && LLFollowCamMgr::getActiveFollowCamParams()) - { - mAllowChangeToFollow = FALSE; - mFocusOnAvatar = TRUE; - changeCameraToFollow(); - } - - //NOTE - this needs to be integrated into a general upVector system here within llAgent. - if ( camera_mode == CAMERA_MODE_FOLLOW && mFocusOnAvatar ) - { - mCameraUpVector = mFollowCam.getUpVector(); - } - - if (mSitCameraEnabled) - { - if (mSitCameraReferenceObject->isDead()) - { - setSitCamera(LLUUID::null); - } - } - - // Update UI with our camera inputs - LLFloaterCamera* camera_floater = LLFloaterReg::findTypedInstance("camera"); - if (camera_floater) - { - camera_floater->mRotate->setToggleState(gAgentCamera.getOrbitRightKey() > 0.f, // left - gAgentCamera.getOrbitUpKey() > 0.f, // top - gAgentCamera.getOrbitLeftKey() > 0.f, // right - gAgentCamera.getOrbitDownKey() > 0.f); // bottom - - camera_floater->mTrack->setToggleState(gAgentCamera.getPanLeftKey() > 0.f, // left - gAgentCamera.getPanUpKey() > 0.f, // top - gAgentCamera.getPanRightKey() > 0.f, // right - gAgentCamera.getPanDownKey() > 0.f); // bottom - } - - // Handle camera movement based on keyboard. - const F32 ORBIT_OVER_RATE = 90.f * DEG_TO_RAD; // radians per second - const F32 ORBIT_AROUND_RATE = 90.f * DEG_TO_RAD; // radians per second - const F32 PAN_RATE = 5.f; // meters per second - - if (gAgentCamera.getOrbitUpKey() || gAgentCamera.getOrbitDownKey()) - { - F32 input_rate = gAgentCamera.getOrbitUpKey() - gAgentCamera.getOrbitDownKey(); - cameraOrbitOver( input_rate * ORBIT_OVER_RATE / gFPSClamped ); - } - - if (gAgentCamera.getOrbitLeftKey() || gAgentCamera.getOrbitRightKey()) - { - F32 input_rate = gAgentCamera.getOrbitLeftKey() - gAgentCamera.getOrbitRightKey(); - cameraOrbitAround(input_rate * ORBIT_AROUND_RATE / gFPSClamped); - } - - if (gAgentCamera.getOrbitInKey() || gAgentCamera.getOrbitOutKey()) - { - F32 input_rate = gAgentCamera.getOrbitInKey() - gAgentCamera.getOrbitOutKey(); - - LLVector3d to_focus = gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()) - calcFocusPositionTargetGlobal(); - F32 distance_to_focus = (F32)to_focus.magVec(); - // Move at distance (in meters) meters per second - cameraOrbitIn( input_rate * distance_to_focus / gFPSClamped ); - } - - if (gAgentCamera.getPanInKey() || gAgentCamera.getPanOutKey()) - { - F32 input_rate = gAgentCamera.getPanInKey() - gAgentCamera.getPanOutKey(); - cameraPanIn(input_rate * PAN_RATE / gFPSClamped); - } - - if (gAgentCamera.getPanRightKey() || gAgentCamera.getPanLeftKey()) - { - F32 input_rate = gAgentCamera.getPanRightKey() - gAgentCamera.getPanLeftKey(); - cameraPanLeft(input_rate * -PAN_RATE / gFPSClamped ); - } - - if (gAgentCamera.getPanUpKey() || gAgentCamera.getPanDownKey()) - { - F32 input_rate = gAgentCamera.getPanUpKey() - gAgentCamera.getPanDownKey(); - cameraPanUp(input_rate * PAN_RATE / gFPSClamped ); - } - - // Clear camera keyboard keys. - gAgentCamera.clearOrbitKeys(); - gAgentCamera.clearPanKeys(); - - // lerp camera focus offset - mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLSmoothInterpolation::getInterpolant(CAMERA_FOCUS_HALF_LIFE)); - - if ( mCameraMode == CAMERA_MODE_FOLLOW ) - { - if (isAgentAvatarValid()) - { - //-------------------------------------------------------------------------------- - // this is where the avatar's position and rotation are given to followCam, and - // where it is updated. All three of its attributes are updated: (1) position, - // (2) focus, and (3) upvector. They can then be queried elsewhere in llAgent. - //-------------------------------------------------------------------------------- - // *TODO: use combined rotation of frameagent and sit object - LLQuaternion avatarRotationForFollowCam = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); - - LLFollowCamParams* current_cam = LLFollowCamMgr::getActiveFollowCamParams(); - if (current_cam) - { - mFollowCam.copyParams(*current_cam); - mFollowCam.setSubjectPositionAndRotation( gAgentAvatarp->getRenderPosition(), avatarRotationForFollowCam ); - mFollowCam.update(); - LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true); - } - else - { - changeCameraToThirdPerson(TRUE); - } - } - } - - BOOL hit_limit; - LLVector3d camera_pos_global; - LLVector3d camera_target_global = calcCameraPositionTargetGlobal(&hit_limit); - mCameraVirtualPositionAgent = gAgent.getPosAgentFromGlobal(camera_target_global); - LLVector3d focus_target_global = calcFocusPositionTargetGlobal(); - - // perform field of view correction - mCameraFOVZoomFactor = calcCameraFOVZoomFactor(); - camera_target_global = focus_target_global + (camera_target_global - focus_target_global) * (1.f + mCameraFOVZoomFactor); - - gAgent.setShowAvatar(TRUE); // can see avatar by default - - // Adjust position for animation - if (mCameraAnimating) - { - F32 time = mAnimationTimer.getElapsedTimeF32(); - - // yet another instance of critically damped motion, hooray! - // F32 fraction_of_animation = 1.f - pow(2.f, -time / CAMERA_ZOOM_HALF_LIFE); - - // linear interpolation - F32 fraction_of_animation = time / mAnimationDuration; - - BOOL isfirstPerson = mCameraMode == CAMERA_MODE_MOUSELOOK; - BOOL wasfirstPerson = mLastCameraMode == CAMERA_MODE_MOUSELOOK; - F32 fraction_animation_to_skip; - - if (mAnimationCameraStartGlobal == camera_target_global) - { - fraction_animation_to_skip = 0.f; - } - else - { - LLVector3d cam_delta = mAnimationCameraStartGlobal - camera_target_global; - fraction_animation_to_skip = HEAD_BUFFER_SIZE / (F32)cam_delta.magVec(); - } - F32 animation_start_fraction = (wasfirstPerson) ? fraction_animation_to_skip : 0.f; - F32 animation_finish_fraction = (isfirstPerson) ? (1.f - fraction_animation_to_skip) : 1.f; - - if (fraction_of_animation < animation_finish_fraction) - { - if (fraction_of_animation < animation_start_fraction || fraction_of_animation > animation_finish_fraction ) - { - gAgent.setShowAvatar(FALSE); - } - - // ...adjust position for animation - F32 smooth_fraction_of_animation = llsmoothstep(0.0f, 1.0f, fraction_of_animation); - camera_pos_global = lerp(mAnimationCameraStartGlobal, camera_target_global, smooth_fraction_of_animation); - mFocusGlobal = lerp(mAnimationFocusStartGlobal, focus_target_global, smooth_fraction_of_animation); - } - else - { - // ...animation complete - mCameraAnimating = FALSE; - - camera_pos_global = camera_target_global; - mFocusGlobal = focus_target_global; - - gAgent.endAnimationUpdateUI(); - gAgent.setShowAvatar(TRUE); - } - - if (isAgentAvatarValid() && (mCameraMode != CAMERA_MODE_MOUSELOOK)) - { - gAgentAvatarp->updateAttachmentVisibility(mCameraMode); - } - } - else - { - camera_pos_global = camera_target_global; - mFocusGlobal = focus_target_global; - gAgent.setShowAvatar(TRUE); - } - - // smoothing - if (TRUE) - { - LLVector3d agent_pos = gAgent.getPositionGlobal(); - LLVector3d camera_pos_agent = camera_pos_global - agent_pos; - // Sitting on what you're manipulating can cause camera jitter with smoothing. - // This turns off smoothing while editing. -MG - bool in_build_mode = LLToolMgr::getInstance()->inBuildMode(); - mCameraSmoothingStop = mCameraSmoothingStop || in_build_mode; - - if (cameraThirdPerson() && !mCameraSmoothingStop) - { - const F32 SMOOTHING_HALF_LIFE = 0.02f; - - F32 smoothing = LLSmoothInterpolation::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, FALSE); - - if (!mFocusObject) // we differentiate on avatar mode - { - // for avatar-relative focus, we smooth in avatar space - - // the avatar moves too jerkily w/r/t global space to smooth there. - - LLVector3d delta = camera_pos_agent - mCameraSmoothingLastPositionAgent; - if (delta.magVec() < MAX_CAMERA_SMOOTH_DISTANCE) // only smooth over short distances please - { - camera_pos_agent = lerp(mCameraSmoothingLastPositionAgent, camera_pos_agent, smoothing); - camera_pos_global = camera_pos_agent + agent_pos; - } - } - else - { - LLVector3d delta = camera_pos_global - mCameraSmoothingLastPositionGlobal; - if (delta.magVec() < MAX_CAMERA_SMOOTH_DISTANCE) // only smooth over short distances please - { - camera_pos_global = lerp(mCameraSmoothingLastPositionGlobal, camera_pos_global, smoothing); - } - } - } - - mCameraSmoothingLastPositionGlobal = camera_pos_global; - mCameraSmoothingLastPositionAgent = camera_pos_agent; - mCameraSmoothingStop = false; - } - - - mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLSmoothInterpolation::getInterpolant(FOV_ZOOM_HALF_LIFE)); - -// LL_INFOS() << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << LL_ENDL; - - LLVector3 focus_agent = gAgent.getPosAgentFromGlobal(mFocusGlobal); - - mCameraPositionAgent = gAgent.getPosAgentFromGlobal(camera_pos_global); - - // Move the camera - - LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, mCameraUpVector, focus_agent); - //LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, camera_skyward, focus_agent); - - // Change FOV - LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / (1.f + mCameraCurrentFOVZoomFactor)); - - // follow camera when in customize mode - if (cameraCustomizeAvatar()) - { - setLookAt(LOOKAT_TARGET_FOCUS, NULL, mCameraPositionAgent); - } - - // update the travel distance stat - // this isn't directly related to the camera - // but this seemed like the best place to do this - LLVector3d global_pos = gAgent.getPositionGlobal(); - if (!gAgent.getLastPositionGlobal().isExactlyZero()) - { - LLVector3d delta = global_pos - gAgent.getLastPositionGlobal(); - gAgent.setDistanceTraveled(gAgent.getDistanceTraveled() + delta.magVec()); - } - gAgent.setLastPositionGlobal(global_pos); - - if (LLVOAvatar::sVisibleInFirstPerson && isAgentAvatarValid() && !gAgentAvatarp->isSitting() && cameraMouselook()) - { - LLVector3 head_pos = gAgentAvatarp->mHeadp->getWorldPosition() + - LLVector3(0.08f, 0.f, 0.05f) * gAgentAvatarp->mHeadp->getWorldRotation() + - LLVector3(0.1f, 0.f, 0.f) * gAgentAvatarp->mPelvisp->getWorldRotation(); - LLVector3 diff = mCameraPositionAgent - head_pos; - diff = diff * ~gAgentAvatarp->mRoot->getWorldRotation(); - - LLJoint* torso_joint = gAgentAvatarp->mTorsop; - LLJoint* chest_joint = gAgentAvatarp->mChestp; - LLVector3 torso_scale = torso_joint->getScale(); - LLVector3 chest_scale = chest_joint->getScale(); - - // shorten avatar skeleton to avoid foot interpenetration - if (!gAgentAvatarp->mInAir) - { - LLVector3 chest_offset = LLVector3(0.f, 0.f, chest_joint->getPosition().mV[VZ]) * torso_joint->getWorldRotation(); - F32 z_compensate = llclamp(-diff.mV[VZ], -0.2f, 1.f); - F32 scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / chest_offset.mV[VZ]), 0.5f, 1.2f); - torso_joint->setScale(LLVector3(1.f, 1.f, scale_factor)); - - LLJoint* neck_joint = gAgentAvatarp->mNeckp; - LLVector3 neck_offset = LLVector3(0.f, 0.f, neck_joint->getPosition().mV[VZ]) * chest_joint->getWorldRotation(); - scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / neck_offset.mV[VZ]), 0.5f, 1.2f); - chest_joint->setScale(LLVector3(1.f, 1.f, scale_factor)); - diff.mV[VZ] = 0.f; - } - - // SL-315 - gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff); - - gAgentAvatarp->mRoot->updateWorldMatrixChildren(); - - for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); - iter != gAgentAvatarp->mAttachmentPoints.end(); ) - { - LLVOAvatar::attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); - attachment_iter != attachment->mAttachedObjects.end(); - ++attachment_iter) - { - LLViewerObject *attached_object = (*attachment_iter); - if (attached_object && !attached_object->isDead() && attached_object->mDrawable.notNull()) - { - // clear any existing "early" movements of attachment - attached_object->mDrawable->clearState(LLDrawable::EARLY_MOVE); - gPipeline.updateMoveNormalAsync(attached_object->mDrawable); - attached_object->updateText(); - } - } - } - - torso_joint->setScale(torso_scale); - chest_joint->setScale(chest_scale); - } + LL_RECORD_BLOCK_TIME(FTM_UPDATE_CAMERA); + + // - changed camera_skyward to the new global "mCameraUpVector" + mCameraUpVector = LLVector3::z_axis; + //LLVector3 camera_skyward(0.f, 0.f, 1.f); + + U32 camera_mode = mCameraAnimating ? mLastCameraMode : mCameraMode; + + validateFocusObject(); + + if (isAgentAvatarValid() && + gAgentAvatarp->isSitting() && + camera_mode == CAMERA_MODE_MOUSELOOK) + { + //changed camera_skyward to the new global "mCameraUpVector" + mCameraUpVector = mCameraUpVector * gAgentAvatarp->getRenderRotation(); + } + + if (cameraThirdPerson() && (mFocusOnAvatar || mAllowChangeToFollow) && LLFollowCamMgr::getActiveFollowCamParams()) + { + mAllowChangeToFollow = FALSE; + mFocusOnAvatar = TRUE; + changeCameraToFollow(); + } + + //NOTE - this needs to be integrated into a general upVector system here within llAgent. + if ( camera_mode == CAMERA_MODE_FOLLOW && mFocusOnAvatar ) + { + mCameraUpVector = mFollowCam.getUpVector(); + } + + if (mSitCameraEnabled) + { + if (mSitCameraReferenceObject->isDead()) + { + setSitCamera(LLUUID::null); + } + } + + // Update UI with our camera inputs + LLFloaterCamera* camera_floater = LLFloaterReg::findTypedInstance("camera"); + if (camera_floater) + { + camera_floater->mRotate->setToggleState(gAgentCamera.getOrbitRightKey() > 0.f, // left + gAgentCamera.getOrbitUpKey() > 0.f, // top + gAgentCamera.getOrbitLeftKey() > 0.f, // right + gAgentCamera.getOrbitDownKey() > 0.f); // bottom + + camera_floater->mTrack->setToggleState(gAgentCamera.getPanLeftKey() > 0.f, // left + gAgentCamera.getPanUpKey() > 0.f, // top + gAgentCamera.getPanRightKey() > 0.f, // right + gAgentCamera.getPanDownKey() > 0.f); // bottom + } + + // Handle camera movement based on keyboard. + const F32 ORBIT_OVER_RATE = 90.f * DEG_TO_RAD; // radians per second + const F32 ORBIT_AROUND_RATE = 90.f * DEG_TO_RAD; // radians per second + const F32 PAN_RATE = 5.f; // meters per second + + if (gAgentCamera.getOrbitUpKey() || gAgentCamera.getOrbitDownKey()) + { + F32 input_rate = gAgentCamera.getOrbitUpKey() - gAgentCamera.getOrbitDownKey(); + cameraOrbitOver( input_rate * ORBIT_OVER_RATE / gFPSClamped ); + } + + if (gAgentCamera.getOrbitLeftKey() || gAgentCamera.getOrbitRightKey()) + { + F32 input_rate = gAgentCamera.getOrbitLeftKey() - gAgentCamera.getOrbitRightKey(); + cameraOrbitAround(input_rate * ORBIT_AROUND_RATE / gFPSClamped); + } + + if (gAgentCamera.getOrbitInKey() || gAgentCamera.getOrbitOutKey()) + { + F32 input_rate = gAgentCamera.getOrbitInKey() - gAgentCamera.getOrbitOutKey(); + + LLVector3d to_focus = gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()) - calcFocusPositionTargetGlobal(); + F32 distance_to_focus = (F32)to_focus.magVec(); + // Move at distance (in meters) meters per second + cameraOrbitIn( input_rate * distance_to_focus / gFPSClamped ); + } + + if (gAgentCamera.getPanInKey() || gAgentCamera.getPanOutKey()) + { + F32 input_rate = gAgentCamera.getPanInKey() - gAgentCamera.getPanOutKey(); + cameraPanIn(input_rate * PAN_RATE / gFPSClamped); + } + + if (gAgentCamera.getPanRightKey() || gAgentCamera.getPanLeftKey()) + { + F32 input_rate = gAgentCamera.getPanRightKey() - gAgentCamera.getPanLeftKey(); + cameraPanLeft(input_rate * -PAN_RATE / gFPSClamped ); + } + + if (gAgentCamera.getPanUpKey() || gAgentCamera.getPanDownKey()) + { + F32 input_rate = gAgentCamera.getPanUpKey() - gAgentCamera.getPanDownKey(); + cameraPanUp(input_rate * PAN_RATE / gFPSClamped ); + } + + // Clear camera keyboard keys. + gAgentCamera.clearOrbitKeys(); + gAgentCamera.clearPanKeys(); + + // lerp camera focus offset + mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLSmoothInterpolation::getInterpolant(CAMERA_FOCUS_HALF_LIFE)); + + if ( mCameraMode == CAMERA_MODE_FOLLOW ) + { + if (isAgentAvatarValid()) + { + //-------------------------------------------------------------------------------- + // this is where the avatar's position and rotation are given to followCam, and + // where it is updated. All three of its attributes are updated: (1) position, + // (2) focus, and (3) upvector. They can then be queried elsewhere in llAgent. + //-------------------------------------------------------------------------------- + // *TODO: use combined rotation of frameagent and sit object + LLQuaternion avatarRotationForFollowCam = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); + + LLFollowCamParams* current_cam = LLFollowCamMgr::getActiveFollowCamParams(); + if (current_cam) + { + mFollowCam.copyParams(*current_cam); + mFollowCam.setSubjectPositionAndRotation( gAgentAvatarp->getRenderPosition(), avatarRotationForFollowCam ); + mFollowCam.update(); + LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true); + } + else + { + changeCameraToThirdPerson(TRUE); + } + } + } + + BOOL hit_limit; + LLVector3d camera_pos_global; + LLVector3d camera_target_global = calcCameraPositionTargetGlobal(&hit_limit); + mCameraVirtualPositionAgent = gAgent.getPosAgentFromGlobal(camera_target_global); + LLVector3d focus_target_global = calcFocusPositionTargetGlobal(); + + // perform field of view correction + mCameraFOVZoomFactor = calcCameraFOVZoomFactor(); + camera_target_global = focus_target_global + (camera_target_global - focus_target_global) * (1.f + mCameraFOVZoomFactor); + + gAgent.setShowAvatar(TRUE); // can see avatar by default + + // Adjust position for animation + if (mCameraAnimating) + { + F32 time = mAnimationTimer.getElapsedTimeF32(); + + // yet another instance of critically damped motion, hooray! + // F32 fraction_of_animation = 1.f - pow(2.f, -time / CAMERA_ZOOM_HALF_LIFE); + + // linear interpolation + F32 fraction_of_animation = time / mAnimationDuration; + + BOOL isfirstPerson = mCameraMode == CAMERA_MODE_MOUSELOOK; + BOOL wasfirstPerson = mLastCameraMode == CAMERA_MODE_MOUSELOOK; + F32 fraction_animation_to_skip; + + if (mAnimationCameraStartGlobal == camera_target_global) + { + fraction_animation_to_skip = 0.f; + } + else + { + LLVector3d cam_delta = mAnimationCameraStartGlobal - camera_target_global; + fraction_animation_to_skip = HEAD_BUFFER_SIZE / (F32)cam_delta.magVec(); + } + F32 animation_start_fraction = (wasfirstPerson) ? fraction_animation_to_skip : 0.f; + F32 animation_finish_fraction = (isfirstPerson) ? (1.f - fraction_animation_to_skip) : 1.f; + + if (fraction_of_animation < animation_finish_fraction) + { + if (fraction_of_animation < animation_start_fraction || fraction_of_animation > animation_finish_fraction ) + { + gAgent.setShowAvatar(FALSE); + } + + // ...adjust position for animation + F32 smooth_fraction_of_animation = llsmoothstep(0.0f, 1.0f, fraction_of_animation); + camera_pos_global = lerp(mAnimationCameraStartGlobal, camera_target_global, smooth_fraction_of_animation); + mFocusGlobal = lerp(mAnimationFocusStartGlobal, focus_target_global, smooth_fraction_of_animation); + } + else + { + // ...animation complete + mCameraAnimating = FALSE; + + camera_pos_global = camera_target_global; + mFocusGlobal = focus_target_global; + + gAgent.endAnimationUpdateUI(); + gAgent.setShowAvatar(TRUE); + } + + if (isAgentAvatarValid() && (mCameraMode != CAMERA_MODE_MOUSELOOK)) + { + gAgentAvatarp->updateAttachmentVisibility(mCameraMode); + } + } + else + { + camera_pos_global = camera_target_global; + mFocusGlobal = focus_target_global; + gAgent.setShowAvatar(TRUE); + } + + // smoothing + if (TRUE) + { + LLVector3d agent_pos = gAgent.getPositionGlobal(); + LLVector3d camera_pos_agent = camera_pos_global - agent_pos; + // Sitting on what you're manipulating can cause camera jitter with smoothing. + // This turns off smoothing while editing. -MG + bool in_build_mode = LLToolMgr::getInstance()->inBuildMode(); + mCameraSmoothingStop = mCameraSmoothingStop || in_build_mode; + + if (cameraThirdPerson() && !mCameraSmoothingStop) + { + const F32 SMOOTHING_HALF_LIFE = 0.02f; + + F32 smoothing = LLSmoothInterpolation::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, FALSE); + + if (!mFocusObject) // we differentiate on avatar mode + { + // for avatar-relative focus, we smooth in avatar space - + // the avatar moves too jerkily w/r/t global space to smooth there. + + LLVector3d delta = camera_pos_agent - mCameraSmoothingLastPositionAgent; + if (delta.magVec() < MAX_CAMERA_SMOOTH_DISTANCE) // only smooth over short distances please + { + camera_pos_agent = lerp(mCameraSmoothingLastPositionAgent, camera_pos_agent, smoothing); + camera_pos_global = camera_pos_agent + agent_pos; + } + } + else + { + LLVector3d delta = camera_pos_global - mCameraSmoothingLastPositionGlobal; + if (delta.magVec() < MAX_CAMERA_SMOOTH_DISTANCE) // only smooth over short distances please + { + camera_pos_global = lerp(mCameraSmoothingLastPositionGlobal, camera_pos_global, smoothing); + } + } + } + + mCameraSmoothingLastPositionGlobal = camera_pos_global; + mCameraSmoothingLastPositionAgent = camera_pos_agent; + mCameraSmoothingStop = false; + } + + + mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLSmoothInterpolation::getInterpolant(FOV_ZOOM_HALF_LIFE)); + +// LL_INFOS() << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << LL_ENDL; + + LLVector3 focus_agent = gAgent.getPosAgentFromGlobal(mFocusGlobal); + + mCameraPositionAgent = gAgent.getPosAgentFromGlobal(camera_pos_global); + + // Move the camera + + LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, mCameraUpVector, focus_agent); + //LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, camera_skyward, focus_agent); + + // Change FOV + LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / (1.f + mCameraCurrentFOVZoomFactor)); + + // follow camera when in customize mode + if (cameraCustomizeAvatar()) + { + setLookAt(LOOKAT_TARGET_FOCUS, NULL, mCameraPositionAgent); + } + + // update the travel distance stat + // this isn't directly related to the camera + // but this seemed like the best place to do this + LLVector3d global_pos = gAgent.getPositionGlobal(); + if (!gAgent.getLastPositionGlobal().isExactlyZero()) + { + LLVector3d delta = global_pos - gAgent.getLastPositionGlobal(); + gAgent.setDistanceTraveled(gAgent.getDistanceTraveled() + delta.magVec()); + } + gAgent.setLastPositionGlobal(global_pos); + + if (LLVOAvatar::sVisibleInFirstPerson && isAgentAvatarValid() && !gAgentAvatarp->isSitting() && cameraMouselook()) + { + LLVector3 head_pos = gAgentAvatarp->mHeadp->getWorldPosition() + + LLVector3(0.08f, 0.f, 0.05f) * gAgentAvatarp->mHeadp->getWorldRotation() + + LLVector3(0.1f, 0.f, 0.f) * gAgentAvatarp->mPelvisp->getWorldRotation(); + LLVector3 diff = mCameraPositionAgent - head_pos; + diff = diff * ~gAgentAvatarp->mRoot->getWorldRotation(); + + LLJoint* torso_joint = gAgentAvatarp->mTorsop; + LLJoint* chest_joint = gAgentAvatarp->mChestp; + LLVector3 torso_scale = torso_joint->getScale(); + LLVector3 chest_scale = chest_joint->getScale(); + + // shorten avatar skeleton to avoid foot interpenetration + if (!gAgentAvatarp->mInAir) + { + LLVector3 chest_offset = LLVector3(0.f, 0.f, chest_joint->getPosition().mV[VZ]) * torso_joint->getWorldRotation(); + F32 z_compensate = llclamp(-diff.mV[VZ], -0.2f, 1.f); + F32 scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / chest_offset.mV[VZ]), 0.5f, 1.2f); + torso_joint->setScale(LLVector3(1.f, 1.f, scale_factor)); + + LLJoint* neck_joint = gAgentAvatarp->mNeckp; + LLVector3 neck_offset = LLVector3(0.f, 0.f, neck_joint->getPosition().mV[VZ]) * chest_joint->getWorldRotation(); + scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / neck_offset.mV[VZ]), 0.5f, 1.2f); + chest_joint->setScale(LLVector3(1.f, 1.f, scale_factor)); + diff.mV[VZ] = 0.f; + } + + // SL-315 + gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff); + + gAgentAvatarp->mRoot->updateWorldMatrixChildren(); + + for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + iter != gAgentAvatarp->mAttachmentPoints.end(); ) + { + LLVOAvatar::attachment_map_t::iterator curiter = iter++; + LLViewerJointAttachment* attachment = curiter->second; + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); + attachment_iter != attachment->mAttachedObjects.end(); + ++attachment_iter) + { + LLViewerObject *attached_object = (*attachment_iter); + if (attached_object && !attached_object->isDead() && attached_object->mDrawable.notNull()) + { + // clear any existing "early" movements of attachment + attached_object->mDrawable->clearState(LLDrawable::EARLY_MOVE); + gPipeline.updateMoveNormalAsync(attached_object->mDrawable); + attached_object->updateText(); + } + } + } + + torso_joint->setScale(torso_scale); + chest_joint->setScale(chest_scale); + } } void LLAgentCamera::updateLastCamera() { - mLastCameraMode = mCameraMode; + mLastCameraMode = mCameraMode; } void LLAgentCamera::updateFocusOffset() { - validateFocusObject(); - if (mFocusObject.notNull()) - { - LLVector3d obj_pos = gAgent.getPosGlobalFromAgent(mFocusObject->getRenderPosition()); - mFocusObjectOffset.setVec(mFocusTargetGlobal - obj_pos); - } + validateFocusObject(); + if (mFocusObject.notNull()) + { + LLVector3d obj_pos = gAgent.getPosGlobalFromAgent(mFocusObject->getRenderPosition()); + mFocusObjectOffset.setVec(mFocusTargetGlobal - obj_pos); + } } void LLAgentCamera::validateFocusObject() { - if (mFocusObject.notNull() && - mFocusObject->isDead()) - { - mFocusObjectOffset.clearVec(); - clearFocusObject(); - mCameraFOVZoomFactor = 0.f; - } + if (mFocusObject.notNull() && + mFocusObject->isDead()) + { + mFocusObjectOffset.clearVec(); + clearFocusObject(); + mCameraFOVZoomFactor = 0.f; + } } //----------------------------------------------------------------------------- @@ -1499,124 +1499,124 @@ void LLAgentCamera::validateFocusObject() //----------------------------------------------------------------------------- LLVector3d LLAgentCamera::calcFocusPositionTargetGlobal() { - if (mFocusObject.notNull() && mFocusObject->isDead()) - { - clearFocusObject(); - } - - if (mCameraMode == CAMERA_MODE_FOLLOW && mFocusOnAvatar) - { - mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(mFollowCam.getSimulatedFocus()); - return mFocusTargetGlobal; - } - else if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - LLVector3d at_axis(1.0, 0.0, 0.0); - LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion(); - if (isAgentAvatarValid() && gAgentAvatarp->getParent()) - { - LLViewerObject* root_object = (LLViewerObject*)gAgentAvatarp->getRoot(); - if (!root_object->flagCameraDecoupled()) - { - agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation(); - } - } - at_axis = at_axis * agent_rot; - mFocusTargetGlobal = calcCameraPositionTargetGlobal() + at_axis; - return mFocusTargetGlobal; - } - else if (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR) - { - if (mFocusOnAvatar) - { - LLVector3 focus_target = isAgentAvatarValid() - ? gAgentAvatarp->mHeadp->getWorldPosition() - : gAgent.getPositionAgent(); - LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target); - mFocusTargetGlobal = focus_target_global; - } - return mFocusTargetGlobal; - } - else if (!mFocusOnAvatar) - { - if (mFocusObject.notNull() && !mFocusObject->isDead() && mFocusObject->mDrawable.notNull()) - { - LLDrawable* drawablep = mFocusObject->mDrawable; - - if (mTrackFocusObject && - drawablep && - drawablep->isActive()) - { - if (!mFocusObject->isAvatar()) - { - if (mFocusObject->isSelected()) - { - gPipeline.updateMoveNormalAsync(drawablep); - } - else - { - if (drawablep->isState(LLDrawable::MOVE_UNDAMPED)) - { - gPipeline.updateMoveNormalAsync(drawablep); - } - else - { - gPipeline.updateMoveDampedAsync(drawablep); - } - } - } - } - // if not tracking object, update offset based on new object position - else - { - updateFocusOffset(); - } - LLVector3 focus_agent = mFocusObject->getRenderPosition() + mFocusObjectOffset; - mFocusTargetGlobal.setVec(gAgent.getPosGlobalFromAgent(focus_agent)); - } - return mFocusTargetGlobal; - } - else if (mSitCameraEnabled && isAgentAvatarValid() && gAgentAvatarp->isSitting() && mSitCameraReferenceObject.notNull()) - { - // sit camera - LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition(); - LLQuaternion object_rot = mSitCameraReferenceObject->getRenderRotation(); - - LLVector3 target_pos = object_pos + (mSitCameraFocus * object_rot); - return gAgent.getPosGlobalFromAgent(target_pos); - } - else - { - return gAgent.getPositionGlobal() + calcThirdPersonFocusOffset(); - } + if (mFocusObject.notNull() && mFocusObject->isDead()) + { + clearFocusObject(); + } + + if (mCameraMode == CAMERA_MODE_FOLLOW && mFocusOnAvatar) + { + mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(mFollowCam.getSimulatedFocus()); + return mFocusTargetGlobal; + } + else if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + LLVector3d at_axis(1.0, 0.0, 0.0); + LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion(); + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + LLViewerObject* root_object = (LLViewerObject*)gAgentAvatarp->getRoot(); + if (!root_object->flagCameraDecoupled()) + { + agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation(); + } + } + at_axis = at_axis * agent_rot; + mFocusTargetGlobal = calcCameraPositionTargetGlobal() + at_axis; + return mFocusTargetGlobal; + } + else if (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR) + { + if (mFocusOnAvatar) + { + LLVector3 focus_target = isAgentAvatarValid() + ? gAgentAvatarp->mHeadp->getWorldPosition() + : gAgent.getPositionAgent(); + LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target); + mFocusTargetGlobal = focus_target_global; + } + return mFocusTargetGlobal; + } + else if (!mFocusOnAvatar) + { + if (mFocusObject.notNull() && !mFocusObject->isDead() && mFocusObject->mDrawable.notNull()) + { + LLDrawable* drawablep = mFocusObject->mDrawable; + + if (mTrackFocusObject && + drawablep && + drawablep->isActive()) + { + if (!mFocusObject->isAvatar()) + { + if (mFocusObject->isSelected()) + { + gPipeline.updateMoveNormalAsync(drawablep); + } + else + { + if (drawablep->isState(LLDrawable::MOVE_UNDAMPED)) + { + gPipeline.updateMoveNormalAsync(drawablep); + } + else + { + gPipeline.updateMoveDampedAsync(drawablep); + } + } + } + } + // if not tracking object, update offset based on new object position + else + { + updateFocusOffset(); + } + LLVector3 focus_agent = mFocusObject->getRenderPosition() + mFocusObjectOffset; + mFocusTargetGlobal.setVec(gAgent.getPosGlobalFromAgent(focus_agent)); + } + return mFocusTargetGlobal; + } + else if (mSitCameraEnabled && isAgentAvatarValid() && gAgentAvatarp->isSitting() && mSitCameraReferenceObject.notNull()) + { + // sit camera + LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition(); + LLQuaternion object_rot = mSitCameraReferenceObject->getRenderRotation(); + + LLVector3 target_pos = object_pos + (mSitCameraFocus * object_rot); + return gAgent.getPosGlobalFromAgent(target_pos); + } + else + { + return gAgent.getPositionGlobal() + calcThirdPersonFocusOffset(); + } } LLVector3d LLAgentCamera::calcThirdPersonFocusOffset() { - // ...offset from avatar - LLVector3d focus_offset; - LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion(); - if (isAgentAvatarValid() && gAgentAvatarp->getParent()) - { - agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation(); - } - - focus_offset = convert_from_llsd(mFocusOffsetInitial[mCameraPreset]->get(), TYPE_VEC3D, ""); - return focus_offset * agent_rot; + // ...offset from avatar + LLVector3d focus_offset; + LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion(); + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation(); + } + + focus_offset = convert_from_llsd(mFocusOffsetInitial[mCameraPreset]->get(), TYPE_VEC3D, ""); + return focus_offset * agent_rot; } void LLAgentCamera::setupSitCamera() { - // agent frame entering this function is in world coordinates - if (isAgentAvatarValid() && gAgentAvatarp->getParent()) - { - LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); - // slam agent coordinate frame to proper parent local version - LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis(); - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - gAgent.resetAxes(at_axis * ~parent_rot); - } + // agent frame entering this function is in world coordinates + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); + // slam agent coordinate frame to proper parent local version + LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis(); + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis * ~parent_rot); + } } //----------------------------------------------------------------------------- @@ -1624,7 +1624,7 @@ void LLAgentCamera::setupSitCamera() //----------------------------------------------------------------------------- const LLVector3 &LLAgentCamera::getCameraPositionAgent() const { - return LLViewerCamera::getInstance()->getOrigin(); + return LLViewerCamera::getInstance()->getOrigin(); } //----------------------------------------------------------------------------- @@ -1632,39 +1632,39 @@ const LLVector3 &LLAgentCamera::getCameraPositionAgent() const //----------------------------------------------------------------------------- LLVector3d LLAgentCamera::getCameraPositionGlobal() const { - return gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()); + return gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()); } //----------------------------------------------------------------------------- // calcCameraFOVZoomFactor() //----------------------------------------------------------------------------- -F32 LLAgentCamera::calcCameraFOVZoomFactor() +F32 LLAgentCamera::calcCameraFOVZoomFactor() { - LLVector3 camera_offset_dir; - camera_offset_dir.setVec(mCameraFocusOffset); - - if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - return 0.f; - } - else if (mFocusObject.notNull() && !mFocusObject->isAvatar() && !mFocusOnAvatar) - { - // don't FOV zoom on mostly transparent objects - F32 obj_min_dist = 0.f; - calcCameraMinDistance(obj_min_dist); - F32 current_distance = llmax(0.001f, camera_offset_dir.magVec()); - - mFocusObjectDist = obj_min_dist - current_distance; - - F32 new_fov_zoom = llclamp(mFocusObjectDist / current_distance, 0.f, 1000.f); - return new_fov_zoom; - } - else // focusing on land or avatar - { - // keep old field of view until user changes focus explicitly - return mCameraFOVZoomFactor; - //return 0.f; - } + LLVector3 camera_offset_dir; + camera_offset_dir.setVec(mCameraFocusOffset); + + if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + return 0.f; + } + else if (mFocusObject.notNull() && !mFocusObject->isAvatar() && !mFocusOnAvatar) + { + // don't FOV zoom on mostly transparent objects + F32 obj_min_dist = 0.f; + calcCameraMinDistance(obj_min_dist); + F32 current_distance = llmax(0.001f, camera_offset_dir.magVec()); + + mFocusObjectDist = obj_min_dist - current_distance; + + F32 new_fov_zoom = llclamp(mFocusObjectDist / current_distance, 0.f, 1000.f); + return new_fov_zoom; + } + else // focusing on land or avatar + { + // keep old field of view until user changes focus explicitly + return mCameraFOVZoomFactor; + //return 0.f; + } } //----------------------------------------------------------------------------- @@ -1672,268 +1672,268 @@ F32 LLAgentCamera::calcCameraFOVZoomFactor() //----------------------------------------------------------------------------- LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) { - // Compute base camera position and look-at points. - F32 camera_land_height; - LLVector3d frame_center_global = !isAgentAvatarValid() ? - gAgent.getPositionGlobal() : - gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot->getWorldPosition()); - - BOOL isConstrained = FALSE; - LLVector3d head_offset; - head_offset.setVec(mThirdPersonHeadOffset); - - LLVector3d camera_position_global; - - if (mCameraMode == CAMERA_MODE_FOLLOW && mFocusOnAvatar) - { - camera_position_global = gAgent.getPosGlobalFromAgent(mFollowCam.getSimulatedPosition()); - } - else if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - if (!isAgentAvatarValid() || gAgentAvatarp->mDrawable.isNull()) - { - LL_WARNS() << "Null avatar drawable!" << LL_ENDL; - return LLVector3d::zero; - } - head_offset.clearVec(); - if (gAgentAvatarp->isSitting() && gAgentAvatarp->getParent()) - { - gAgentAvatarp->updateHeadOffset(); - head_offset.mdV[VX] = gAgentAvatarp->mHeadOffset.mV[VX]; - head_offset.mdV[VY] = gAgentAvatarp->mHeadOffset.mV[VY]; - head_offset.mdV[VZ] = gAgentAvatarp->mHeadOffset.mV[VZ] + 0.1f; - const LLMatrix4& mat = ((LLViewerObject*) gAgentAvatarp->getParent())->getRenderMatrix(); - camera_position_global = gAgent.getPosGlobalFromAgent - ((gAgentAvatarp->getPosition()+ - LLVector3(head_offset)*gAgentAvatarp->getRotation()) * mat); - } - else - { - head_offset.mdV[VZ] = gAgentAvatarp->mHeadOffset.mV[VZ]; - if (gAgentAvatarp->isSitting()) - { - head_offset.mdV[VZ] += 0.1; - } - camera_position_global = gAgent.getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition());//frame_center_global; - head_offset = head_offset * gAgentAvatarp->getRenderRotation(); - camera_position_global = camera_position_global + head_offset; - } - } - else if (mCameraMode == CAMERA_MODE_THIRD_PERSON && mFocusOnAvatar) - { - LLVector3 local_camera_offset; - F32 camera_distance = 0.f; - - if (mSitCameraEnabled - && isAgentAvatarValid() - && gAgentAvatarp->isSitting() - && mSitCameraReferenceObject.notNull()) - { - // sit camera - LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition(); - LLQuaternion object_rot = mSitCameraReferenceObject->getRenderRotation(); - - LLVector3 target_pos = object_pos + (mSitCameraPos * object_rot); - - camera_position_global = gAgent.getPosGlobalFromAgent(target_pos); - } - else - { - local_camera_offset = mCameraZoomFraction * getCameraOffsetInitial() * gSavedSettings.getF32("CameraOffsetScale"); - - // are we sitting down? - if (isAgentAvatarValid() && gAgentAvatarp->getParent()) - { - LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); - // slam agent coordinate frame to proper parent local version - LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis() * parent_rot; - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - gAgent.resetAxes(at_axis * ~parent_rot); - - local_camera_offset = local_camera_offset * gAgent.getFrameAgent().getQuaternion() * parent_rot; - } - else - { - local_camera_offset = gAgent.getFrameAgent().rotateToAbsolute( local_camera_offset ); - } - - if (!mCameraCollidePlane.isExactlyZero() && (!isAgentAvatarValid() || !gAgentAvatarp->isSitting())) - { - LLVector3 plane_normal; - plane_normal.setVec(mCameraCollidePlane.mV); - - F32 offset_dot_norm = local_camera_offset * plane_normal; - if (llabs(offset_dot_norm) < 0.001f) - { - offset_dot_norm = 0.001f; - } - - camera_distance = local_camera_offset.normalize(); - - F32 pos_dot_norm = gAgent.getPosAgentFromGlobal(frame_center_global + head_offset) * plane_normal; - - // if agent is outside the colliding half-plane - if (pos_dot_norm > mCameraCollidePlane.mV[VW]) - { - // check to see if camera is on the opposite side (inside) the half-plane - if (offset_dot_norm + pos_dot_norm < mCameraCollidePlane.mV[VW]) - { - // diminish offset by factor to push it back outside the half-plane - camera_distance *= (pos_dot_norm - mCameraCollidePlane.mV[VW] - CAMERA_COLLIDE_EPSILON) / -offset_dot_norm; - } - } - else - { - if (offset_dot_norm + pos_dot_norm > mCameraCollidePlane.mV[VW]) - { - camera_distance *= (mCameraCollidePlane.mV[VW] - pos_dot_norm - CAMERA_COLLIDE_EPSILON) / offset_dot_norm; - } - } - } - else - { - camera_distance = local_camera_offset.normalize(); - } - - mTargetCameraDistance = llmax(camera_distance, MIN_CAMERA_DISTANCE); - - if (mTargetCameraDistance != mCurrentCameraDistance) - { - F32 camera_lerp_amt = LLSmoothInterpolation::getInterpolant(CAMERA_ZOOM_HALF_LIFE); - - mCurrentCameraDistance = lerp(mCurrentCameraDistance, mTargetCameraDistance, camera_lerp_amt); - } - - // Make the camera distance current - local_camera_offset *= mCurrentCameraDistance; - - // set the global camera position - LLVector3d camera_offset; - - camera_offset.setVec( local_camera_offset ); - camera_position_global = frame_center_global + head_offset + camera_offset; - - if (isAgentAvatarValid()) - { - LLVector3d camera_lag_d; - F32 lag_interp = LLSmoothInterpolation::getInterpolant(CAMERA_LAG_HALF_LIFE); - LLVector3 target_lag; - LLVector3 vel = gAgent.getVelocity(); - - // lag by appropriate amount for flying - F32 time_in_air = gAgentAvatarp->mTimeInAir.getElapsedTimeF32(); - if(!mCameraAnimating && gAgentAvatarp->mInAir && time_in_air > GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME) - { - LLVector3 frame_at_axis = gAgent.getFrameAgent().getAtAxis(); - frame_at_axis -= projected_vec(frame_at_axis, gAgent.getReferenceUpVector()); - frame_at_axis.normalize(); - - //transition smoothly in air mode, to avoid camera pop - F32 u = (time_in_air - GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME) / GROUND_TO_AIR_CAMERA_TRANSITION_TIME; - u = llclamp(u, 0.f, 1.f); - - lag_interp *= u; - - if (gViewerWindow->getLeftMouseDown() && gViewerWindow->getLastPick().mObjectID == gAgentAvatarp->getID()) - { - // disable camera lag when using mouse-directed steering - target_lag.clearVec(); - } - else - { - target_lag = vel * gSavedSettings.getF32("DynamicCameraStrength") / 30.f; - } - - mCameraLag = lerp(mCameraLag, target_lag, lag_interp); - - F32 lag_dist = mCameraLag.magVec(); - if (lag_dist > MAX_CAMERA_LAG) - { - mCameraLag = mCameraLag * MAX_CAMERA_LAG / lag_dist; - } - - // clamp camera lag so that avatar is always in front - F32 dot = (mCameraLag - (frame_at_axis * (MIN_CAMERA_LAG * u))) * frame_at_axis; - if (dot < -(MIN_CAMERA_LAG * u)) - { - mCameraLag -= (dot + (MIN_CAMERA_LAG * u)) * frame_at_axis; - } - } - else - { - mCameraLag = lerp(mCameraLag, LLVector3::zero, LLSmoothInterpolation::getInterpolant(0.15f)); - } - - camera_lag_d.setVec(mCameraLag); - camera_position_global = camera_position_global - camera_lag_d; - } - } - } - else - { - LLVector3d focusPosGlobal = calcFocusPositionTargetGlobal(); - // camera gets pushed out later wrt mCameraFOVZoomFactor...this is "raw" value - camera_position_global = focusPosGlobal + mCameraFocusOffset; - } - - if (!gSavedSettings.getBOOL("DisableCameraConstraints") && !gAgent.isGodlike()) - { - LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global); - bool constrain = true; - if(regionp && regionp->canManageEstate()) - { - constrain = false; - } - if(constrain) - { - F32 max_dist = (CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode) ? APPEARANCE_MAX_ZOOM : mDrawDistance; - - LLVector3d camera_offset = camera_position_global - gAgent.getPositionGlobal(); - F32 camera_distance = (F32)camera_offset.magVec(); - - if(camera_distance > max_dist) - { - camera_position_global = gAgent.getPositionGlobal() + (max_dist/camera_distance)*camera_offset; - isConstrained = TRUE; - } - } + // Compute base camera position and look-at points. + F32 camera_land_height; + LLVector3d frame_center_global = !isAgentAvatarValid() ? + gAgent.getPositionGlobal() : + gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot->getWorldPosition()); + + BOOL isConstrained = FALSE; + LLVector3d head_offset; + head_offset.setVec(mThirdPersonHeadOffset); + + LLVector3d camera_position_global; + + if (mCameraMode == CAMERA_MODE_FOLLOW && mFocusOnAvatar) + { + camera_position_global = gAgent.getPosGlobalFromAgent(mFollowCam.getSimulatedPosition()); + } + else if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + if (!isAgentAvatarValid() || gAgentAvatarp->mDrawable.isNull()) + { + LL_WARNS() << "Null avatar drawable!" << LL_ENDL; + return LLVector3d::zero; + } + head_offset.clearVec(); + if (gAgentAvatarp->isSitting() && gAgentAvatarp->getParent()) + { + gAgentAvatarp->updateHeadOffset(); + head_offset.mdV[VX] = gAgentAvatarp->mHeadOffset.mV[VX]; + head_offset.mdV[VY] = gAgentAvatarp->mHeadOffset.mV[VY]; + head_offset.mdV[VZ] = gAgentAvatarp->mHeadOffset.mV[VZ] + 0.1f; + const LLMatrix4& mat = ((LLViewerObject*) gAgentAvatarp->getParent())->getRenderMatrix(); + camera_position_global = gAgent.getPosGlobalFromAgent + ((gAgentAvatarp->getPosition()+ + LLVector3(head_offset)*gAgentAvatarp->getRotation()) * mat); + } + else + { + head_offset.mdV[VZ] = gAgentAvatarp->mHeadOffset.mV[VZ]; + if (gAgentAvatarp->isSitting()) + { + head_offset.mdV[VZ] += 0.1; + } + camera_position_global = gAgent.getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition());//frame_center_global; + head_offset = head_offset * gAgentAvatarp->getRenderRotation(); + camera_position_global = camera_position_global + head_offset; + } + } + else if (mCameraMode == CAMERA_MODE_THIRD_PERSON && mFocusOnAvatar) + { + LLVector3 local_camera_offset; + F32 camera_distance = 0.f; + + if (mSitCameraEnabled + && isAgentAvatarValid() + && gAgentAvatarp->isSitting() + && mSitCameraReferenceObject.notNull()) + { + // sit camera + LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition(); + LLQuaternion object_rot = mSitCameraReferenceObject->getRenderRotation(); + + LLVector3 target_pos = object_pos + (mSitCameraPos * object_rot); + + camera_position_global = gAgent.getPosGlobalFromAgent(target_pos); + } + else + { + local_camera_offset = mCameraZoomFraction * getCameraOffsetInitial() * gSavedSettings.getF32("CameraOffsetScale"); + + // are we sitting down? + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); + // slam agent coordinate frame to proper parent local version + LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis() * parent_rot; + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis * ~parent_rot); + + local_camera_offset = local_camera_offset * gAgent.getFrameAgent().getQuaternion() * parent_rot; + } + else + { + local_camera_offset = gAgent.getFrameAgent().rotateToAbsolute( local_camera_offset ); + } + + if (!mCameraCollidePlane.isExactlyZero() && (!isAgentAvatarValid() || !gAgentAvatarp->isSitting())) + { + LLVector3 plane_normal; + plane_normal.setVec(mCameraCollidePlane.mV); + + F32 offset_dot_norm = local_camera_offset * plane_normal; + if (llabs(offset_dot_norm) < 0.001f) + { + offset_dot_norm = 0.001f; + } + + camera_distance = local_camera_offset.normalize(); + + F32 pos_dot_norm = gAgent.getPosAgentFromGlobal(frame_center_global + head_offset) * plane_normal; + + // if agent is outside the colliding half-plane + if (pos_dot_norm > mCameraCollidePlane.mV[VW]) + { + // check to see if camera is on the opposite side (inside) the half-plane + if (offset_dot_norm + pos_dot_norm < mCameraCollidePlane.mV[VW]) + { + // diminish offset by factor to push it back outside the half-plane + camera_distance *= (pos_dot_norm - mCameraCollidePlane.mV[VW] - CAMERA_COLLIDE_EPSILON) / -offset_dot_norm; + } + } + else + { + if (offset_dot_norm + pos_dot_norm > mCameraCollidePlane.mV[VW]) + { + camera_distance *= (mCameraCollidePlane.mV[VW] - pos_dot_norm - CAMERA_COLLIDE_EPSILON) / offset_dot_norm; + } + } + } + else + { + camera_distance = local_camera_offset.normalize(); + } + + mTargetCameraDistance = llmax(camera_distance, MIN_CAMERA_DISTANCE); + + if (mTargetCameraDistance != mCurrentCameraDistance) + { + F32 camera_lerp_amt = LLSmoothInterpolation::getInterpolant(CAMERA_ZOOM_HALF_LIFE); + + mCurrentCameraDistance = lerp(mCurrentCameraDistance, mTargetCameraDistance, camera_lerp_amt); + } + + // Make the camera distance current + local_camera_offset *= mCurrentCameraDistance; + + // set the global camera position + LLVector3d camera_offset; + + camera_offset.setVec( local_camera_offset ); + camera_position_global = frame_center_global + head_offset + camera_offset; + + if (isAgentAvatarValid()) + { + LLVector3d camera_lag_d; + F32 lag_interp = LLSmoothInterpolation::getInterpolant(CAMERA_LAG_HALF_LIFE); + LLVector3 target_lag; + LLVector3 vel = gAgent.getVelocity(); + + // lag by appropriate amount for flying + F32 time_in_air = gAgentAvatarp->mTimeInAir.getElapsedTimeF32(); + if(!mCameraAnimating && gAgentAvatarp->mInAir && time_in_air > GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME) + { + LLVector3 frame_at_axis = gAgent.getFrameAgent().getAtAxis(); + frame_at_axis -= projected_vec(frame_at_axis, gAgent.getReferenceUpVector()); + frame_at_axis.normalize(); + + //transition smoothly in air mode, to avoid camera pop + F32 u = (time_in_air - GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME) / GROUND_TO_AIR_CAMERA_TRANSITION_TIME; + u = llclamp(u, 0.f, 1.f); + + lag_interp *= u; + + if (gViewerWindow->getLeftMouseDown() && gViewerWindow->getLastPick().mObjectID == gAgentAvatarp->getID()) + { + // disable camera lag when using mouse-directed steering + target_lag.clearVec(); + } + else + { + target_lag = vel * gSavedSettings.getF32("DynamicCameraStrength") / 30.f; + } + + mCameraLag = lerp(mCameraLag, target_lag, lag_interp); + + F32 lag_dist = mCameraLag.magVec(); + if (lag_dist > MAX_CAMERA_LAG) + { + mCameraLag = mCameraLag * MAX_CAMERA_LAG / lag_dist; + } + + // clamp camera lag so that avatar is always in front + F32 dot = (mCameraLag - (frame_at_axis * (MIN_CAMERA_LAG * u))) * frame_at_axis; + if (dot < -(MIN_CAMERA_LAG * u)) + { + mCameraLag -= (dot + (MIN_CAMERA_LAG * u)) * frame_at_axis; + } + } + else + { + mCameraLag = lerp(mCameraLag, LLVector3::zero, LLSmoothInterpolation::getInterpolant(0.15f)); + } + + camera_lag_d.setVec(mCameraLag); + camera_position_global = camera_position_global - camera_lag_d; + } + } + } + else + { + LLVector3d focusPosGlobal = calcFocusPositionTargetGlobal(); + // camera gets pushed out later wrt mCameraFOVZoomFactor...this is "raw" value + camera_position_global = focusPosGlobal + mCameraFocusOffset; + } + + if (!gSavedSettings.getBOOL("DisableCameraConstraints") && !gAgent.isGodlike()) + { + LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global); + bool constrain = true; + if(regionp && regionp->canManageEstate()) + { + constrain = false; + } + if(constrain) + { + F32 max_dist = (CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode) ? APPEARANCE_MAX_ZOOM : mDrawDistance; + + LLVector3d camera_offset = camera_position_global - gAgent.getPositionGlobal(); + F32 camera_distance = (F32)camera_offset.magVec(); + + if(camera_distance > max_dist) + { + camera_position_global = gAgent.getPositionGlobal() + (max_dist/camera_distance)*camera_offset; + isConstrained = TRUE; + } + } // JC - Could constrain camera based on parcel stuff here. -// LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global); -// -// if (regionp && !regionp->mParcelOverlay->isBuildCameraAllowed(regionp->getPosRegionFromGlobal(camera_position_global))) -// { -// camera_position_global = last_position_global; +// LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global); +// +// if (regionp && !regionp->mParcelOverlay->isBuildCameraAllowed(regionp->getPosRegionFromGlobal(camera_position_global))) +// { +// camera_position_global = last_position_global; // -// isConstrained = TRUE; -// } - } +// isConstrained = TRUE; +// } + } - // Don't let camera go underground - F32 camera_min_off_ground = getCameraMinOffGround(); + // Don't let camera go underground + F32 camera_min_off_ground = getCameraMinOffGround(); - camera_land_height = LLWorld::getInstance()->resolveLandHeightGlobal(camera_position_global); + camera_land_height = LLWorld::getInstance()->resolveLandHeightGlobal(camera_position_global); - if (camera_position_global.mdV[VZ] < camera_land_height + camera_min_off_ground) - { - camera_position_global.mdV[VZ] = camera_land_height + camera_min_off_ground; - isConstrained = TRUE; - } + if (camera_position_global.mdV[VZ] < camera_land_height + camera_min_off_ground) + { + camera_position_global.mdV[VZ] = camera_land_height + camera_min_off_ground; + isConstrained = TRUE; + } - if (hit_limit) - { - *hit_limit = isConstrained; - } + if (hit_limit) + { + *hit_limit = isConstrained; + } - return camera_position_global; + return camera_position_global; } LLVector3 LLAgentCamera::getCameraOffsetInitial() { - return convert_from_llsd(mCameraOffsetInitial[mCameraPreset]->get(), TYPE_VEC3, ""); + return convert_from_llsd(mCameraOffsetInitial[mCameraPreset]->get(), TYPE_VEC3, ""); } F32 LLAgentCamera::getCameraMaxZoomDistance() @@ -1949,48 +1949,48 @@ F32 LLAgentCamera::getCameraMaxZoomDistance() //----------------------------------------------------------------------------- void LLAgentCamera::handleScrollWheel(S32 clicks) { - if (mCameraMode == CAMERA_MODE_FOLLOW && getFocusOnAvatar()) - { - if (!mFollowCam.getPositionLocked()) // not if the followCam position is locked in place - { - mFollowCam.zoom(clicks); - if (mFollowCam.isZoomedToMinimumDistance()) - { - changeCameraToMouselook(FALSE); - } - } - } - else - { - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - const F32 ROOT_ROOT_TWO = sqrt(F_SQRT2); - - // Block if camera is animating - if (mCameraAnimating) - { - return; - } - - if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - F32 zoom_factor = (F32)pow(0.8, -clicks); - cameraZoomIn(zoom_factor); - } - else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON)) - { - F32 camera_offset_initial_mag = getCameraOffsetInitial().magVec(); - - F32 current_zoom_fraction = mTargetCameraDistance / (camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale")); - current_zoom_fraction *= 1.f - pow(ROOT_ROOT_TWO, clicks); - - cameraOrbitIn(current_zoom_fraction * camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale")); - } - else - { - F32 current_zoom_fraction = (F32)mCameraFocusOffsetTarget.magVec(); - cameraOrbitIn(current_zoom_fraction * (1.f - pow(ROOT_ROOT_TWO, clicks))); - } - } + if (mCameraMode == CAMERA_MODE_FOLLOW && getFocusOnAvatar()) + { + if (!mFollowCam.getPositionLocked()) // not if the followCam position is locked in place + { + mFollowCam.zoom(clicks); + if (mFollowCam.isZoomedToMinimumDistance()) + { + changeCameraToMouselook(FALSE); + } + } + } + else + { + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + const F32 ROOT_ROOT_TWO = sqrt(F_SQRT2); + + // Block if camera is animating + if (mCameraAnimating) + { + return; + } + + if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + F32 zoom_factor = (F32)pow(0.8, -clicks); + cameraZoomIn(zoom_factor); + } + else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON)) + { + F32 camera_offset_initial_mag = getCameraOffsetInitial().magVec(); + + F32 current_zoom_fraction = mTargetCameraDistance / (camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale")); + current_zoom_fraction *= 1.f - pow(ROOT_ROOT_TWO, clicks); + + cameraOrbitIn(current_zoom_fraction * camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale")); + } + else + { + F32 current_zoom_fraction = (F32)mCameraFocusOffsetTarget.magVec(); + cameraOrbitIn(current_zoom_fraction * (1.f - pow(ROOT_ROOT_TWO, clicks))); + } + } } @@ -1999,21 +1999,21 @@ void LLAgentCamera::handleScrollWheel(S32 clicks) //----------------------------------------------------------------------------- F32 LLAgentCamera::getCameraMinOffGround() { - if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - return 0.f; - } - else - { - if (gSavedSettings.getBOOL("DisableCameraConstraints")) - { - return -1000.f; - } - else - { - return 0.5f; - } - } + if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + return 0.f; + } + else + { + if (gSavedSettings.getBOOL("DisableCameraConstraints")) + { + return -1000.f; + } + else + { + return 0.5f; + } + } } @@ -2022,15 +2022,15 @@ F32 LLAgentCamera::getCameraMinOffGround() //----------------------------------------------------------------------------- void LLAgentCamera::resetCamera() { - // Remove any pitch from the avatar - LLVector3 at = gAgent.getFrameAgent().getAtAxis(); - at.mV[VZ] = 0.f; - at.normalize(); - gAgent.resetAxes(at); - // have to explicitly clear field of view zoom now - mCameraFOVZoomFactor = 0.f; - - updateCamera(); + // Remove any pitch from the avatar + LLVector3 at = gAgent.getFrameAgent().getAtAxis(); + at.mV[VZ] = 0.f; + at.normalize(); + gAgent.resetAxes(at); + // have to explicitly clear field of view zoom now + mCameraFOVZoomFactor = 0.f; + + updateCamera(); } //----------------------------------------------------------------------------- @@ -2038,58 +2038,58 @@ void LLAgentCamera::resetCamera() //----------------------------------------------------------------------------- void LLAgentCamera::changeCameraToMouselook(BOOL animate) { - if (!gSavedSettings.getBOOL("EnableMouselook") - || LLViewerJoystick::getInstance()->getOverrideCamera()) - { - return; - } - - // visibility changes at end of animation - gViewerWindow->getWindow()->resetBusyCount(); - - // Menus should not remain open on switching to mouselook... - LLMenuGL::sMenuContainer->hideMenus(); - LLUI::clearPopups(); - - // unpause avatar animation - gAgent.unpauseAnimation(); - - LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset); - - if (isAgentAvatarValid()) - { - gAgentAvatarp->stopMotion(ANIM_AGENT_BODY_NOISE); - gAgentAvatarp->stopMotion(ANIM_AGENT_BREATHE_ROT); - } - - //gViewerWindow->stopGrab(); - LLSelectMgr::getInstance()->deselectAll(); - gViewerWindow->hideCursor(); - gViewerWindow->moveCursorToCenter(); - - if (mCameraMode != CAMERA_MODE_MOUSELOOK) - { - gFocusMgr.setKeyboardFocus(NULL); - - updateLastCamera(); - mCameraMode = CAMERA_MODE_MOUSELOOK; - const U32 old_flags = gAgent.getControlFlags(); - gAgent.setControlFlags(AGENT_CONTROL_MOUSELOOK); - if (old_flags != gAgent.getControlFlags()) - { - gAgent.setFlagsDirty(); - } - - if (animate) - { - startCameraAnimation(); - } - else - { - mCameraAnimating = FALSE; - gAgent.endAnimationUpdateUI(); - } - } + if (!gSavedSettings.getBOOL("EnableMouselook") + || LLViewerJoystick::getInstance()->getOverrideCamera()) + { + return; + } + + // visibility changes at end of animation + gViewerWindow->getWindow()->resetBusyCount(); + + // Menus should not remain open on switching to mouselook... + LLMenuGL::sMenuContainer->hideMenus(); + LLUI::clearPopups(); + + // unpause avatar animation + gAgent.unpauseAnimation(); + + LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset); + + if (isAgentAvatarValid()) + { + gAgentAvatarp->stopMotion(ANIM_AGENT_BODY_NOISE); + gAgentAvatarp->stopMotion(ANIM_AGENT_BREATHE_ROT); + } + + //gViewerWindow->stopGrab(); + LLSelectMgr::getInstance()->deselectAll(); + gViewerWindow->hideCursor(); + gViewerWindow->moveCursorToCenter(); + + if (mCameraMode != CAMERA_MODE_MOUSELOOK) + { + gFocusMgr.setKeyboardFocus(NULL); + + updateLastCamera(); + mCameraMode = CAMERA_MODE_MOUSELOOK; + const U32 old_flags = gAgent.getControlFlags(); + gAgent.setControlFlags(AGENT_CONTROL_MOUSELOOK); + if (old_flags != gAgent.getControlFlags()) + { + gAgent.setFlagsDirty(); + } + + if (animate) + { + startCameraAnimation(); + } + else + { + mCameraAnimating = FALSE; + gAgent.endAnimationUpdateUI(); + } + } } @@ -2098,24 +2098,24 @@ void LLAgentCamera::changeCameraToMouselook(BOOL animate) //----------------------------------------------------------------------------- void LLAgentCamera::changeCameraToDefault() { - if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { - return; - } - - if (LLFollowCamMgr::getActiveFollowCamParams()) - { - changeCameraToFollow(); - } - else - { - changeCameraToThirdPerson(); - } - if (gSavedSettings.getBOOL("HideUIControls")) - { - gViewerWindow->setUIVisibility(false); - LLPanelStandStopFlying::getInstance()->setVisible(false); - } + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + return; + } + + if (LLFollowCamMgr::getActiveFollowCamParams()) + { + changeCameraToFollow(); + } + else + { + changeCameraToThirdPerson(); + } + if (gSavedSettings.getBOOL("HideUIControls")) + { + gViewerWindow->setUIVisibility(false); + LLPanelStandStopFlying::getInstance()->setVisible(false); + } } @@ -2124,53 +2124,53 @@ void LLAgentCamera::changeCameraToDefault() //----------------------------------------------------------------------------- void LLAgentCamera::changeCameraToFollow(BOOL animate) { - if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { - return; - } - - if(mCameraMode != CAMERA_MODE_FOLLOW) - { - if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - animate = FALSE; - } - startCameraAnimation(); - - updateLastCamera(); - mCameraMode = CAMERA_MODE_FOLLOW; - - // bang-in the current focus, position, and up vector of the follow cam - mFollowCam.reset(mCameraPositionAgent, LLViewerCamera::getInstance()->getPointOfInterest(), LLVector3::z_axis); - - if (gBasicToolset) - { - LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); - } - - if (isAgentAvatarValid()) - { - // SL-315 - gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero); - gAgentAvatarp->startMotion( ANIM_AGENT_BODY_NOISE ); - gAgentAvatarp->startMotion( ANIM_AGENT_BREATHE_ROT ); - } - - // unpause avatar animation - gAgent.unpauseAnimation(); - - gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); - - if (animate) - { - startCameraAnimation(); - } - else - { - mCameraAnimating = FALSE; - gAgent.endAnimationUpdateUI(); - } - } + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + return; + } + + if(mCameraMode != CAMERA_MODE_FOLLOW) + { + if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + animate = FALSE; + } + startCameraAnimation(); + + updateLastCamera(); + mCameraMode = CAMERA_MODE_FOLLOW; + + // bang-in the current focus, position, and up vector of the follow cam + mFollowCam.reset(mCameraPositionAgent, LLViewerCamera::getInstance()->getPointOfInterest(), LLVector3::z_axis); + + if (gBasicToolset) + { + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + } + + if (isAgentAvatarValid()) + { + // SL-315 + gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero); + gAgentAvatarp->startMotion( ANIM_AGENT_BODY_NOISE ); + gAgentAvatarp->startMotion( ANIM_AGENT_BREATHE_ROT ); + } + + // unpause avatar animation + gAgent.unpauseAnimation(); + + gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); + + if (animate) + { + startCameraAnimation(); + } + else + { + mCameraAnimating = FALSE; + gAgent.endAnimationUpdateUI(); + } + } } //----------------------------------------------------------------------------- @@ -2178,77 +2178,77 @@ void LLAgentCamera::changeCameraToFollow(BOOL animate) //----------------------------------------------------------------------------- void LLAgentCamera::changeCameraToThirdPerson(BOOL animate) { - if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { - return; - } - - gViewerWindow->getWindow()->resetBusyCount(); - - mCameraZoomFraction = INITIAL_ZOOM_FRACTION; - - if (isAgentAvatarValid()) - { - if (!gAgentAvatarp->isSitting()) - { - // SL-315 - gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero); - } - gAgentAvatarp->startMotion(ANIM_AGENT_BODY_NOISE); - gAgentAvatarp->startMotion(ANIM_AGENT_BREATHE_ROT); - } - - LLVector3 at_axis; - - // unpause avatar animation - gAgent.unpauseAnimation(); - - if (mCameraMode != CAMERA_MODE_THIRD_PERSON) - { - if (gBasicToolset) - { - LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); - } - - mCameraLag.clearVec(); - if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - mCurrentCameraDistance = MIN_CAMERA_DISTANCE; - mTargetCameraDistance = MIN_CAMERA_DISTANCE; - animate = FALSE; - } - updateLastCamera(); - mCameraMode = CAMERA_MODE_THIRD_PERSON; - gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); - } - - // Remove any pitch from the avatar - if (isAgentAvatarValid() && gAgentAvatarp->getParent()) - { - LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); - at_axis = LLViewerCamera::getInstance()->getAtAxis(); - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - gAgent.resetAxes(at_axis * ~obj_rot); - } - else - { - at_axis = gAgent.getFrameAgent().getAtAxis(); - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - gAgent.resetAxes(at_axis); - } - - - if (animate) - { - startCameraAnimation(); - } - else - { - mCameraAnimating = FALSE; - gAgent.endAnimationUpdateUI(); - } + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + return; + } + + gViewerWindow->getWindow()->resetBusyCount(); + + mCameraZoomFraction = INITIAL_ZOOM_FRACTION; + + if (isAgentAvatarValid()) + { + if (!gAgentAvatarp->isSitting()) + { + // SL-315 + gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero); + } + gAgentAvatarp->startMotion(ANIM_AGENT_BODY_NOISE); + gAgentAvatarp->startMotion(ANIM_AGENT_BREATHE_ROT); + } + + LLVector3 at_axis; + + // unpause avatar animation + gAgent.unpauseAnimation(); + + if (mCameraMode != CAMERA_MODE_THIRD_PERSON) + { + if (gBasicToolset) + { + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + } + + mCameraLag.clearVec(); + if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + mCurrentCameraDistance = MIN_CAMERA_DISTANCE; + mTargetCameraDistance = MIN_CAMERA_DISTANCE; + animate = FALSE; + } + updateLastCamera(); + mCameraMode = CAMERA_MODE_THIRD_PERSON; + gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); + } + + // Remove any pitch from the avatar + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); + at_axis = LLViewerCamera::getInstance()->getAtAxis(); + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis * ~obj_rot); + } + else + { + at_axis = gAgent.getFrameAgent().getAtAxis(); + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis); + } + + + if (animate) + { + startCameraAnimation(); + } + else + { + mCameraAnimating = FALSE; + gAgent.endAnimationUpdateUI(); + } } //----------------------------------------------------------------------------- @@ -2256,81 +2256,81 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate) //----------------------------------------------------------------------------- void LLAgentCamera::changeCameraToCustomizeAvatar() { - if (LLViewerJoystick::getInstance()->getOverrideCamera() || !isAgentAvatarValid()) - { - return; - } - - gAgent.standUp(); // force stand up - gViewerWindow->getWindow()->resetBusyCount(); - - if (gFaceEditToolset) - { - LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset); - } - - startCameraAnimation(); - - if (mCameraMode != CAMERA_MODE_CUSTOMIZE_AVATAR) - { - updateLastCamera(); - mCameraMode = CAMERA_MODE_CUSTOMIZE_AVATAR; - gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); - - gFocusMgr.setKeyboardFocus( NULL ); - gFocusMgr.setMouseCapture( NULL ); - if( gMorphView ) - { - gMorphView->setVisible( TRUE ); - } - // Remove any pitch or rotation from the avatar - LLVector3 at = gAgent.getAtAxis(); - at.mV[VZ] = 0.f; - at.normalize(); - gAgent.resetAxes(at); - - gAgent.sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START); - gAgent.setCustomAnim(TRUE); - gAgentAvatarp->startMotion(ANIM_AGENT_CUSTOMIZE); - LLMotion* turn_motion = gAgentAvatarp->findMotion(ANIM_AGENT_CUSTOMIZE); - - if (turn_motion) - { - // delay camera animation long enough to play through turn animation - setAnimationDuration(turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP); - } - } - - LLVector3 agent_at = gAgent.getAtAxis(); - agent_at.mV[VZ] = 0.f; - agent_at.normalize(); - - // default focus point for customize avatar - LLVector3 focus_target = isAgentAvatarValid() - ? gAgentAvatarp->mHeadp->getWorldPosition() - : gAgent.getPositionAgent(); - - LLVector3d camera_offset(agent_at * -1.0); - // push camera up and out from avatar - camera_offset.mdV[VZ] = 0.1f; - camera_offset *= CUSTOMIZE_AVATAR_CAMERA_DEFAULT_DIST; - LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target); - setAnimationDuration(gSavedSettings.getF32("ZoomTime")); - setCameraPosAndFocusGlobal(focus_target_global + camera_offset, focus_target_global, gAgent.getID()); + if (LLViewerJoystick::getInstance()->getOverrideCamera() || !isAgentAvatarValid()) + { + return; + } + + gAgent.standUp(); // force stand up + gViewerWindow->getWindow()->resetBusyCount(); + + if (gFaceEditToolset) + { + LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset); + } + + startCameraAnimation(); + + if (mCameraMode != CAMERA_MODE_CUSTOMIZE_AVATAR) + { + updateLastCamera(); + mCameraMode = CAMERA_MODE_CUSTOMIZE_AVATAR; + gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); + + gFocusMgr.setKeyboardFocus( NULL ); + gFocusMgr.setMouseCapture( NULL ); + if( gMorphView ) + { + gMorphView->setVisible( TRUE ); + } + // Remove any pitch or rotation from the avatar + LLVector3 at = gAgent.getAtAxis(); + at.mV[VZ] = 0.f; + at.normalize(); + gAgent.resetAxes(at); + + gAgent.sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START); + gAgent.setCustomAnim(TRUE); + gAgentAvatarp->startMotion(ANIM_AGENT_CUSTOMIZE); + LLMotion* turn_motion = gAgentAvatarp->findMotion(ANIM_AGENT_CUSTOMIZE); + + if (turn_motion) + { + // delay camera animation long enough to play through turn animation + setAnimationDuration(turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP); + } + } + + LLVector3 agent_at = gAgent.getAtAxis(); + agent_at.mV[VZ] = 0.f; + agent_at.normalize(); + + // default focus point for customize avatar + LLVector3 focus_target = isAgentAvatarValid() + ? gAgentAvatarp->mHeadp->getWorldPosition() + : gAgent.getPositionAgent(); + + LLVector3d camera_offset(agent_at * -1.0); + // push camera up and out from avatar + camera_offset.mdV[VZ] = 0.1f; + camera_offset *= CUSTOMIZE_AVATAR_CAMERA_DEFAULT_DIST; + LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target); + setAnimationDuration(gSavedSettings.getF32("ZoomTime")); + setCameraPosAndFocusGlobal(focus_target_global + camera_offset, focus_target_global, gAgent.getID()); } void LLAgentCamera::switchCameraPreset(ECameraPreset preset) { - //zoom is supposed to be reset for the front and group views - mCameraZoomFraction = 1.f; + //zoom is supposed to be reset for the front and group views + mCameraZoomFraction = 1.f; - //focusing on avatar in that case means following him on movements - mFocusOnAvatar = TRUE; + //focusing on avatar in that case means following him on movements + mFocusOnAvatar = TRUE; - mCameraPreset = preset; + mCameraPreset = preset; - gSavedSettings.setU32("CameraPreset", mCameraPreset); + gSavedSettings.setU32("CameraPreset", mCameraPreset); } @@ -2340,16 +2340,16 @@ void LLAgentCamera::switchCameraPreset(ECameraPreset preset) void LLAgentCamera::setAnimationDuration(F32 duration) { - if (mCameraAnimating) - { - // do not cut any existing camera animation short - F32 animation_left = llmax(0.f, mAnimationDuration - mAnimationTimer.getElapsedTimeF32()); - mAnimationDuration = llmax(duration, animation_left); - } - else - { - mAnimationDuration = duration; - } + if (mCameraAnimating) + { + // do not cut any existing camera animation short + F32 animation_left = llmax(0.f, mAnimationDuration - mAnimationTimer.getElapsedTimeF32()); + mAnimationDuration = llmax(duration, animation_left); + } + else + { + mAnimationDuration = duration; + } } //----------------------------------------------------------------------------- @@ -2357,11 +2357,11 @@ void LLAgentCamera::setAnimationDuration(F32 duration) //----------------------------------------------------------------------------- void LLAgentCamera::startCameraAnimation() { - mAnimationCameraStartGlobal = getCameraPositionGlobal(); - mAnimationFocusStartGlobal = mFocusGlobal; - setAnimationDuration(gSavedSettings.getF32("ZoomTime")); - mAnimationTimer.reset(); - mCameraAnimating = TRUE; + mAnimationCameraStartGlobal = getCameraPositionGlobal(); + mAnimationFocusStartGlobal = mFocusGlobal; + setAnimationDuration(gSavedSettings.getF32("ZoomTime")); + mAnimationTimer.reset(); + mCameraAnimating = TRUE; } //----------------------------------------------------------------------------- @@ -2369,23 +2369,23 @@ void LLAgentCamera::startCameraAnimation() //----------------------------------------------------------------------------- void LLAgentCamera::stopCameraAnimation() { - mCameraAnimating = FALSE; + mCameraAnimating = FALSE; } void LLAgentCamera::clearFocusObject() { - if (mFocusObject.notNull()) - { - startCameraAnimation(); + if (mFocusObject.notNull()) + { + startCameraAnimation(); - setFocusObject(NULL); - mFocusObjectOffset.clearVec(); - } + setFocusObject(NULL); + mFocusObjectOffset.clearVec(); + } } void LLAgentCamera::setFocusObject(LLViewerObject* object) { - mFocusObject = object; + mFocusObject = object; } // Focus on a point, but try to keep camera position stable. @@ -2394,104 +2394,104 @@ void LLAgentCamera::setFocusObject(LLViewerObject* object) //----------------------------------------------------------------------------- void LLAgentCamera::setFocusGlobal(const LLPickInfo& pick) { - LLViewerObject* objectp = gObjectList.findObject(pick.mObjectID); - - if (objectp) - { - // focus on object plus designated offset - // which may or may not be same as pick.mPosGlobal - setFocusGlobal(objectp->getPositionGlobal() + LLVector3d(pick.mObjectOffset), pick.mObjectID); - } - else - { - // focus directly on point where user clicked - setFocusGlobal(pick.mPosGlobal, pick.mObjectID); - } + LLViewerObject* objectp = gObjectList.findObject(pick.mObjectID); + + if (objectp) + { + // focus on object plus designated offset + // which may or may not be same as pick.mPosGlobal + setFocusGlobal(objectp->getPositionGlobal() + LLVector3d(pick.mObjectOffset), pick.mObjectID); + } + else + { + // focus directly on point where user clicked + setFocusGlobal(pick.mPosGlobal, pick.mObjectID); + } } void LLAgentCamera::setFocusGlobal(const LLVector3d& focus, const LLUUID &object_id) { - setFocusObject(gObjectList.findObject(object_id)); - LLVector3d old_focus = mFocusTargetGlobal; - LLViewerObject *focus_obj = mFocusObject; - - // if focus has changed - if (old_focus != focus) - { - if (focus.isExactlyZero()) - { - if (isAgentAvatarValid()) - { - mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition()); - } - else - { - mFocusTargetGlobal = gAgent.getPositionGlobal(); - } - mCameraFocusOffsetTarget = getCameraPositionGlobal() - mFocusTargetGlobal; - mCameraFocusOffset = mCameraFocusOffsetTarget; - setLookAt(LOOKAT_TARGET_CLEAR); - } - else - { - mFocusTargetGlobal = focus; - if (!focus_obj) - { - mCameraFOVZoomFactor = 0.f; - } - - mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(mCameraVirtualPositionAgent) - mFocusTargetGlobal; - - startCameraAnimation(); - - if (focus_obj) - { - if (focus_obj->isAvatar()) - { - setLookAt(LOOKAT_TARGET_FOCUS, focus_obj); - } - else - { - setLookAt(LOOKAT_TARGET_FOCUS, focus_obj, (gAgent.getPosAgentFromGlobal(focus) - focus_obj->getRenderPosition()) * ~focus_obj->getRenderRotation()); - } - } - else - { - setLookAt(LOOKAT_TARGET_FOCUS, NULL, gAgent.getPosAgentFromGlobal(mFocusTargetGlobal)); - } - } - } - else // focus == mFocusTargetGlobal - { - if (focus.isExactlyZero()) - { - if (isAgentAvatarValid()) - { - mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition()); - } - else - { - mFocusTargetGlobal = gAgent.getPositionGlobal(); - } - } - mCameraFocusOffsetTarget = (getCameraPositionGlobal() - mFocusTargetGlobal) / (1.f + mCameraFOVZoomFactor);; - mCameraFocusOffset = mCameraFocusOffsetTarget; - } - - if (mFocusObject.notNull()) - { - // for attachments, make offset relative to avatar, not the attachment - if (mFocusObject->isAttachment()) - { - while (mFocusObject.notNull() && !mFocusObject->isAvatar()) - { - mFocusObject = (LLViewerObject*) mFocusObject->getParent(); - } - setFocusObject((LLViewerObject*)mFocusObject); - } - updateFocusOffset(); - } + setFocusObject(gObjectList.findObject(object_id)); + LLVector3d old_focus = mFocusTargetGlobal; + LLViewerObject *focus_obj = mFocusObject; + + // if focus has changed + if (old_focus != focus) + { + if (focus.isExactlyZero()) + { + if (isAgentAvatarValid()) + { + mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition()); + } + else + { + mFocusTargetGlobal = gAgent.getPositionGlobal(); + } + mCameraFocusOffsetTarget = getCameraPositionGlobal() - mFocusTargetGlobal; + mCameraFocusOffset = mCameraFocusOffsetTarget; + setLookAt(LOOKAT_TARGET_CLEAR); + } + else + { + mFocusTargetGlobal = focus; + if (!focus_obj) + { + mCameraFOVZoomFactor = 0.f; + } + + mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(mCameraVirtualPositionAgent) - mFocusTargetGlobal; + + startCameraAnimation(); + + if (focus_obj) + { + if (focus_obj->isAvatar()) + { + setLookAt(LOOKAT_TARGET_FOCUS, focus_obj); + } + else + { + setLookAt(LOOKAT_TARGET_FOCUS, focus_obj, (gAgent.getPosAgentFromGlobal(focus) - focus_obj->getRenderPosition()) * ~focus_obj->getRenderRotation()); + } + } + else + { + setLookAt(LOOKAT_TARGET_FOCUS, NULL, gAgent.getPosAgentFromGlobal(mFocusTargetGlobal)); + } + } + } + else // focus == mFocusTargetGlobal + { + if (focus.isExactlyZero()) + { + if (isAgentAvatarValid()) + { + mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition()); + } + else + { + mFocusTargetGlobal = gAgent.getPositionGlobal(); + } + } + mCameraFocusOffsetTarget = (getCameraPositionGlobal() - mFocusTargetGlobal) / (1.f + mCameraFOVZoomFactor);; + mCameraFocusOffset = mCameraFocusOffsetTarget; + } + + if (mFocusObject.notNull()) + { + // for attachments, make offset relative to avatar, not the attachment + if (mFocusObject->isAttachment()) + { + while (mFocusObject.notNull() && !mFocusObject->isAvatar()) + { + mFocusObject = (LLViewerObject*) mFocusObject->getParent(); + } + setFocusObject((LLViewerObject*)mFocusObject); + } + updateFocusOffset(); + } } // Used for avatar customization @@ -2500,48 +2500,48 @@ void LLAgentCamera::setFocusGlobal(const LLVector3d& focus, const LLUUID &object //----------------------------------------------------------------------------- void LLAgentCamera::setCameraPosAndFocusGlobal(const LLVector3d& camera_pos, const LLVector3d& focus, const LLUUID &object_id) { - LLVector3d old_focus = mFocusTargetGlobal.isExactlyZero() ? focus : mFocusTargetGlobal; - - F64 focus_delta_squared = (old_focus - focus).magVecSquared(); - const F64 ANIM_EPSILON_SQUARED = 0.0001; - if (focus_delta_squared > ANIM_EPSILON_SQUARED) - { - startCameraAnimation(); - } - - //LLViewerCamera::getInstance()->setOrigin( gAgent.getPosAgentFromGlobal( camera_pos ) ); - setFocusObject(gObjectList.findObject(object_id)); - mFocusTargetGlobal = focus; - mCameraFocusOffsetTarget = camera_pos - focus; - mCameraFocusOffset = mCameraFocusOffsetTarget; - - if (mFocusObject) - { - if (mFocusObject->isAvatar()) - { - setLookAt(LOOKAT_TARGET_FOCUS, mFocusObject); - } - else - { - setLookAt(LOOKAT_TARGET_FOCUS, mFocusObject, (gAgent.getPosAgentFromGlobal(focus) - mFocusObject->getRenderPosition()) * ~mFocusObject->getRenderRotation()); - } - } - else - { - setLookAt(LOOKAT_TARGET_FOCUS, NULL, gAgent.getPosAgentFromGlobal(mFocusTargetGlobal)); - } - - if (mCameraAnimating) - { - const F64 ANIM_METERS_PER_SECOND = 10.0; - const F64 MIN_ANIM_SECONDS = 0.5; - const F64 MAX_ANIM_SECONDS = 10.0; - F64 anim_duration = llmax( MIN_ANIM_SECONDS, sqrt(focus_delta_squared) / ANIM_METERS_PER_SECOND ); - anim_duration = llmin( anim_duration, MAX_ANIM_SECONDS ); - setAnimationDuration( (F32)anim_duration ); - } - - updateFocusOffset(); + LLVector3d old_focus = mFocusTargetGlobal.isExactlyZero() ? focus : mFocusTargetGlobal; + + F64 focus_delta_squared = (old_focus - focus).magVecSquared(); + const F64 ANIM_EPSILON_SQUARED = 0.0001; + if (focus_delta_squared > ANIM_EPSILON_SQUARED) + { + startCameraAnimation(); + } + + //LLViewerCamera::getInstance()->setOrigin( gAgent.getPosAgentFromGlobal( camera_pos ) ); + setFocusObject(gObjectList.findObject(object_id)); + mFocusTargetGlobal = focus; + mCameraFocusOffsetTarget = camera_pos - focus; + mCameraFocusOffset = mCameraFocusOffsetTarget; + + if (mFocusObject) + { + if (mFocusObject->isAvatar()) + { + setLookAt(LOOKAT_TARGET_FOCUS, mFocusObject); + } + else + { + setLookAt(LOOKAT_TARGET_FOCUS, mFocusObject, (gAgent.getPosAgentFromGlobal(focus) - mFocusObject->getRenderPosition()) * ~mFocusObject->getRenderRotation()); + } + } + else + { + setLookAt(LOOKAT_TARGET_FOCUS, NULL, gAgent.getPosAgentFromGlobal(mFocusTargetGlobal)); + } + + if (mCameraAnimating) + { + const F64 ANIM_METERS_PER_SECOND = 10.0; + const F64 MIN_ANIM_SECONDS = 0.5; + const F64 MAX_ANIM_SECONDS = 10.0; + F64 anim_duration = llmax( MIN_ANIM_SECONDS, sqrt(focus_delta_squared) / ANIM_METERS_PER_SECOND ); + anim_duration = llmin( anim_duration, MAX_ANIM_SECONDS ); + setAnimationDuration( (F32)anim_duration ); + } + + updateFocusOffset(); } //----------------------------------------------------------------------------- @@ -2549,27 +2549,27 @@ void LLAgentCamera::setCameraPosAndFocusGlobal(const LLVector3d& camera_pos, con //----------------------------------------------------------------------------- void LLAgentCamera::setSitCamera(const LLUUID &object_id, const LLVector3 &camera_pos, const LLVector3 &camera_focus) { - BOOL camera_enabled = !object_id.isNull(); - - if (camera_enabled) - { - LLViewerObject *reference_object = gObjectList.findObject(object_id); - if (reference_object) - { - //convert to root object relative? - mSitCameraPos = camera_pos; - mSitCameraFocus = camera_focus; - mSitCameraReferenceObject = reference_object; - mSitCameraEnabled = TRUE; - } - } - else - { - mSitCameraPos.clearVec(); - mSitCameraFocus.clearVec(); - mSitCameraReferenceObject = NULL; - mSitCameraEnabled = FALSE; - } + BOOL camera_enabled = !object_id.isNull(); + + if (camera_enabled) + { + LLViewerObject *reference_object = gObjectList.findObject(object_id); + if (reference_object) + { + //convert to root object relative? + mSitCameraPos = camera_pos; + mSitCameraFocus = camera_focus; + mSitCameraReferenceObject = reference_object; + mSitCameraEnabled = TRUE; + } + } + else + { + mSitCameraPos.clearVec(); + mSitCameraFocus.clearVec(); + mSitCameraReferenceObject = NULL; + mSitCameraEnabled = FALSE; + } } //----------------------------------------------------------------------------- @@ -2577,80 +2577,80 @@ void LLAgentCamera::setSitCamera(const LLUUID &object_id, const LLVector3 &camer //----------------------------------------------------------------------------- void LLAgentCamera::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate) { - if (focus_on_avatar != mFocusOnAvatar) - { - if (animate) - { - startCameraAnimation(); - } - else - { - stopCameraAnimation(); - } - } - - //RN: when focused on the avatar, we're not "looking" at it - // looking implies intent while focusing on avatar means - // you're just walking around with a camera on you...eesh. - if (!mFocusOnAvatar && focus_on_avatar) - { - setFocusGlobal(LLVector3d::zero); - mCameraFOVZoomFactor = 0.f; - if (mCameraMode == CAMERA_MODE_THIRD_PERSON) - { - LLVector3 at_axis; - if (isAgentAvatarValid() && gAgentAvatarp->getParent()) - { - LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); - at_axis = LLViewerCamera::getInstance()->getAtAxis(); - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - gAgent.resetAxes(at_axis * ~obj_rot); - } - else - { - at_axis = LLViewerCamera::getInstance()->getAtAxis(); - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - gAgent.resetAxes(at_axis); - } - } - } - // unlocking camera from avatar - else if (mFocusOnAvatar && !focus_on_avatar) - { - // keep camera focus point consistent, even though it is now unlocked - setFocusGlobal(gAgent.getPositionGlobal() + calcThirdPersonFocusOffset(), gAgent.getID()); - mAllowChangeToFollow = FALSE; - } - - mFocusOnAvatar = focus_on_avatar; + if (focus_on_avatar != mFocusOnAvatar) + { + if (animate) + { + startCameraAnimation(); + } + else + { + stopCameraAnimation(); + } + } + + //RN: when focused on the avatar, we're not "looking" at it + // looking implies intent while focusing on avatar means + // you're just walking around with a camera on you...eesh. + if (!mFocusOnAvatar && focus_on_avatar) + { + setFocusGlobal(LLVector3d::zero); + mCameraFOVZoomFactor = 0.f; + if (mCameraMode == CAMERA_MODE_THIRD_PERSON) + { + LLVector3 at_axis; + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); + at_axis = LLViewerCamera::getInstance()->getAtAxis(); + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis * ~obj_rot); + } + else + { + at_axis = LLViewerCamera::getInstance()->getAtAxis(); + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis); + } + } + } + // unlocking camera from avatar + else if (mFocusOnAvatar && !focus_on_avatar) + { + // keep camera focus point consistent, even though it is now unlocked + setFocusGlobal(gAgent.getPositionGlobal() + calcThirdPersonFocusOffset(), gAgent.getID()); + mAllowChangeToFollow = FALSE; + } + + mFocusOnAvatar = focus_on_avatar; } BOOL LLAgentCamera::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position) { - if(object && object->isAttachment()) - { - LLViewerObject* parent = object; - while(parent) - { - if (parent == gAgentAvatarp) - { - // looking at an attachment on ourselves, which we don't want to do - object = gAgentAvatarp; - position.clearVec(); - } - parent = (LLViewerObject*)parent->getParent(); - } - } - if(!mLookAt || mLookAt->isDead()) - { - mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT); - mLookAt->setSourceObject(gAgentAvatarp); - } - - return mLookAt->setLookAt(target_type, object, position); + if(object && object->isAttachment()) + { + LLViewerObject* parent = object; + while(parent) + { + if (parent == gAgentAvatarp) + { + // looking at an attachment on ourselves, which we don't want to do + object = gAgentAvatarp; + position.clearVec(); + } + parent = (LLViewerObject*)parent->getParent(); + } + } + if(!mLookAt || mLookAt->isDead()) + { + mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT); + mLookAt->setSourceObject(gAgentAvatarp); + } + + return mLookAt->setLookAt(target_type, object, position); } //----------------------------------------------------------------------------- @@ -2658,157 +2658,157 @@ BOOL LLAgentCamera::setLookAt(ELookAtType target_type, LLViewerObject *object, L //----------------------------------------------------------------------------- void LLAgentCamera::lookAtLastChat() { - // Block if camera is animating or not in normal third person camera mode - if (mCameraAnimating || !cameraThirdPerson()) - { - return; - } - - LLViewerObject *chatter = gObjectList.findObject(gAgent.getLastChatter()); - if (!chatter) - { - return; - } - - LLVector3 delta_pos; - if (chatter->isAvatar()) - { - LLVOAvatar *chatter_av = (LLVOAvatar*)chatter; - if (isAgentAvatarValid() && chatter_av->mHeadp) - { - delta_pos = chatter_av->mHeadp->getWorldPosition() - gAgentAvatarp->mHeadp->getWorldPosition(); - } - else - { - delta_pos = chatter->getPositionAgent() - gAgent.getPositionAgent(); - } - delta_pos.normalize(); - - gAgent.setControlFlags(AGENT_CONTROL_STOP); - - changeCameraToThirdPerson(); - - LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition(); - LLVector3 left = delta_pos % LLVector3::z_axis; - left.normalize(); - LLVector3 up = left % delta_pos; - up.normalize(); - new_camera_pos -= delta_pos * 0.4f; - new_camera_pos += left * 0.3f; - new_camera_pos += up * 0.2f; - - setFocusOnAvatar(FALSE, FALSE); - - if (chatter_av->mHeadp) - { - setFocusGlobal(gAgent.getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition()), gAgent.getLastChatter()); - mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - gAgent.getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition()); - } - else - { - setFocusGlobal(chatter->getPositionGlobal(), gAgent.getLastChatter()); - mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal(); - } - } - else - { - delta_pos = chatter->getRenderPosition() - gAgent.getPositionAgent(); - delta_pos.normalize(); - - gAgent.setControlFlags(AGENT_CONTROL_STOP); - - changeCameraToThirdPerson(); - - LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition(); - LLVector3 left = delta_pos % LLVector3::z_axis; - left.normalize(); - LLVector3 up = left % delta_pos; - up.normalize(); - new_camera_pos -= delta_pos * 0.4f; - new_camera_pos += left * 0.3f; - new_camera_pos += up * 0.2f; - - setFocusOnAvatar(FALSE, FALSE); - - setFocusGlobal(chatter->getPositionGlobal(), gAgent.getLastChatter()); - mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal(); - } + // Block if camera is animating or not in normal third person camera mode + if (mCameraAnimating || !cameraThirdPerson()) + { + return; + } + + LLViewerObject *chatter = gObjectList.findObject(gAgent.getLastChatter()); + if (!chatter) + { + return; + } + + LLVector3 delta_pos; + if (chatter->isAvatar()) + { + LLVOAvatar *chatter_av = (LLVOAvatar*)chatter; + if (isAgentAvatarValid() && chatter_av->mHeadp) + { + delta_pos = chatter_av->mHeadp->getWorldPosition() - gAgentAvatarp->mHeadp->getWorldPosition(); + } + else + { + delta_pos = chatter->getPositionAgent() - gAgent.getPositionAgent(); + } + delta_pos.normalize(); + + gAgent.setControlFlags(AGENT_CONTROL_STOP); + + changeCameraToThirdPerson(); + + LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition(); + LLVector3 left = delta_pos % LLVector3::z_axis; + left.normalize(); + LLVector3 up = left % delta_pos; + up.normalize(); + new_camera_pos -= delta_pos * 0.4f; + new_camera_pos += left * 0.3f; + new_camera_pos += up * 0.2f; + + setFocusOnAvatar(FALSE, FALSE); + + if (chatter_av->mHeadp) + { + setFocusGlobal(gAgent.getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition()), gAgent.getLastChatter()); + mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - gAgent.getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition()); + } + else + { + setFocusGlobal(chatter->getPositionGlobal(), gAgent.getLastChatter()); + mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal(); + } + } + else + { + delta_pos = chatter->getRenderPosition() - gAgent.getPositionAgent(); + delta_pos.normalize(); + + gAgent.setControlFlags(AGENT_CONTROL_STOP); + + changeCameraToThirdPerson(); + + LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition(); + LLVector3 left = delta_pos % LLVector3::z_axis; + left.normalize(); + LLVector3 up = left % delta_pos; + up.normalize(); + new_camera_pos -= delta_pos * 0.4f; + new_camera_pos += left * 0.3f; + new_camera_pos += up * 0.2f; + + setFocusOnAvatar(FALSE, FALSE); + + setFocusGlobal(chatter->getPositionGlobal(), gAgent.getLastChatter()); + mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal(); + } } bool LLAgentCamera::isfollowCamLocked() { - return mFollowCam.getPositionLocked(); + return mFollowCam.getPositionLocked(); } BOOL LLAgentCamera::setPointAt(EPointAtType target_type, LLViewerObject *object, LLVector3 position) { - // disallow pointing at attachments and avatars - if (object && (object->isAttachment() || object->isAvatar())) - { - return FALSE; - } - if (!mPointAt || mPointAt->isDead()) - { - mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT); - mPointAt->setSourceObject(gAgentAvatarp); - } - return mPointAt->setPointAt(target_type, object, position); + // disallow pointing at attachments and avatars + if (object && (object->isAttachment() || object->isAvatar())) + { + return FALSE; + } + if (!mPointAt || mPointAt->isDead()) + { + mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT); + mPointAt->setSourceObject(gAgentAvatarp); + } + return mPointAt->setPointAt(target_type, object, position); } ELookAtType LLAgentCamera::getLookAtType() { - if (mLookAt) - { - return mLookAt->getLookAtType(); - } - return LOOKAT_TARGET_NONE; + if (mLookAt) + { + return mLookAt->getLookAtType(); + } + return LOOKAT_TARGET_NONE; } EPointAtType LLAgentCamera::getPointAtType() { - if (mPointAt) - { - return mPointAt->getPointAtType(); - } - return POINTAT_TARGET_NONE; + if (mPointAt) + { + return mPointAt->getPointAtType(); + } + return POINTAT_TARGET_NONE; } void LLAgentCamera::clearGeneralKeys() { - mAtKey = 0; - mWalkKey = 0; - mLeftKey = 0; - mUpKey = 0; - mYawKey = 0.f; - mPitchKey = 0.f; + mAtKey = 0; + mWalkKey = 0; + mLeftKey = 0; + mUpKey = 0; + mYawKey = 0.f; + mPitchKey = 0.f; } void LLAgentCamera::clearOrbitKeys() { - mOrbitLeftKey = 0.f; - mOrbitRightKey = 0.f; - mOrbitUpKey = 0.f; - mOrbitDownKey = 0.f; - mOrbitInKey = 0.f; - mOrbitOutKey = 0.f; + mOrbitLeftKey = 0.f; + mOrbitRightKey = 0.f; + mOrbitUpKey = 0.f; + mOrbitDownKey = 0.f; + mOrbitInKey = 0.f; + mOrbitOutKey = 0.f; } void LLAgentCamera::clearPanKeys() { - mPanRightKey = 0.f; - mPanLeftKey = 0.f; - mPanUpKey = 0.f; - mPanDownKey = 0.f; - mPanInKey = 0.f; - mPanOutKey = 0.f; + mPanRightKey = 0.f; + mPanLeftKey = 0.f; + mPanUpKey = 0.f; + mPanDownKey = 0.f; + mPanInKey = 0.f; + mPanOutKey = 0.f; } // static S32 LLAgentCamera::directionToKey(S32 direction) { - if (direction > 0) return 1; - if (direction < 0) return -1; - return 0; + if (direction > 0) return 1; + if (direction < 0) return -1; + return 0; } diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 4575c1501a..27a9891030 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -27,9 +27,9 @@ #ifndef LL_LLAGENTCAMERA_H #define LL_LLAGENTCAMERA_H -#include "llfollowcam.h" // Ventrella -#include "llhudeffectlookat.h" // EPointAtType -#include "llhudeffectpointat.h" // ELookAtType +#include "llfollowcam.h" // Ventrella +#include "llhudeffectlookat.h" // EPointAtType +#include "llhudeffectpointat.h" // ELookAtType class LLPickInfo; class LLVOAvatarSelf; @@ -40,26 +40,26 @@ class LLControlVariable; //-------------------------------------------------------------------- enum ECameraMode { - CAMERA_MODE_THIRD_PERSON, - CAMERA_MODE_MOUSELOOK, - CAMERA_MODE_CUSTOMIZE_AVATAR, - CAMERA_MODE_FOLLOW + CAMERA_MODE_THIRD_PERSON, + CAMERA_MODE_MOUSELOOK, + CAMERA_MODE_CUSTOMIZE_AVATAR, + CAMERA_MODE_FOLLOW }; /** Camera Presets for CAMERA_MODE_THIRD_PERSON */ enum ECameraPreset { - /** Default preset, what the Third Person Mode actually was */ - CAMERA_PRESET_REAR_VIEW, - - /** "Looking at the Avatar from the front" */ - CAMERA_PRESET_FRONT_VIEW, + /** Default preset, what the Third Person Mode actually was */ + CAMERA_PRESET_REAR_VIEW, + + /** "Looking at the Avatar from the front" */ + CAMERA_PRESET_FRONT_VIEW, - /** "Above and to the left, over the shoulder, pulled back a little on the zoom" */ - CAMERA_PRESET_GROUP_VIEW, + /** "Above and to the left, over the shoulder, pulled back a little on the zoom" */ + CAMERA_PRESET_GROUP_VIEW, - /** Current view when a preset is saved */ - CAMERA_PRESET_CUSTOM0 + /** Current view when a preset is saved */ + CAMERA_PRESET_CUSTOM0 }; //------------------------------------------------------------------------ @@ -67,243 +67,243 @@ enum ECameraPreset //------------------------------------------------------------------------ class LLAgentCamera { - LOG_CLASS(LLAgentCamera); + LOG_CLASS(LLAgentCamera); public: - //-------------------------------------------------------------------- - // Constructors / Destructors - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Constructors / Destructors + //-------------------------------------------------------------------- public: - LLAgentCamera(); - virtual ~LLAgentCamera(); - void init(); - void cleanup(); - void setAvatarObject(LLVOAvatarSelf* avatar); - bool isInitialized() { return mInitialized; } + LLAgentCamera(); + virtual ~LLAgentCamera(); + void init(); + void cleanup(); + void setAvatarObject(LLVOAvatarSelf* avatar); + bool isInitialized() { return mInitialized; } private: - bool mInitialized; + bool mInitialized; - //-------------------------------------------------------------------- - // Mode - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Mode + //-------------------------------------------------------------------- public: - void changeCameraToDefault(); - void changeCameraToMouselook(BOOL animate = TRUE); - void changeCameraToThirdPerson(BOOL animate = TRUE); - void changeCameraToCustomizeAvatar(); // Trigger transition animation - void changeCameraToFollow(BOOL animate = TRUE); // Ventrella - BOOL cameraThirdPerson() const { return (mCameraMode == CAMERA_MODE_THIRD_PERSON && mLastCameraMode == CAMERA_MODE_THIRD_PERSON); } - BOOL cameraMouselook() const { return (mCameraMode == CAMERA_MODE_MOUSELOOK && mLastCameraMode == CAMERA_MODE_MOUSELOOK); } - BOOL cameraCustomizeAvatar() const { return (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR /*&& !mCameraAnimating*/); } - BOOL cameraFollow() const { return (mCameraMode == CAMERA_MODE_FOLLOW && mLastCameraMode == CAMERA_MODE_FOLLOW); } - ECameraMode getCameraMode() const { return mCameraMode; } - ECameraMode getLastCameraMode() const { return mLastCameraMode; } - void updateCamera(); // Call once per frame to update camera location/orientation - void resetCamera(); // Slam camera into its default position - void updateLastCamera(); // Set last camera to current camera + void changeCameraToDefault(); + void changeCameraToMouselook(BOOL animate = TRUE); + void changeCameraToThirdPerson(BOOL animate = TRUE); + void changeCameraToCustomizeAvatar(); // Trigger transition animation + void changeCameraToFollow(BOOL animate = TRUE); // Ventrella + BOOL cameraThirdPerson() const { return (mCameraMode == CAMERA_MODE_THIRD_PERSON && mLastCameraMode == CAMERA_MODE_THIRD_PERSON); } + BOOL cameraMouselook() const { return (mCameraMode == CAMERA_MODE_MOUSELOOK && mLastCameraMode == CAMERA_MODE_MOUSELOOK); } + BOOL cameraCustomizeAvatar() const { return (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR /*&& !mCameraAnimating*/); } + BOOL cameraFollow() const { return (mCameraMode == CAMERA_MODE_FOLLOW && mLastCameraMode == CAMERA_MODE_FOLLOW); } + ECameraMode getCameraMode() const { return mCameraMode; } + ECameraMode getLastCameraMode() const { return mLastCameraMode; } + void updateCamera(); // Call once per frame to update camera location/orientation + void resetCamera(); // Slam camera into its default position + void updateLastCamera(); // Set last camera to current camera private: - ECameraMode mCameraMode; // Target mode after transition animation is done - ECameraMode mLastCameraMode; + ECameraMode mCameraMode; // Target mode after transition animation is done + ECameraMode mLastCameraMode; - //-------------------------------------------------------------------- - // Preset - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Preset + //-------------------------------------------------------------------- public: - void switchCameraPreset(ECameraPreset preset); + void switchCameraPreset(ECameraPreset preset); private: - /** Determines default camera offset depending on the current camera preset */ - LLVector3 getCameraOffsetInitial(); - /** Determines maximum camera distance from target for mouselook, opposite to LAND_MIN_ZOOM */ - F32 getCameraMaxZoomDistance(); + /** Determines default camera offset depending on the current camera preset */ + LLVector3 getCameraOffsetInitial(); + /** Determines maximum camera distance from target for mouselook, opposite to LAND_MIN_ZOOM */ + F32 getCameraMaxZoomDistance(); - /** Camera preset in Third Person Mode */ - ECameraPreset mCameraPreset; + /** Camera preset in Third Person Mode */ + ECameraPreset mCameraPreset; - /** Initial camera offsets */ - std::map > mCameraOffsetInitial; + /** Initial camera offsets */ + std::map > mCameraOffsetInitial; - /** Initial focus offsets */ - std::map > mFocusOffsetInitial; + /** Initial focus offsets */ + std::map > mFocusOffsetInitial; - //-------------------------------------------------------------------- - // Position - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Position + //-------------------------------------------------------------------- public: - LLVector3d getCameraPositionGlobal() const; - const LLVector3 &getCameraPositionAgent() const; - LLVector3d calcCameraPositionTargetGlobal(BOOL *hit_limit = NULL); // Calculate the camera position target - F32 getCameraMinOffGround(); // Minimum height off ground for this mode, meters - void setCameraCollidePlane(const LLVector4 &plane) { mCameraCollidePlane = plane; } - BOOL calcCameraMinDistance(F32 &obj_min_distance); - F32 getCurrentCameraBuildOffset() { return (F32)mCameraFocusOffset.length(); } - void clearCameraLag() { mCameraLag.clearVec(); } + LLVector3d getCameraPositionGlobal() const; + const LLVector3 &getCameraPositionAgent() const; + LLVector3d calcCameraPositionTargetGlobal(BOOL *hit_limit = NULL); // Calculate the camera position target + F32 getCameraMinOffGround(); // Minimum height off ground for this mode, meters + void setCameraCollidePlane(const LLVector4 &plane) { mCameraCollidePlane = plane; } + BOOL calcCameraMinDistance(F32 &obj_min_distance); + F32 getCurrentCameraBuildOffset() { return (F32)mCameraFocusOffset.length(); } + void clearCameraLag() { mCameraLag.clearVec(); } private: - F32 mCurrentCameraDistance; // Current camera offset from avatar - F32 mTargetCameraDistance; // Target camera offset from avatar - F32 mCameraFOVZoomFactor; // Amount of fov zoom applied to camera when zeroing in on an object - F32 mCameraCurrentFOVZoomFactor; // Interpolated fov zoom - F32 mCameraFOVDefault; // Default field of view that is basis for FOV zoom effect - LLVector4 mCameraCollidePlane; // Colliding plane for camera - F32 mCameraZoomFraction; // Mousewheel driven fraction of zoom - LLVector3 mCameraPositionAgent; // Camera position in agent coordinates - LLVector3 mCameraVirtualPositionAgent; // Camera virtual position (target) before performing FOV zoom - LLVector3d mCameraSmoothingLastPositionGlobal; - LLVector3d mCameraSmoothingLastPositionAgent; - bool mCameraSmoothingStop; - LLVector3 mCameraLag; // Third person camera lag - LLVector3 mCameraUpVector; // Camera's up direction in world coordinates (determines the 'roll' of the view) - - //-------------------------------------------------------------------- - // Follow - //-------------------------------------------------------------------- + F32 mCurrentCameraDistance; // Current camera offset from avatar + F32 mTargetCameraDistance; // Target camera offset from avatar + F32 mCameraFOVZoomFactor; // Amount of fov zoom applied to camera when zeroing in on an object + F32 mCameraCurrentFOVZoomFactor; // Interpolated fov zoom + F32 mCameraFOVDefault; // Default field of view that is basis for FOV zoom effect + LLVector4 mCameraCollidePlane; // Colliding plane for camera + F32 mCameraZoomFraction; // Mousewheel driven fraction of zoom + LLVector3 mCameraPositionAgent; // Camera position in agent coordinates + LLVector3 mCameraVirtualPositionAgent; // Camera virtual position (target) before performing FOV zoom + LLVector3d mCameraSmoothingLastPositionGlobal; + LLVector3d mCameraSmoothingLastPositionAgent; + bool mCameraSmoothingStop; + LLVector3 mCameraLag; // Third person camera lag + LLVector3 mCameraUpVector; // Camera's up direction in world coordinates (determines the 'roll' of the view) + + //-------------------------------------------------------------------- + // Follow + //-------------------------------------------------------------------- public: - void setUsingFollowCam(bool using_follow_cam); - bool isfollowCamLocked(); + void setUsingFollowCam(bool using_follow_cam); + bool isfollowCamLocked(); private: - LLFollowCam mFollowCam; // Ventrella + LLFollowCam mFollowCam; // Ventrella - //-------------------------------------------------------------------- - // Sit - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Sit + //-------------------------------------------------------------------- public: - void setupSitCamera(); - BOOL sitCameraEnabled() { return mSitCameraEnabled; } - void setSitCamera(const LLUUID &object_id, - const LLVector3 &camera_pos = LLVector3::zero, const LLVector3 &camera_focus = LLVector3::zero); + void setupSitCamera(); + BOOL sitCameraEnabled() { return mSitCameraEnabled; } + void setSitCamera(const LLUUID &object_id, + const LLVector3 &camera_pos = LLVector3::zero, const LLVector3 &camera_focus = LLVector3::zero); private: - LLPointer mSitCameraReferenceObject; // Object to which camera is related when sitting - BOOL mSitCameraEnabled; // Use provided camera information when sitting? - LLVector3 mSitCameraPos; // Root relative camera pos when sitting - LLVector3 mSitCameraFocus; // Root relative camera target when sitting - - //-------------------------------------------------------------------- - // Animation - //-------------------------------------------------------------------- + LLPointer mSitCameraReferenceObject; // Object to which camera is related when sitting + BOOL mSitCameraEnabled; // Use provided camera information when sitting? + LLVector3 mSitCameraPos; // Root relative camera pos when sitting + LLVector3 mSitCameraFocus; // Root relative camera target when sitting + + //-------------------------------------------------------------------- + // Animation + //-------------------------------------------------------------------- public: - void setCameraAnimating(BOOL b) { mCameraAnimating = b; } - BOOL getCameraAnimating() { return mCameraAnimating; } - void setAnimationDuration(F32 seconds); - void startCameraAnimation(); - void stopCameraAnimation(); + void setCameraAnimating(BOOL b) { mCameraAnimating = b; } + BOOL getCameraAnimating() { return mCameraAnimating; } + void setAnimationDuration(F32 seconds); + void startCameraAnimation(); + void stopCameraAnimation(); private: - LLFrameTimer mAnimationTimer; // Seconds that transition animation has been active - F32 mAnimationDuration; // In seconds - BOOL mCameraAnimating; // Camera is transitioning from one mode to another - LLVector3d mAnimationCameraStartGlobal; // Camera start position, global coords - LLVector3d mAnimationFocusStartGlobal; // Camera focus point, global coords - - //-------------------------------------------------------------------- - // Focus - //-------------------------------------------------------------------- + LLFrameTimer mAnimationTimer; // Seconds that transition animation has been active + F32 mAnimationDuration; // In seconds + BOOL mCameraAnimating; // Camera is transitioning from one mode to another + LLVector3d mAnimationCameraStartGlobal; // Camera start position, global coords + LLVector3d mAnimationFocusStartGlobal; // Camera focus point, global coords + + //-------------------------------------------------------------------- + // Focus + //-------------------------------------------------------------------- public: - LLVector3d calcFocusPositionTargetGlobal(); - LLVector3 calcFocusOffset(LLViewerObject *object, LLVector3 pos_agent, S32 x, S32 y); - BOOL getFocusOnAvatar() const { return mFocusOnAvatar; } - LLPointer& getFocusObject() { return mFocusObject; } - F32 getFocusObjectDist() const { return mFocusObjectDist; } - void updateFocusOffset(); - void validateFocusObject(); - void setFocusGlobal(const LLPickInfo& pick); - void setFocusGlobal(const LLVector3d &focus, const LLUUID &object_id = LLUUID::null); - void setFocusOnAvatar(BOOL focus, BOOL animate); - void setCameraPosAndFocusGlobal(const LLVector3d& pos, const LLVector3d& focus, const LLUUID &object_id); - void clearFocusObject(); - void setFocusObject(LLViewerObject* object); - void setAllowChangeToFollow(BOOL focus) { mAllowChangeToFollow = focus; } - void setObjectTracking(BOOL track) { mTrackFocusObject = track; } - const LLVector3d &getFocusGlobal() const { return mFocusGlobal; } - const LLVector3d &getFocusTargetGlobal() const { return mFocusTargetGlobal; } + LLVector3d calcFocusPositionTargetGlobal(); + LLVector3 calcFocusOffset(LLViewerObject *object, LLVector3 pos_agent, S32 x, S32 y); + BOOL getFocusOnAvatar() const { return mFocusOnAvatar; } + LLPointer& getFocusObject() { return mFocusObject; } + F32 getFocusObjectDist() const { return mFocusObjectDist; } + void updateFocusOffset(); + void validateFocusObject(); + void setFocusGlobal(const LLPickInfo& pick); + void setFocusGlobal(const LLVector3d &focus, const LLUUID &object_id = LLUUID::null); + void setFocusOnAvatar(BOOL focus, BOOL animate); + void setCameraPosAndFocusGlobal(const LLVector3d& pos, const LLVector3d& focus, const LLUUID &object_id); + void clearFocusObject(); + void setFocusObject(LLViewerObject* object); + void setAllowChangeToFollow(BOOL focus) { mAllowChangeToFollow = focus; } + void setObjectTracking(BOOL track) { mTrackFocusObject = track; } + const LLVector3d &getFocusGlobal() const { return mFocusGlobal; } + const LLVector3d &getFocusTargetGlobal() const { return mFocusTargetGlobal; } private: - LLVector3d mCameraFocusOffset; // Offset from focus point in build mode - LLVector3d mCameraFocusOffsetTarget; // Target towards which we are lerping the camera's focus offset - BOOL mFocusOnAvatar; - BOOL mAllowChangeToFollow; - LLVector3d mFocusGlobal; - LLVector3d mFocusTargetGlobal; - LLPointer mFocusObject; - F32 mFocusObjectDist; - LLVector3 mFocusObjectOffset; - F32 mFocusDotRadius; // Meters - BOOL mTrackFocusObject; - - //-------------------------------------------------------------------- - // Lookat / Pointat - //-------------------------------------------------------------------- + LLVector3d mCameraFocusOffset; // Offset from focus point in build mode + LLVector3d mCameraFocusOffsetTarget; // Target towards which we are lerping the camera's focus offset + BOOL mFocusOnAvatar; + BOOL mAllowChangeToFollow; + LLVector3d mFocusGlobal; + LLVector3d mFocusTargetGlobal; + LLPointer mFocusObject; + F32 mFocusObjectDist; + LLVector3 mFocusObjectOffset; + F32 mFocusDotRadius; // Meters + BOOL mTrackFocusObject; + + //-------------------------------------------------------------------- + // Lookat / Pointat + //-------------------------------------------------------------------- public: - void updateLookAt(const S32 mouse_x, const S32 mouse_y); - BOOL setLookAt(ELookAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); - ELookAtType getLookAtType(); - void lookAtLastChat(); - void slamLookAt(const LLVector3 &look_at); // Set the physics data - BOOL setPointAt(EPointAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); - EPointAtType getPointAtType(); + void updateLookAt(const S32 mouse_x, const S32 mouse_y); + BOOL setLookAt(ELookAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); + ELookAtType getLookAtType(); + void lookAtLastChat(); + void slamLookAt(const LLVector3 &look_at); // Set the physics data + BOOL setPointAt(EPointAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); + EPointAtType getPointAtType(); public: - LLPointer mLookAt; - LLPointer mPointAt; + LLPointer mLookAt; + LLPointer mPointAt; - //-------------------------------------------------------------------- - // Third person - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Third person + //-------------------------------------------------------------------- public: - LLVector3d calcThirdPersonFocusOffset(); - void setThirdPersonHeadOffset(LLVector3 offset) { mThirdPersonHeadOffset = offset; } + LLVector3d calcThirdPersonFocusOffset(); + void setThirdPersonHeadOffset(LLVector3 offset) { mThirdPersonHeadOffset = offset; } private: - LLVector3 mThirdPersonHeadOffset; // Head offset for third person camera position + LLVector3 mThirdPersonHeadOffset; // Head offset for third person camera position - //-------------------------------------------------------------------- - // Orbit - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Orbit + //-------------------------------------------------------------------- public: - void cameraOrbitAround(const F32 radians); // Rotate camera CCW radians about build focus point - void cameraOrbitOver(const F32 radians); // Rotate camera forward radians over build focus point - void cameraOrbitIn(const F32 meters); // Move camera in toward build focus point + void cameraOrbitAround(const F32 radians); // Rotate camera CCW radians about build focus point + void cameraOrbitOver(const F32 radians); // Rotate camera forward radians over build focus point + void cameraOrbitIn(const F32 meters); // Move camera in toward build focus point - //-------------------------------------------------------------------- - // Zoom - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Zoom + //-------------------------------------------------------------------- public: - void handleScrollWheel(S32 clicks); // Mousewheel driven zoom - void cameraZoomIn(const F32 factor); // Zoom in by fraction of current distance - F32 getCameraZoomFraction(); // Get camera zoom as fraction of minimum and maximum zoom - void setCameraZoomFraction(F32 fraction); // Set camera zoom as fraction of minimum and maximum zoom - F32 calcCameraFOVZoomFactor(); - - //-------------------------------------------------------------------- - // Pan - //-------------------------------------------------------------------- + void handleScrollWheel(S32 clicks); // Mousewheel driven zoom + void cameraZoomIn(const F32 factor); // Zoom in by fraction of current distance + F32 getCameraZoomFraction(); // Get camera zoom as fraction of minimum and maximum zoom + void setCameraZoomFraction(F32 fraction); // Set camera zoom as fraction of minimum and maximum zoom + F32 calcCameraFOVZoomFactor(); + + //-------------------------------------------------------------------- + // Pan + //-------------------------------------------------------------------- public: - void cameraPanIn(const F32 meters); - void cameraPanLeft(const F32 meters); - void cameraPanUp(const F32 meters); - - //-------------------------------------------------------------------- - // View - //-------------------------------------------------------------------- + void cameraPanIn(const F32 meters); + void cameraPanLeft(const F32 meters); + void cameraPanUp(const F32 meters); + + //-------------------------------------------------------------------- + // View + //-------------------------------------------------------------------- public: - // Called whenever the agent moves. Puts camera back in default position, deselects items, etc. - void resetView(BOOL reset_camera = TRUE, BOOL change_camera = FALSE); - // Called on camera movement. Unlocks camera from the default position behind the avatar. - void unlockView(); + // Called whenever the agent moves. Puts camera back in default position, deselects items, etc. + void resetView(BOOL reset_camera = TRUE, BOOL change_camera = FALSE); + // Called on camera movement. Unlocks camera from the default position behind the avatar. + void unlockView(); public: - F32 mDrawDistance; + F32 mDrawDistance; - //-------------------------------------------------------------------- - // Mouselook - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Mouselook + //-------------------------------------------------------------------- public: - BOOL getForceMouselook() const { return mForceMouselook; } - void setForceMouselook(BOOL mouselook) { mForceMouselook = mouselook; } + BOOL getForceMouselook() const { return mForceMouselook; } + void setForceMouselook(BOOL mouselook) { mForceMouselook = mouselook; } private: - BOOL mForceMouselook; - - //-------------------------------------------------------------------- - // HUD - //-------------------------------------------------------------------- + BOOL mForceMouselook; + + //-------------------------------------------------------------------- + // HUD + //-------------------------------------------------------------------- public: - F32 mHUDTargetZoom; // Target zoom level for HUD objects (used when editing) - F32 mHUDCurZoom; // Current animated zoom level for HUD objects + F32 mHUDTargetZoom; // Target zoom level for HUD objects (used when editing) + F32 mHUDCurZoom; // Current animated zoom level for HUD objects /******************************************************************************** @@ -312,84 +312,84 @@ public: **/ public: - S32 getAtKey() const { return mAtKey; } - S32 getWalkKey() const { return mWalkKey; } - S32 getLeftKey() const { return mLeftKey; } - S32 getUpKey() const { return mUpKey; } - F32 getYawKey() const { return mYawKey; } - F32 getPitchKey() const { return mPitchKey; } - - void setAtKey(S32 mag) { mAtKey = mag; } - void setWalkKey(S32 mag) { mWalkKey = mag; } - void setLeftKey(S32 mag) { mLeftKey = mag; } - void setUpKey(S32 mag) { mUpKey = mag; } - void setYawKey(F32 mag) { mYawKey = mag; } - void setPitchKey(F32 mag) { mPitchKey = mag; } - - void clearGeneralKeys(); - static S32 directionToKey(S32 direction); // Changes direction to -1/0/1 + S32 getAtKey() const { return mAtKey; } + S32 getWalkKey() const { return mWalkKey; } + S32 getLeftKey() const { return mLeftKey; } + S32 getUpKey() const { return mUpKey; } + F32 getYawKey() const { return mYawKey; } + F32 getPitchKey() const { return mPitchKey; } + + void setAtKey(S32 mag) { mAtKey = mag; } + void setWalkKey(S32 mag) { mWalkKey = mag; } + void setLeftKey(S32 mag) { mLeftKey = mag; } + void setUpKey(S32 mag) { mUpKey = mag; } + void setYawKey(F32 mag) { mYawKey = mag; } + void setPitchKey(F32 mag) { mPitchKey = mag; } + + void clearGeneralKeys(); + static S32 directionToKey(S32 direction); // Changes direction to -1/0/1 private: - S32 mAtKey; // Either 1, 0, or -1. Indicates that movement key is pressed - S32 mWalkKey; // Like AtKey, but causes less forward thrust - S32 mLeftKey; - S32 mUpKey; - F32 mYawKey; - F32 mPitchKey; - - //-------------------------------------------------------------------- - // Orbit - //-------------------------------------------------------------------- + S32 mAtKey; // Either 1, 0, or -1. Indicates that movement key is pressed + S32 mWalkKey; // Like AtKey, but causes less forward thrust + S32 mLeftKey; + S32 mUpKey; + F32 mYawKey; + F32 mPitchKey; + + //-------------------------------------------------------------------- + // Orbit + //-------------------------------------------------------------------- public: - F32 getOrbitLeftKey() const { return mOrbitLeftKey; } - F32 getOrbitRightKey() const { return mOrbitRightKey; } - F32 getOrbitUpKey() const { return mOrbitUpKey; } - F32 getOrbitDownKey() const { return mOrbitDownKey; } - F32 getOrbitInKey() const { return mOrbitInKey; } - F32 getOrbitOutKey() const { return mOrbitOutKey; } - - void setOrbitLeftKey(F32 mag) { mOrbitLeftKey = mag; } - void setOrbitRightKey(F32 mag) { mOrbitRightKey = mag; } - void setOrbitUpKey(F32 mag) { mOrbitUpKey = mag; } - void setOrbitDownKey(F32 mag) { mOrbitDownKey = mag; } - void setOrbitInKey(F32 mag) { mOrbitInKey = mag; } - void setOrbitOutKey(F32 mag) { mOrbitOutKey = mag; } - - void clearOrbitKeys(); + F32 getOrbitLeftKey() const { return mOrbitLeftKey; } + F32 getOrbitRightKey() const { return mOrbitRightKey; } + F32 getOrbitUpKey() const { return mOrbitUpKey; } + F32 getOrbitDownKey() const { return mOrbitDownKey; } + F32 getOrbitInKey() const { return mOrbitInKey; } + F32 getOrbitOutKey() const { return mOrbitOutKey; } + + void setOrbitLeftKey(F32 mag) { mOrbitLeftKey = mag; } + void setOrbitRightKey(F32 mag) { mOrbitRightKey = mag; } + void setOrbitUpKey(F32 mag) { mOrbitUpKey = mag; } + void setOrbitDownKey(F32 mag) { mOrbitDownKey = mag; } + void setOrbitInKey(F32 mag) { mOrbitInKey = mag; } + void setOrbitOutKey(F32 mag) { mOrbitOutKey = mag; } + + void clearOrbitKeys(); private: - F32 mOrbitLeftKey; - F32 mOrbitRightKey; - F32 mOrbitUpKey; - F32 mOrbitDownKey; - F32 mOrbitInKey; - F32 mOrbitOutKey; - - //-------------------------------------------------------------------- - // Pan - //-------------------------------------------------------------------- + F32 mOrbitLeftKey; + F32 mOrbitRightKey; + F32 mOrbitUpKey; + F32 mOrbitDownKey; + F32 mOrbitInKey; + F32 mOrbitOutKey; + + //-------------------------------------------------------------------- + // Pan + //-------------------------------------------------------------------- public: - F32 getPanLeftKey() const { return mPanLeftKey; } - F32 getPanRightKey() const { return mPanRightKey; } - F32 getPanUpKey() const { return mPanUpKey; } - F32 getPanDownKey() const { return mPanDownKey; } - F32 getPanInKey() const { return mPanInKey; } - F32 getPanOutKey() const { return mPanOutKey; } - - void setPanLeftKey(F32 mag) { mPanLeftKey = mag; } - void setPanRightKey(F32 mag) { mPanRightKey = mag; } - void setPanUpKey(F32 mag) { mPanUpKey = mag; } - void setPanDownKey(F32 mag) { mPanDownKey = mag; } - void setPanInKey(F32 mag) { mPanInKey = mag; } - void setPanOutKey(F32 mag) { mPanOutKey = mag; } - - void clearPanKeys(); + F32 getPanLeftKey() const { return mPanLeftKey; } + F32 getPanRightKey() const { return mPanRightKey; } + F32 getPanUpKey() const { return mPanUpKey; } + F32 getPanDownKey() const { return mPanDownKey; } + F32 getPanInKey() const { return mPanInKey; } + F32 getPanOutKey() const { return mPanOutKey; } + + void setPanLeftKey(F32 mag) { mPanLeftKey = mag; } + void setPanRightKey(F32 mag) { mPanRightKey = mag; } + void setPanUpKey(F32 mag) { mPanUpKey = mag; } + void setPanDownKey(F32 mag) { mPanDownKey = mag; } + void setPanInKey(F32 mag) { mPanInKey = mag; } + void setPanOutKey(F32 mag) { mPanOutKey = mag; } + + void clearPanKeys(); private: - F32 mPanUpKey; - F32 mPanDownKey; - F32 mPanLeftKey; - F32 mPanRightKey; - F32 mPanInKey; - F32 mPanOutKey; + F32 mPanUpKey; + F32 mPanDownKey; + F32 mPanLeftKey; + F32 mPanRightKey; + F32 mPanInKey; + F32 mPanOutKey; /** Keys ** ** diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index df06ad31e6..9848a1af0b 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -34,7 +34,7 @@ #include "m3math.h" #include "llrender.h" -#include "llagent.h" // for gAgent for getRegion for getWaterHeight +#include "llagent.h" // for gAgent for getRegion for getWaterHeight #include "llcubemap.h" #include "lldrawable.h" #include "llface.h" @@ -64,26 +64,26 @@ F32 LLDrawPoolWater::sWaterFogEnd = 0.f; LLVector3 LLDrawPoolWater::sLightDir; LLDrawPoolWater::LLDrawPoolWater() : - LLFacePool(POOL_WATER) + LLFacePool(POOL_WATER) { - mHBTex[0] = LLViewerTextureManager::getFetchedTexture(gSunTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); - gGL.getTexUnit(0)->bind(mHBTex[0]) ; - mHBTex[0]->setAddressMode(LLTexUnit::TAM_CLAMP); + mHBTex[0] = LLViewerTextureManager::getFetchedTexture(gSunTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + gGL.getTexUnit(0)->bind(mHBTex[0]) ; + mHBTex[0]->setAddressMode(LLTexUnit::TAM_CLAMP); - mHBTex[1] = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); - gGL.getTexUnit(0)->bind(mHBTex[1]); - mHBTex[1]->setAddressMode(LLTexUnit::TAM_CLAMP); + mHBTex[1] = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + gGL.getTexUnit(0)->bind(mHBTex[1]); + mHBTex[1]->setAddressMode(LLTexUnit::TAM_CLAMP); - mWaterImagep = LLViewerTextureManager::getFetchedTexture(TRANSPARENT_WATER_TEXTURE); - llassert(mWaterImagep); - mWaterImagep->setNoDelete(); - mOpaqueWaterImagep = LLViewerTextureManager::getFetchedTexture(OPAQUE_WATER_TEXTURE); - llassert(mOpaqueWaterImagep); - mWaterNormp = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL); - mWaterNormp->setNoDelete(); + mWaterImagep = LLViewerTextureManager::getFetchedTexture(TRANSPARENT_WATER_TEXTURE); + llassert(mWaterImagep); + mWaterImagep->setNoDelete(); + mOpaqueWaterImagep = LLViewerTextureManager::getFetchedTexture(OPAQUE_WATER_TEXTURE); + llassert(mOpaqueWaterImagep); + mWaterNormp = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL); + mWaterNormp->setNoDelete(); - restoreGL(); + restoreGL(); } LLDrawPoolWater::~LLDrawPoolWater() @@ -93,48 +93,48 @@ LLDrawPoolWater::~LLDrawPoolWater() //static void LLDrawPoolWater::restoreGL() { - + } LLDrawPool *LLDrawPoolWater::instancePool() { - LL_ERRS() << "Should never be calling instancePool on a water pool!" << LL_ENDL; - return NULL; + LL_ERRS() << "Should never be calling instancePool on a water pool!" << LL_ENDL; + return NULL; } void LLDrawPoolWater::prerender() { - mVertexShaderLevel = (gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps) ? - LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_WATER) : 0; + mVertexShaderLevel = (gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps) ? + LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_WATER) : 0; - // got rid of modulation by light color since it got a little too - // green at sunset and sl-57047 (underwater turns black at 8:00) - sWaterFogColor = LLWaterParamManager::instance().getFogColor(); - sWaterFogColor.mV[3] = 0; + // got rid of modulation by light color since it got a little too + // green at sunset and sl-57047 (underwater turns black at 8:00) + sWaterFogColor = LLWaterParamManager::instance().getFogColor(); + sWaterFogColor.mV[3] = 0; } S32 LLDrawPoolWater::getNumPasses() { - if (LLViewerCamera::getInstance()->getOrigin().mV[2] < 1024.f) - { - return 1; - } + if (LLViewerCamera::getInstance()->getOrigin().mV[2] < 1024.f) + { + return 1; + } - return 0; + return 0; } void LLDrawPoolWater::beginPostDeferredPass(S32 pass) { - beginRenderPass(pass); - deferred_render = TRUE; + beginRenderPass(pass); + deferred_render = TRUE; } void LLDrawPoolWater::endPostDeferredPass(S32 pass) { - endRenderPass(pass); - deferred_render = FALSE; + endRenderPass(pass); + deferred_render = FALSE; } //=============================== @@ -142,591 +142,591 @@ void LLDrawPoolWater::endPostDeferredPass(S32 pass) //=============================== void LLDrawPoolWater::renderDeferred(S32 pass) { - LL_RECORD_BLOCK_TIME(FTM_RENDER_WATER); - deferred_render = TRUE; - shade(); - deferred_render = FALSE; + LL_RECORD_BLOCK_TIME(FTM_RENDER_WATER); + deferred_render = TRUE; + shade(); + deferred_render = FALSE; } //========================================= void LLDrawPoolWater::render(S32 pass) { - LL_RECORD_BLOCK_TIME(FTM_RENDER_WATER); - if (mDrawFace.empty() || LLDrawable::getCurrentFrame() <= 1) - { - return; - } - - //do a quick 'n dirty depth sort - for (std::vector::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace* facep = *iter; - facep->mDistance = -facep->mCenterLocal.mV[2]; - } - - std::sort(mDrawFace.begin(), mDrawFace.end(), LLFace::CompareDistanceGreater()); - - // See if we are rendering water as opaque or not - if (!gSavedSettings.getBOOL("RenderTransparentWater")) - { - // render water for low end hardware - renderOpaqueLegacyWater(); - return; - } - - LLGLEnable blend(GL_BLEND); - - if ((mVertexShaderLevel > 0) && !sSkipScreenCopy) - { - shade(); - return; - } - - LLVOSky *voskyp = gSky.mVOSkyp; - - stop_glerror(); - - if (!gGLManager.mHasMultitexture) - { - // Ack! No multitexture! Bail! - return; - } - - LLFace* refl_face = voskyp->getReflFace(); - - gPipeline.disableLights(); - - LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); - - LLGLDisable cullFace(GL_CULL_FACE); - - // Set up second pass first - mWaterImagep->addTextureStats(1024.f*1024.f); - gGL.getTexUnit(1)->activate(); - gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->bind(mWaterImagep) ; - - LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); - F32 up_dot = camera_up * LLVector3::z_axis; - - LLColor4 water_color; - if (LLViewerCamera::getInstance()->cameraUnderWater()) - { - water_color.setVec(1.f, 1.f, 1.f, 0.4f); - } - else - { - water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot)); - } - - gGL.diffuseColor4fv(water_color.mV); - - // Automatically generate texture coords for detail map - glEnable(GL_TEXTURE_GEN_S); //texture unit 1 - glEnable(GL_TEXTURE_GEN_T); //texture unit 1 - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - - // Slowly move over time. - F32 offset = fmod(gFrameTimeSeconds*2.f, 100.f); - F32 tp0[4] = {16.f/256.f, 0.0f, 0.0f, offset*0.01f}; - F32 tp1[4] = {0.0f, 16.f/256.f, 0.0f, offset*0.01f}; - glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); - glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); - - gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR); - gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA); - - gGL.getTexUnit(0)->activate(); - - glClearStencil(1); - glClear(GL_STENCIL_BUFFER_BIT); - LLGLEnable gls_stencil(GL_STENCIL_TEST); - glStencilOp(GL_KEEP, GL_REPLACE, GL_KEEP); - glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFF); - - for (std::vector::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace *face = *iter; - if (voskyp->isReflFace(face)) - { - continue; - } - gGL.getTexUnit(0)->bind(face->getTexture()); - face->renderIndexed(); - } - - // Now, disable texture coord generation on texture state 1 - gGL.getTexUnit(1)->activate(); - gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->disable(); - glDisable(GL_TEXTURE_GEN_S); //texture unit 1 - glDisable(GL_TEXTURE_GEN_T); //texture unit 1 - - // Disable texture coordinate and color arrays - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - stop_glerror(); - - if (gSky.mVOSkyp->getCubeMap()) - { - gSky.mVOSkyp->getCubeMap()->enable(0); - gSky.mVOSkyp->getCubeMap()->bind(); - - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadIdentity(); - LLMatrix4 camera_mat = LLViewerCamera::getInstance()->getModelview(); - LLMatrix4 camera_rot(camera_mat.getMat3()); - camera_rot.invert(); - - gGL.loadMatrix((F32 *)camera_rot.mMatrix); - - gGL.matrixMode(LLRender::MM_MODELVIEW); - LLOverrideFaceColor overrid(this, 1.f, 1.f, 1.f, 0.5f*up_dot); - - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - - for (std::vector::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace *face = *iter; - if (voskyp->isReflFace(face)) - { - //refl_face = face; - continue; - } - - if (face->getGeomCount() > 0) - { - face->renderIndexed(); - } - } - - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - - gSky.mVOSkyp->getCubeMap()->disable(); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadIdentity(); - gGL.matrixMode(LLRender::MM_MODELVIEW); - - } - - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); + LL_RECORD_BLOCK_TIME(FTM_RENDER_WATER); + if (mDrawFace.empty() || LLDrawable::getCurrentFrame() <= 1) + { + return; + } + + //do a quick 'n dirty depth sort + for (std::vector::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace* facep = *iter; + facep->mDistance = -facep->mCenterLocal.mV[2]; + } + + std::sort(mDrawFace.begin(), mDrawFace.end(), LLFace::CompareDistanceGreater()); + + // See if we are rendering water as opaque or not + if (!gSavedSettings.getBOOL("RenderTransparentWater")) + { + // render water for low end hardware + renderOpaqueLegacyWater(); + return; + } + + LLGLEnable blend(GL_BLEND); + + if ((mVertexShaderLevel > 0) && !sSkipScreenCopy) + { + shade(); + return; + } + + LLVOSky *voskyp = gSky.mVOSkyp; + + stop_glerror(); + + if (!gGLManager.mHasMultitexture) + { + // Ack! No multitexture! Bail! + return; + } + + LLFace* refl_face = voskyp->getReflFace(); + + gPipeline.disableLights(); + + LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); + + LLGLDisable cullFace(GL_CULL_FACE); + + // Set up second pass first + mWaterImagep->addTextureStats(1024.f*1024.f); + gGL.getTexUnit(1)->activate(); + gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->bind(mWaterImagep) ; + + LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); + F32 up_dot = camera_up * LLVector3::z_axis; + + LLColor4 water_color; + if (LLViewerCamera::getInstance()->cameraUnderWater()) + { + water_color.setVec(1.f, 1.f, 1.f, 0.4f); + } + else + { + water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot)); + } + + gGL.diffuseColor4fv(water_color.mV); + + // Automatically generate texture coords for detail map + glEnable(GL_TEXTURE_GEN_S); //texture unit 1 + glEnable(GL_TEXTURE_GEN_T); //texture unit 1 + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + + // Slowly move over time. + F32 offset = fmod(gFrameTimeSeconds*2.f, 100.f); + F32 tp0[4] = {16.f/256.f, 0.0f, 0.0f, offset*0.01f}; + F32 tp1[4] = {0.0f, 16.f/256.f, 0.0f, offset*0.01f}; + glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); + glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); + + gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR); + gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA); + + gGL.getTexUnit(0)->activate(); + + glClearStencil(1); + glClear(GL_STENCIL_BUFFER_BIT); + LLGLEnable gls_stencil(GL_STENCIL_TEST); + glStencilOp(GL_KEEP, GL_REPLACE, GL_KEEP); + glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFF); + + for (std::vector::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace *face = *iter; + if (voskyp->isReflFace(face)) + { + continue; + } + gGL.getTexUnit(0)->bind(face->getTexture()); + face->renderIndexed(); + } + + // Now, disable texture coord generation on texture state 1 + gGL.getTexUnit(1)->activate(); + gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->disable(); + glDisable(GL_TEXTURE_GEN_S); //texture unit 1 + glDisable(GL_TEXTURE_GEN_T); //texture unit 1 + + // Disable texture coordinate and color arrays + gGL.getTexUnit(0)->activate(); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + stop_glerror(); + + if (gSky.mVOSkyp->getCubeMap()) + { + gSky.mVOSkyp->getCubeMap()->enable(0); + gSky.mVOSkyp->getCubeMap()->bind(); + + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + LLMatrix4 camera_mat = LLViewerCamera::getInstance()->getModelview(); + LLMatrix4 camera_rot(camera_mat.getMat3()); + camera_rot.invert(); + + gGL.loadMatrix((F32 *)camera_rot.mMatrix); + + gGL.matrixMode(LLRender::MM_MODELVIEW); + LLOverrideFaceColor overrid(this, 1.f, 1.f, 1.f, 0.5f*up_dot); + + gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); + + for (std::vector::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace *face = *iter; + if (voskyp->isReflFace(face)) + { + //refl_face = face; + continue; + } + + if (face->getGeomCount() > 0) + { + face->renderIndexed(); + } + } + + gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); + + gSky.mVOSkyp->getCubeMap()->disable(); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + + } + + glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); if (refl_face) - { - glStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFF); - renderReflection(refl_face); - } + { + glStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFF); + renderReflection(refl_face); + } - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); + gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } // for low end hardware void LLDrawPoolWater::renderOpaqueLegacyWater() { - LLVOSky *voskyp = gSky.mVOSkyp; - - LLGLSLShader* shader = NULL; - if (LLGLSLShader::sNoFixedFunction) - { - if (LLPipeline::sUnderWaterRender) - { - shader = &gObjectSimpleNonIndexedTexGenWaterProgram; - } - else - { - shader = &gObjectSimpleNonIndexedTexGenProgram; - } - - shader->bind(); - } - - stop_glerror(); - - // Depth sorting and write to depth buffer - // since this is opaque, we should see nothing - // behind the water. No blending because - // of no transparency. And no face culling so - // that the underside of the water is also opaque. - LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE); - LLGLDisable no_cull(GL_CULL_FACE); - LLGLDisable no_blend(GL_BLEND); - - gPipeline.disableLights(); - - mOpaqueWaterImagep->addTextureStats(1024.f*1024.f); - - // Activate the texture binding and bind one - // texture since all images will have the same texture - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->bind(mOpaqueWaterImagep); - - // Automatically generate texture coords for water texture - if (!shader) - { - glEnable(GL_TEXTURE_GEN_S); //texture unit 0 - glEnable(GL_TEXTURE_GEN_T); //texture unit 0 - glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGenf(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - } - - // Use the fact that we know all water faces are the same size - // to save some computation - - // Slowly move texture coordinates over time so the watter appears - // to be moving. - F32 movement_period_secs = 50.f; - - F32 offset = fmod(gFrameTimeSeconds, movement_period_secs); - - if (movement_period_secs != 0) - { - offset /= movement_period_secs; - } - else - { - offset = 0; - } - - F32 tp0[4] = { 16.f / 256.f, 0.0f, 0.0f, offset }; - F32 tp1[4] = { 0.0f, 16.f / 256.f, 0.0f, offset }; - - if (!shader) - { - glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); - glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); - } - else - { - shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0); - shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1); - } - - gGL.diffuseColor3f(1.f, 1.f, 1.f); - - for (std::vector::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace *face = *iter; - if (voskyp->isReflFace(face)) - { - continue; - } - - face->renderIndexed(); - } - - stop_glerror(); - - if (!shader) - { - // Reset the settings back to expected values - glDisable(GL_TEXTURE_GEN_S); //texture unit 0 - glDisable(GL_TEXTURE_GEN_T); //texture unit 0 - } - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); + LLVOSky *voskyp = gSky.mVOSkyp; + + LLGLSLShader* shader = NULL; + if (LLGLSLShader::sNoFixedFunction) + { + if (LLPipeline::sUnderWaterRender) + { + shader = &gObjectSimpleNonIndexedTexGenWaterProgram; + } + else + { + shader = &gObjectSimpleNonIndexedTexGenProgram; + } + + shader->bind(); + } + + stop_glerror(); + + // Depth sorting and write to depth buffer + // since this is opaque, we should see nothing + // behind the water. No blending because + // of no transparency. And no face culling so + // that the underside of the water is also opaque. + LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE); + LLGLDisable no_cull(GL_CULL_FACE); + LLGLDisable no_blend(GL_BLEND); + + gPipeline.disableLights(); + + mOpaqueWaterImagep->addTextureStats(1024.f*1024.f); + + // Activate the texture binding and bind one + // texture since all images will have the same texture + gGL.getTexUnit(0)->activate(); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->bind(mOpaqueWaterImagep); + + // Automatically generate texture coords for water texture + if (!shader) + { + glEnable(GL_TEXTURE_GEN_S); //texture unit 0 + glEnable(GL_TEXTURE_GEN_T); //texture unit 0 + glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glTexGenf(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + } + + // Use the fact that we know all water faces are the same size + // to save some computation + + // Slowly move texture coordinates over time so the watter appears + // to be moving. + F32 movement_period_secs = 50.f; + + F32 offset = fmod(gFrameTimeSeconds, movement_period_secs); + + if (movement_period_secs != 0) + { + offset /= movement_period_secs; + } + else + { + offset = 0; + } + + F32 tp0[4] = { 16.f / 256.f, 0.0f, 0.0f, offset }; + F32 tp1[4] = { 0.0f, 16.f / 256.f, 0.0f, offset }; + + if (!shader) + { + glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); + glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); + } + else + { + shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0); + shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1); + } + + gGL.diffuseColor3f(1.f, 1.f, 1.f); + + for (std::vector::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace *face = *iter; + if (voskyp->isReflFace(face)) + { + continue; + } + + face->renderIndexed(); + } + + stop_glerror(); + + if (!shader) + { + // Reset the settings back to expected values + glDisable(GL_TEXTURE_GEN_S); //texture unit 0 + glDisable(GL_TEXTURE_GEN_T); //texture unit 0 + } + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } void LLDrawPoolWater::renderReflection(LLFace* face) { - LLVOSky *voskyp = gSky.mVOSkyp; - - if (!voskyp) - { - return; - } - - if (!face->getGeomCount()) - { - return; - } - - S8 dr = voskyp->getDrawRefl(); - if (dr < 0) - { - return; - } - - LLGLSNoFog noFog; - - gGL.getTexUnit(0)->bind(mHBTex[dr]); - - LLOverrideFaceColor override(this, LLColor4(face->getFaceColor().mV)); - face->renderIndexed(); + LLVOSky *voskyp = gSky.mVOSkyp; + + if (!voskyp) + { + return; + } + + if (!face->getGeomCount()) + { + return; + } + + S8 dr = voskyp->getDrawRefl(); + if (dr < 0) + { + return; + } + + LLGLSNoFog noFog; + + gGL.getTexUnit(0)->bind(mHBTex[dr]); + + LLOverrideFaceColor override(this, LLColor4(face->getFaceColor().mV)); + face->renderIndexed(); } void LLDrawPoolWater::shade() { - if (!deferred_render) - { - gGL.setColorMask(true, true); - } - - LLVOSky *voskyp = gSky.mVOSkyp; - - if(voskyp == NULL) - { - return; - } - - LLGLDisable blend(GL_BLEND); - - LLColor3 light_diffuse(0,0,0); - F32 light_exp = 0.0f; - LLVector3 light_dir; - LLColor3 light_color; - - if (gSky.getSunDirection().mV[2] > LLSky::NIGHTTIME_ELEVATION_COS) - { - light_dir = gSky.getSunDirection(); - light_dir.normVec(); - light_color = gSky.getSunDiffuseColor(); - if(gSky.mVOSkyp) { - light_diffuse = gSky.mVOSkyp->getSun().getColorCached(); - light_diffuse.normVec(); - } - light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0); - light_diffuse *= light_exp + 0.25f; - } - else - { - light_dir = gSky.getMoonDirection(); - light_dir.normVec(); - light_color = gSky.getMoonDiffuseColor(); - light_diffuse = gSky.mVOSkyp->getMoon().getColorCached(); - light_diffuse.normVec(); - light_diffuse *= 0.5f; - light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0); - } - - light_exp *= light_exp; - light_exp *= light_exp; - light_exp *= light_exp; - light_exp *= light_exp; - light_exp *= 256.f; - light_exp = light_exp > 32.f ? light_exp : 32.f; - - LLGLSLShader* shader; - - F32 eyedepth = LLViewerCamera::getInstance()->getOrigin().mV[2] - gAgent.getRegion()->getWaterHeight(); - - if (eyedepth < 0.f && LLPipeline::sWaterReflections) - { - if (deferred_render) - { - shader = &gDeferredUnderWaterProgram; - } - else - { - shader = &gUnderWaterProgram; - } - } - else if (deferred_render) - { - shader = &gDeferredWaterProgram; - } - else - { - shader = &gWaterProgram; - } - - if (deferred_render) - { - gPipeline.bindDeferredShader(*shader); - } - else - { - shader->bind(); - } - - sTime = (F32)LLFrameTimer::getElapsedSeconds()*0.5f; - - S32 reftex = shader->enableTexture(LLShaderMgr::WATER_REFTEX); - - if (reftex > -1) - { - gGL.getTexUnit(reftex)->activate(); - gGL.getTexUnit(reftex)->bind(&gPipeline.mWaterRef); - gGL.getTexUnit(0)->activate(); - } - - //bind normal map - S32 bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP); - - LLWaterParamManager * param_mgr = &LLWaterParamManager::instance(); - - // change mWaterNormp if needed - if (mWaterNormp->getID() != param_mgr->getNormalMapID()) - { - mWaterNormp = LLViewerTextureManager::getFetchedTexture(param_mgr->getNormalMapID()); - } - - mWaterNormp->addTextureStats(1024.f*1024.f); - gGL.getTexUnit(bumpTex)->bind(mWaterNormp) ; - if (gSavedSettings.getBOOL("RenderWaterMipNormal")) - { - mWaterNormp->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC); - } - else - { - mWaterNormp->setFilteringOption(LLTexUnit::TFO_POINT); - } - - S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX); - - if (screentex > -1) - { - shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV); - shader->uniform1f(LLShaderMgr::WATER_FOGDENSITY, - param_mgr->getFogDensity()); - gPipeline.mWaterDis.bindTexture(0, screentex); - } - - stop_glerror(); - - gGL.getTexUnit(screentex)->bind(&gPipeline.mWaterDis); - - if (mVertexShaderLevel == 1) - { - sWaterFogColor.mV[3] = param_mgr->mDensitySliderValue; - shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV); - } - - F32 screenRes[] = - { - 1.f/gGLViewport[2], - 1.f/gGLViewport[3] - }; - shader->uniform2fv(LLShaderMgr::DEFERRED_SCREEN_RES, 1, screenRes); - stop_glerror(); - - S32 diffTex = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP); - stop_glerror(); - - light_dir.normVec(); - sLightDir = light_dir; - - light_diffuse *= 6.f; - - //shader->uniformMatrix4fv("inverse_ref", 1, GL_FALSE, (GLfloat*) gGLObliqueProjectionInverse.mMatrix); - shader->uniform1f(LLShaderMgr::WATER_WATERHEIGHT, eyedepth); - shader->uniform1f(LLShaderMgr::WATER_TIME, sTime); - shader->uniform3fv(LLShaderMgr::WATER_EYEVEC, 1, LLViewerCamera::getInstance()->getOrigin().mV); - shader->uniform3fv(LLShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV); - shader->uniform1f(LLShaderMgr::WATER_SPECULAR_EXP, light_exp); - shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, param_mgr->getWave1Dir().mV); - shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR2, 1, param_mgr->getWave2Dir().mV); - shader->uniform3fv(LLShaderMgr::WATER_LIGHT_DIR, 1, light_dir.mV); - - shader->uniform3fv(LLShaderMgr::WATER_NORM_SCALE, 1, param_mgr->getNormalScale().mV); - shader->uniform1f(LLShaderMgr::WATER_FRESNEL_SCALE, param_mgr->getFresnelScale()); - shader->uniform1f(LLShaderMgr::WATER_FRESNEL_OFFSET, param_mgr->getFresnelOffset()); - shader->uniform1f(LLShaderMgr::WATER_BLUR_MULTIPLIER, param_mgr->getBlurMultiplier()); - - F32 sunAngle = llmax(0.f, light_dir.mV[2]); - F32 scaledAngle = 1.f - sunAngle; - - shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE, sunAngle); - shader->uniform1f(LLShaderMgr::WATER_SCALED_ANGLE, scaledAngle); - shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE2, 0.1f + 0.2f*sunAngle); - - LLColor4 water_color; - LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); - F32 up_dot = camera_up * LLVector3::z_axis; - if (LLViewerCamera::getInstance()->cameraUnderWater()) - { - water_color.setVec(1.f, 1.f, 1.f, 0.4f); - shader->uniform1f(LLShaderMgr::WATER_REFSCALE, param_mgr->getScaleBelow()); - } - else - { - water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot)); - shader->uniform1f(LLShaderMgr::WATER_REFSCALE, param_mgr->getScaleAbove()); - } - - if (water_color.mV[3] > 0.9f) - { - water_color.mV[3] = 0.9f; - } - - { - LLGLEnable depth_clamp(gGLManager.mHasDepthClamp ? GL_DEPTH_CLAMP : 0); - LLGLDisable cullface(GL_CULL_FACE); - for (std::vector::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace *face = *iter; - - if (voskyp->isReflFace(face)) - { - continue; - } - - LLVOWater* water = (LLVOWater*) face->getViewerObject(); - gGL.getTexUnit(diffTex)->bind(face->getTexture()); - - sNeedsReflectionUpdate = TRUE; - - if (water->getUseTexture() || !water->getIsEdgePatch()) - { - sNeedsDistortionUpdate = TRUE; - face->renderIndexed(); - } - else if (gGLManager.mHasDepthClamp || deferred_render) - { - face->renderIndexed(); - } - else - { - LLGLSquashToFarClip far_clip(glh_get_current_projection()); - face->renderIndexed(); - } - } - } - - shader->disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); - shader->disableTexture(LLShaderMgr::WATER_SCREENTEX); - shader->disableTexture(LLShaderMgr::BUMP_MAP); - shader->disableTexture(LLShaderMgr::DIFFUSE_MAP); - shader->disableTexture(LLShaderMgr::WATER_REFTEX); - shader->disableTexture(LLShaderMgr::WATER_SCREENDEPTH); - - if (deferred_render) - { - gPipeline.unbindDeferredShader(*shader); - } - else - { - shader->unbind(); - } - - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); - if (!deferred_render) - { - gGL.setColorMask(true, false); - } + if (!deferred_render) + { + gGL.setColorMask(true, true); + } + + LLVOSky *voskyp = gSky.mVOSkyp; + + if(voskyp == NULL) + { + return; + } + + LLGLDisable blend(GL_BLEND); + + LLColor3 light_diffuse(0,0,0); + F32 light_exp = 0.0f; + LLVector3 light_dir; + LLColor3 light_color; + + if (gSky.getSunDirection().mV[2] > LLSky::NIGHTTIME_ELEVATION_COS) + { + light_dir = gSky.getSunDirection(); + light_dir.normVec(); + light_color = gSky.getSunDiffuseColor(); + if(gSky.mVOSkyp) { + light_diffuse = gSky.mVOSkyp->getSun().getColorCached(); + light_diffuse.normVec(); + } + light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0); + light_diffuse *= light_exp + 0.25f; + } + else + { + light_dir = gSky.getMoonDirection(); + light_dir.normVec(); + light_color = gSky.getMoonDiffuseColor(); + light_diffuse = gSky.mVOSkyp->getMoon().getColorCached(); + light_diffuse.normVec(); + light_diffuse *= 0.5f; + light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0); + } + + light_exp *= light_exp; + light_exp *= light_exp; + light_exp *= light_exp; + light_exp *= light_exp; + light_exp *= 256.f; + light_exp = light_exp > 32.f ? light_exp : 32.f; + + LLGLSLShader* shader; + + F32 eyedepth = LLViewerCamera::getInstance()->getOrigin().mV[2] - gAgent.getRegion()->getWaterHeight(); + + if (eyedepth < 0.f && LLPipeline::sWaterReflections) + { + if (deferred_render) + { + shader = &gDeferredUnderWaterProgram; + } + else + { + shader = &gUnderWaterProgram; + } + } + else if (deferred_render) + { + shader = &gDeferredWaterProgram; + } + else + { + shader = &gWaterProgram; + } + + if (deferred_render) + { + gPipeline.bindDeferredShader(*shader); + } + else + { + shader->bind(); + } + + sTime = (F32)LLFrameTimer::getElapsedSeconds()*0.5f; + + S32 reftex = shader->enableTexture(LLShaderMgr::WATER_REFTEX); + + if (reftex > -1) + { + gGL.getTexUnit(reftex)->activate(); + gGL.getTexUnit(reftex)->bind(&gPipeline.mWaterRef); + gGL.getTexUnit(0)->activate(); + } + + //bind normal map + S32 bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP); + + LLWaterParamManager * param_mgr = &LLWaterParamManager::instance(); + + // change mWaterNormp if needed + if (mWaterNormp->getID() != param_mgr->getNormalMapID()) + { + mWaterNormp = LLViewerTextureManager::getFetchedTexture(param_mgr->getNormalMapID()); + } + + mWaterNormp->addTextureStats(1024.f*1024.f); + gGL.getTexUnit(bumpTex)->bind(mWaterNormp) ; + if (gSavedSettings.getBOOL("RenderWaterMipNormal")) + { + mWaterNormp->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC); + } + else + { + mWaterNormp->setFilteringOption(LLTexUnit::TFO_POINT); + } + + S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX); + + if (screentex > -1) + { + shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV); + shader->uniform1f(LLShaderMgr::WATER_FOGDENSITY, + param_mgr->getFogDensity()); + gPipeline.mWaterDis.bindTexture(0, screentex); + } + + stop_glerror(); + + gGL.getTexUnit(screentex)->bind(&gPipeline.mWaterDis); + + if (mVertexShaderLevel == 1) + { + sWaterFogColor.mV[3] = param_mgr->mDensitySliderValue; + shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV); + } + + F32 screenRes[] = + { + 1.f/gGLViewport[2], + 1.f/gGLViewport[3] + }; + shader->uniform2fv(LLShaderMgr::DEFERRED_SCREEN_RES, 1, screenRes); + stop_glerror(); + + S32 diffTex = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP); + stop_glerror(); + + light_dir.normVec(); + sLightDir = light_dir; + + light_diffuse *= 6.f; + + //shader->uniformMatrix4fv("inverse_ref", 1, GL_FALSE, (GLfloat*) gGLObliqueProjectionInverse.mMatrix); + shader->uniform1f(LLShaderMgr::WATER_WATERHEIGHT, eyedepth); + shader->uniform1f(LLShaderMgr::WATER_TIME, sTime); + shader->uniform3fv(LLShaderMgr::WATER_EYEVEC, 1, LLViewerCamera::getInstance()->getOrigin().mV); + shader->uniform3fv(LLShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV); + shader->uniform1f(LLShaderMgr::WATER_SPECULAR_EXP, light_exp); + shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, param_mgr->getWave1Dir().mV); + shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR2, 1, param_mgr->getWave2Dir().mV); + shader->uniform3fv(LLShaderMgr::WATER_LIGHT_DIR, 1, light_dir.mV); + + shader->uniform3fv(LLShaderMgr::WATER_NORM_SCALE, 1, param_mgr->getNormalScale().mV); + shader->uniform1f(LLShaderMgr::WATER_FRESNEL_SCALE, param_mgr->getFresnelScale()); + shader->uniform1f(LLShaderMgr::WATER_FRESNEL_OFFSET, param_mgr->getFresnelOffset()); + shader->uniform1f(LLShaderMgr::WATER_BLUR_MULTIPLIER, param_mgr->getBlurMultiplier()); + + F32 sunAngle = llmax(0.f, light_dir.mV[2]); + F32 scaledAngle = 1.f - sunAngle; + + shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE, sunAngle); + shader->uniform1f(LLShaderMgr::WATER_SCALED_ANGLE, scaledAngle); + shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE2, 0.1f + 0.2f*sunAngle); + + LLColor4 water_color; + LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); + F32 up_dot = camera_up * LLVector3::z_axis; + if (LLViewerCamera::getInstance()->cameraUnderWater()) + { + water_color.setVec(1.f, 1.f, 1.f, 0.4f); + shader->uniform1f(LLShaderMgr::WATER_REFSCALE, param_mgr->getScaleBelow()); + } + else + { + water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot)); + shader->uniform1f(LLShaderMgr::WATER_REFSCALE, param_mgr->getScaleAbove()); + } + + if (water_color.mV[3] > 0.9f) + { + water_color.mV[3] = 0.9f; + } + + { + LLGLEnable depth_clamp(gGLManager.mHasDepthClamp ? GL_DEPTH_CLAMP : 0); + LLGLDisable cullface(GL_CULL_FACE); + for (std::vector::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace *face = *iter; + + if (voskyp->isReflFace(face)) + { + continue; + } + + LLVOWater* water = (LLVOWater*) face->getViewerObject(); + gGL.getTexUnit(diffTex)->bind(face->getTexture()); + + sNeedsReflectionUpdate = TRUE; + + if (water->getUseTexture() || !water->getIsEdgePatch()) + { + sNeedsDistortionUpdate = TRUE; + face->renderIndexed(); + } + else if (gGLManager.mHasDepthClamp || deferred_render) + { + face->renderIndexed(); + } + else + { + LLGLSquashToFarClip far_clip(glh_get_current_projection()); + face->renderIndexed(); + } + } + } + + shader->disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); + shader->disableTexture(LLShaderMgr::WATER_SCREENTEX); + shader->disableTexture(LLShaderMgr::BUMP_MAP); + shader->disableTexture(LLShaderMgr::DIFFUSE_MAP); + shader->disableTexture(LLShaderMgr::WATER_REFTEX); + shader->disableTexture(LLShaderMgr::WATER_SCREENDEPTH); + + if (deferred_render) + { + gPipeline.unbindDeferredShader(*shader); + } + else + { + shader->unbind(); + } + + gGL.getTexUnit(0)->activate(); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + if (!deferred_render) + { + gGL.setColorMask(true, false); + } } LLViewerTexture *LLDrawPoolWater::getDebugTexture() { - return LLViewerFetchedTexture::sSmokeImagep; + return LLViewerFetchedTexture::sSmokeImagep; } LLColor3 LLDrawPoolWater::getDebugColor() const { - return LLColor3(0.f, 1.f, 1.f); + return LLColor3(0.f, 1.f, 1.f); } diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index c12ccb386e..2582715dd9 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -46,7 +46,7 @@ static LLDefaultChildRegistry::Register r("panel_camera_item"); -const F32 NUDGE_TIME = 0.25f; // in seconds +const F32 NUDGE_TIME = 0.25f; // in seconds const F32 ORBIT_NUDGE_RATE = 0.05f; // fraction of normal speed // constants @@ -61,94 +61,94 @@ bool LLFloaterCamera::sAppearanceEditing = false; // Zoom the camera in and out class LLPanelCameraZoom -: public LLPanel +: public LLPanel { - LOG_CLASS(LLPanelCameraZoom); + LOG_CLASS(LLPanelCameraZoom); public: - LLPanelCameraZoom(); + LLPanelCameraZoom(); - /* virtual */ BOOL postBuild(); - /* virtual */ void draw(); + /* virtual */ BOOL postBuild(); + /* virtual */ void draw(); protected: - void onZoomPlusHeldDown(); - void onZoomMinusHeldDown(); - void onSliderValueChanged(); - void onCameraTrack(); - void onCameraRotate(); - F32 getOrbitRate(F32 time); + void onZoomPlusHeldDown(); + void onZoomMinusHeldDown(); + void onSliderValueChanged(); + void onCameraTrack(); + void onCameraRotate(); + F32 getOrbitRate(F32 time); private: - LLButton* mPlusBtn; - LLButton* mMinusBtn; - LLSlider* mSlider; + LLButton* mPlusBtn; + LLButton* mMinusBtn; + LLSlider* mSlider; }; LLPanelCameraItem::Params::Params() -: icon_over("icon_over"), - icon_selected("icon_selected"), - picture("picture"), - text("text"), - selected_picture("selected_picture"), - mousedown_callback("mousedown_callback") +: icon_over("icon_over"), + icon_selected("icon_selected"), + picture("picture"), + text("text"), + selected_picture("selected_picture"), + mousedown_callback("mousedown_callback") { } LLPanelCameraItem::LLPanelCameraItem(const LLPanelCameraItem::Params& p) -: LLPanel(p) +: LLPanel(p) { - LLIconCtrl::Params icon_params = p.picture; - mPicture = LLUICtrlFactory::create(icon_params); - addChild(mPicture); + LLIconCtrl::Params icon_params = p.picture; + mPicture = LLUICtrlFactory::create(icon_params); + addChild(mPicture); - icon_params = p.icon_over; - mIconOver = LLUICtrlFactory::create(icon_params); - addChild(mIconOver); + icon_params = p.icon_over; + mIconOver = LLUICtrlFactory::create(icon_params); + addChild(mIconOver); - icon_params = p.icon_selected; - mIconSelected = LLUICtrlFactory::create(icon_params); - addChild(mIconSelected); + icon_params = p.icon_selected; + mIconSelected = LLUICtrlFactory::create(icon_params); + addChild(mIconSelected); - icon_params = p.selected_picture; - mPictureSelected = LLUICtrlFactory::create(icon_params); - addChild(mPictureSelected); + icon_params = p.selected_picture; + mPictureSelected = LLUICtrlFactory::create(icon_params); + addChild(mPictureSelected); - LLTextBox::Params text_params = p.text; - mText = LLUICtrlFactory::create(text_params); - addChild(mText); + LLTextBox::Params text_params = p.text; + mText = LLUICtrlFactory::create(text_params); + addChild(mText); - if (p.mousedown_callback.isProvided()) - { - setCommitCallback(initCommitCallback(p.mousedown_callback)); - } + if (p.mousedown_callback.isProvided()) + { + setCommitCallback(initCommitCallback(p.mousedown_callback)); + } } void set_view_visible(LLView* parent, const std::string& name, bool visible) { - parent->getChildView(name)->setVisible(visible); + parent->getChildView(name)->setVisible(visible); } BOOL LLPanelCameraItem::postBuild() { - setMouseEnterCallback(boost::bind(set_view_visible, this, "hovered_icon", true)); - setMouseLeaveCallback(boost::bind(set_view_visible, this, "hovered_icon", false)); - setMouseDownCallback(boost::bind(&LLPanelCameraItem::onAnyMouseClick, this)); - setRightMouseDownCallback(boost::bind(&LLPanelCameraItem::onAnyMouseClick, this)); - return TRUE; + setMouseEnterCallback(boost::bind(set_view_visible, this, "hovered_icon", true)); + setMouseLeaveCallback(boost::bind(set_view_visible, this, "hovered_icon", false)); + setMouseDownCallback(boost::bind(&LLPanelCameraItem::onAnyMouseClick, this)); + setRightMouseDownCallback(boost::bind(&LLPanelCameraItem::onAnyMouseClick, this)); + return TRUE; } void LLPanelCameraItem::onAnyMouseClick() { - if (mCommitSignal) (*mCommitSignal)(this, LLSD()); + if (mCommitSignal) (*mCommitSignal)(this, LLSD()); } void LLPanelCameraItem::setValue(const LLSD& value) { - if (!value.isMap()) return;; - if (!value.has("selected")) return; - getChildView("selected_icon")->setVisible( value["selected"]); - getChildView("picture")->setVisible( !value["selected"]); - getChildView("selected_picture")->setVisible( value["selected"]); + if (!value.isMap()) return;; + if (!value.has("selected")) return; + getChildView("selected_icon")->setVisible( value["selected"]); + getChildView("picture")->setVisible( !value["selected"]); + getChildView("selected_picture")->setVisible( value["selected"]); } static LLPanelInjector t_camera_zoom_panel("camera_zoom_panel"); @@ -158,85 +158,85 @@ static LLPanelInjector t_camera_zoom_panel("camera_zoom_panel //------------------------------------------------------------------------------- LLPanelCameraZoom::LLPanelCameraZoom() -: mPlusBtn( NULL ), - mMinusBtn( NULL ), - mSlider( NULL ) +: mPlusBtn( NULL ), + mMinusBtn( NULL ), + mSlider( NULL ) { - mCommitCallbackRegistrar.add("Zoom.minus", boost::bind(&LLPanelCameraZoom::onZoomMinusHeldDown, this)); - mCommitCallbackRegistrar.add("Zoom.plus", boost::bind(&LLPanelCameraZoom::onZoomPlusHeldDown, this)); - mCommitCallbackRegistrar.add("Slider.value_changed", boost::bind(&LLPanelCameraZoom::onSliderValueChanged, this)); - mCommitCallbackRegistrar.add("Camera.track", boost::bind(&LLPanelCameraZoom::onCameraTrack, this)); - mCommitCallbackRegistrar.add("Camera.rotate", boost::bind(&LLPanelCameraZoom::onCameraRotate, this)); + mCommitCallbackRegistrar.add("Zoom.minus", boost::bind(&LLPanelCameraZoom::onZoomMinusHeldDown, this)); + mCommitCallbackRegistrar.add("Zoom.plus", boost::bind(&LLPanelCameraZoom::onZoomPlusHeldDown, this)); + mCommitCallbackRegistrar.add("Slider.value_changed", boost::bind(&LLPanelCameraZoom::onSliderValueChanged, this)); + mCommitCallbackRegistrar.add("Camera.track", boost::bind(&LLPanelCameraZoom::onCameraTrack, this)); + mCommitCallbackRegistrar.add("Camera.rotate", boost::bind(&LLPanelCameraZoom::onCameraRotate, this)); } BOOL LLPanelCameraZoom::postBuild() { - mPlusBtn = getChild ("zoom_plus_btn"); - mMinusBtn = getChild ("zoom_minus_btn"); - mSlider = getChild ("zoom_slider"); - return LLPanel::postBuild(); + mPlusBtn = getChild ("zoom_plus_btn"); + mMinusBtn = getChild ("zoom_minus_btn"); + mSlider = getChild ("zoom_slider"); + return LLPanel::postBuild(); } void LLPanelCameraZoom::draw() { - mSlider->setValue(gAgentCamera.getCameraZoomFraction()); - LLPanel::draw(); + mSlider->setValue(gAgentCamera.getCameraZoomFraction()); + LLPanel::draw(); } void LLPanelCameraZoom::onZoomPlusHeldDown() { - F32 val = mSlider->getValueF32(); - F32 inc = mSlider->getIncrement(); - mSlider->setValue(val - inc); - F32 time = mPlusBtn->getHeldDownTime(); - gAgentCamera.unlockView(); - gAgentCamera.setOrbitInKey(getOrbitRate(time)); + F32 val = mSlider->getValueF32(); + F32 inc = mSlider->getIncrement(); + mSlider->setValue(val - inc); + F32 time = mPlusBtn->getHeldDownTime(); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitInKey(getOrbitRate(time)); } void LLPanelCameraZoom::onZoomMinusHeldDown() { - F32 val = mSlider->getValueF32(); - F32 inc = mSlider->getIncrement(); - mSlider->setValue(val + inc); - F32 time = mMinusBtn->getHeldDownTime(); - gAgentCamera.unlockView(); - gAgentCamera.setOrbitOutKey(getOrbitRate(time)); + F32 val = mSlider->getValueF32(); + F32 inc = mSlider->getIncrement(); + mSlider->setValue(val + inc); + F32 time = mMinusBtn->getHeldDownTime(); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitOutKey(getOrbitRate(time)); } void LLPanelCameraZoom::onCameraTrack() { - // EXP-202 when camera panning activated, remove the hint - LLFirstUse::viewPopup( false ); + // EXP-202 when camera panning activated, remove the hint + LLFirstUse::viewPopup( false ); } void LLPanelCameraZoom::onCameraRotate() { - // EXP-202 when camera rotation activated, remove the hint - LLFirstUse::viewPopup( false ); + // EXP-202 when camera rotation activated, remove the hint + LLFirstUse::viewPopup( false ); } F32 LLPanelCameraZoom::getOrbitRate(F32 time) { - if( time < NUDGE_TIME ) - { - F32 rate = ORBIT_NUDGE_RATE + time * (1 - ORBIT_NUDGE_RATE)/ NUDGE_TIME; - return rate; - } - else - { - return 1; - } + if( time < NUDGE_TIME ) + { + F32 rate = ORBIT_NUDGE_RATE + time * (1 - ORBIT_NUDGE_RATE)/ NUDGE_TIME; + return rate; + } + else + { + return 1; + } } void LLPanelCameraZoom::onSliderValueChanged() { - F32 zoom_level = mSlider->getValueF32(); - gAgentCamera.setCameraZoomFraction(zoom_level); + F32 zoom_level = mSlider->getValueF32(); + gAgentCamera.setCameraZoomFraction(zoom_level); } void activate_camera_tool() { - LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance()); + LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance()); }; // @@ -245,375 +245,375 @@ void activate_camera_tool() /*static*/ bool LLFloaterCamera::inFreeCameraMode() { - LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); - if (floater_camera && floater_camera->mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA && gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) - { - return true; - } - return false; + LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); + if (floater_camera && floater_camera->mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA && gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) + { + return true; + } + return false; } void LLFloaterCamera::resetCameraMode() { - LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); - if (!floater_camera) return; - floater_camera->switchMode(CAMERA_CTRL_MODE_PAN); + LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); + if (!floater_camera) return; + floater_camera->switchMode(CAMERA_CTRL_MODE_PAN); } void LLFloaterCamera::onAvatarEditingAppearance(bool editing) { - sAppearanceEditing = editing; - LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); - if (!floater_camera) return; - floater_camera->handleAvatarEditingAppearance(editing); + sAppearanceEditing = editing; + LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); + if (!floater_camera) return; + floater_camera->handleAvatarEditingAppearance(editing); } void LLFloaterCamera::handleAvatarEditingAppearance(bool editing) { - //camera presets (rear, front, etc.) - getChildView("preset_views_list")->setEnabled(!editing); - getChildView("presets_btn")->setEnabled(!editing); + //camera presets (rear, front, etc.) + getChildView("preset_views_list")->setEnabled(!editing); + getChildView("presets_btn")->setEnabled(!editing); - //camera modes (object view, mouselook view) - getChildView("camera_modes_list")->setEnabled(!editing); - getChildView("avatarview_btn")->setEnabled(!editing); + //camera modes (object view, mouselook view) + getChildView("camera_modes_list")->setEnabled(!editing); + getChildView("avatarview_btn")->setEnabled(!editing); } void LLFloaterCamera::update() { - ECameraControlMode mode = determineMode(); - if (mode != mCurrMode) setMode(mode); + ECameraControlMode mode = determineMode(); + if (mode != mCurrMode) setMode(mode); } void LLFloaterCamera::toPrevMode() { - switchMode(mPrevMode); + switchMode(mPrevMode); } /*static*/ void LLFloaterCamera::onLeavingMouseLook() { - LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); - if (floater_camera) - { - floater_camera->updateItemsSelection(); - if(floater_camera->inFreeCameraMode()) - { - activate_camera_tool(); - } - } + LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); + if (floater_camera) + { + floater_camera->updateItemsSelection(); + if(floater_camera->inFreeCameraMode()) + { + activate_camera_tool(); + } + } } LLFloaterCamera* LLFloaterCamera::findInstance() { - return LLFloaterReg::findTypedInstance("camera"); + return LLFloaterReg::findTypedInstance("camera"); } void LLFloaterCamera::onOpen(const LLSD& key) { - LLFirstUse::viewPopup(); + LLFirstUse::viewPopup(); - mZoom->onOpen(key); + mZoom->onOpen(key); - // Returns to previous mode, see EXT-2727(View tool should remember state). - // In case floater was just hidden and it isn't reset the mode - // just update state to current one. Else go to previous. - if ( !mClosed ) - updateState(); - else - toPrevMode(); - mClosed = FALSE; + // Returns to previous mode, see EXT-2727(View tool should remember state). + // In case floater was just hidden and it isn't reset the mode + // just update state to current one. Else go to previous. + if ( !mClosed ) + updateState(); + else + toPrevMode(); + mClosed = FALSE; } void LLFloaterCamera::onClose(bool app_quitting) { - //We don't care of camera mode if app is quitting - if(app_quitting) - return; - // It is necessary to reset mCurrMode to CAMERA_CTRL_MODE_PAN so - // to avoid seeing an empty floater when reopening the control. - if (mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA) - mCurrMode = CAMERA_CTRL_MODE_PAN; - // When mCurrMode is in CAMERA_CTRL_MODE_PAN - // switchMode won't modify mPrevMode, so force it here. - // It is needed to correctly return to previous mode on open, see EXT-2727. - if (mCurrMode == CAMERA_CTRL_MODE_PAN) - mPrevMode = CAMERA_CTRL_MODE_PAN; + //We don't care of camera mode if app is quitting + if(app_quitting) + return; + // It is necessary to reset mCurrMode to CAMERA_CTRL_MODE_PAN so + // to avoid seeing an empty floater when reopening the control. + if (mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA) + mCurrMode = CAMERA_CTRL_MODE_PAN; + // When mCurrMode is in CAMERA_CTRL_MODE_PAN + // switchMode won't modify mPrevMode, so force it here. + // It is needed to correctly return to previous mode on open, see EXT-2727. + if (mCurrMode == CAMERA_CTRL_MODE_PAN) + mPrevMode = CAMERA_CTRL_MODE_PAN; - switchMode(CAMERA_CTRL_MODE_PAN); - mClosed = TRUE; + switchMode(CAMERA_CTRL_MODE_PAN); + mClosed = TRUE; - gAgent.setMovementLocked(FALSE); + gAgent.setMovementLocked(FALSE); } LLFloaterCamera::LLFloaterCamera(const LLSD& val) -: LLFloater(val), - mClosed(FALSE), - mCurrMode(CAMERA_CTRL_MODE_PAN), - mPrevMode(CAMERA_CTRL_MODE_PAN) +: LLFloater(val), + mClosed(FALSE), + mCurrMode(CAMERA_CTRL_MODE_PAN), + mPrevMode(CAMERA_CTRL_MODE_PAN) { - LLHints::registerHintTarget("view_popup", getHandle()); - mCommitCallbackRegistrar.add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2)); - mCommitCallbackRegistrar.add("Presets.GoViewPrefs", boost::bind(&LLFloaterCamera::onViewButtonClick, this, _2)); + 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 BOOL LLFloaterCamera::postBuild() { - updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730) + updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730) - mRotate = getChild(ORBIT); - mZoom = findChild(ZOOM); - mTrack = getChild(PAN); + mRotate = getChild(ORBIT); + mZoom = findChild(ZOOM); + mTrack = getChild(PAN); - assignButton2Mode(CAMERA_CTRL_MODE_MODES, "avatarview_btn"); - assignButton2Mode(CAMERA_CTRL_MODE_PAN, "pan_btn"); - assignButton2Mode(CAMERA_CTRL_MODE_PRESETS, "presets_btn"); + assignButton2Mode(CAMERA_CTRL_MODE_MODES, "avatarview_btn"); + assignButton2Mode(CAMERA_CTRL_MODE_PAN, "pan_btn"); + assignButton2Mode(CAMERA_CTRL_MODE_PRESETS, "presets_btn"); - update(); + update(); - // ensure that appearance mode is handled while building. See EXT-7796. - handleAvatarEditingAppearance(sAppearanceEditing); + // ensure that appearance mode is handled while building. See EXT-7796. + handleAvatarEditingAppearance(sAppearanceEditing); - return LLFloater::postBuild(); + return LLFloater::postBuild(); } -F32 LLFloaterCamera::getCurrentTransparency() +F32 LLFloaterCamera::getCurrentTransparency() { - static LLCachedControl camera_opacity(gSavedSettings, "CameraOpacity"); - static LLCachedControl active_floater_transparency(gSavedSettings, "ActiveFloaterTransparency"); - return llmin(camera_opacity(), active_floater_transparency()); + 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 - 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("view"); - if (tabcontainer && graphicspanel) - { - tabcontainer->selectTabPanel(graphicspanel); - } - } + // 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("view"); + 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 - // is changed in process - const child_list_t child_list = *panel->getChildList(); - child_list_t::const_reverse_iterator iter = child_list.rbegin(); - child_list_t::const_reverse_iterator end = child_list.rend(); - for ( ; iter != end; ++iter) - { - LLView* view = *iter; - LLPanel* item = dynamic_cast(view); - if (panel) - list->addItem(item); - } + // copying child list and then iterating over a copy, because list itself + // is changed in process + const child_list_t child_list = *panel->getChildList(); + child_list_t::const_reverse_iterator iter = child_list.rbegin(); + child_list_t::const_reverse_iterator end = child_list.rend(); + for ( ; iter != end; ++iter) + { + LLView* view = *iter; + LLPanel* item = dynamic_cast(view); + if (panel) + list->addItem(item); + } } ECameraControlMode LLFloaterCamera::determineMode() { - if (sAppearanceEditing) - { - // this is the only enabled camera mode while editing agent appearance. - return CAMERA_CTRL_MODE_PAN; - } + if (sAppearanceEditing) + { + // this is the only enabled camera mode while editing agent appearance. + return CAMERA_CTRL_MODE_PAN; + } - LLTool* curr_tool = LLToolMgr::getInstance()->getCurrentTool(); - if (curr_tool == LLToolCamera::getInstance()) - { - return CAMERA_CTRL_MODE_FREE_CAMERA; - } + LLTool* curr_tool = LLToolMgr::getInstance()->getCurrentTool(); + if (curr_tool == LLToolCamera::getInstance()) + { + return CAMERA_CTRL_MODE_FREE_CAMERA; + } - if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) - { - return CAMERA_CTRL_MODE_PRESETS; - } + if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) + { + return CAMERA_CTRL_MODE_PRESETS; + } - return CAMERA_CTRL_MODE_PAN; + return CAMERA_CTRL_MODE_PAN; } void clear_camera_tool() { - LLToolMgr* tool_mgr = LLToolMgr::getInstance(); - if (tool_mgr->usingTransientTool() && - tool_mgr->getCurrentTool() == LLToolCamera::getInstance()) - { - tool_mgr->clearTransientTool(); - } + LLToolMgr* tool_mgr = LLToolMgr::getInstance(); + if (tool_mgr->usingTransientTool() && + tool_mgr->getCurrentTool() == LLToolCamera::getInstance()) + { + tool_mgr->clearTransientTool(); + } } void LLFloaterCamera::setMode(ECameraControlMode mode) { - if (mode != mCurrMode) - { - mPrevMode = mCurrMode; - mCurrMode = mode; - } - - updateState(); + if (mode != mCurrMode) + { + mPrevMode = mCurrMode; + mCurrMode = mode; + } + + updateState(); } void LLFloaterCamera::switchMode(ECameraControlMode mode) { - setMode(mode); + setMode(mode); - switch (mode) - { - case CAMERA_CTRL_MODE_MODES: - if(sFreeCamera) - { - switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); - } - break; + switch (mode) + { + case CAMERA_CTRL_MODE_MODES: + if(sFreeCamera) + { + switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); + } + break; - case CAMERA_CTRL_MODE_PAN: - sFreeCamera = false; - clear_camera_tool(); - break; + case CAMERA_CTRL_MODE_PAN: + sFreeCamera = false; + clear_camera_tool(); + break; - case CAMERA_CTRL_MODE_FREE_CAMERA: - sFreeCamera = true; - activate_camera_tool(); - break; + case CAMERA_CTRL_MODE_FREE_CAMERA: + sFreeCamera = true; + activate_camera_tool(); + break; - case CAMERA_CTRL_MODE_PRESETS: - if(sFreeCamera) - { - switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); - } - break; + case CAMERA_CTRL_MODE_PRESETS: + if(sFreeCamera) + { + switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); + } + break; - default: - //normally we won't occur here - llassert_always(FALSE); - } + default: + //normally we won't occur here + llassert_always(FALSE); + } } void LLFloaterCamera::onClickBtn(ECameraControlMode mode) { - // check for a click on active button - if (mCurrMode == mode) mMode2Button[mode]->setToggleState(TRUE); - - switchMode(mode); + // check for a click on active button + if (mCurrMode == mode) mMode2Button[mode]->setToggleState(TRUE); + + switchMode(mode); } void LLFloaterCamera::assignButton2Mode(ECameraControlMode mode, const std::string& button_name) { - LLButton* button = getChild(button_name); - - button->setClickedCallback(boost::bind(&LLFloaterCamera::onClickBtn, this, mode)); - mMode2Button[mode] = button; + LLButton* button = getChild(button_name); + + button->setClickedCallback(boost::bind(&LLFloaterCamera::onClickBtn, this, mode)); + mMode2Button[mode] = button; } void LLFloaterCamera::updateState() { - getChildView(ZOOM)->setVisible(CAMERA_CTRL_MODE_PAN == mCurrMode); - - bool show_presets = (CAMERA_CTRL_MODE_PRESETS == mCurrMode) || (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode - && CAMERA_CTRL_MODE_PRESETS == mPrevMode); - getChildView(PRESETS)->setVisible(show_presets); - - bool show_camera_modes = CAMERA_CTRL_MODE_MODES == mCurrMode || (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode - && CAMERA_CTRL_MODE_MODES == mPrevMode); - getChildView("camera_modes_list")->setVisible( show_camera_modes); + getChildView(ZOOM)->setVisible(CAMERA_CTRL_MODE_PAN == mCurrMode); + + bool show_presets = (CAMERA_CTRL_MODE_PRESETS == mCurrMode) || (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode + && CAMERA_CTRL_MODE_PRESETS == mPrevMode); + getChildView(PRESETS)->setVisible(show_presets); + + bool show_camera_modes = CAMERA_CTRL_MODE_MODES == mCurrMode || (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode + && CAMERA_CTRL_MODE_MODES == mPrevMode); + getChildView("camera_modes_list")->setVisible( show_camera_modes); - updateItemsSelection(); + updateItemsSelection(); - if (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode) - { - return; - } + if (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode) + { + return; + } - //updating buttons - std::map::const_iterator iter = mMode2Button.begin(); - for (; iter != mMode2Button.end(); ++iter) - { - iter->second->setToggleState(iter->first == mCurrMode); - } + //updating buttons + std::map::const_iterator iter = mMode2Button.begin(); + for (; iter != mMode2Button.end(); ++iter) + { + iter->second->setToggleState(iter->first == mCurrMode); + } } void LLFloaterCamera::updateItemsSelection() { - ECameraPreset preset = (ECameraPreset) gSavedSettings.getU32("CameraPreset"); - LLSD argument; - argument["selected"] = preset == CAMERA_PRESET_REAR_VIEW; - getChild("rear_view")->setValue(argument); - argument["selected"] = preset == CAMERA_PRESET_GROUP_VIEW; - getChild("group_view")->setValue(argument); - argument["selected"] = preset == CAMERA_PRESET_FRONT_VIEW; - getChild("front_view")->setValue(argument); - argument["selected"] = gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK; - getChild("mouselook_view")->setValue(argument); - argument["selected"] = mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA; - getChild("object_view")->setValue(argument); + ECameraPreset preset = (ECameraPreset) gSavedSettings.getU32("CameraPreset"); + LLSD argument; + argument["selected"] = preset == CAMERA_PRESET_REAR_VIEW; + getChild("rear_view")->setValue(argument); + argument["selected"] = preset == CAMERA_PRESET_GROUP_VIEW; + getChild("group_view")->setValue(argument); + argument["selected"] = preset == CAMERA_PRESET_FRONT_VIEW; + getChild("front_view")->setValue(argument); + argument["selected"] = gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK; + getChild("mouselook_view")->setValue(argument); + argument["selected"] = mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA; + getChild("object_view")->setValue(argument); } void LLFloaterCamera::onClickCameraItem(const LLSD& param) { - std::string name = param.asString(); - - if ("mouselook_view" == name) - { - gAgentCamera.changeCameraToMouselook(); - } - else if ("object_view" == name) - { - LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance(); - if (camera_floater) - camera_floater->switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); - } - else - { - switchToPreset(name); - } - - LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance(); - if (camera_floater) - { - camera_floater->updateItemsSelection(); - camera_floater->fromFreeToPresets(); - } + std::string name = param.asString(); + + if ("mouselook_view" == name) + { + gAgentCamera.changeCameraToMouselook(); + } + else if ("object_view" == name) + { + LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance(); + if (camera_floater) + camera_floater->switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); + } + else + { + switchToPreset(name); + } + + LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance(); + if (camera_floater) + { + camera_floater->updateItemsSelection(); + camera_floater->fromFreeToPresets(); + } } /*static*/ void LLFloaterCamera::switchToPreset(const std::string& name) { - sFreeCamera = false; - clear_camera_tool(); - if ("rear_view" == name) - { - gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); - } - else if ("group_view" == name) - { - gAgentCamera.switchCameraPreset(CAMERA_PRESET_GROUP_VIEW); - } - else if ("front_view" == name) - { - gAgentCamera.switchCameraPreset(CAMERA_PRESET_FRONT_VIEW); - } + sFreeCamera = false; + clear_camera_tool(); + if ("rear_view" == name) + { + gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); + } + else if ("group_view" == name) + { + gAgentCamera.switchCameraPreset(CAMERA_PRESET_GROUP_VIEW); + } + else if ("front_view" == name) + { + gAgentCamera.switchCameraPreset(CAMERA_PRESET_FRONT_VIEW); + } } void LLFloaterCamera::fromFreeToPresets() { - if (!sFreeCamera && mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA && mPrevMode == CAMERA_CTRL_MODE_PRESETS) - { - switchMode(CAMERA_CTRL_MODE_PRESETS); - } + if (!sFreeCamera && mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA && mPrevMode == CAMERA_CTRL_MODE_PRESETS) + { + switchMode(CAMERA_CTRL_MODE_PRESETS); + } } diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index 481e9aec1b..1b24b143bf 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -39,95 +39,95 @@ class LLPanelCameraZoom; enum ECameraControlMode { - CAMERA_CTRL_MODE_MODES, - CAMERA_CTRL_MODE_PAN, - CAMERA_CTRL_MODE_FREE_CAMERA, - CAMERA_CTRL_MODE_PRESETS + CAMERA_CTRL_MODE_MODES, + CAMERA_CTRL_MODE_PAN, + CAMERA_CTRL_MODE_FREE_CAMERA, + CAMERA_CTRL_MODE_PRESETS }; class LLFloaterCamera : public LLFloater { - friend class LLFloaterReg; - + friend class LLFloaterReg; + public: - /* whether in free camera mode */ - static bool inFreeCameraMode(); - /* callback for camera items selection changing */ - static void onClickCameraItem(const LLSD& param); + /* whether in free camera mode */ + static bool inFreeCameraMode(); + /* callback for camera items selection changing */ + static void onClickCameraItem(const LLSD& param); - static void onLeavingMouseLook(); + static void onLeavingMouseLook(); - /** resets current camera mode to orbit mode */ - static void resetCameraMode(); + /** resets current camera mode to orbit mode */ + static void resetCameraMode(); - /** Called when Avatar is entered/exited editing appearance mode */ - static void onAvatarEditingAppearance(bool editing); + /** Called when Avatar is entered/exited editing appearance mode */ + static void onAvatarEditingAppearance(bool editing); - /* determines actual mode and updates ui */ - void update(); + /* determines actual mode and updates ui */ + void update(); - /*switch to one of the camera presets (front, rear, side)*/ - static void switchToPreset(const std::string& name); + /*switch to one of the camera presets (front, rear, side)*/ + static void switchToPreset(const std::string& name); - /* move to CAMERA_CTRL_MODE_PRESETS from CAMERA_CTRL_MODE_FREE_CAMERA if we are on presets panel and - are not in free camera mode*/ - void fromFreeToPresets(); + /* move to CAMERA_CTRL_MODE_PRESETS from CAMERA_CTRL_MODE_FREE_CAMERA if we are on presets panel and + are not in free camera mode*/ + void fromFreeToPresets(); - virtual void onOpen(const LLSD& key); - virtual void onClose(bool app_quitting); + virtual void onOpen(const LLSD& key); + virtual void onClose(bool app_quitting); - LLJoystickCameraRotate* mRotate; - LLPanelCameraZoom* mZoom; - LLJoystickCameraTrack* mTrack; + LLJoystickCameraRotate* mRotate; + LLPanelCameraZoom* mZoom; + LLJoystickCameraTrack* mTrack; private: - LLFloaterCamera(const LLSD& val); - ~LLFloaterCamera() {}; + LLFloaterCamera(const LLSD& val); + ~LLFloaterCamera() {}; - /* return instance if it exists - created by LLFloaterReg */ - static LLFloaterCamera* findInstance(); + /* return instance if it exists - created by LLFloaterReg */ + static LLFloaterCamera* findInstance(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ BOOL postBuild(); - F32 getCurrentTransparency(); + F32 getCurrentTransparency(); - void onViewButtonClick(const LLSD& user_data); + void onViewButtonClick(const LLSD& user_data); - ECameraControlMode determineMode(); + ECameraControlMode determineMode(); - /* resets to the previous mode */ - void toPrevMode(); + /* resets to the previous mode */ + void toPrevMode(); - /* sets a new mode and performs related actions */ - void switchMode(ECameraControlMode mode); + /* sets a new mode and performs related actions */ + void switchMode(ECameraControlMode mode); - /* sets a new mode preserving previous one and updates ui*/ - void setMode(ECameraControlMode mode); + /* sets a new mode preserving previous one and updates ui*/ + void setMode(ECameraControlMode mode); - /* updates the state (UI) according to the current mode */ - void updateState(); + /* updates the state (UI) according to the current mode */ + void updateState(); - /* update camera modes items selection and camera preset items selection according to the currently selected preset */ - void updateItemsSelection(); + /* update camera modes items selection and camera preset items selection according to the currently selected preset */ + void updateItemsSelection(); - void onClickBtn(ECameraControlMode mode); - void assignButton2Mode(ECameraControlMode mode, const std::string& button_name); - - // fills flatlist with items from given panel - void fillFlatlistFromPanel (LLFlatListView* list, LLPanel* panel); + void onClickBtn(ECameraControlMode mode); + void assignButton2Mode(ECameraControlMode mode, const std::string& button_name); + + // fills flatlist with items from given panel + void fillFlatlistFromPanel (LLFlatListView* list, LLPanel* panel); - void handleAvatarEditingAppearance(bool editing); + void handleAvatarEditingAppearance(bool editing); - // set to true when free camera mode is selected in modes list - // remains true until preset camera mode is chosen, or pan button is clicked, or escape pressed - static bool sFreeCamera; - static bool sAppearanceEditing; - BOOL mClosed; - ECameraControlMode mPrevMode; - ECameraControlMode mCurrMode; - std::map mMode2Button; + // set to true when free camera mode is selected in modes list + // remains true until preset camera mode is chosen, or pan button is clicked, or escape pressed + static bool sFreeCamera; + static bool sAppearanceEditing; + BOOL mClosed; + ECameraControlMode mPrevMode; + ECameraControlMode mCurrMode; + std::map mMode2Button; }; /** @@ -138,33 +138,33 @@ private: * it's items are used inside of flatlist. */ class LLPanelCameraItem - : public LLPanel + : public LLPanel { public: - struct Params : public LLInitParam::Block - { - Optional icon_over; - Optional icon_selected; - Optional picture; - Optional selected_picture; - - Optional text; - Optional mousedown_callback; - Params(); - }; - /*virtual*/ BOOL postBuild(); - /** setting on/off background icon to indicate selected state */ - /*virtual*/ void setValue(const LLSD& value); - // sends commit signal - void onAnyMouseClick(); + struct Params : public LLInitParam::Block + { + Optional icon_over; + Optional icon_selected; + Optional picture; + Optional selected_picture; + + Optional text; + Optional mousedown_callback; + Params(); + }; + /*virtual*/ BOOL postBuild(); + /** setting on/off background icon to indicate selected state */ + /*virtual*/ void setValue(const LLSD& value); + // sends commit signal + void onAnyMouseClick(); protected: - friend class LLUICtrlFactory; - LLPanelCameraItem(const Params&); - LLIconCtrl* mIconOver; - LLIconCtrl* mIconSelected; - LLIconCtrl* mPicture; - LLIconCtrl* mPictureSelected; - LLTextBox* mText; + friend class LLUICtrlFactory; + LLPanelCameraItem(const Params&); + LLIconCtrl* mIconOver; + LLIconCtrl* mIconSelected; + LLIconCtrl* mPicture; + LLIconCtrl* mPictureSelected; + LLTextBox* mText; }; #endif diff --git a/indra/newview/llfloaterdeleteprefpreset.cpp b/indra/newview/llfloaterdeleteprefpreset.cpp index bd62849b42..dd8117f95f 100644 --- a/indra/newview/llfloaterdeleteprefpreset.cpp +++ b/indra/newview/llfloaterdeleteprefpreset.cpp @@ -37,65 +37,65 @@ #include "llfloaterreg.h" LLFloaterDeletePrefPreset::LLFloaterDeletePrefPreset(const LLSD &key) -: LLFloater(key) +: LLFloater(key) { } // virtual BOOL LLFloaterDeletePrefPreset::postBuild() { - LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance("preferences"); - if (preferences) - { - preferences->addDependentFloater(this); - } - getChild("delete")->setCommitCallback(boost::bind(&LLFloaterDeletePrefPreset::onBtnDelete, this)); - getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterDeletePrefPreset::onBtnCancel, this)); - LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterDeletePrefPreset::onPresetsListChange, this)); - - return TRUE; + LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance("preferences"); + if (preferences) + { + preferences->addDependentFloater(this); + } + getChild("delete")->setCommitCallback(boost::bind(&LLFloaterDeletePrefPreset::onBtnDelete, this)); + getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterDeletePrefPreset::onBtnCancel, this)); + LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterDeletePrefPreset::onPresetsListChange, this)); + + return TRUE; } void LLFloaterDeletePrefPreset::onOpen(const LLSD& key) { - mSubdirectory = key.asString(); - std::string floater_title = getString(std::string("title_") + mSubdirectory); - setTitle(floater_title); + mSubdirectory = key.asString(); + std::string floater_title = getString(std::string("title_") + mSubdirectory); + setTitle(floater_title); - LLComboBox* combo = getChild("preset_combo"); - EDefaultOptions option = DEFAULT_HIDE; - bool action; - action = LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); + LLComboBox* combo = getChild("preset_combo"); + EDefaultOptions option = DEFAULT_HIDE; + bool action; + action = LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); - LLButton* delete_btn = getChild("delete"); - delete_btn->setEnabled(action); + LLButton* delete_btn = getChild("delete"); + delete_btn->setEnabled(action); } void LLFloaterDeletePrefPreset::onBtnDelete() { - LLComboBox* combo = getChild("preset_combo"); - std::string name = combo->getSimple(); + LLComboBox* combo = getChild("preset_combo"); + std::string name = combo->getSimple(); - if (!LLPresetsManager::getInstance()->deletePreset(mSubdirectory, name)) - { - LLSD args; - args["NAME"] = name; - LLNotificationsUtil::add("PresetNotDeleted", args); - } + if (!LLPresetsManager::getInstance()->deletePreset(mSubdirectory, name)) + { + LLSD args; + args["NAME"] = name; + LLNotificationsUtil::add("PresetNotDeleted", args); + } - closeFloater(); + closeFloater(); } void LLFloaterDeletePrefPreset::onPresetsListChange() { - LLComboBox* combo = getChild("preset_combo"); + LLComboBox* combo = getChild("preset_combo"); - EDefaultOptions option = DEFAULT_HIDE; + EDefaultOptions option = DEFAULT_HIDE; - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); } void LLFloaterDeletePrefPreset::onBtnCancel() { - closeFloater(); + closeFloater(); } diff --git a/indra/newview/llfloaterloadprefpreset.cpp b/indra/newview/llfloaterloadprefpreset.cpp index fa17a9d40e..0584bf7e09 100644 --- a/indra/newview/llfloaterloadprefpreset.cpp +++ b/indra/newview/llfloaterloadprefpreset.cpp @@ -36,57 +36,57 @@ #include "llviewercontrol.h" LLFloaterLoadPrefPreset::LLFloaterLoadPrefPreset(const LLSD &key) -: LLFloater(key) +: LLFloater(key) { } // virtual BOOL LLFloaterLoadPrefPreset::postBuild() { - LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance("preferences"); - if (preferences) - { - preferences->addDependentFloater(this); - } - getChild("ok")->setCommitCallback(boost::bind(&LLFloaterLoadPrefPreset::onBtnOk, this)); - getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterLoadPrefPreset::onBtnCancel, this)); - LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterLoadPrefPreset::onPresetsListChange, this)); - - return TRUE; + LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance("preferences"); + if (preferences) + { + preferences->addDependentFloater(this); + } + getChild("ok")->setCommitCallback(boost::bind(&LLFloaterLoadPrefPreset::onBtnOk, this)); + getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterLoadPrefPreset::onBtnCancel, this)); + LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterLoadPrefPreset::onPresetsListChange, this)); + + return TRUE; } void LLFloaterLoadPrefPreset::onOpen(const LLSD& key) { - mSubdirectory = key.asString(); - std::string floater_title = getString(std::string("title_") + mSubdirectory); + mSubdirectory = key.asString(); + std::string floater_title = getString(std::string("title_") + mSubdirectory); - setTitle(floater_title); + setTitle(floater_title); - LLComboBox* combo = getChild("preset_combo"); + LLComboBox* combo = getChild("preset_combo"); - EDefaultOptions option = DEFAULT_TOP; - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); + EDefaultOptions option = DEFAULT_TOP; + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); } void LLFloaterLoadPrefPreset::onPresetsListChange() { - LLComboBox* combo = getChild("preset_combo"); + LLComboBox* combo = getChild("preset_combo"); - EDefaultOptions option = DEFAULT_TOP; - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); + EDefaultOptions option = DEFAULT_TOP; + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); } void LLFloaterLoadPrefPreset::onBtnCancel() { - closeFloater(); + closeFloater(); } void LLFloaterLoadPrefPreset::onBtnOk() { - LLComboBox* combo = getChild("preset_combo"); - std::string name = combo->getSimple(); + LLComboBox* combo = getChild("preset_combo"); + std::string name = combo->getSimple(); - LLPresetsManager::getInstance()->loadPreset(mSubdirectory, name); + LLPresetsManager::getInstance()->loadPreset(mSubdirectory, name); - closeFloater(); + closeFloater(); } diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 6b4e4ceeac..ee85a46405 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -139,35 +139,35 @@ static const F32 ARC_LIMIT_MAP_SCALE = (MAX_ARC_LOG - MIN_ARC_LOG) / (MAX_INDIRE class LLVoiceSetKeyDialog : public LLModalDialog { public: - LLVoiceSetKeyDialog(const LLSD& key); - ~LLVoiceSetKeyDialog(); - - /*virtual*/ BOOL postBuild(); - - void setParent(LLFloaterPreference* parent) { mParent = parent; } - - BOOL handleKeyHere(KEY key, MASK mask); - static void onCancel(void* user_data); - + LLVoiceSetKeyDialog(const LLSD& key); + ~LLVoiceSetKeyDialog(); + + /*virtual*/ BOOL postBuild(); + + void setParent(LLFloaterPreference* parent) { mParent = parent; } + + BOOL handleKeyHere(KEY key, MASK mask); + static void onCancel(void* user_data); + private: - LLFloaterPreference* mParent; + LLFloaterPreference* mParent; }; LLVoiceSetKeyDialog::LLVoiceSetKeyDialog(const LLSD& key) : LLModalDialog(key), - mParent(NULL) + mParent(NULL) { } //virtual BOOL LLVoiceSetKeyDialog::postBuild() { - childSetAction("Cancel", onCancel, this); - getChild("Cancel")->setFocus(TRUE); - - gFocusMgr.setKeystrokesOnly(TRUE); - - return TRUE; + childSetAction("Cancel", onCancel, this); + getChild("Cancel")->setFocus(TRUE); + + gFocusMgr.setKeystrokesOnly(TRUE); + + return TRUE; } LLVoiceSetKeyDialog::~LLVoiceSetKeyDialog() @@ -176,25 +176,25 @@ LLVoiceSetKeyDialog::~LLVoiceSetKeyDialog() BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask) { - BOOL result = TRUE; - - if (key == 'Q' && mask == MASK_CONTROL) - { - result = FALSE; - } - else if (mParent) - { - mParent->setKey(key); - } - closeFloater(); - return result; + BOOL result = TRUE; + + if (key == 'Q' && mask == MASK_CONTROL) + { + result = FALSE; + } + else if (mParent) + { + mParent->setKey(key); + } + closeFloater(); + return result; } //static void LLVoiceSetKeyDialog::onCancel(void* user_data) { - LLVoiceSetKeyDialog* self = (LLVoiceSetKeyDialog*)user_data; - self->closeFloater(); + LLVoiceSetKeyDialog* self = (LLVoiceSetKeyDialog*)user_data; + self->closeFloater(); } @@ -204,8 +204,8 @@ void LLVoiceSetKeyDialog::onCancel(void* user_data) // if creating/destroying these is too slow, we'll need to create // a static member and update all our static callbacks -void handleNameTagOptionChanged(const LLSD& newvalue); -void handleDisplayNamesOptionChanged(const LLSD& newvalue); +void handleNameTagOptionChanged(const LLSD& newvalue); +void handleDisplayNamesOptionChanged(const LLSD& newvalue); bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response); bool callback_clear_cache(const LLSD& notification, const LLSD& response); @@ -216,110 +216,110 @@ void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator); bool callback_clear_cache(const LLSD& notification, const LLSD& response) { - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if ( option == 0 ) // YES - { - // flag client texture cache for clearing next time the client runs - gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE); - LLNotificationsUtil::add("CacheWillClear"); - } + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if ( option == 0 ) // YES + { + // flag client texture cache for clearing next time the client runs + gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE); + LLNotificationsUtil::add("CacheWillClear"); + } - return false; + return false; } bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response) { - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if ( option == 0 ) // YES - { - // clean web - LLViewerMedia::clearAllCaches(); - LLViewerMedia::clearAllCookies(); - - // clean nav bar history - LLNavigationBar::getInstance()->clearHistoryCache(); - - // flag client texture cache for clearing next time the client runs - gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE); - LLNotificationsUtil::add("CacheWillClear"); - - LLSearchHistory::getInstance()->clearHistory(); - LLSearchHistory::getInstance()->save(); - LLSearchComboBox* search_ctrl = LLNavigationBar::getInstance()->getChild("search_combo_box"); - search_ctrl->clearHistory(); - - LLTeleportHistoryStorage::getInstance()->purgeItems(); - LLTeleportHistoryStorage::getInstance()->save(); - } - - return false; + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if ( option == 0 ) // YES + { + // clean web + LLViewerMedia::clearAllCaches(); + LLViewerMedia::clearAllCookies(); + + // clean nav bar history + LLNavigationBar::getInstance()->clearHistoryCache(); + + // flag client texture cache for clearing next time the client runs + gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE); + LLNotificationsUtil::add("CacheWillClear"); + + LLSearchHistory::getInstance()->clearHistory(); + LLSearchHistory::getInstance()->save(); + LLSearchComboBox* search_ctrl = LLNavigationBar::getInstance()->getChild("search_combo_box"); + search_ctrl->clearHistory(); + + LLTeleportHistoryStorage::getInstance()->purgeItems(); + LLTeleportHistoryStorage::getInstance()->save(); + } + + return false; } void handleNameTagOptionChanged(const LLSD& newvalue) { - LLAvatarNameCache::setUseUsernames(gSavedSettings.getBOOL("NameTagShowUsernames")); - LLVOAvatar::invalidateNameTags(); + LLAvatarNameCache::setUseUsernames(gSavedSettings.getBOOL("NameTagShowUsernames")); + LLVOAvatar::invalidateNameTags(); } void handleDisplayNamesOptionChanged(const LLSD& newvalue) { - LLAvatarNameCache::setUseDisplayNames(newvalue.asBoolean()); - LLVOAvatar::invalidateNameTags(); + LLAvatarNameCache::setUseDisplayNames(newvalue.asBoolean()); + LLVOAvatar::invalidateNameTags(); } void handleAppearanceCameraMovementChanged(const LLSD& newvalue) { - if(!newvalue.asBoolean() && gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR) - { - gAgentCamera.changeCameraToDefault(); - gAgentCamera.resetView(); - } + if(!newvalue.asBoolean() && gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR) + { + gAgentCamera.changeCameraToDefault(); + gAgentCamera.resetView(); + } } /*bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater) { - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (0 == option && floater ) - { - if ( floater ) - { - floater->setAllIgnored(); - // LLFirstUse::disableFirstUse(); - floater->buildPopupLists(); - } - } - return false; + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (0 == option && floater ) + { + if ( floater ) + { + floater->setAllIgnored(); + // LLFirstUse::disableFirstUse(); + floater->buildPopupLists(); + } + } + return false; } bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater) { - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if ( 0 == option && floater ) - { - if ( floater ) - { - floater->resetAllIgnored(); - //LLFirstUse::resetFirstUse(); - floater->buildPopupLists(); - } - } - return false; + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if ( 0 == option && floater ) + { + if ( floater ) + { + floater->resetAllIgnored(); + //LLFirstUse::resetFirstUse(); + floater->buildPopupLists(); + } + } + return false; } */ void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator) { - numerator = 0; - denominator = 0; - for (F32 test_denominator = 1.f; test_denominator < 30.f; test_denominator += 1.f) - { - if (fmodf((decimal_val * test_denominator) + 0.01f, 1.f) < 0.02f) - { - numerator = ll_round(decimal_val * test_denominator); - denominator = ll_round(test_denominator); - break; - } - } + numerator = 0; + denominator = 0; + for (F32 test_denominator = 1.f; test_denominator < 30.f; test_denominator += 1.f) + { + if (fmodf((decimal_val * test_denominator) + 0.01f, 1.f) < 0.02f) + { + numerator = ll_round(decimal_val * test_denominator); + denominator = ll_round(test_denominator); + break; + } + } } // static std::string LLFloaterPreference::sSkin = ""; @@ -327,1537 +327,1537 @@ std::string LLFloaterPreference::sSkin = ""; // LLFloaterPreference LLFloaterPreference::LLFloaterPreference(const LLSD& key) - : LLFloater(key), - mGotPersonalInfo(false), - mOriginalIMViaEmail(false), - mLanguageChanged(false), - mAvatarDataInitialized(false), - mClickActionDirty(false) -{ - LLConversationLog::instance().addObserver(this); - - //Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - - static bool registered_dialog = false; - if (!registered_dialog) - { - LLFloaterReg::add("voice_set_key", "floater_select_key.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - registered_dialog = true; - } - - mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreference::onBtnCancel, this, _2)); - mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreference::onBtnOK, this, _2)); - - mCommitCallbackRegistrar.add("Pref.ClearCache", boost::bind(&LLFloaterPreference::onClickClearCache, this)); - mCommitCallbackRegistrar.add("Pref.WebClearCache", boost::bind(&LLFloaterPreference::onClickBrowserClearCache, this)); - mCommitCallbackRegistrar.add("Pref.SetCache", boost::bind(&LLFloaterPreference::onClickSetCache, this)); - mCommitCallbackRegistrar.add("Pref.ResetCache", boost::bind(&LLFloaterPreference::onClickResetCache, this)); - mCommitCallbackRegistrar.add("Pref.ClickSkin", boost::bind(&LLFloaterPreference::onClickSkin, this,_1, _2)); - mCommitCallbackRegistrar.add("Pref.SelectSkin", boost::bind(&LLFloaterPreference::onSelectSkin, this)); - mCommitCallbackRegistrar.add("Pref.VoiceSetKey", boost::bind(&LLFloaterPreference::onClickSetKey, this)); - mCommitCallbackRegistrar.add("Pref.VoiceSetMiddleMouse", boost::bind(&LLFloaterPreference::onClickSetMiddleMouse, this)); - mCommitCallbackRegistrar.add("Pref.SetSounds", boost::bind(&LLFloaterPreference::onClickSetSounds, this)); - mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this)); - mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this)); - mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this)); - mCommitCallbackRegistrar.add("Pref.RenderExceptions", boost::bind(&LLFloaterPreference::onClickRenderExceptions, this)); - mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this)); - mCommitCallbackRegistrar.add("Pref.AvatarImpostorsEnable", boost::bind(&LLFloaterPreference::onAvatarImpostorsEnable, this)); - mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreference::updateMaxComplexity, this)); - mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreference::onVertexShaderEnable, this)); - mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this)); - mCommitCallbackRegistrar.add("Pref.UpdateSliderText", boost::bind(&LLFloaterPreference::refreshUI,this)); - mCommitCallbackRegistrar.add("Pref.QualityPerformance", boost::bind(&LLFloaterPreference::onChangeQuality, this, _2)); - mCommitCallbackRegistrar.add("Pref.applyUIColor", boost::bind(&LLFloaterPreference::applyUIColor, this ,_1, _2)); - mCommitCallbackRegistrar.add("Pref.getUIColor", boost::bind(&LLFloaterPreference::getUIColor, this ,_1, _2)); - mCommitCallbackRegistrar.add("Pref.MaturitySettings", boost::bind(&LLFloaterPreference::onChangeMaturity, this)); - mCommitCallbackRegistrar.add("Pref.BlockList", boost::bind(&LLFloaterPreference::onClickBlockList, this)); - mCommitCallbackRegistrar.add("Pref.Proxy", boost::bind(&LLFloaterPreference::onClickProxySettings, this)); - mCommitCallbackRegistrar.add("Pref.TranslationSettings", boost::bind(&LLFloaterPreference::onClickTranslationSettings, this)); - mCommitCallbackRegistrar.add("Pref.AutoReplace", boost::bind(&LLFloaterPreference::onClickAutoReplace, this)); - mCommitCallbackRegistrar.add("Pref.PermsDefault", boost::bind(&LLFloaterPreference::onClickPermsDefault, this)); - mCommitCallbackRegistrar.add("Pref.SpellChecker", boost::bind(&LLFloaterPreference::onClickSpellChecker, this)); - mCommitCallbackRegistrar.add("Pref.Advanced", boost::bind(&LLFloaterPreference::onClickAdvanced, this)); - - sSkin = gSavedSettings.getString("SkinCurrent"); - - mCommitCallbackRegistrar.add("Pref.ClickActionChange", boost::bind(&LLFloaterPreference::onClickActionChange, this)); - - gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); - gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); - gSavedSettings.getControl("UseDisplayNames")->getCommitSignal()->connect(boost::bind(&handleDisplayNamesOptionChanged, _2)); - - gSavedSettings.getControl("AppearanceCameraMovement")->getCommitSignal()->connect(boost::bind(&handleAppearanceCameraMovementChanged, _2)); - - LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this ); - - mCommitCallbackRegistrar.add("Pref.ClearLog", boost::bind(&LLConversationLog::onClearLog, &LLConversationLog::instance())); - mCommitCallbackRegistrar.add("Pref.DeleteTranscripts", boost::bind(&LLFloaterPreference::onDeleteTranscripts, this)); + : LLFloater(key), + mGotPersonalInfo(false), + mOriginalIMViaEmail(false), + mLanguageChanged(false), + mAvatarDataInitialized(false), + mClickActionDirty(false) +{ + LLConversationLog::instance().addObserver(this); + + //Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + static bool registered_dialog = false; + if (!registered_dialog) + { + LLFloaterReg::add("voice_set_key", "floater_select_key.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + registered_dialog = true; + } + + mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreference::onBtnCancel, this, _2)); + mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreference::onBtnOK, this, _2)); + + mCommitCallbackRegistrar.add("Pref.ClearCache", boost::bind(&LLFloaterPreference::onClickClearCache, this)); + mCommitCallbackRegistrar.add("Pref.WebClearCache", boost::bind(&LLFloaterPreference::onClickBrowserClearCache, this)); + mCommitCallbackRegistrar.add("Pref.SetCache", boost::bind(&LLFloaterPreference::onClickSetCache, this)); + mCommitCallbackRegistrar.add("Pref.ResetCache", boost::bind(&LLFloaterPreference::onClickResetCache, this)); + mCommitCallbackRegistrar.add("Pref.ClickSkin", boost::bind(&LLFloaterPreference::onClickSkin, this,_1, _2)); + mCommitCallbackRegistrar.add("Pref.SelectSkin", boost::bind(&LLFloaterPreference::onSelectSkin, this)); + mCommitCallbackRegistrar.add("Pref.VoiceSetKey", boost::bind(&LLFloaterPreference::onClickSetKey, this)); + mCommitCallbackRegistrar.add("Pref.VoiceSetMiddleMouse", boost::bind(&LLFloaterPreference::onClickSetMiddleMouse, this)); + mCommitCallbackRegistrar.add("Pref.SetSounds", boost::bind(&LLFloaterPreference::onClickSetSounds, this)); + mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this)); + mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this)); + mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this)); + mCommitCallbackRegistrar.add("Pref.RenderExceptions", boost::bind(&LLFloaterPreference::onClickRenderExceptions, this)); + mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this)); + mCommitCallbackRegistrar.add("Pref.AvatarImpostorsEnable", boost::bind(&LLFloaterPreference::onAvatarImpostorsEnable, this)); + mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreference::updateMaxComplexity, this)); + mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreference::onVertexShaderEnable, this)); + mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this)); + mCommitCallbackRegistrar.add("Pref.UpdateSliderText", boost::bind(&LLFloaterPreference::refreshUI,this)); + mCommitCallbackRegistrar.add("Pref.QualityPerformance", boost::bind(&LLFloaterPreference::onChangeQuality, this, _2)); + mCommitCallbackRegistrar.add("Pref.applyUIColor", boost::bind(&LLFloaterPreference::applyUIColor, this ,_1, _2)); + mCommitCallbackRegistrar.add("Pref.getUIColor", boost::bind(&LLFloaterPreference::getUIColor, this ,_1, _2)); + mCommitCallbackRegistrar.add("Pref.MaturitySettings", boost::bind(&LLFloaterPreference::onChangeMaturity, this)); + mCommitCallbackRegistrar.add("Pref.BlockList", boost::bind(&LLFloaterPreference::onClickBlockList, this)); + mCommitCallbackRegistrar.add("Pref.Proxy", boost::bind(&LLFloaterPreference::onClickProxySettings, this)); + mCommitCallbackRegistrar.add("Pref.TranslationSettings", boost::bind(&LLFloaterPreference::onClickTranslationSettings, this)); + mCommitCallbackRegistrar.add("Pref.AutoReplace", boost::bind(&LLFloaterPreference::onClickAutoReplace, this)); + mCommitCallbackRegistrar.add("Pref.PermsDefault", boost::bind(&LLFloaterPreference::onClickPermsDefault, this)); + mCommitCallbackRegistrar.add("Pref.SpellChecker", boost::bind(&LLFloaterPreference::onClickSpellChecker, this)); + mCommitCallbackRegistrar.add("Pref.Advanced", boost::bind(&LLFloaterPreference::onClickAdvanced, this)); + + sSkin = gSavedSettings.getString("SkinCurrent"); + + mCommitCallbackRegistrar.add("Pref.ClickActionChange", boost::bind(&LLFloaterPreference::onClickActionChange, this)); + + gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); + gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); + gSavedSettings.getControl("UseDisplayNames")->getCommitSignal()->connect(boost::bind(&handleDisplayNamesOptionChanged, _2)); + + gSavedSettings.getControl("AppearanceCameraMovement")->getCommitSignal()->connect(boost::bind(&handleAppearanceCameraMovementChanged, _2)); + + LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this ); + + mCommitCallbackRegistrar.add("Pref.ClearLog", boost::bind(&LLConversationLog::onClearLog, &LLConversationLog::instance())); + mCommitCallbackRegistrar.add("Pref.DeleteTranscripts", boost::bind(&LLFloaterPreference::onDeleteTranscripts, this)); } void LLFloaterPreference::processProperties( void* pData, EAvatarProcessorType type ) { - if ( APT_PROPERTIES == type ) - { - const LLAvatarData* pAvatarData = static_cast( pData ); - if (pAvatarData && (gAgent.getID() == pAvatarData->avatar_id) && (pAvatarData->avatar_id != LLUUID::null)) - { - storeAvatarProperties( pAvatarData ); - processProfileProperties( pAvatarData ); - } - } + if ( APT_PROPERTIES == type ) + { + const LLAvatarData* pAvatarData = static_cast( pData ); + if (pAvatarData && (gAgent.getID() == pAvatarData->avatar_id) && (pAvatarData->avatar_id != LLUUID::null)) + { + storeAvatarProperties( pAvatarData ); + processProfileProperties( pAvatarData ); + } + } } void LLFloaterPreference::storeAvatarProperties( const LLAvatarData* pAvatarData ) { - if (LLStartUp::getStartupState() == STATE_STARTED) - { - mAvatarProperties.avatar_id = pAvatarData->avatar_id; - mAvatarProperties.image_id = pAvatarData->image_id; - mAvatarProperties.fl_image_id = pAvatarData->fl_image_id; - mAvatarProperties.about_text = pAvatarData->about_text; - mAvatarProperties.fl_about_text = pAvatarData->fl_about_text; - mAvatarProperties.profile_url = pAvatarData->profile_url; - mAvatarProperties.flags = pAvatarData->flags; - mAvatarProperties.allow_publish = pAvatarData->flags & AVATAR_ALLOW_PUBLISH; - - mAvatarDataInitialized = true; - } + if (LLStartUp::getStartupState() == STATE_STARTED) + { + mAvatarProperties.avatar_id = pAvatarData->avatar_id; + mAvatarProperties.image_id = pAvatarData->image_id; + mAvatarProperties.fl_image_id = pAvatarData->fl_image_id; + mAvatarProperties.about_text = pAvatarData->about_text; + mAvatarProperties.fl_about_text = pAvatarData->fl_about_text; + mAvatarProperties.profile_url = pAvatarData->profile_url; + mAvatarProperties.flags = pAvatarData->flags; + mAvatarProperties.allow_publish = pAvatarData->flags & AVATAR_ALLOW_PUBLISH; + + mAvatarDataInitialized = true; + } } void LLFloaterPreference::processProfileProperties(const LLAvatarData* pAvatarData ) { - getChild("online_searchresults")->setValue( (bool)(pAvatarData->flags & AVATAR_ALLOW_PUBLISH) ); + getChild("online_searchresults")->setValue( (bool)(pAvatarData->flags & AVATAR_ALLOW_PUBLISH) ); } void LLFloaterPreference::saveAvatarProperties( void ) { - const BOOL allowPublish = getChild("online_searchresults")->getValue(); + const BOOL allowPublish = getChild("online_searchresults")->getValue(); - if (allowPublish) - { - mAvatarProperties.flags |= AVATAR_ALLOW_PUBLISH; - } + if (allowPublish) + { + mAvatarProperties.flags |= AVATAR_ALLOW_PUBLISH; + } - // - // NOTE: We really don't want to send the avatar properties unless we absolutely - // need to so we can avoid the accidental profile reset bug, so, if we're - // logged in, the avatar data has been initialized and we have a state change - // for the "allow publish" flag, then set the flag to its new value and send - // the properties update. - // - // NOTE: The only reason we can not remove this update altogether is because of the - // "allow publish" flag, the last remaining profile setting in the viewer - // that doesn't exist in the web profile. - // - if ((LLStartUp::getStartupState() == STATE_STARTED) && mAvatarDataInitialized && (allowPublish != mAvatarProperties.allow_publish)) - { - mAvatarProperties.allow_publish = allowPublish; + // + // NOTE: We really don't want to send the avatar properties unless we absolutely + // need to so we can avoid the accidental profile reset bug, so, if we're + // logged in, the avatar data has been initialized and we have a state change + // for the "allow publish" flag, then set the flag to its new value and send + // the properties update. + // + // NOTE: The only reason we can not remove this update altogether is because of the + // "allow publish" flag, the last remaining profile setting in the viewer + // that doesn't exist in the web profile. + // + if ((LLStartUp::getStartupState() == STATE_STARTED) && mAvatarDataInitialized && (allowPublish != mAvatarProperties.allow_publish)) + { + mAvatarProperties.allow_publish = allowPublish; - LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate( &mAvatarProperties ); - } + LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate( &mAvatarProperties ); + } } BOOL LLFloaterPreference::postBuild() { - gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false)); + gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false)); - gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLViewerChat::signalChatFontChanged)); + gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLViewerChat::signalChatFontChanged)); - gSavedSettings.getControl("ChatBubbleOpacity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onNameTagOpacityChange, this, _2)); + gSavedSettings.getControl("ChatBubbleOpacity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onNameTagOpacityChange, this, _2)); - gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeMaturity, this)); + gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeMaturity, this)); - gSavedPerAccountSettings.getControl("ModelUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeModelFolder, this)); - gSavedPerAccountSettings.getControl("TextureUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeTextureFolder, this)); - gSavedPerAccountSettings.getControl("SoundUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeSoundFolder, this)); - gSavedPerAccountSettings.getControl("AnimationUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeAnimationFolder, this)); + gSavedPerAccountSettings.getControl("ModelUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeModelFolder, this)); + gSavedPerAccountSettings.getControl("TextureUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeTextureFolder, this)); + gSavedPerAccountSettings.getControl("SoundUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeSoundFolder, this)); + gSavedPerAccountSettings.getControl("AnimationUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeAnimationFolder, this)); - LLTabContainer* tabcontainer = getChild("pref core"); - if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab"))) - tabcontainer->selectFirstTab(); + LLTabContainer* tabcontainer = getChild("pref core"); + if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab"))) + tabcontainer->selectFirstTab(); - getChild("cache_location")->setEnabled(FALSE); // make it read-only but selectable (STORM-227) - std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); - setCacheLocation(cache_location); + getChild("cache_location")->setEnabled(FALSE); // make it read-only but selectable (STORM-227) + std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); + setCacheLocation(cache_location); - getChild("log_path_string")->setEnabled(FALSE); // make it read-only but selectable + getChild("log_path_string")->setEnabled(FALSE); // make it read-only but selectable - getChild("language_combobox")->setCommitCallback(boost::bind(&LLFloaterPreference::onLanguageChange, this)); + getChild("language_combobox")->setCommitCallback(boost::bind(&LLFloaterPreference::onLanguageChange, this)); - getChild("FriendIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"FriendIMOptions")); - getChild("NonFriendIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"NonFriendIMOptions")); - getChild("ConferenceIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"ConferenceIMOptions")); - getChild("GroupChatOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"GroupChatOptions")); - getChild("NearbyChatOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"NearbyChatOptions")); - getChild("ObjectIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"ObjectIMOptions")); + getChild("FriendIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"FriendIMOptions")); + getChild("NonFriendIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"NonFriendIMOptions")); + getChild("ConferenceIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"ConferenceIMOptions")); + getChild("GroupChatOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"GroupChatOptions")); + getChild("NearbyChatOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"NearbyChatOptions")); + getChild("ObjectIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"ObjectIMOptions")); - // if floater is opened before login set default localized do not disturb message - if (LLStartUp::getStartupState() < STATE_STARTED) - { - gSavedPerAccountSettings.setString("DoNotDisturbModeResponse", LLTrans::getString("DoNotDisturbModeResponseDefault")); - } + // if floater is opened before login set default localized do not disturb message + if (LLStartUp::getStartupState() < STATE_STARTED) + { + gSavedPerAccountSettings.setString("DoNotDisturbModeResponse", LLTrans::getString("DoNotDisturbModeResponseDefault")); + } - // set 'enable' property for 'Clear log...' button - changed(); + // set 'enable' property for 'Clear log...' button + changed(); - LLLogChat::setSaveHistorySignal(boost::bind(&LLFloaterPreference::onLogChatHistorySaved, this)); + LLLogChat::setSaveHistorySignal(boost::bind(&LLFloaterPreference::onLogChatHistorySaved, this)); - LLSliderCtrl* fov_slider = getChild("camera_fov"); - fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView()); - fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView()); + LLSliderCtrl* fov_slider = getChild("camera_fov"); + fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView()); + fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView()); - return TRUE; + return TRUE; } void LLFloaterPreference::updateDeleteTranscriptsButton() { - std::vector list_of_transcriptions_file_names; - LLLogChat::getListOfTranscriptFiles(list_of_transcriptions_file_names); - getChild("delete_transcripts")->setEnabled(list_of_transcriptions_file_names.size() > 0); + std::vector list_of_transcriptions_file_names; + LLLogChat::getListOfTranscriptFiles(list_of_transcriptions_file_names); + getChild("delete_transcripts")->setEnabled(list_of_transcriptions_file_names.size() > 0); } void LLFloaterPreference::onDoNotDisturbResponseChanged() { - // set "DoNotDisturbResponseChanged" TRUE if user edited message differs from default, FALSE otherwise - bool response_changed_flag = - LLTrans::getString("DoNotDisturbModeResponseDefault") - != getChild("do_not_disturb_response")->getValue().asString(); + // set "DoNotDisturbResponseChanged" TRUE if user edited message differs from default, FALSE otherwise + bool response_changed_flag = + LLTrans::getString("DoNotDisturbModeResponseDefault") + != getChild("do_not_disturb_response")->getValue().asString(); - gSavedPerAccountSettings.setBOOL("DoNotDisturbResponseChanged", response_changed_flag ); + gSavedPerAccountSettings.setBOOL("DoNotDisturbResponseChanged", response_changed_flag ); } LLFloaterPreference::~LLFloaterPreference() { - LLConversationLog::instance().removeObserver(this); + LLConversationLog::instance().removeObserver(this); } void LLFloaterPreference::draw() { - BOOL has_first_selected = (getChildRef("disabled_popups").getFirstSelected()!=NULL); - gSavedSettings.setBOOL("FirstSelectedDisabledPopups", has_first_selected); - - has_first_selected = (getChildRef("enabled_popups").getFirstSelected()!=NULL); - gSavedSettings.setBOOL("FirstSelectedEnabledPopups", has_first_selected); - - LLFloater::draw(); + BOOL has_first_selected = (getChildRef("disabled_popups").getFirstSelected()!=NULL); + gSavedSettings.setBOOL("FirstSelectedDisabledPopups", has_first_selected); + + has_first_selected = (getChildRef("enabled_popups").getFirstSelected()!=NULL); + gSavedSettings.setBOOL("FirstSelectedEnabledPopups", has_first_selected); + + LLFloater::draw(); } void LLFloaterPreference::saveSettings() { - LLTabContainer* tabcontainer = getChild("pref core"); - child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); - child_list_t::const_iterator end = tabcontainer->getChildList()->end(); - for ( ; iter != end; ++iter) - { - LLView* view = *iter; - LLPanelPreference* panel = dynamic_cast(view); - if (panel) - panel->saveSettings(); - } -} + LLTabContainer* tabcontainer = getChild("pref core"); + child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); + child_list_t::const_iterator end = tabcontainer->getChildList()->end(); + for ( ; iter != end; ++iter) + { + LLView* view = *iter; + LLPanelPreference* panel = dynamic_cast(view); + if (panel) + panel->saveSettings(); + } +} void LLFloaterPreference::apply() { - LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this ); - - LLTabContainer* tabcontainer = getChild("pref core"); - if (sSkin != gSavedSettings.getString("SkinCurrent")) - { - LLNotificationsUtil::add("ChangeSkin"); - refreshSkin(this); - } - // Call apply() on all panels that derive from LLPanelPreference - for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); - iter != tabcontainer->getChildList()->end(); ++iter) - { - LLView* view = *iter; - LLPanelPreference* panel = dynamic_cast(view); - if (panel) - panel->apply(); - } - - gViewerWindow->requestResolutionUpdate(); // for UIScaleFactor - - LLSliderCtrl* fov_slider = getChild("camera_fov"); - fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView()); - fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView()); - - std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); - setCacheLocation(cache_location); - - LLViewerMedia::setCookiesEnabled(getChild("cookies_enabled")->getValue()); - - if (hasChild("web_proxy_enabled", TRUE) &&hasChild("web_proxy_editor", TRUE) && hasChild("web_proxy_port", TRUE)) - { - bool proxy_enable = getChild("web_proxy_enabled")->getValue(); - std::string proxy_address = getChild("web_proxy_editor")->getValue(); - int proxy_port = getChild("web_proxy_port")->getValue(); - LLViewerMedia::setProxyConfig(proxy_enable, proxy_address, proxy_port); - } - - if (mGotPersonalInfo) - { - bool new_im_via_email = getChild("send_im_to_email")->getValue().asBoolean(); - bool new_hide_online = getChild("online_visibility")->getValue().asBoolean(); - - if ((new_im_via_email != mOriginalIMViaEmail) - ||(new_hide_online != mOriginalHideOnlineStatus)) - { - // This hack is because we are representing several different - // possible strings with a single checkbox. Since most users - // can only select between 2 values, we represent it as a - // checkbox. This breaks down a little bit for liaisons, but - // works out in the end. - if (new_hide_online != mOriginalHideOnlineStatus) - { - if (new_hide_online) mDirectoryVisibility = VISIBILITY_HIDDEN; - else mDirectoryVisibility = VISIBILITY_DEFAULT; - //Update showonline value, otherwise multiple applys won't work - mOriginalHideOnlineStatus = new_hide_online; - } - gAgent.sendAgentUpdateUserInfo(new_im_via_email,mDirectoryVisibility); - } - } - - saveAvatarProperties(); - - if (mClickActionDirty) - { - updateClickActionSettings(); - mClickActionDirty = false; - } + LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this ); + + LLTabContainer* tabcontainer = getChild("pref core"); + if (sSkin != gSavedSettings.getString("SkinCurrent")) + { + LLNotificationsUtil::add("ChangeSkin"); + refreshSkin(this); + } + // Call apply() on all panels that derive from LLPanelPreference + for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); + iter != tabcontainer->getChildList()->end(); ++iter) + { + LLView* view = *iter; + LLPanelPreference* panel = dynamic_cast(view); + if (panel) + panel->apply(); + } + + gViewerWindow->requestResolutionUpdate(); // for UIScaleFactor + + LLSliderCtrl* fov_slider = getChild("camera_fov"); + fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView()); + fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView()); + + std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); + setCacheLocation(cache_location); + + LLViewerMedia::setCookiesEnabled(getChild("cookies_enabled")->getValue()); + + if (hasChild("web_proxy_enabled", TRUE) &&hasChild("web_proxy_editor", TRUE) && hasChild("web_proxy_port", TRUE)) + { + bool proxy_enable = getChild("web_proxy_enabled")->getValue(); + std::string proxy_address = getChild("web_proxy_editor")->getValue(); + int proxy_port = getChild("web_proxy_port")->getValue(); + LLViewerMedia::setProxyConfig(proxy_enable, proxy_address, proxy_port); + } + + if (mGotPersonalInfo) + { + bool new_im_via_email = getChild("send_im_to_email")->getValue().asBoolean(); + bool new_hide_online = getChild("online_visibility")->getValue().asBoolean(); + + if ((new_im_via_email != mOriginalIMViaEmail) + ||(new_hide_online != mOriginalHideOnlineStatus)) + { + // This hack is because we are representing several different + // possible strings with a single checkbox. Since most users + // can only select between 2 values, we represent it as a + // checkbox. This breaks down a little bit for liaisons, but + // works out in the end. + if (new_hide_online != mOriginalHideOnlineStatus) + { + if (new_hide_online) mDirectoryVisibility = VISIBILITY_HIDDEN; + else mDirectoryVisibility = VISIBILITY_DEFAULT; + //Update showonline value, otherwise multiple applys won't work + mOriginalHideOnlineStatus = new_hide_online; + } + gAgent.sendAgentUpdateUserInfo(new_im_via_email,mDirectoryVisibility); + } + } + + saveAvatarProperties(); + + if (mClickActionDirty) + { + updateClickActionSettings(); + mClickActionDirty = false; + } } void LLFloaterPreference::cancel() { - LLTabContainer* tabcontainer = getChild("pref core"); - // Call cancel() on all panels that derive from LLPanelPreference - for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); - iter != tabcontainer->getChildList()->end(); ++iter) - { - LLView* view = *iter; - LLPanelPreference* panel = dynamic_cast(view); - if (panel) - panel->cancel(); - } - // hide joystick pref floater - LLFloaterReg::hideInstance("pref_joystick"); - - // hide translation settings floater - LLFloaterReg::hideInstance("prefs_translation"); - - // hide autoreplace settings floater - LLFloaterReg::hideInstance("prefs_autoreplace"); - - // hide spellchecker settings folder - LLFloaterReg::hideInstance("prefs_spellchecker"); - - // hide advanced graphics floater - LLFloaterReg::hideInstance("prefs_graphics_advanced"); - - // reverts any changes to current skin - gSavedSettings.setString("SkinCurrent", sSkin); - - if (mClickActionDirty) - { - updateClickActionControls(); - mClickActionDirty = false; - } - - LLFloaterPreferenceProxy * advanced_proxy_settings = LLFloaterReg::findTypedInstance("prefs_proxy"); - if (advanced_proxy_settings) - { - advanced_proxy_settings->cancel(); - } - //Need to reload the navmesh if the pathing console is up - LLHandle pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle(); - if ( !pathfindingConsoleHandle.isDead() ) - { - LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get(); - pPathfindingConsole->onRegionBoundaryCross(); - } - - if (!mSavedGraphicsPreset.empty()) - { - gSavedSettings.setString("PresetGraphicActive", mSavedGraphicsPreset); - LLPresetsManager::getInstance()->triggerChangeSignal(); - } + LLTabContainer* tabcontainer = getChild("pref core"); + // Call cancel() on all panels that derive from LLPanelPreference + for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); + iter != tabcontainer->getChildList()->end(); ++iter) + { + LLView* view = *iter; + LLPanelPreference* panel = dynamic_cast(view); + if (panel) + panel->cancel(); + } + // hide joystick pref floater + LLFloaterReg::hideInstance("pref_joystick"); + + // hide translation settings floater + LLFloaterReg::hideInstance("prefs_translation"); + + // hide autoreplace settings floater + LLFloaterReg::hideInstance("prefs_autoreplace"); + + // hide spellchecker settings folder + LLFloaterReg::hideInstance("prefs_spellchecker"); + + // hide advanced graphics floater + LLFloaterReg::hideInstance("prefs_graphics_advanced"); + + // reverts any changes to current skin + gSavedSettings.setString("SkinCurrent", sSkin); + + if (mClickActionDirty) + { + updateClickActionControls(); + mClickActionDirty = false; + } + + LLFloaterPreferenceProxy * advanced_proxy_settings = LLFloaterReg::findTypedInstance("prefs_proxy"); + if (advanced_proxy_settings) + { + advanced_proxy_settings->cancel(); + } + //Need to reload the navmesh if the pathing console is up + LLHandle pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle(); + if ( !pathfindingConsoleHandle.isDead() ) + { + LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get(); + pPathfindingConsole->onRegionBoundaryCross(); + } + + if (!mSavedGraphicsPreset.empty()) + { + gSavedSettings.setString("PresetGraphicActive", mSavedGraphicsPreset); + LLPresetsManager::getInstance()->triggerChangeSignal(); + } } void LLFloaterPreference::onOpen(const LLSD& key) { - // this variable and if that follows it are used to properly handle do not disturb mode response message - static bool initialized = FALSE; - // if user is logged in and we haven't initialized do not disturb mode response yet, do it - if (!initialized && LLStartUp::getStartupState() == STATE_STARTED) - { - // Special approach is used for do not disturb response localization, because "DoNotDisturbModeResponse" is - // in non-localizable xml, and also because it may be changed by user and in this case it shouldn't be localized. - // To keep track of whether do not disturb response is default or changed by user additional setting DoNotDisturbResponseChanged - // was added into per account settings. - - // initialization should happen once,so setting variable to TRUE - initialized = TRUE; - // this connection is needed to properly set "DoNotDisturbResponseChanged" setting when user makes changes in - // do not disturb response message. - gSavedPerAccountSettings.getControl("DoNotDisturbModeResponse")->getSignal()->connect(boost::bind(&LLFloaterPreference::onDoNotDisturbResponseChanged, this)); - } - gAgent.sendAgentUserInfoRequest(); - - /////////////////////////// From LLPanelGeneral ////////////////////////// - // if we have no agent, we can't let them choose anything - // if we have an agent, then we only let them choose if they have a choice - bool can_choose_maturity = - gAgent.getID().notNull() && - (gAgent.isMature() || gAgent.isGodlike()); - - LLComboBox* maturity_combo = getChild("maturity_desired_combobox"); - LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest( gAgent.getID() ); - if (can_choose_maturity) - { - // if they're not adult or a god, they shouldn't see the adult selection, so delete it - if (!gAgent.isAdult() && !gAgent.isGodlikeWithoutAdminMenuFakery()) - { - // we're going to remove the adult entry from the combo - LLScrollListCtrl* maturity_list = maturity_combo->findChild("ComboBox"); - if (maturity_list) - { - maturity_list->deleteItems(LLSD(SIM_ACCESS_ADULT)); - } - } - getChildView("maturity_desired_combobox")->setEnabled( true); - getChildView("maturity_desired_textbox")->setVisible( false); - } - else - { - getChild("maturity_desired_textbox")->setValue(maturity_combo->getSelectedItemLabel()); - getChildView("maturity_desired_combobox")->setEnabled( false); - } - - // Forget previous language changes. - mLanguageChanged = false; - - // Display selected maturity icons. - onChangeMaturity(); - - onChangeModelFolder(); - onChangeTextureFolder(); - onChangeSoundFolder(); - onChangeAnimationFolder(); - - // Load (double-)click to walk/teleport settings. - updateClickActionControls(); - - // Enabled/disabled popups, might have been changed by user actions - // while preferences floater was closed. - buildPopupLists(); - - - //get the options that were checked - onNotificationsChange("FriendIMOptions"); - onNotificationsChange("NonFriendIMOptions"); - onNotificationsChange("ConferenceIMOptions"); - onNotificationsChange("GroupChatOptions"); - onNotificationsChange("NearbyChatOptions"); - onNotificationsChange("ObjectIMOptions"); - - LLPanelLogin::setAlwaysRefresh(true); - refresh(); - - // Make sure the current state of prefs are saved away when - // when the floater is opened. That will make cancel do its - // job - saveSettings(); - - // Make sure there is a default preference file - LLPresetsManager::getInstance()->createMissingDefault(PRESETS_CAMERA); - LLPresetsManager::getInstance()->createMissingDefault(PRESETS_GRAPHIC); - - bool started = (LLStartUp::getStartupState() == STATE_STARTED); - - LLButton* load_btn = findChild("PrefLoadButton"); - LLButton* save_btn = findChild("PrefSaveButton"); - LLButton* delete_btn = findChild("PrefDeleteButton"); - LLButton* exceptions_btn = findChild("RenderExceptionsButton"); - - if (load_btn && save_btn && delete_btn && exceptions_btn) - { - load_btn->setEnabled(started); - save_btn->setEnabled(started); - delete_btn->setEnabled(started); - exceptions_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); - } + // this variable and if that follows it are used to properly handle do not disturb mode response message + static bool initialized = FALSE; + // if user is logged in and we haven't initialized do not disturb mode response yet, do it + if (!initialized && LLStartUp::getStartupState() == STATE_STARTED) + { + // Special approach is used for do not disturb response localization, because "DoNotDisturbModeResponse" is + // in non-localizable xml, and also because it may be changed by user and in this case it shouldn't be localized. + // To keep track of whether do not disturb response is default or changed by user additional setting DoNotDisturbResponseChanged + // was added into per account settings. + + // initialization should happen once,so setting variable to TRUE + initialized = TRUE; + // this connection is needed to properly set "DoNotDisturbResponseChanged" setting when user makes changes in + // do not disturb response message. + gSavedPerAccountSettings.getControl("DoNotDisturbModeResponse")->getSignal()->connect(boost::bind(&LLFloaterPreference::onDoNotDisturbResponseChanged, this)); + } + gAgent.sendAgentUserInfoRequest(); + + /////////////////////////// From LLPanelGeneral ////////////////////////// + // if we have no agent, we can't let them choose anything + // if we have an agent, then we only let them choose if they have a choice + bool can_choose_maturity = + gAgent.getID().notNull() && + (gAgent.isMature() || gAgent.isGodlike()); + + LLComboBox* maturity_combo = getChild("maturity_desired_combobox"); + LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest( gAgent.getID() ); + if (can_choose_maturity) + { + // if they're not adult or a god, they shouldn't see the adult selection, so delete it + if (!gAgent.isAdult() && !gAgent.isGodlikeWithoutAdminMenuFakery()) + { + // we're going to remove the adult entry from the combo + LLScrollListCtrl* maturity_list = maturity_combo->findChild("ComboBox"); + if (maturity_list) + { + maturity_list->deleteItems(LLSD(SIM_ACCESS_ADULT)); + } + } + getChildView("maturity_desired_combobox")->setEnabled( true); + getChildView("maturity_desired_textbox")->setVisible( false); + } + else + { + getChild("maturity_desired_textbox")->setValue(maturity_combo->getSelectedItemLabel()); + getChildView("maturity_desired_combobox")->setEnabled( false); + } + + // Forget previous language changes. + mLanguageChanged = false; + + // Display selected maturity icons. + onChangeMaturity(); + + onChangeModelFolder(); + onChangeTextureFolder(); + onChangeSoundFolder(); + onChangeAnimationFolder(); + + // Load (double-)click to walk/teleport settings. + updateClickActionControls(); + + // Enabled/disabled popups, might have been changed by user actions + // while preferences floater was closed. + buildPopupLists(); + + + //get the options that were checked + onNotificationsChange("FriendIMOptions"); + onNotificationsChange("NonFriendIMOptions"); + onNotificationsChange("ConferenceIMOptions"); + onNotificationsChange("GroupChatOptions"); + onNotificationsChange("NearbyChatOptions"); + onNotificationsChange("ObjectIMOptions"); + + LLPanelLogin::setAlwaysRefresh(true); + refresh(); + + // Make sure the current state of prefs are saved away when + // when the floater is opened. That will make cancel do its + // job + saveSettings(); + + // Make sure there is a default preference file + LLPresetsManager::getInstance()->createMissingDefault(PRESETS_CAMERA); + LLPresetsManager::getInstance()->createMissingDefault(PRESETS_GRAPHIC); + + bool started = (LLStartUp::getStartupState() == STATE_STARTED); + + LLButton* load_btn = findChild("PrefLoadButton"); + LLButton* save_btn = findChild("PrefSaveButton"); + LLButton* delete_btn = findChild("PrefDeleteButton"); + LLButton* exceptions_btn = findChild("RenderExceptionsButton"); + + if (load_btn && save_btn && delete_btn && exceptions_btn) + { + load_btn->setEnabled(started); + save_btn->setEnabled(started); + delete_btn->setEnabled(started); + exceptions_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() { - refreshEnabledGraphics(); + refreshEnabledGraphics(); } void LLFloaterPreferenceGraphicsAdvanced::onVertexShaderEnable() { - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->refresh(); - } + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->refresh(); + } - refreshEnabledGraphics(); + refreshEnabledGraphics(); } void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledGraphics() { - refreshEnabledState(); + refreshEnabledState(); } void LLFloaterPreference::onAvatarImpostorsEnable() { - refreshEnabledGraphics(); + refreshEnabledGraphics(); } //static void LLFloaterPreference::initDoNotDisturbResponse() - { - if (!gSavedPerAccountSettings.getBOOL("DoNotDisturbResponseChanged")) - { - //LLTrans::getString("DoNotDisturbModeResponseDefault") is used here for localization (EXT-5885) - gSavedPerAccountSettings.setString("DoNotDisturbModeResponse", LLTrans::getString("DoNotDisturbModeResponseDefault")); - } - } + { + if (!gSavedPerAccountSettings.getBOOL("DoNotDisturbResponseChanged")) + { + //LLTrans::getString("DoNotDisturbModeResponseDefault") is used here for localization (EXT-5885) + gSavedPerAccountSettings.setString("DoNotDisturbModeResponse", LLTrans::getString("DoNotDisturbModeResponseDefault")); + } + } //static void LLFloaterPreference::updateShowFavoritesCheckbox(bool val) { - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->getChild("favorites_on_login_check")->setValue(val); - } + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->getChild("favorites_on_login_check")->setValue(val); + } } void LLFloaterPreference::setHardwareDefaults() { - std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); - if (!preset_graphic_active.empty()) - { - saveGraphicsPreset(preset_graphic_active); - saveSettings(); // save here to be able to return to the previous preset by Cancel - } + std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); + if (!preset_graphic_active.empty()) + { + saveGraphicsPreset(preset_graphic_active); + saveSettings(); // save here to be able to return to the previous preset by Cancel + } - LLFeatureManager::getInstance()->applyRecommendedSettings(); + LLFeatureManager::getInstance()->applyRecommendedSettings(); - // reset indirects before refresh because we may have changed what they control - LLAvatarComplexityControls::setIndirectControls(); + // reset indirects before refresh because we may have changed what they control + LLAvatarComplexityControls::setIndirectControls(); - refreshEnabledGraphics(); - gSavedSettings.setString("PresetGraphicActive", ""); - LLPresetsManager::getInstance()->triggerChangeSignal(); + refreshEnabledGraphics(); + gSavedSettings.setString("PresetGraphicActive", ""); + LLPresetsManager::getInstance()->triggerChangeSignal(); - LLTabContainer* tabcontainer = getChild("pref core"); - child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); - child_list_t::const_iterator end = tabcontainer->getChildList()->end(); - for ( ; iter != end; ++iter) - { - LLView* view = *iter; - LLPanelPreference* panel = dynamic_cast(view); - if (panel) - { - panel->setHardwareDefaults(); - } - } + LLTabContainer* tabcontainer = getChild("pref core"); + child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); + child_list_t::const_iterator end = tabcontainer->getChildList()->end(); + for ( ; iter != end; ++iter) + { + LLView* view = *iter; + LLPanelPreference* panel = dynamic_cast(view); + if (panel) + { + panel->setHardwareDefaults(); + } + } } void LLFloaterPreference::getControlNames(std::vector& names) { - LLView* view = findChild("display"); - LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); - if (view && advanced) - { - std::list stack; - stack.push_back(view); - stack.push_back(advanced); - while(!stack.empty()) - { - // Process view on top of the stack - LLView* curview = stack.front(); - stack.pop_front(); - - LLUICtrl* ctrl = dynamic_cast(curview); - if (ctrl) - { - LLControlVariable* control = ctrl->getControlVariable(); - if (control) - { - std::string control_name = control->getName(); - if (std::find(names.begin(), names.end(), control_name) == names.end()) - { - names.push_back(control_name); - } - } - } - - for (child_list_t::const_iterator iter = curview->getChildList()->begin(); - iter != curview->getChildList()->end(); ++iter) - { - stack.push_back(*iter); - } - } - } + LLView* view = findChild("display"); + LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); + if (view && advanced) + { + std::list stack; + stack.push_back(view); + stack.push_back(advanced); + while(!stack.empty()) + { + // Process view on top of the stack + LLView* curview = stack.front(); + stack.pop_front(); + + LLUICtrl* ctrl = dynamic_cast(curview); + if (ctrl) + { + LLControlVariable* control = ctrl->getControlVariable(); + if (control) + { + std::string control_name = control->getName(); + if (std::find(names.begin(), names.end(), control_name) == names.end()) + { + names.push_back(control_name); + } + } + } + + for (child_list_t::const_iterator iter = curview->getChildList()->begin(); + iter != curview->getChildList()->end(); ++iter) + { + stack.push_back(*iter); + } + } + } } //virtual void LLFloaterPreference::onClose(bool app_quitting) { - gSavedSettings.setS32("LastPrefTab", getChild("pref core")->getCurrentPanelIndex()); - LLPanelLogin::setAlwaysRefresh(false); - if (!app_quitting) - { - cancel(); - } + gSavedSettings.setS32("LastPrefTab", getChild("pref core")->getCurrentPanelIndex()); + LLPanelLogin::setAlwaysRefresh(false); + if (!app_quitting) + { + cancel(); + } } // static void LLFloaterPreference::onBtnOK(const LLSD& userdata) { - // commit any outstanding text entry - if (hasFocus()) - { - LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); - if (cur_focus && cur_focus->acceptsTextInput()) - { - cur_focus->onCommit(); - } - } - - if (canClose()) - { - saveSettings(); - apply(); - - if (userdata.asString() == "closeadvanced") - { - LLFloaterReg::hideInstance("prefs_graphics_advanced"); - } - else - { - closeFloater(false); - } - - //Conversation transcript and log path changed so reload conversations based on new location - if(mPriorInstantMessageLogPath.length()) - { - if(moveTranscriptsAndLog()) - { - //When floaters are empty but have a chat history files, reload chat history into them - LLFloaterIMSessionTab::reloadEmptyFloaters(); - } - //Couldn't move files so restore the old path and show a notification - else - { - gSavedPerAccountSettings.setString("InstantMessageLogPath", mPriorInstantMessageLogPath); - LLNotificationsUtil::add("PreferenceChatPathChanged"); - } - mPriorInstantMessageLogPath.clear(); - } - - LLUIColorTable::instance().saveUserSettings(); - gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); - - //Only save once logged in and loaded per account settings - if(mGotPersonalInfo) - { - gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE); - } - } - else - { - // Show beep, pop up dialog, etc. - LL_INFOS() << "Can't close preferences!" << LL_ENDL; - } - - LLPanelLogin::updateLocationSelectorsVisibility(); - //Need to reload the navmesh if the pathing console is up - LLHandle pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle(); - if ( !pathfindingConsoleHandle.isDead() ) - { - LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get(); - pPathfindingConsole->onRegionBoundaryCross(); - } + // commit any outstanding text entry + if (hasFocus()) + { + LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); + if (cur_focus && cur_focus->acceptsTextInput()) + { + cur_focus->onCommit(); + } + } + + if (canClose()) + { + saveSettings(); + apply(); + + if (userdata.asString() == "closeadvanced") + { + LLFloaterReg::hideInstance("prefs_graphics_advanced"); + } + else + { + closeFloater(false); + } + + //Conversation transcript and log path changed so reload conversations based on new location + if(mPriorInstantMessageLogPath.length()) + { + if(moveTranscriptsAndLog()) + { + //When floaters are empty but have a chat history files, reload chat history into them + LLFloaterIMSessionTab::reloadEmptyFloaters(); + } + //Couldn't move files so restore the old path and show a notification + else + { + gSavedPerAccountSettings.setString("InstantMessageLogPath", mPriorInstantMessageLogPath); + LLNotificationsUtil::add("PreferenceChatPathChanged"); + } + mPriorInstantMessageLogPath.clear(); + } + + LLUIColorTable::instance().saveUserSettings(); + gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); + + //Only save once logged in and loaded per account settings + if(mGotPersonalInfo) + { + gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE); + } + } + else + { + // Show beep, pop up dialog, etc. + LL_INFOS() << "Can't close preferences!" << LL_ENDL; + } + + LLPanelLogin::updateLocationSelectorsVisibility(); + //Need to reload the navmesh if the pathing console is up + LLHandle pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle(); + if ( !pathfindingConsoleHandle.isDead() ) + { + LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get(); + pPathfindingConsole->onRegionBoundaryCross(); + } } // static void LLFloaterPreference::onBtnCancel(const LLSD& userdata) { - if (hasFocus()) - { - LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); - if (cur_focus && cur_focus->acceptsTextInput()) - { - cur_focus->onCommit(); - } - refresh(); - } - cancel(); - - if (userdata.asString() == "closeadvanced") - { - LLFloaterReg::hideInstance("prefs_graphics_advanced"); - } - else - { - closeFloater(); - } + if (hasFocus()) + { + LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); + if (cur_focus && cur_focus->acceptsTextInput()) + { + cur_focus->onCommit(); + } + refresh(); + } + cancel(); + + if (userdata.asString() == "closeadvanced") + { + LLFloaterReg::hideInstance("prefs_graphics_advanced"); + } + else + { + closeFloater(); + } } // static void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_via_email, bool is_verified_email) { - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { instance->setPersonalInfo(visibility, im_via_email, is_verified_email); - } + } } void LLFloaterPreference::refreshEnabledGraphics() { - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->refresh(); - } + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->refresh(); + } - LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); - if (advanced) - { - advanced->refresh(); - } + LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); + if (advanced) + { + advanced->refresh(); + } } void LLFloaterPreference::onClickClearCache() { - LLNotificationsUtil::add("ConfirmClearCache", LLSD(), LLSD(), callback_clear_cache); + LLNotificationsUtil::add("ConfirmClearCache", LLSD(), LLSD(), callback_clear_cache); } void LLFloaterPreference::onClickBrowserClearCache() { - LLNotificationsUtil::add("ConfirmClearBrowserCache", LLSD(), LLSD(), callback_clear_browser_cache); + LLNotificationsUtil::add("ConfirmClearBrowserCache", LLSD(), LLSD(), callback_clear_browser_cache); } // Called when user changes language via the combobox. void LLFloaterPreference::onLanguageChange() { - // Let the user know that the change will only take effect after restart. - // Do it only once so that we're not too irritating. - if (!mLanguageChanged) - { - LLNotificationsUtil::add("ChangeLanguage"); - mLanguageChanged = true; - } + // Let the user know that the change will only take effect after restart. + // Do it only once so that we're not too irritating. + if (!mLanguageChanged) + { + LLNotificationsUtil::add("ChangeLanguage"); + mLanguageChanged = true; + } } void LLFloaterPreference::onNotificationsChange(const std::string& OptionName) { - mNotificationOptions[OptionName] = getChild(OptionName)->getSelectedItemLabel(); + mNotificationOptions[OptionName] = getChild(OptionName)->getSelectedItemLabel(); - bool show_notifications_alert = true; - for (notifications_map::iterator it_notification = mNotificationOptions.begin(); it_notification != mNotificationOptions.end(); it_notification++) - { - if(it_notification->second != "No action") - { - show_notifications_alert = false; - break; - } - } + bool show_notifications_alert = true; + for (notifications_map::iterator it_notification = mNotificationOptions.begin(); it_notification != mNotificationOptions.end(); it_notification++) + { + if(it_notification->second != "No action") + { + show_notifications_alert = false; + break; + } + } - getChild("notifications_alert")->setVisible(show_notifications_alert); + getChild("notifications_alert")->setVisible(show_notifications_alert); } void LLFloaterPreference::onNameTagOpacityChange(const LLSD& newvalue) { - LLColorSwatchCtrl* color_swatch = findChild("background"); - if (color_swatch) - { - LLColor4 new_color = color_swatch->get(); - color_swatch->set( new_color.setAlpha(newvalue.asReal()) ); - } + LLColorSwatchCtrl* color_swatch = findChild("background"); + if (color_swatch) + { + LLColor4 new_color = color_swatch->get(); + color_swatch->set( new_color.setAlpha(newvalue.asReal()) ); + } } void LLFloaterPreference::onClickSetCache() { - std::string cur_name(gSavedSettings.getString("CacheLocation")); -// std::string cur_top_folder(gDirUtilp->getBaseFileName(cur_name)); - - std::string proposed_name(cur_name); + std::string cur_name(gSavedSettings.getString("CacheLocation")); +// std::string cur_top_folder(gDirUtilp->getBaseFileName(cur_name)); + + std::string proposed_name(cur_name); - (new LLDirPickerThread(boost::bind(&LLFloaterPreference::changeCachePath, this, _1, _2), proposed_name))->getFile(); + (new LLDirPickerThread(boost::bind(&LLFloaterPreference::changeCachePath, this, _1, _2), proposed_name))->getFile(); } void LLFloaterPreference::changeCachePath(const std::vector& filenames, std::string proposed_name) { - std::string dir_name = filenames[0]; - if (!dir_name.empty() && dir_name != proposed_name) - { - std::string new_top_folder(gDirUtilp->getBaseFileName(dir_name)); - LLNotificationsUtil::add("CacheWillBeMoved"); - gSavedSettings.setString("NewCacheLocation", dir_name); - gSavedSettings.setString("NewCacheLocationTopFolder", new_top_folder); - } - else - { - std::string cache_location = gDirUtilp->getCacheDir(); - gSavedSettings.setString("CacheLocation", cache_location); - std::string top_folder(gDirUtilp->getBaseFileName(cache_location)); - gSavedSettings.setString("CacheLocationTopFolder", top_folder); - } + std::string dir_name = filenames[0]; + if (!dir_name.empty() && dir_name != proposed_name) + { + std::string new_top_folder(gDirUtilp->getBaseFileName(dir_name)); + LLNotificationsUtil::add("CacheWillBeMoved"); + gSavedSettings.setString("NewCacheLocation", dir_name); + gSavedSettings.setString("NewCacheLocationTopFolder", new_top_folder); + } + else + { + std::string cache_location = gDirUtilp->getCacheDir(); + gSavedSettings.setString("CacheLocation", cache_location); + std::string top_folder(gDirUtilp->getBaseFileName(cache_location)); + gSavedSettings.setString("CacheLocationTopFolder", top_folder); + } } void LLFloaterPreference::onClickResetCache() { - if (gDirUtilp->getCacheDir(false) == gDirUtilp->getCacheDir(true)) - { - // The cache location was already the default. - return; - } - gSavedSettings.setString("NewCacheLocation", ""); - gSavedSettings.setString("NewCacheLocationTopFolder", ""); - LLNotificationsUtil::add("CacheWillBeMoved"); - std::string cache_location = gDirUtilp->getCacheDir(false); - gSavedSettings.setString("CacheLocation", cache_location); - std::string top_folder(gDirUtilp->getBaseFileName(cache_location)); - gSavedSettings.setString("CacheLocationTopFolder", top_folder); + if (gDirUtilp->getCacheDir(false) == gDirUtilp->getCacheDir(true)) + { + // The cache location was already the default. + return; + } + gSavedSettings.setString("NewCacheLocation", ""); + gSavedSettings.setString("NewCacheLocationTopFolder", ""); + LLNotificationsUtil::add("CacheWillBeMoved"); + std::string cache_location = gDirUtilp->getCacheDir(false); + gSavedSettings.setString("CacheLocation", cache_location); + std::string top_folder(gDirUtilp->getBaseFileName(cache_location)); + gSavedSettings.setString("CacheLocationTopFolder", top_folder); } void LLFloaterPreference::onClickSkin(LLUICtrl* ctrl, const LLSD& userdata) { - gSavedSettings.setString("SkinCurrent", userdata.asString()); - ctrl->setValue(userdata.asString()); + gSavedSettings.setString("SkinCurrent", userdata.asString()); + ctrl->setValue(userdata.asString()); } void LLFloaterPreference::onSelectSkin() { - std::string skin_selection = getChild("skin_selection")->getValue().asString(); - gSavedSettings.setString("SkinCurrent", skin_selection); + std::string skin_selection = getChild("skin_selection")->getValue().asString(); + gSavedSettings.setString("SkinCurrent", skin_selection); } void LLFloaterPreference::refreshSkin(void* data) { - LLPanel*self = (LLPanel*)data; - sSkin = gSavedSettings.getString("SkinCurrent"); - self->getChild("skin_selection", true)->setValue(sSkin); + LLPanel*self = (LLPanel*)data; + sSkin = gSavedSettings.getString("SkinCurrent"); + self->getChild("skin_selection", true)->setValue(sSkin); } void LLFloaterPreference::buildPopupLists() { - LLScrollListCtrl& disabled_popups = - getChildRef("disabled_popups"); - LLScrollListCtrl& enabled_popups = - getChildRef("enabled_popups"); - - disabled_popups.deleteAllItems(); - enabled_popups.deleteAllItems(); - - for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); - iter != LLNotifications::instance().templatesEnd(); - ++iter) - { - LLNotificationTemplatePtr templatep = iter->second; - LLNotificationFormPtr formp = templatep->mForm; - - LLNotificationForm::EIgnoreType ignore = formp->getIgnoreType(); - if (ignore == LLNotificationForm::IGNORE_NO) - continue; - - LLSD row; - row["columns"][0]["value"] = formp->getIgnoreMessage(); - row["columns"][0]["font"] = "SANSSERIF_SMALL"; - row["columns"][0]["width"] = 400; - - LLScrollListItem* item = NULL; - - bool show_popup = !formp->getIgnored(); - if (!show_popup) - { - if (ignore == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE) - { - LLSD last_response = LLUI::sSettingGroups["config"]->getLLSD("Default" + templatep->mName); - if (!last_response.isUndefined()) - { - for (LLSD::map_const_iterator it = last_response.beginMap(); - it != last_response.endMap(); - ++it) - { - if (it->second.asBoolean()) - { - row["columns"][1]["value"] = formp->getElement(it->first)["ignore"].asString(); - break; - } - } - } - row["columns"][1]["font"] = "SANSSERIF_SMALL"; - row["columns"][1]["width"] = 360; - } - item = disabled_popups.addElement(row); - } - else - { - item = enabled_popups.addElement(row); - } - - if (item) - { - item->setUserdata((void*)&iter->first); - } - } + LLScrollListCtrl& disabled_popups = + getChildRef("disabled_popups"); + LLScrollListCtrl& enabled_popups = + getChildRef("enabled_popups"); + + disabled_popups.deleteAllItems(); + enabled_popups.deleteAllItems(); + + for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); + iter != LLNotifications::instance().templatesEnd(); + ++iter) + { + LLNotificationTemplatePtr templatep = iter->second; + LLNotificationFormPtr formp = templatep->mForm; + + LLNotificationForm::EIgnoreType ignore = formp->getIgnoreType(); + if (ignore == LLNotificationForm::IGNORE_NO) + continue; + + LLSD row; + row["columns"][0]["value"] = formp->getIgnoreMessage(); + row["columns"][0]["font"] = "SANSSERIF_SMALL"; + row["columns"][0]["width"] = 400; + + LLScrollListItem* item = NULL; + + bool show_popup = !formp->getIgnored(); + if (!show_popup) + { + if (ignore == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE) + { + LLSD last_response = LLUI::sSettingGroups["config"]->getLLSD("Default" + templatep->mName); + if (!last_response.isUndefined()) + { + for (LLSD::map_const_iterator it = last_response.beginMap(); + it != last_response.endMap(); + ++it) + { + if (it->second.asBoolean()) + { + row["columns"][1]["value"] = formp->getElement(it->first)["ignore"].asString(); + break; + } + } + } + row["columns"][1]["font"] = "SANSSERIF_SMALL"; + row["columns"][1]["width"] = 360; + } + item = disabled_popups.addElement(row); + } + else + { + item = enabled_popups.addElement(row); + } + + if (item) + { + item->setUserdata((void*)&iter->first); + } + } } void LLFloaterPreference::refreshEnabledState() { - LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); - LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); + LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); + LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); - // if vertex shaders off, disable all shader related products - if (!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable") || - !LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")) - { - ctrl_wind_light->setEnabled(FALSE); - ctrl_wind_light->setValue(FALSE); - } - else - { - ctrl_wind_light->setEnabled(gSavedSettings.getBOOL("VertexShaderEnable")); - } + // if vertex shaders off, disable all shader related products + if (!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable") || + !LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")) + { + ctrl_wind_light->setEnabled(FALSE); + ctrl_wind_light->setValue(FALSE); + } + else + { + ctrl_wind_light->setEnabled(gSavedSettings.getBOOL("VertexShaderEnable")); + } - //Deferred/SSAO/Shadows - BOOL bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump") && gSavedSettings.getBOOL("RenderObjectBump"); - BOOL shaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders") && gSavedSettings.getBOOL("VertexShaderEnable"); - BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && - bumpshiny && - shaders && - gGLManager.mHasFramebufferObject && - gSavedSettings.getBOOL("RenderAvatarVP") && - (ctrl_wind_light->get()) ? TRUE : FALSE; + //Deferred/SSAO/Shadows + BOOL bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump") && gSavedSettings.getBOOL("RenderObjectBump"); + BOOL shaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders") && gSavedSettings.getBOOL("VertexShaderEnable"); + BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && + bumpshiny && + shaders && + gGLManager.mHasFramebufferObject && + gSavedSettings.getBOOL("RenderAvatarVP") && + (ctrl_wind_light->get()) ? TRUE : FALSE; - ctrl_deferred->setEnabled(enabled); + ctrl_deferred->setEnabled(enabled); - // Cannot have floater active until caps have been received - getChild("default_creation_permissions")->setEnabled(LLStartUp::getStartupState() < STATE_STARTED ? false : true); + // Cannot have floater active until caps have been received + getChild("default_creation_permissions")->setEnabled(LLStartUp::getStartupState() < STATE_STARTED ? false : true); - getChildView("block_list")->setEnabled(LLLoginInstance::getInstance()->authSuccess()); + getChildView("block_list")->setEnabled(LLLoginInstance::getInstance()->authSuccess()); } void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() { - LLComboBox* ctrl_reflections = getChild("Reflections"); - LLTextBox* reflections_text = getChild("ReflectionsText"); - - // Reflections - BOOL reflections = gSavedSettings.getBOOL("VertexShaderEnable") - && gGLManager.mHasCubeMap - && LLCubeMap::sUseCubeMaps; - ctrl_reflections->setEnabled(reflections); - reflections_text->setEnabled(reflections); - - // Bump & Shiny - LLCheckBoxCtrl* bumpshiny_ctrl = getChild("BumpShiny"); - bool bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump"); - bumpshiny_ctrl->setEnabled(bumpshiny ? TRUE : FALSE); + LLComboBox* ctrl_reflections = getChild("Reflections"); + LLTextBox* reflections_text = getChild("ReflectionsText"); + + // Reflections + BOOL reflections = gSavedSettings.getBOOL("VertexShaderEnable") + && gGLManager.mHasCubeMap + && LLCubeMap::sUseCubeMaps; + ctrl_reflections->setEnabled(reflections); + reflections_text->setEnabled(reflections); + + // Bump & Shiny + LLCheckBoxCtrl* bumpshiny_ctrl = getChild("BumpShiny"); + bool bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump"); + bumpshiny_ctrl->setEnabled(bumpshiny ? TRUE : FALSE); + + // Avatar Mode + // Enable Avatar Shaders + LLCheckBoxCtrl* ctrl_avatar_vp = getChild("AvatarVertexProgram"); + // Avatar Render Mode + LLCheckBoxCtrl* ctrl_avatar_cloth = getChild("AvatarCloth"); - // Avatar Mode - // Enable Avatar Shaders - LLCheckBoxCtrl* ctrl_avatar_vp = getChild("AvatarVertexProgram"); - // Avatar Render Mode - LLCheckBoxCtrl* ctrl_avatar_cloth = getChild("AvatarCloth"); - - bool avatar_vp_enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarVP"); - if (LLViewerShaderMgr::sInitialized) - { - S32 max_avatar_shader = LLViewerShaderMgr::instance()->mMaxAvatarShaderLevel; - avatar_vp_enabled = (max_avatar_shader > 0) ? TRUE : FALSE; - } - - ctrl_avatar_vp->setEnabled(avatar_vp_enabled); - - if (gSavedSettings.getBOOL("VertexShaderEnable") == FALSE || - gSavedSettings.getBOOL("RenderAvatarVP") == FALSE) - { - ctrl_avatar_cloth->setEnabled(FALSE); - } - else - { - ctrl_avatar_cloth->setEnabled(TRUE); - } - - // Vertex Shaders - // Global Shader Enable - LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); - LLSliderCtrl* terrain_detail = getChild("TerrainDetail"); // can be linked with control var - LLTextBox* terrain_text = getChild("TerrainDetailText"); - - ctrl_shader_enable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")); - - BOOL shaders = ctrl_shader_enable->get(); - if (shaders) - { - terrain_detail->setEnabled(FALSE); - terrain_text->setEnabled(FALSE); - } - else - { - terrain_detail->setEnabled(TRUE); - terrain_text->setEnabled(TRUE); - } - - // WindLight - LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); - LLSliderCtrl* sky = getChild("SkyMeshDetail"); - LLTextBox* sky_text = getChild("SkyMeshDetailText"); - - // *HACK just checks to see if we can use shaders... - // maybe some cards that use shaders, but don't support windlight - ctrl_wind_light->setEnabled(ctrl_shader_enable->getEnabled() && shaders); - - sky->setEnabled(ctrl_wind_light->get() && shaders); - sky_text->setEnabled(ctrl_wind_light->get() && shaders); - - //Deferred/SSAO/Shadows - LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); - - BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && - ((bumpshiny_ctrl && bumpshiny_ctrl->get()) ? TRUE : FALSE) && - shaders && - gGLManager.mHasFramebufferObject && - gSavedSettings.getBOOL("RenderAvatarVP") && - (ctrl_wind_light->get()) ? TRUE : FALSE; - - ctrl_deferred->setEnabled(enabled); - - LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); - LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); - LLComboBox* ctrl_shadow = getChild("ShadowDetail"); - LLTextBox* shadow_text = getChild("RenderShadowDetailText"); - - // note, okay here to get from ctrl_deferred as it's twin, ctrl_deferred2 will alway match it - enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO") && (ctrl_deferred->get() ? TRUE : FALSE); - - ctrl_deferred->set(gSavedSettings.getBOOL("RenderDeferred")); - - ctrl_ssao->setEnabled(enabled); - ctrl_dof->setEnabled(enabled); - - enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail"); - - ctrl_shadow->setEnabled(enabled); - shadow_text->setEnabled(enabled); - - // Hardware settings - F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); - S32Megabytes min_tex_mem = LLViewerTextureList::getMinVideoRamSetting(); - S32Megabytes max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting(false, mem_multiplier); - getChild("GraphicsCardTextureMemory")->setMinValue(min_tex_mem.value()); - getChild("GraphicsCardTextureMemory")->setMaxValue(max_tex_mem.value()); - - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") || - !gGLManager.mHasVertexBufferObject) - { - getChildView("vbo")->setEnabled(FALSE); - } - - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderCompressTextures") || - !gGLManager.mHasVertexBufferObject) - { - getChildView("texture compression")->setEnabled(FALSE); - } - - // if no windlight shaders, turn off nighttime brightness, gamma, and fog distance - LLUICtrl* gamma_ctrl = getChild("gamma"); - gamma_ctrl->setEnabled(!gPipeline.canUseWindLightShaders()); - getChildView("(brightness, lower is brighter)")->setEnabled(!gPipeline.canUseWindLightShaders()); - getChildView("fog")->setEnabled(!gPipeline.canUseWindLightShaders()); - getChildView("antialiasing restart")->setVisible(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred")); - - // now turn off any features that are unavailable - disableUnavailableSettings(); + bool avatar_vp_enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarVP"); + if (LLViewerShaderMgr::sInitialized) + { + S32 max_avatar_shader = LLViewerShaderMgr::instance()->mMaxAvatarShaderLevel; + avatar_vp_enabled = (max_avatar_shader > 0) ? TRUE : FALSE; + } + + ctrl_avatar_vp->setEnabled(avatar_vp_enabled); + + if (gSavedSettings.getBOOL("VertexShaderEnable") == FALSE || + gSavedSettings.getBOOL("RenderAvatarVP") == FALSE) + { + ctrl_avatar_cloth->setEnabled(FALSE); + } + else + { + ctrl_avatar_cloth->setEnabled(TRUE); + } + + // Vertex Shaders + // Global Shader Enable + LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); + LLSliderCtrl* terrain_detail = getChild("TerrainDetail"); // can be linked with control var + LLTextBox* terrain_text = getChild("TerrainDetailText"); + + ctrl_shader_enable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")); + + BOOL shaders = ctrl_shader_enable->get(); + if (shaders) + { + terrain_detail->setEnabled(FALSE); + terrain_text->setEnabled(FALSE); + } + else + { + terrain_detail->setEnabled(TRUE); + terrain_text->setEnabled(TRUE); + } + + // WindLight + LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); + LLSliderCtrl* sky = getChild("SkyMeshDetail"); + LLTextBox* sky_text = getChild("SkyMeshDetailText"); + + // *HACK just checks to see if we can use shaders... + // maybe some cards that use shaders, but don't support windlight + ctrl_wind_light->setEnabled(ctrl_shader_enable->getEnabled() && shaders); + + sky->setEnabled(ctrl_wind_light->get() && shaders); + sky_text->setEnabled(ctrl_wind_light->get() && shaders); + + //Deferred/SSAO/Shadows + LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); + + BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && + ((bumpshiny_ctrl && bumpshiny_ctrl->get()) ? TRUE : FALSE) && + shaders && + gGLManager.mHasFramebufferObject && + gSavedSettings.getBOOL("RenderAvatarVP") && + (ctrl_wind_light->get()) ? TRUE : FALSE; + + ctrl_deferred->setEnabled(enabled); + + LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); + LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); + LLComboBox* ctrl_shadow = getChild("ShadowDetail"); + LLTextBox* shadow_text = getChild("RenderShadowDetailText"); + + // note, okay here to get from ctrl_deferred as it's twin, ctrl_deferred2 will alway match it + enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO") && (ctrl_deferred->get() ? TRUE : FALSE); + + ctrl_deferred->set(gSavedSettings.getBOOL("RenderDeferred")); + + ctrl_ssao->setEnabled(enabled); + ctrl_dof->setEnabled(enabled); + + enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail"); + + ctrl_shadow->setEnabled(enabled); + shadow_text->setEnabled(enabled); + + // Hardware settings + F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); + S32Megabytes min_tex_mem = LLViewerTextureList::getMinVideoRamSetting(); + S32Megabytes max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting(false, mem_multiplier); + getChild("GraphicsCardTextureMemory")->setMinValue(min_tex_mem.value()); + getChild("GraphicsCardTextureMemory")->setMaxValue(max_tex_mem.value()); + + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") || + !gGLManager.mHasVertexBufferObject) + { + getChildView("vbo")->setEnabled(FALSE); + } + + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderCompressTextures") || + !gGLManager.mHasVertexBufferObject) + { + getChildView("texture compression")->setEnabled(FALSE); + } + + // if no windlight shaders, turn off nighttime brightness, gamma, and fog distance + LLUICtrl* gamma_ctrl = getChild("gamma"); + gamma_ctrl->setEnabled(!gPipeline.canUseWindLightShaders()); + getChildView("(brightness, lower is brighter)")->setEnabled(!gPipeline.canUseWindLightShaders()); + getChildView("fog")->setEnabled(!gPipeline.canUseWindLightShaders()); + getChildView("antialiasing restart")->setVisible(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred")); + + // now turn off any features that are unavailable + disableUnavailableSettings(); } // static void LLAvatarComplexityControls::setIndirectControls() { - /* - * We have controls that have an indirect relationship between the control - * values and adjacent text and the underlying setting they influence. - * In each case, the control and its associated setting are named Indirect - * This method interrogates the controlled setting and establishes the - * appropriate value for the indirect control. It must be called whenever the - * underlying setting may have changed other than through the indirect control, - * such as when the 'Reset all to recommended settings' button is used... - */ - setIndirectMaxNonImpostors(); - setIndirectMaxArc(); + /* + * We have controls that have an indirect relationship between the control + * values and adjacent text and the underlying setting they influence. + * In each case, the control and its associated setting are named Indirect + * This method interrogates the controlled setting and establishes the + * appropriate value for the indirect control. It must be called whenever the + * underlying setting may have changed other than through the indirect control, + * such as when the 'Reset all to recommended settings' button is used... + */ + setIndirectMaxNonImpostors(); + setIndirectMaxArc(); } // static void LLAvatarComplexityControls::setIndirectMaxNonImpostors() { - U32 max_non_impostors = gSavedSettings.getU32("RenderAvatarMaxNonImpostors"); - // for this one, we just need to make zero, which means off, the max value of the slider - U32 indirect_max_non_impostors = (0 == max_non_impostors) ? LLVOAvatar::IMPOSTORS_OFF : max_non_impostors; - gSavedSettings.setU32("IndirectMaxNonImpostors", indirect_max_non_impostors); + U32 max_non_impostors = gSavedSettings.getU32("RenderAvatarMaxNonImpostors"); + // for this one, we just need to make zero, which means off, the max value of the slider + U32 indirect_max_non_impostors = (0 == max_non_impostors) ? LLVOAvatar::IMPOSTORS_OFF : max_non_impostors; + gSavedSettings.setU32("IndirectMaxNonImpostors", indirect_max_non_impostors); } void LLAvatarComplexityControls::setIndirectMaxArc() { - U32 max_arc = gSavedSettings.getU32("RenderAvatarMaxComplexity"); - U32 indirect_max_arc; - if (0 == max_arc) - { - // the off position is all the way to the right, so set to control max - indirect_max_arc = INDIRECT_MAX_ARC_OFF; - } - else - { - // This is the inverse of the calculation in updateMaxComplexity - indirect_max_arc = (U32)ll_round(((log(F32(max_arc)) - MIN_ARC_LOG) / ARC_LIMIT_MAP_SCALE)) + MIN_INDIRECT_ARC_LIMIT; - } - gSavedSettings.setU32("IndirectMaxComplexity", indirect_max_arc); + U32 max_arc = gSavedSettings.getU32("RenderAvatarMaxComplexity"); + U32 indirect_max_arc; + if (0 == max_arc) + { + // the off position is all the way to the right, so set to control max + indirect_max_arc = INDIRECT_MAX_ARC_OFF; + } + else + { + // This is the inverse of the calculation in updateMaxComplexity + indirect_max_arc = (U32)ll_round(((log(F32(max_arc)) - MIN_ARC_LOG) / ARC_LIMIT_MAP_SCALE)) + MIN_INDIRECT_ARC_LIMIT; + } + gSavedSettings.setU32("IndirectMaxComplexity", indirect_max_arc); } void LLFloaterPreferenceGraphicsAdvanced::disableUnavailableSettings() -{ - LLComboBox* ctrl_reflections = getChild("Reflections"); - LLTextBox* reflections_text = getChild("ReflectionsText"); - LLCheckBoxCtrl* ctrl_avatar_vp = getChild("AvatarVertexProgram"); - LLCheckBoxCtrl* ctrl_avatar_cloth = getChild("AvatarCloth"); - LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); - LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); - LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); - LLComboBox* ctrl_shadows = getChild("ShadowDetail"); - LLTextBox* shadows_text = getChild("RenderShadowDetailText"); - LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); - LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); - LLSliderCtrl* sky = getChild("SkyMeshDetail"); - LLTextBox* sky_text = getChild("SkyMeshDetailText"); - - // if vertex shaders off, disable all shader related products - if (!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")) - { - ctrl_shader_enable->setEnabled(FALSE); - ctrl_shader_enable->setValue(FALSE); - - ctrl_wind_light->setEnabled(FALSE); - ctrl_wind_light->setValue(FALSE); - - sky->setEnabled(FALSE); - sky_text->setEnabled(FALSE); - - ctrl_reflections->setEnabled(FALSE); - ctrl_reflections->setValue(0); - reflections_text->setEnabled(FALSE); - - ctrl_avatar_vp->setEnabled(FALSE); - ctrl_avatar_vp->setValue(FALSE); - - ctrl_avatar_cloth->setEnabled(FALSE); - ctrl_avatar_cloth->setValue(FALSE); - - ctrl_shadows->setEnabled(FALSE); - ctrl_shadows->setValue(0); - shadows_text->setEnabled(FALSE); - - ctrl_ssao->setEnabled(FALSE); - ctrl_ssao->setValue(FALSE); - - ctrl_dof->setEnabled(FALSE); - ctrl_dof->setValue(FALSE); - - ctrl_deferred->setEnabled(FALSE); - ctrl_deferred->setValue(FALSE); - } - - // disabled windlight - if (!LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")) - { - ctrl_wind_light->setEnabled(FALSE); - ctrl_wind_light->setValue(FALSE); - - sky->setEnabled(FALSE); - sky_text->setEnabled(FALSE); - - //deferred needs windlight, disable deferred - ctrl_shadows->setEnabled(FALSE); - ctrl_shadows->setValue(0); - shadows_text->setEnabled(FALSE); - - ctrl_ssao->setEnabled(FALSE); - ctrl_ssao->setValue(FALSE); - - ctrl_dof->setEnabled(FALSE); - ctrl_dof->setValue(FALSE); - - ctrl_deferred->setEnabled(FALSE); - ctrl_deferred->setValue(FALSE); - } - - // disabled deferred - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") || - !gGLManager.mHasFramebufferObject) - { - ctrl_shadows->setEnabled(FALSE); - ctrl_shadows->setValue(0); - shadows_text->setEnabled(FALSE); - - ctrl_ssao->setEnabled(FALSE); - ctrl_ssao->setValue(FALSE); - - ctrl_dof->setEnabled(FALSE); - ctrl_dof->setValue(FALSE); - - ctrl_deferred->setEnabled(FALSE); - ctrl_deferred->setValue(FALSE); - } - - // disabled deferred SSAO - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO")) - { - ctrl_ssao->setEnabled(FALSE); - ctrl_ssao->setValue(FALSE); - } - - // disabled deferred shadows - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail")) - { - ctrl_shadows->setEnabled(FALSE); - ctrl_shadows->setValue(0); - shadows_text->setEnabled(FALSE); - } - - // disabled reflections - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderReflectionDetail")) - { - ctrl_reflections->setEnabled(FALSE); - ctrl_reflections->setValue(FALSE); - reflections_text->setEnabled(FALSE); - } - - // disabled av - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarVP")) - { - ctrl_avatar_vp->setEnabled(FALSE); - ctrl_avatar_vp->setValue(FALSE); - - ctrl_avatar_cloth->setEnabled(FALSE); - ctrl_avatar_cloth->setValue(FALSE); - - //deferred needs AvatarVP, disable deferred - ctrl_shadows->setEnabled(FALSE); - ctrl_shadows->setValue(0); - shadows_text->setEnabled(FALSE); - - ctrl_ssao->setEnabled(FALSE); - ctrl_ssao->setValue(FALSE); - - ctrl_dof->setEnabled(FALSE); - ctrl_dof->setValue(FALSE); - - ctrl_deferred->setEnabled(FALSE); - ctrl_deferred->setValue(FALSE); - } - - // disabled cloth - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarCloth")) - { - ctrl_avatar_cloth->setEnabled(FALSE); - ctrl_avatar_cloth->setValue(FALSE); - } +{ + LLComboBox* ctrl_reflections = getChild("Reflections"); + LLTextBox* reflections_text = getChild("ReflectionsText"); + LLCheckBoxCtrl* ctrl_avatar_vp = getChild("AvatarVertexProgram"); + LLCheckBoxCtrl* ctrl_avatar_cloth = getChild("AvatarCloth"); + LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); + LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); + LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); + LLComboBox* ctrl_shadows = getChild("ShadowDetail"); + LLTextBox* shadows_text = getChild("RenderShadowDetailText"); + LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); + LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); + LLSliderCtrl* sky = getChild("SkyMeshDetail"); + LLTextBox* sky_text = getChild("SkyMeshDetailText"); + + // if vertex shaders off, disable all shader related products + if (!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")) + { + ctrl_shader_enable->setEnabled(FALSE); + ctrl_shader_enable->setValue(FALSE); + + ctrl_wind_light->setEnabled(FALSE); + ctrl_wind_light->setValue(FALSE); + + sky->setEnabled(FALSE); + sky_text->setEnabled(FALSE); + + ctrl_reflections->setEnabled(FALSE); + ctrl_reflections->setValue(0); + reflections_text->setEnabled(FALSE); + + ctrl_avatar_vp->setEnabled(FALSE); + ctrl_avatar_vp->setValue(FALSE); + + ctrl_avatar_cloth->setEnabled(FALSE); + ctrl_avatar_cloth->setValue(FALSE); + + ctrl_shadows->setEnabled(FALSE); + ctrl_shadows->setValue(0); + shadows_text->setEnabled(FALSE); + + ctrl_ssao->setEnabled(FALSE); + ctrl_ssao->setValue(FALSE); + + ctrl_dof->setEnabled(FALSE); + ctrl_dof->setValue(FALSE); + + ctrl_deferred->setEnabled(FALSE); + ctrl_deferred->setValue(FALSE); + } + + // disabled windlight + if (!LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")) + { + ctrl_wind_light->setEnabled(FALSE); + ctrl_wind_light->setValue(FALSE); + + sky->setEnabled(FALSE); + sky_text->setEnabled(FALSE); + + //deferred needs windlight, disable deferred + ctrl_shadows->setEnabled(FALSE); + ctrl_shadows->setValue(0); + shadows_text->setEnabled(FALSE); + + ctrl_ssao->setEnabled(FALSE); + ctrl_ssao->setValue(FALSE); + + ctrl_dof->setEnabled(FALSE); + ctrl_dof->setValue(FALSE); + + ctrl_deferred->setEnabled(FALSE); + ctrl_deferred->setValue(FALSE); + } + + // disabled deferred + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") || + !gGLManager.mHasFramebufferObject) + { + ctrl_shadows->setEnabled(FALSE); + ctrl_shadows->setValue(0); + shadows_text->setEnabled(FALSE); + + ctrl_ssao->setEnabled(FALSE); + ctrl_ssao->setValue(FALSE); + + ctrl_dof->setEnabled(FALSE); + ctrl_dof->setValue(FALSE); + + ctrl_deferred->setEnabled(FALSE); + ctrl_deferred->setValue(FALSE); + } + + // disabled deferred SSAO + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO")) + { + ctrl_ssao->setEnabled(FALSE); + ctrl_ssao->setValue(FALSE); + } + + // disabled deferred shadows + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail")) + { + ctrl_shadows->setEnabled(FALSE); + ctrl_shadows->setValue(0); + shadows_text->setEnabled(FALSE); + } + + // disabled reflections + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderReflectionDetail")) + { + ctrl_reflections->setEnabled(FALSE); + ctrl_reflections->setValue(FALSE); + reflections_text->setEnabled(FALSE); + } + + // disabled av + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarVP")) + { + ctrl_avatar_vp->setEnabled(FALSE); + ctrl_avatar_vp->setValue(FALSE); + + ctrl_avatar_cloth->setEnabled(FALSE); + ctrl_avatar_cloth->setValue(FALSE); + + //deferred needs AvatarVP, disable deferred + ctrl_shadows->setEnabled(FALSE); + ctrl_shadows->setValue(0); + shadows_text->setEnabled(FALSE); + + ctrl_ssao->setEnabled(FALSE); + ctrl_ssao->setValue(FALSE); + + ctrl_dof->setEnabled(FALSE); + ctrl_dof->setValue(FALSE); + + ctrl_deferred->setEnabled(FALSE); + ctrl_deferred->setValue(FALSE); + } + + // disabled cloth + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarCloth")) + { + ctrl_avatar_cloth->setEnabled(FALSE); + ctrl_avatar_cloth->setValue(FALSE); + } } void LLFloaterPreference::refresh() { - LLPanel::refresh(); + LLPanel::refresh(); LLAvatarComplexityControls::setText( gSavedSettings.getU32("RenderAvatarMaxComplexity"), getChild("IndirectMaxComplexityText", true)); - refreshEnabledState(); - LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); - if (advanced) - { - advanced->refresh(); - } + refreshEnabledState(); + LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); + if (advanced) + { + advanced->refresh(); + } } void LLFloaterPreferenceGraphicsAdvanced::refresh() { - getChild("fsaa")->setValue((LLSD::Integer) gSavedSettings.getU32("RenderFSAASamples")); - - // sliders and their text boxes - // mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow"); - // slider text boxes - updateSliderText(getChild("ObjectMeshDetail", true), getChild("ObjectMeshDetailText", true)); - updateSliderText(getChild("FlexibleMeshDetail", true), getChild("FlexibleMeshDetailText", true)); - updateSliderText(getChild("TreeMeshDetail", true), getChild("TreeMeshDetailText", true)); - updateSliderText(getChild("AvatarMeshDetail", true), getChild("AvatarMeshDetailText", true)); - updateSliderText(getChild("AvatarPhysicsDetail", true), getChild("AvatarPhysicsDetailText", true)); - updateSliderText(getChild("TerrainMeshDetail", true), getChild("TerrainMeshDetailText", true)); - updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true)); - updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); - updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true)); + getChild("fsaa")->setValue((LLSD::Integer) gSavedSettings.getU32("RenderFSAASamples")); + + // sliders and their text boxes + // mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow"); + // slider text boxes + updateSliderText(getChild("ObjectMeshDetail", true), getChild("ObjectMeshDetailText", true)); + updateSliderText(getChild("FlexibleMeshDetail", true), getChild("FlexibleMeshDetailText", true)); + updateSliderText(getChild("TreeMeshDetail", true), getChild("TreeMeshDetailText", true)); + updateSliderText(getChild("AvatarMeshDetail", true), getChild("AvatarMeshDetailText", true)); + updateSliderText(getChild("AvatarPhysicsDetail", true), getChild("AvatarPhysicsDetailText", true)); + updateSliderText(getChild("TerrainMeshDetail", true), getChild("TerrainMeshDetailText", true)); + updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true)); + updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); + updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true)); LLAvatarComplexityControls::setIndirectControls(); - setMaxNonImpostorsText( + setMaxNonImpostorsText( gSavedSettings.getU32("RenderAvatarMaxNonImpostors"), getChild("IndirectMaxNonImpostorsText", true)); LLAvatarComplexityControls::setText( gSavedSettings.getU32("RenderAvatarMaxComplexity"), getChild("IndirectMaxComplexityText", true)); - refreshEnabledState(); + refreshEnabledState(); } void LLFloaterPreference::onCommitWindowedMode() { - refresh(); + refresh(); } void LLFloaterPreference::onChangeQuality(const LLSD& data) { - U32 level = (U32)(data.asReal()); - LLFeatureManager::getInstance()->setGraphicsLevel(level, true); - refreshEnabledGraphics(); - refresh(); + U32 level = (U32)(data.asReal()); + LLFeatureManager::getInstance()->setGraphicsLevel(level, true); + refreshEnabledGraphics(); + refresh(); } void LLFloaterPreference::onClickSetKey() { - LLVoiceSetKeyDialog* dialog = LLFloaterReg::showTypedInstance("voice_set_key", LLSD(), TRUE); - if (dialog) - { - dialog->setParent(this); - } + LLVoiceSetKeyDialog* dialog = LLFloaterReg::showTypedInstance("voice_set_key", LLSD(), TRUE); + if (dialog) + { + dialog->setParent(this); + } } void LLFloaterPreference::setKey(KEY key) { - getChild("modifier_combo")->setValue(LLKeyboard::stringFromKey(key)); - // update the control right away since we no longer wait for apply - getChild("modifier_combo")->onCommit(); + getChild("modifier_combo")->setValue(LLKeyboard::stringFromKey(key)); + // update the control right away since we no longer wait for apply + getChild("modifier_combo")->onCommit(); } void LLFloaterPreference::onClickSetMiddleMouse() { - LLUICtrl* p2t_line_editor = getChild("modifier_combo"); + LLUICtrl* p2t_line_editor = getChild("modifier_combo"); - // update the control right away since we no longer wait for apply - p2t_line_editor->setControlValue(MIDDLE_MOUSE_CV); + // update the control right away since we no longer wait for apply + p2t_line_editor->setControlValue(MIDDLE_MOUSE_CV); - //push2talk button "middle mouse" control value is in English, need to localize it for presentation - LLPanel* advanced_preferences = dynamic_cast(p2t_line_editor->getParent()); - if (advanced_preferences) - { - p2t_line_editor->setValue(advanced_preferences->getString("middle_mouse")); - } + //push2talk button "middle mouse" control value is in English, need to localize it for presentation + LLPanel* advanced_preferences = dynamic_cast(p2t_line_editor->getParent()); + if (advanced_preferences) + { + p2t_line_editor->setValue(advanced_preferences->getString("middle_mouse")); + } } void LLFloaterPreference::onClickSetSounds() { - // Disable Enable gesture sounds checkbox if the master sound is disabled - // or if sound effects are disabled. - getChild("gesture_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds")); + // Disable Enable gesture sounds checkbox if the master sound is disabled + // or if sound effects are disabled. + getChild("gesture_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds")); } /* void LLFloaterPreference::onClickSkipDialogs() { - LLNotificationsUtil::add("SkipShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_skip_dialogs, _1, _2, this)); + LLNotificationsUtil::add("SkipShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_skip_dialogs, _1, _2, this)); } void LLFloaterPreference::onClickResetDialogs() { - LLNotificationsUtil::add("ResetShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_reset_dialogs, _1, _2, this)); + LLNotificationsUtil::add("ResetShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_reset_dialogs, _1, _2, this)); } */ void LLFloaterPreference::onClickEnablePopup() -{ - LLScrollListCtrl& disabled_popups = getChildRef("disabled_popups"); - - std::vector items = disabled_popups.getAllSelected(); - std::vector::iterator itor; - for (itor = items.begin(); itor != items.end(); ++itor) - { - LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata())); - //gSavedSettings.setWarning(templatep->mName, TRUE); - std::string notification_name = templatep->mName; - LLUI::sSettingGroups["ignores"]->setBOOL(notification_name, TRUE); - } - - buildPopupLists(); +{ + LLScrollListCtrl& disabled_popups = getChildRef("disabled_popups"); + + std::vector items = disabled_popups.getAllSelected(); + std::vector::iterator itor; + for (itor = items.begin(); itor != items.end(); ++itor) + { + LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata())); + //gSavedSettings.setWarning(templatep->mName, TRUE); + std::string notification_name = templatep->mName; + LLUI::sSettingGroups["ignores"]->setBOOL(notification_name, TRUE); + } + + buildPopupLists(); } void LLFloaterPreference::onClickDisablePopup() -{ - LLScrollListCtrl& enabled_popups = getChildRef("enabled_popups"); - - std::vector items = enabled_popups.getAllSelected(); - std::vector::iterator itor; - for (itor = items.begin(); itor != items.end(); ++itor) - { - LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata())); - templatep->mForm->setIgnored(true); - } - - buildPopupLists(); +{ + LLScrollListCtrl& enabled_popups = getChildRef("enabled_popups"); + + std::vector items = enabled_popups.getAllSelected(); + std::vector::iterator itor; + for (itor = items.begin(); itor != items.end(); ++itor) + { + LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata())); + templatep->mForm->setIgnored(true); + } + + buildPopupLists(); } void LLFloaterPreference::resetAllIgnored() { - for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); - iter != LLNotifications::instance().templatesEnd(); - ++iter) - { - if (iter->second->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) - { - iter->second->mForm->setIgnored(false); - } - } + for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); + iter != LLNotifications::instance().templatesEnd(); + ++iter) + { + if (iter->second->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) + { + iter->second->mForm->setIgnored(false); + } + } } void LLFloaterPreference::setAllIgnored() { - for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); - iter != LLNotifications::instance().templatesEnd(); - ++iter) - { - if (iter->second->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) - { - iter->second->mForm->setIgnored(true); - } - } + for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); + iter != LLNotifications::instance().templatesEnd(); + ++iter) + { + if (iter->second->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) + { + iter->second->mForm->setIgnored(true); + } + } } void LLFloaterPreference::onClickLogPath() { - std::string proposed_name(gSavedPerAccountSettings.getString("InstantMessageLogPath")); - mPriorInstantMessageLogPath.clear(); - + std::string proposed_name(gSavedPerAccountSettings.getString("InstantMessageLogPath")); + mPriorInstantMessageLogPath.clear(); + - (new LLDirPickerThread(boost::bind(&LLFloaterPreference::changeLogPath, this, _1, _2), proposed_name))->getFile(); + (new LLDirPickerThread(boost::bind(&LLFloaterPreference::changeLogPath, this, _1, _2), proposed_name))->getFile(); } void LLFloaterPreference::changeLogPath(const std::vector& filenames, std::string proposed_name) { - //Path changed - if (proposed_name != filenames[0]) - { - gSavedPerAccountSettings.setString("InstantMessageLogPath", filenames[0]); - mPriorInstantMessageLogPath = proposed_name; + //Path changed + if (proposed_name != filenames[0]) + { + gSavedPerAccountSettings.setString("InstantMessageLogPath", filenames[0]); + mPriorInstantMessageLogPath = proposed_name; - // enable/disable 'Delete transcripts button - updateDeleteTranscriptsButton(); - } + // enable/disable 'Delete transcripts button + updateDeleteTranscriptsButton(); + } } bool LLFloaterPreference::moveTranscriptsAndLog() { - std::string instantMessageLogPath(gSavedPerAccountSettings.getString("InstantMessageLogPath")); - std::string chatLogPath = gDirUtilp->add(instantMessageLogPath, gDirUtilp->getUserName()); - - bool madeDirectory = false; - - //Does the directory really exist, if not then make it - if(!LLFile::isdir(chatLogPath)) - { - //mkdir success is defined as zero - if(LLFile::mkdir(chatLogPath) != 0) - { - return false; - } - madeDirectory = true; - } - - std::string originalConversationLogDir = LLConversationLog::instance().getFileName(); - std::string targetConversationLogDir = gDirUtilp->add(chatLogPath, "conversation.log"); - //Try to move the conversation log - if(!LLConversationLog::instance().moveLog(originalConversationLogDir, targetConversationLogDir)) - { - //Couldn't move the log and created a new directory so remove the new directory - if(madeDirectory) - { - LLFile::rmdir(chatLogPath); - } - return false; - } - - //Attempt to move transcripts - std::vector listOfTranscripts; - std::vector listOfFilesMoved; - - LLLogChat::getListOfTranscriptFiles(listOfTranscripts); - - if(!LLLogChat::moveTranscripts(gDirUtilp->getChatLogsDir(), - instantMessageLogPath, - listOfTranscripts, - listOfFilesMoved)) - { - //Couldn't move all the transcripts so restore those that moved back to their old location - LLLogChat::moveTranscripts(instantMessageLogPath, - gDirUtilp->getChatLogsDir(), - listOfFilesMoved); - - //Move the conversation log back - LLConversationLog::instance().moveLog(targetConversationLogDir, originalConversationLogDir); - - if(madeDirectory) - { - LLFile::rmdir(chatLogPath); - } - - return false; - } - - gDirUtilp->setChatLogsDir(instantMessageLogPath); - gDirUtilp->updatePerAccountChatLogsDir(); - - return true; + std::string instantMessageLogPath(gSavedPerAccountSettings.getString("InstantMessageLogPath")); + std::string chatLogPath = gDirUtilp->add(instantMessageLogPath, gDirUtilp->getUserName()); + + bool madeDirectory = false; + + //Does the directory really exist, if not then make it + if(!LLFile::isdir(chatLogPath)) + { + //mkdir success is defined as zero + if(LLFile::mkdir(chatLogPath) != 0) + { + return false; + } + madeDirectory = true; + } + + std::string originalConversationLogDir = LLConversationLog::instance().getFileName(); + std::string targetConversationLogDir = gDirUtilp->add(chatLogPath, "conversation.log"); + //Try to move the conversation log + if(!LLConversationLog::instance().moveLog(originalConversationLogDir, targetConversationLogDir)) + { + //Couldn't move the log and created a new directory so remove the new directory + if(madeDirectory) + { + LLFile::rmdir(chatLogPath); + } + return false; + } + + //Attempt to move transcripts + std::vector listOfTranscripts; + std::vector listOfFilesMoved; + + LLLogChat::getListOfTranscriptFiles(listOfTranscripts); + + if(!LLLogChat::moveTranscripts(gDirUtilp->getChatLogsDir(), + instantMessageLogPath, + listOfTranscripts, + listOfFilesMoved)) + { + //Couldn't move all the transcripts so restore those that moved back to their old location + LLLogChat::moveTranscripts(instantMessageLogPath, + gDirUtilp->getChatLogsDir(), + listOfFilesMoved); + + //Move the conversation log back + LLConversationLog::instance().moveLog(targetConversationLogDir, originalConversationLogDir); + + if(madeDirectory) + { + LLFile::rmdir(chatLogPath); + } + + return false; + } + + gDirUtilp->setChatLogsDir(instantMessageLogPath); + gDirUtilp->updatePerAccountChatLogsDir(); + + return true; } void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im_via_email, bool is_verified_email) { - mGotPersonalInfo = true; - mOriginalIMViaEmail = im_via_email; - mDirectoryVisibility = visibility; - - if (visibility == VISIBILITY_DEFAULT) - { - mOriginalHideOnlineStatus = false; - getChildView("online_visibility")->setEnabled(TRUE); - } - else if (visibility == VISIBILITY_HIDDEN) - { - mOriginalHideOnlineStatus = true; - getChildView("online_visibility")->setEnabled(TRUE); - } - else - { - mOriginalHideOnlineStatus = true; - } - - getChild("online_searchresults")->setEnabled(TRUE); - getChildView("friends_online_notify_checkbox")->setEnabled(TRUE); - getChild("online_visibility")->setValue(mOriginalHideOnlineStatus); - getChild("online_visibility")->setLabelArg("[DIR_VIS]", mDirectoryVisibility); - getChildView("send_im_to_email")->setEnabled(is_verified_email); + mGotPersonalInfo = true; + mOriginalIMViaEmail = im_via_email; + mDirectoryVisibility = visibility; + + if (visibility == VISIBILITY_DEFAULT) + { + mOriginalHideOnlineStatus = false; + getChildView("online_visibility")->setEnabled(TRUE); + } + else if (visibility == VISIBILITY_HIDDEN) + { + mOriginalHideOnlineStatus = true; + getChildView("online_visibility")->setEnabled(TRUE); + } + else + { + mOriginalHideOnlineStatus = true; + } + + getChild("online_searchresults")->setEnabled(TRUE); + getChildView("friends_online_notify_checkbox")->setEnabled(TRUE); + getChild("online_visibility")->setValue(mOriginalHideOnlineStatus); + getChild("online_visibility")->setLabelArg("[DIR_VIS]", mDirectoryVisibility); + getChildView("send_im_to_email")->setEnabled(is_verified_email); std::string tooltip; if (!is_verified_email) @@ -1867,115 +1867,115 @@ void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im // *TODO: Show or hide verify email text here based on is_verified_email getChild("send_im_to_email")->setValue(im_via_email); - getChildView("favorites_on_login_check")->setEnabled(TRUE); - getChildView("log_path_button")->setEnabled(TRUE); - getChildView("chat_font_size")->setEnabled(TRUE); - getChildView("conversation_log_combo")->setEnabled(TRUE); + getChildView("favorites_on_login_check")->setEnabled(TRUE); + getChildView("log_path_button")->setEnabled(TRUE); + getChildView("chat_font_size")->setEnabled(TRUE); + getChildView("conversation_log_combo")->setEnabled(TRUE); } void LLFloaterPreference::refreshUI() { - refresh(); + refresh(); } void LLFloaterPreferenceGraphicsAdvanced::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box) { - if (text_box == NULL || ctrl== NULL) - return; - - // get range and points when text should change - F32 value = (F32)ctrl->getValue().asReal(); - F32 min = ctrl->getMinValue(); - F32 max = ctrl->getMaxValue(); - F32 range = max - min; - llassert(range > 0); - F32 midPoint = min + range / 3.0f; - F32 highPoint = min + (2.0f * range / 3.0f); - - // choose the right text - if (value < midPoint) - { - text_box->setText(LLTrans::getString("GraphicsQualityLow")); - } - else if (value < highPoint) - { - text_box->setText(LLTrans::getString("GraphicsQualityMid")); - } - else - { - text_box->setText(LLTrans::getString("GraphicsQualityHigh")); - } + if (text_box == NULL || ctrl== NULL) + return; + + // get range and points when text should change + F32 value = (F32)ctrl->getValue().asReal(); + F32 min = ctrl->getMinValue(); + F32 max = ctrl->getMaxValue(); + F32 range = max - min; + llassert(range > 0); + F32 midPoint = min + range / 3.0f; + F32 highPoint = min + (2.0f * range / 3.0f); + + // choose the right text + if (value < midPoint) + { + text_box->setText(LLTrans::getString("GraphicsQualityLow")); + } + else if (value < highPoint) + { + text_box->setText(LLTrans::getString("GraphicsQualityMid")); + } + else + { + text_box->setText(LLTrans::getString("GraphicsQualityHigh")); + } } void LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors() { - // Called when the IndirectMaxNonImpostors control changes - // Responsible for fixing the slider label (IndirectMaxNonImpostorsText) and setting RenderAvatarMaxNonImpostors - LLSliderCtrl* ctrl = getChild("IndirectMaxNonImpostors",true); - U32 value = ctrl->getValue().asInteger(); + // Called when the IndirectMaxNonImpostors control changes + // Responsible for fixing the slider label (IndirectMaxNonImpostorsText) and setting RenderAvatarMaxNonImpostors + LLSliderCtrl* ctrl = getChild("IndirectMaxNonImpostors",true); + U32 value = ctrl->getValue().asInteger(); - if (0 == value || LLVOAvatar::IMPOSTORS_OFF <= value) - { - value=0; - } - gSavedSettings.setU32("RenderAvatarMaxNonImpostors", value); - LLVOAvatar::updateImpostorRendering(value); // make it effective immediately - setMaxNonImpostorsText(value, getChild("IndirectMaxNonImpostorsText")); + if (0 == value || LLVOAvatar::IMPOSTORS_OFF <= value) + { + value=0; + } + gSavedSettings.setU32("RenderAvatarMaxNonImpostors", value); + LLVOAvatar::updateImpostorRendering(value); // make it effective immediately + setMaxNonImpostorsText(value, getChild("IndirectMaxNonImpostorsText")); } void LLFloaterPreferenceGraphicsAdvanced::setMaxNonImpostorsText(U32 value, LLTextBox* text_box) { - if (0 == value) - { - text_box->setText(LLTrans::getString("no_limit")); - } - else - { - text_box->setText(llformat("%d", value)); - } + if (0 == value) + { + text_box->setText(LLTrans::getString("no_limit")); + } + else + { + text_box->setText(llformat("%d", value)); + } } void LLAvatarComplexityControls::updateMax(LLSliderCtrl* slider, LLTextBox* value_label) { - // Called when the IndirectMaxComplexity control changes - // Responsible for fixing the slider label (IndirectMaxComplexityText) and setting RenderAvatarMaxComplexity - U32 indirect_value = slider->getValue().asInteger(); - U32 max_arc; - - if (INDIRECT_MAX_ARC_OFF == indirect_value) - { - // The 'off' position is when the slider is all the way to the right, - // which is a value of INDIRECT_MAX_ARC_OFF, - // so it is necessary to set max_arc to 0 disable muted avatars. - max_arc = 0; - } - else - { - // if this is changed, the inverse calculation in setIndirectMaxArc - // must be changed to match - max_arc = (U32)ll_round(exp(MIN_ARC_LOG + (ARC_LIMIT_MAP_SCALE * (indirect_value - MIN_INDIRECT_ARC_LIMIT)))); - } - - gSavedSettings.setU32("RenderAvatarMaxComplexity", (U32)max_arc); - setText(max_arc, value_label); + // Called when the IndirectMaxComplexity control changes + // Responsible for fixing the slider label (IndirectMaxComplexityText) and setting RenderAvatarMaxComplexity + U32 indirect_value = slider->getValue().asInteger(); + U32 max_arc; + + if (INDIRECT_MAX_ARC_OFF == indirect_value) + { + // The 'off' position is when the slider is all the way to the right, + // which is a value of INDIRECT_MAX_ARC_OFF, + // so it is necessary to set max_arc to 0 disable muted avatars. + max_arc = 0; + } + else + { + // if this is changed, the inverse calculation in setIndirectMaxArc + // must be changed to match + max_arc = (U32)ll_round(exp(MIN_ARC_LOG + (ARC_LIMIT_MAP_SCALE * (indirect_value - MIN_INDIRECT_ARC_LIMIT)))); + } + + gSavedSettings.setU32("RenderAvatarMaxComplexity", (U32)max_arc); + setText(max_arc, value_label); } void LLAvatarComplexityControls::setText(U32 value, LLTextBox* text_box) { - if (0 == value) - { - text_box->setText(LLTrans::getString("no_limit")); - } - else - { - text_box->setText(llformat("%d", value)); - } + if (0 == value) + { + text_box->setText(LLTrans::getString("no_limit")); + } + else + { + text_box->setText(llformat("%d", value)); + } } void LLFloaterPreference::updateMaxComplexity() { - // Called when the IndirectMaxComplexity control changes + // Called when the IndirectMaxComplexity control changes LLAvatarComplexityControls::updateMax( getChild("IndirectMaxComplexity"), getChild("IndirectMaxComplexityText")); @@ -1983,7 +1983,7 @@ void LLFloaterPreference::updateMaxComplexity() void LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity() { - // Called when the IndirectMaxComplexity control changes + // Called when the IndirectMaxComplexity control changes LLAvatarComplexityControls::updateMax( getChild("IndirectMaxComplexity"), getChild("IndirectMaxComplexityText")); @@ -1991,16 +1991,16 @@ void LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity() void LLFloaterPreference::onChangeMaturity() { - U8 sim_access = gSavedSettings.getU32("PreferredMaturity"); + U8 sim_access = gSavedSettings.getU32("PreferredMaturity"); - getChild("rating_icon_general")->setVisible(sim_access == SIM_ACCESS_PG - || sim_access == SIM_ACCESS_MATURE - || sim_access == SIM_ACCESS_ADULT); + getChild("rating_icon_general")->setVisible(sim_access == SIM_ACCESS_PG + || sim_access == SIM_ACCESS_MATURE + || sim_access == SIM_ACCESS_ADULT); - getChild("rating_icon_moderate")->setVisible(sim_access == SIM_ACCESS_MATURE - || sim_access == SIM_ACCESS_ADULT); + getChild("rating_icon_moderate")->setVisible(sim_access == SIM_ACCESS_MATURE + || sim_access == SIM_ACCESS_ADULT); - getChild("rating_icon_adult")->setVisible(sim_access == SIM_ACCESS_ADULT); + getChild("rating_icon_adult")->setVisible(sim_access == SIM_ACCESS_ADULT); } std::string get_category_path(LLUUID cat_id) @@ -2064,23 +2064,23 @@ void LLFloaterPreference::onChangeAnimationFolder() // but the UI for this will still be enabled void LLFloaterPreference::onClickBlockList() { - LLFloaterSidePanelContainer::showPanel("people", "panel_people", - LLSD().with("people_panel_tab_name", "blocked_panel")); + LLFloaterSidePanelContainer::showPanel("people", "panel_people", + LLSD().with("people_panel_tab_name", "blocked_panel")); } void LLFloaterPreference::onClickProxySettings() { - LLFloaterReg::showInstance("prefs_proxy"); + LLFloaterReg::showInstance("prefs_proxy"); } void LLFloaterPreference::onClickTranslationSettings() { - LLFloaterReg::showInstance("prefs_translation"); + LLFloaterReg::showInstance("prefs_translation"); } void LLFloaterPreference::onClickAutoReplace() { - LLFloaterReg::showInstance("prefs_autoreplace"); + LLFloaterReg::showInstance("prefs_autoreplace"); } void LLFloaterPreference::onClickSpellChecker() @@ -2095,141 +2095,141 @@ void LLFloaterPreference::onClickRenderExceptions() void LLFloaterPreference::onClickAdvanced() { - LLFloaterReg::showInstance("prefs_graphics_advanced"); + LLFloaterReg::showInstance("prefs_graphics_advanced"); - LLTabContainer* tabcontainer = getChild("pref core"); - for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); - iter != tabcontainer->getChildList()->end(); ++iter) - { - LLView* view = *iter; - LLPanelPreferenceGraphics* panel = dynamic_cast(view); - if (panel) - { - panel->resetDirtyChilds(); - } - } + LLTabContainer* tabcontainer = getChild("pref core"); + for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); + iter != tabcontainer->getChildList()->end(); ++iter) + { + LLView* view = *iter; + LLPanelPreferenceGraphics* panel = dynamic_cast(view); + if (panel) + { + panel->resetDirtyChilds(); + } + } } void LLFloaterPreference::onClickActionChange() { - mClickActionDirty = true; + mClickActionDirty = true; } void LLFloaterPreference::onClickPermsDefault() { - LLFloaterReg::showInstance("perms_default"); + LLFloaterReg::showInstance("perms_default"); } void LLFloaterPreference::onDeleteTranscripts() { - LLSD args; - args["FOLDER"] = gDirUtilp->getUserName(); + LLSD args; + args["FOLDER"] = gDirUtilp->getUserName(); - LLNotificationsUtil::add("PreferenceChatDeleteTranscripts", args, LLSD(), boost::bind(&LLFloaterPreference::onDeleteTranscriptsResponse, this, _1, _2)); + LLNotificationsUtil::add("PreferenceChatDeleteTranscripts", args, LLSD(), boost::bind(&LLFloaterPreference::onDeleteTranscriptsResponse, this, _1, _2)); } void LLFloaterPreference::onDeleteTranscriptsResponse(const LLSD& notification, const LLSD& response) { - if (0 == LLNotificationsUtil::getSelectedOption(notification, response)) - { - LLLogChat::deleteTranscripts(); - updateDeleteTranscriptsButton(); - } + if (0 == LLNotificationsUtil::getSelectedOption(notification, response)) + { + LLLogChat::deleteTranscripts(); + updateDeleteTranscriptsButton(); + } } void LLFloaterPreference::onLogChatHistorySaved() { - LLButton * delete_transcripts_buttonp = getChild("delete_transcripts"); + LLButton * delete_transcripts_buttonp = getChild("delete_transcripts"); - if (!delete_transcripts_buttonp->getEnabled()) - { - delete_transcripts_buttonp->setEnabled(true); - } + if (!delete_transcripts_buttonp->getEnabled()) + { + delete_transcripts_buttonp->setEnabled(true); + } } void LLFloaterPreference::updateClickActionSettings() { - const int single_clk_action = getChild("single_click_action_combo")->getValue().asInteger(); - const int double_clk_action = getChild("double_click_action_combo")->getValue().asInteger(); + const int single_clk_action = getChild("single_click_action_combo")->getValue().asInteger(); + const int double_clk_action = getChild("double_click_action_combo")->getValue().asInteger(); - gSavedSettings.setBOOL("ClickToWalk", single_clk_action == 1); - gSavedSettings.setBOOL("DoubleClickAutoPilot", double_clk_action == 1); - gSavedSettings.setBOOL("DoubleClickTeleport", double_clk_action == 2); + gSavedSettings.setBOOL("ClickToWalk", single_clk_action == 1); + gSavedSettings.setBOOL("DoubleClickAutoPilot", double_clk_action == 1); + gSavedSettings.setBOOL("DoubleClickTeleport", double_clk_action == 2); } void LLFloaterPreference::updateClickActionControls() { - const bool click_to_walk = gSavedSettings.getBOOL("ClickToWalk"); - const bool dbl_click_to_walk = gSavedSettings.getBOOL("DoubleClickAutoPilot"); - const bool dbl_click_to_teleport = gSavedSettings.getBOOL("DoubleClickTeleport"); + const bool click_to_walk = gSavedSettings.getBOOL("ClickToWalk"); + const bool dbl_click_to_walk = gSavedSettings.getBOOL("DoubleClickAutoPilot"); + const bool dbl_click_to_teleport = gSavedSettings.getBOOL("DoubleClickTeleport"); - getChild("single_click_action_combo")->setValue((int)click_to_walk); - getChild("double_click_action_combo")->setValue(dbl_click_to_teleport ? 2 : (int)dbl_click_to_walk); + getChild("single_click_action_combo")->setValue((int)click_to_walk); + getChild("double_click_action_combo")->setValue(dbl_click_to_teleport ? 2 : (int)dbl_click_to_walk); } void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param) { - LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue())); + LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue())); } void LLFloaterPreference::getUIColor(LLUICtrl* ctrl, const LLSD& param) { - LLColorSwatchCtrl* color_swatch = (LLColorSwatchCtrl*) ctrl; - color_swatch->setOriginal(LLUIColorTable::instance().getColor(param.asString())); + LLColorSwatchCtrl* color_swatch = (LLColorSwatchCtrl*) ctrl; + color_swatch->setOriginal(LLUIColorTable::instance().getColor(param.asString())); } void LLFloaterPreference::setCacheLocation(const LLStringExplicit& location) { - LLUICtrl* cache_location_editor = getChild("cache_location"); - cache_location_editor->setValue(location); - cache_location_editor->setToolTip(location); + LLUICtrl* cache_location_editor = getChild("cache_location"); + cache_location_editor->setValue(location); + cache_location_editor->setToolTip(location); } void LLFloaterPreference::selectPanel(const LLSD& name) { - LLTabContainer * tab_containerp = getChild("pref core"); - LLPanel * panel = tab_containerp->getPanelByName(name); - if (NULL != panel) - { - tab_containerp->selectTabPanel(panel); - } + LLTabContainer * tab_containerp = getChild("pref core"); + LLPanel * panel = tab_containerp->getPanelByName(name); + if (NULL != panel) + { + tab_containerp->selectTabPanel(panel); + } } void LLFloaterPreference::selectPrivacyPanel() { - selectPanel("im"); + selectPanel("im"); } void LLFloaterPreference::selectChatPanel() { - selectPanel("chat"); + selectPanel("chat"); } void LLFloaterPreference::changed() { - getChild("clear_log")->setEnabled(LLConversationLog::instance().getConversations().size() > 0); + getChild("clear_log")->setEnabled(LLConversationLog::instance().getConversations().size() > 0); - // set 'enable' property for 'Delete transcripts...' button - updateDeleteTranscriptsButton(); + // set 'enable' property for 'Delete transcripts...' button + updateDeleteTranscriptsButton(); } void LLFloaterPreference::saveCameraPreset(std::string& preset) { - mSavedCameraPreset = preset; + mSavedCameraPreset = preset; } void LLFloaterPreference::saveGraphicsPreset(std::string& preset) { - mSavedGraphicsPreset = preset; + mSavedGraphicsPreset = preset; } //------------------------------Updater--------------------------------------- static bool handleBandwidthChanged(const LLSD& newvalue) { - gViewerThrottle.setMaxBandwidth((F32) newvalue.asReal()); - return true; + gViewerThrottle.setMaxBandwidth((F32) newvalue.asReal()); + return true; } class LLPanelPreference::Updater : public LLEventTimer @@ -2237,37 +2237,37 @@ class LLPanelPreference::Updater : public LLEventTimer public: - typedef boost::function callback_t; + typedef boost::function callback_t; - Updater(callback_t cb, F32 period) - :LLEventTimer(period), - mCallback(cb) - { - mEventTimer.stop(); - } + Updater(callback_t cb, F32 period) + :LLEventTimer(period), + mCallback(cb) + { + mEventTimer.stop(); + } - virtual ~Updater(){} + virtual ~Updater(){} - void update(const LLSD& new_value) - { - mNewValue = new_value; - mEventTimer.start(); - } + void update(const LLSD& new_value) + { + mNewValue = new_value; + mEventTimer.start(); + } protected: - BOOL tick() - { - mCallback(mNewValue); - mEventTimer.stop(); + BOOL tick() + { + mCallback(mNewValue); + mEventTimer.stop(); - return FALSE; - } + return FALSE; + } private: - LLSD mNewValue; - callback_t mCallback; + LLSD mNewValue; + callback_t mCallback; }; //---------------------------------------------------------------------------- static LLPanelInjector t_places("panel_preference"); @@ -2275,169 +2275,169 @@ LLPanelPreference::LLPanelPreference() : LLPanel(), mBandWidthUpdater(NULL) { - mCommitCallbackRegistrar.add("Pref.setControlFalse", boost::bind(&LLPanelPreference::setControlFalse,this, _2)); - mCommitCallbackRegistrar.add("Pref.updateMediaAutoPlayCheckbox", boost::bind(&LLPanelPreference::updateMediaAutoPlayCheckbox, this, _1)); - mCommitCallbackRegistrar.add("Pref.PrefDelete", boost::bind(&LLPanelPreference::deletePreset, this, _2)); - mCommitCallbackRegistrar.add("Pref.PrefSave", boost::bind(&LLPanelPreference::savePreset, this, _2)); - mCommitCallbackRegistrar.add("Pref.PrefLoad", boost::bind(&LLPanelPreference::loadPreset, this, _2)); + mCommitCallbackRegistrar.add("Pref.setControlFalse", boost::bind(&LLPanelPreference::setControlFalse,this, _2)); + mCommitCallbackRegistrar.add("Pref.updateMediaAutoPlayCheckbox", boost::bind(&LLPanelPreference::updateMediaAutoPlayCheckbox, this, _1)); + mCommitCallbackRegistrar.add("Pref.PrefDelete", boost::bind(&LLPanelPreference::deletePreset, this, _2)); + mCommitCallbackRegistrar.add("Pref.PrefSave", boost::bind(&LLPanelPreference::savePreset, this, _2)); + mCommitCallbackRegistrar.add("Pref.PrefLoad", boost::bind(&LLPanelPreference::loadPreset, this, _2)); } //virtual BOOL LLPanelPreference::postBuild() { - ////////////////////// PanelGeneral /////////////////// - if (hasChild("display_names_check", TRUE)) - { - BOOL use_people_api = gSavedSettings.getBOOL("UsePeopleAPI"); - LLCheckBoxCtrl* ctrl_display_name = getChild("display_names_check"); - ctrl_display_name->setEnabled(use_people_api); - if (!use_people_api) - { - ctrl_display_name->setValue(FALSE); - } - } - - ////////////////////// PanelVoice /////////////////// - if (hasChild("voice_unavailable", TRUE)) - { - BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice"); - getChildView("voice_unavailable")->setVisible( voice_disabled); - getChildView("enable_voice_check")->setVisible( !voice_disabled); - } - - //////////////////////PanelSkins /////////////////// - - if (hasChild("skin_selection", TRUE)) - { - LLFloaterPreference::refreshSkin(this); - - // if skin is set to a skin that no longer exists (silver) set back to default - if (getChild("skin_selection")->getSelectedIndex() < 0) - { - gSavedSettings.setString("SkinCurrent", "default"); - LLFloaterPreference::refreshSkin(this); - } - - } - - //////////////////////PanelPrivacy /////////////////// - if (hasChild("media_enabled", TRUE)) - { - bool media_enabled = gSavedSettings.getBOOL("AudioStreamingMedia"); - - getChild("media_enabled")->set(media_enabled); - getChild("autoplay_enabled")->setEnabled(media_enabled); - } - if (hasChild("music_enabled", TRUE)) - { - getChild("music_enabled")->set(gSavedSettings.getBOOL("AudioStreamingMusic")); - } - if (hasChild("voice_call_friends_only_check", TRUE)) - { - getChild("voice_call_friends_only_check")->setCommitCallback(boost::bind(&showFriendsOnlyWarning, _1, _2)); - } - if (hasChild("allow_multiple_viewer_check", TRUE)) - { - getChild("allow_multiple_viewer_check")->setCommitCallback(boost::bind(&showMultipleViewersWarning, _1, _2)); - } - if (hasChild("favorites_on_login_check", TRUE)) - { - getChild("favorites_on_login_check")->setCommitCallback(boost::bind(&handleFavoritesOnLoginChanged, _1, _2)); - bool show_favorites_at_login = LLPanelLogin::getShowFavorites(); - getChild("favorites_on_login_check")->setValue(show_favorites_at_login); - } - if (hasChild("mute_chb_label", TRUE)) - { - getChild("mute_chb_label")->setShowCursorHand(false); - getChild("mute_chb_label")->setClickedCallback(boost::bind(&toggleMuteWhenMinimized)); - } - - //////////////////////PanelAdvanced /////////////////// - if (hasChild("modifier_combo", TRUE)) - { - //localizing if push2talk button is set to middle mouse - if (MIDDLE_MOUSE_CV == getChild("modifier_combo")->getValue().asString()) - { - getChild("modifier_combo")->setValue(getString("middle_mouse")); - } - } - - //////////////////////PanelSetup /////////////////// - if (hasChild("max_bandwidth"), TRUE) - { - mBandWidthUpdater = new LLPanelPreference::Updater(boost::bind(&handleBandwidthChanged, _1), BANDWIDTH_UPDATER_TIMEOUT); - gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&LLPanelPreference::Updater::update, mBandWidthUpdater, _2)); - } + ////////////////////// PanelGeneral /////////////////// + if (hasChild("display_names_check", TRUE)) + { + BOOL use_people_api = gSavedSettings.getBOOL("UsePeopleAPI"); + LLCheckBoxCtrl* ctrl_display_name = getChild("display_names_check"); + ctrl_display_name->setEnabled(use_people_api); + if (!use_people_api) + { + ctrl_display_name->setValue(FALSE); + } + } + + ////////////////////// PanelVoice /////////////////// + if (hasChild("voice_unavailable", TRUE)) + { + BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice"); + getChildView("voice_unavailable")->setVisible( voice_disabled); + getChildView("enable_voice_check")->setVisible( !voice_disabled); + } + + //////////////////////PanelSkins /////////////////// + + if (hasChild("skin_selection", TRUE)) + { + LLFloaterPreference::refreshSkin(this); + + // if skin is set to a skin that no longer exists (silver) set back to default + if (getChild("skin_selection")->getSelectedIndex() < 0) + { + gSavedSettings.setString("SkinCurrent", "default"); + LLFloaterPreference::refreshSkin(this); + } + + } + + //////////////////////PanelPrivacy /////////////////// + if (hasChild("media_enabled", TRUE)) + { + bool media_enabled = gSavedSettings.getBOOL("AudioStreamingMedia"); + + getChild("media_enabled")->set(media_enabled); + getChild("autoplay_enabled")->setEnabled(media_enabled); + } + if (hasChild("music_enabled", TRUE)) + { + getChild("music_enabled")->set(gSavedSettings.getBOOL("AudioStreamingMusic")); + } + if (hasChild("voice_call_friends_only_check", TRUE)) + { + getChild("voice_call_friends_only_check")->setCommitCallback(boost::bind(&showFriendsOnlyWarning, _1, _2)); + } + if (hasChild("allow_multiple_viewer_check", TRUE)) + { + getChild("allow_multiple_viewer_check")->setCommitCallback(boost::bind(&showMultipleViewersWarning, _1, _2)); + } + if (hasChild("favorites_on_login_check", TRUE)) + { + getChild("favorites_on_login_check")->setCommitCallback(boost::bind(&handleFavoritesOnLoginChanged, _1, _2)); + bool show_favorites_at_login = LLPanelLogin::getShowFavorites(); + getChild("favorites_on_login_check")->setValue(show_favorites_at_login); + } + if (hasChild("mute_chb_label", TRUE)) + { + getChild("mute_chb_label")->setShowCursorHand(false); + getChild("mute_chb_label")->setClickedCallback(boost::bind(&toggleMuteWhenMinimized)); + } + + //////////////////////PanelAdvanced /////////////////// + if (hasChild("modifier_combo", TRUE)) + { + //localizing if push2talk button is set to middle mouse + if (MIDDLE_MOUSE_CV == getChild("modifier_combo")->getValue().asString()) + { + getChild("modifier_combo")->setValue(getString("middle_mouse")); + } + } + + //////////////////////PanelSetup /////////////////// + if (hasChild("max_bandwidth"), TRUE) + { + mBandWidthUpdater = new LLPanelPreference::Updater(boost::bind(&handleBandwidthChanged, _1), BANDWIDTH_UPDATER_TIMEOUT); + gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&LLPanelPreference::Updater::update, mBandWidthUpdater, _2)); + } #ifdef EXTERNAL_TOS - LLRadioGroup* ext_browser_settings = getChild("preferred_browser_behavior"); - if (ext_browser_settings) - { - // turn off ability to set external/internal browser - ext_browser_settings->setSelectedByValue(LLWeb::BROWSER_EXTERNAL_ONLY, true); - ext_browser_settings->setEnabled(false); - } + LLRadioGroup* ext_browser_settings = getChild("preferred_browser_behavior"); + if (ext_browser_settings) + { + // turn off ability to set external/internal browser + ext_browser_settings->setSelectedByValue(LLWeb::BROWSER_EXTERNAL_ONLY, true); + ext_browser_settings->setEnabled(false); + } #endif - apply(); - return true; + apply(); + return true; } LLPanelPreference::~LLPanelPreference() { - if (mBandWidthUpdater) - { - delete mBandWidthUpdater; - } + if (mBandWidthUpdater) + { + delete mBandWidthUpdater; + } } void LLPanelPreference::apply() { - // no-op + // no-op } void LLPanelPreference::saveSettings() { - LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); - - // Save the value of all controls in the hierarchy - mSavedValues.clear(); - std::list view_stack; - view_stack.push_back(this); - if (advanced) - { - view_stack.push_back(advanced); - } - while(!view_stack.empty()) - { - // Process view on top of the stack - LLView* curview = view_stack.front(); - view_stack.pop_front(); - - LLColorSwatchCtrl* color_swatch = dynamic_cast(curview); - if (color_swatch) - { - mSavedColors[color_swatch->getName()] = color_swatch->get(); - } - else - { - LLUICtrl* ctrl = dynamic_cast(curview); - if (ctrl) - { - LLControlVariable* control = ctrl->getControlVariable(); - if (control) - { - mSavedValues[control] = control->getValue(); - } - } - } - - // Push children onto the end of the work stack - for (child_list_t::const_iterator iter = curview->getChildList()->begin(); - iter != curview->getChildList()->end(); ++iter) - { - view_stack.push_back(*iter); - } - } + LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); + + // Save the value of all controls in the hierarchy + mSavedValues.clear(); + std::list view_stack; + view_stack.push_back(this); + if (advanced) + { + view_stack.push_back(advanced); + } + while(!view_stack.empty()) + { + // Process view on top of the stack + LLView* curview = view_stack.front(); + view_stack.pop_front(); + + LLColorSwatchCtrl* color_swatch = dynamic_cast(curview); + if (color_swatch) + { + mSavedColors[color_swatch->getName()] = color_swatch->get(); + } + else + { + LLUICtrl* ctrl = dynamic_cast(curview); + if (ctrl) + { + LLControlVariable* control = ctrl->getControlVariable(); + if (control) + { + mSavedValues[control] = control->getValue(); + } + } + } + + // Push children onto the end of the work stack + for (child_list_t::const_iterator iter = curview->getChildList()->begin(); + iter != curview->getChildList()->end(); ++iter) + { + view_stack.push_back(*iter); + } + } } void LLPanelPreference::showMultipleViewersWarning(LLUICtrl* checkbox, const LLSD& value) @@ -2450,104 +2450,104 @@ void LLPanelPreference::showMultipleViewersWarning(LLUICtrl* checkbox, const LLS void LLPanelPreference::showFriendsOnlyWarning(LLUICtrl* checkbox, const LLSD& value) { - if (checkbox && checkbox->getValue()) - { - LLNotificationsUtil::add("FriendsAndGroupsOnly"); - } + if (checkbox && checkbox->getValue()) + { + LLNotificationsUtil::add("FriendsAndGroupsOnly"); + } } void LLPanelPreference::handleFavoritesOnLoginChanged(LLUICtrl* checkbox, const LLSD& value) { - if (checkbox) - { - LLFavoritesOrderStorage::instance().showFavoritesOnLoginChanged(checkbox->getValue().asBoolean()); - if(checkbox->getValue()) - { - LLNotificationsUtil::add("FavoritesOnLogin"); - } - } + if (checkbox) + { + LLFavoritesOrderStorage::instance().showFavoritesOnLoginChanged(checkbox->getValue().asBoolean()); + if(checkbox->getValue()) + { + LLNotificationsUtil::add("FavoritesOnLogin"); + } + } } void LLPanelPreference::toggleMuteWhenMinimized() { - std::string mute("MuteWhenMinimized"); - gSavedSettings.setBOOL(mute, !gSavedSettings.getBOOL(mute)); + std::string mute("MuteWhenMinimized"); + gSavedSettings.setBOOL(mute, !gSavedSettings.getBOOL(mute)); } void LLPanelPreference::cancel() { - for (control_values_map_t::iterator iter = mSavedValues.begin(); - iter != mSavedValues.end(); ++iter) - { - LLControlVariable* control = iter->first; - LLSD ctrl_value = iter->second; + for (control_values_map_t::iterator iter = mSavedValues.begin(); + iter != mSavedValues.end(); ++iter) + { + LLControlVariable* control = iter->first; + LLSD ctrl_value = iter->second; - if((control->getName() == "InstantMessageLogPath") && (ctrl_value.asString() == "")) - { - continue; - } + if((control->getName() == "InstantMessageLogPath") && (ctrl_value.asString() == "")) + { + continue; + } - control->set(ctrl_value); - } + control->set(ctrl_value); + } - for (string_color_map_t::iterator iter = mSavedColors.begin(); - iter != mSavedColors.end(); ++iter) - { - LLColorSwatchCtrl* color_swatch = findChild(iter->first); - if (color_swatch) - { - color_swatch->set(iter->second); - color_swatch->onCommit(); - } - } + for (string_color_map_t::iterator iter = mSavedColors.begin(); + iter != mSavedColors.end(); ++iter) + { + LLColorSwatchCtrl* color_swatch = findChild(iter->first); + if (color_swatch) + { + color_swatch->set(iter->second); + color_swatch->onCommit(); + } + } } void LLPanelPreference::setControlFalse(const LLSD& user_data) { - std::string control_name = user_data.asString(); - LLControlVariable* control = findControl(control_name); - - if (control) - control->set(LLSD(FALSE)); + std::string control_name = user_data.asString(); + LLControlVariable* control = findControl(control_name); + + if (control) + control->set(LLSD(FALSE)); } void LLPanelPreference::updateMediaAutoPlayCheckbox(LLUICtrl* ctrl) { - std::string name = ctrl->getName(); + std::string name = ctrl->getName(); - // Disable "Allow Media to auto play" only when both - // "Streaming Music" and "Media" are unchecked. STORM-513. - if ((name == "enable_music") || (name == "enable_media")) - { - bool music_enabled = getChild("enable_music")->get(); - bool media_enabled = getChild("enable_media")->get(); + // Disable "Allow Media to auto play" only when both + // "Streaming Music" and "Media" are unchecked. STORM-513. + if ((name == "enable_music") || (name == "enable_media")) + { + bool music_enabled = getChild("enable_music")->get(); + bool media_enabled = getChild("enable_media")->get(); - getChild("media_auto_play_btn")->setEnabled(music_enabled || media_enabled); - } + getChild("media_auto_play_btn")->setEnabled(music_enabled || media_enabled); + } } void LLPanelPreference::deletePreset(const LLSD& user_data) { - std::string subdirectory = user_data.asString(); - LLFloaterReg::hideInstance("load_pref_preset", subdirectory); - LLFloaterReg::hideInstance("save_pref_preset", subdirectory); - LLFloaterReg::showInstance("delete_pref_preset", subdirectory); + std::string subdirectory = user_data.asString(); + LLFloaterReg::hideInstance("load_pref_preset", subdirectory); + LLFloaterReg::hideInstance("save_pref_preset", subdirectory); + LLFloaterReg::showInstance("delete_pref_preset", subdirectory); } void LLPanelPreference::savePreset(const LLSD& user_data) { - std::string subdirectory = user_data.asString(); - LLFloaterReg::hideInstance("delete_pref_preset", subdirectory); - LLFloaterReg::hideInstance("load_pref_preset", subdirectory); - LLFloaterReg::showInstance("save_pref_preset", subdirectory); + std::string subdirectory = user_data.asString(); + LLFloaterReg::hideInstance("delete_pref_preset", subdirectory); + LLFloaterReg::hideInstance("load_pref_preset", subdirectory); + LLFloaterReg::showInstance("save_pref_preset", subdirectory); } void LLPanelPreference::loadPreset(const LLSD& user_data) { - std::string subdirectory = user_data.asString(); - LLFloaterReg::hideInstance("delete_pref_preset", subdirectory); - LLFloaterReg::hideInstance("save_pref_preset", subdirectory); - LLFloaterReg::showInstance("load_pref_preset", subdirectory); + std::string subdirectory = user_data.asString(); + LLFloaterReg::hideInstance("delete_pref_preset", subdirectory); + LLFloaterReg::hideInstance("save_pref_preset", subdirectory); + LLFloaterReg::showInstance("load_pref_preset", subdirectory); } void LLPanelPreference::setHardwareDefaults() @@ -2557,39 +2557,39 @@ void LLPanelPreference::setHardwareDefaults() class LLPanelPreferencePrivacy : public LLPanelPreference { public: - LLPanelPreferencePrivacy() - { - mAccountIndependentSettings.push_back("VoiceCallsFriendsOnly"); - mAccountIndependentSettings.push_back("AutoDisengageMic"); - } - - /*virtual*/ void saveSettings() - { - LLPanelPreference::saveSettings(); - - // Don't save (=erase from the saved values map) per-account privacy settings - // if we're not logged in, otherwise they will be reset to defaults on log off. - if (LLStartUp::getStartupState() != STATE_STARTED) - { - // Erase only common settings, assuming there are no color settings on Privacy page. - for (control_values_map_t::iterator it = mSavedValues.begin(); it != mSavedValues.end(); ) - { - const std::string setting = it->first->getName(); - if (find(mAccountIndependentSettings.begin(), - mAccountIndependentSettings.end(), setting) == mAccountIndependentSettings.end()) - { - mSavedValues.erase(it++); - } - else - { - ++it; - } - } - } - } + LLPanelPreferencePrivacy() + { + mAccountIndependentSettings.push_back("VoiceCallsFriendsOnly"); + mAccountIndependentSettings.push_back("AutoDisengageMic"); + } + + /*virtual*/ void saveSettings() + { + LLPanelPreference::saveSettings(); + + // Don't save (=erase from the saved values map) per-account privacy settings + // if we're not logged in, otherwise they will be reset to defaults on log off. + if (LLStartUp::getStartupState() != STATE_STARTED) + { + // Erase only common settings, assuming there are no color settings on Privacy page. + for (control_values_map_t::iterator it = mSavedValues.begin(); it != mSavedValues.end(); ) + { + const std::string setting = it->first->getName(); + if (find(mAccountIndependentSettings.begin(), + mAccountIndependentSettings.end(), setting) == mAccountIndependentSettings.end()) + { + mSavedValues.erase(it++); + } + else + { + ++it; + } + } + } + } private: - std::list mAccountIndependentSettings; + std::list mAccountIndependentSettings; }; static LLPanelInjector t_pref_graph("panel_preference_graphics"); @@ -2598,253 +2598,253 @@ static LLPanelInjector t_pref_view("panel_preference_view BOOL LLPanelPreferenceView::postBuild() { - setPresetText(); + 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 - } + 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(); + return LLPanelPreference::postBuild(); } void LLPanelPreferenceView::onPresetsListChangeCamera() { - LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); - if (presetsMgr) - { - presetsMgr->setCameraDirty(false); - } + LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); + if (presetsMgr) + { + presetsMgr->setCameraDirty(false); + } - setPresetText(); + setPresetText(); - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance && !gSavedSettings.getString("PresetCameraActive").empty()) - { - instance->saveSettings(); //make cancel work correctly after changing the preset - } + 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(); + 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()) - { - preset_camera_active.clear(); - } - } - - 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")); - } + 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()) + { + preset_camera_active.clear(); + } + } + + 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() { - LLFloaterReg::showInstance("prefs_graphics_advanced"); - LLFloaterReg::hideInstance("prefs_graphics_advanced"); + LLFloaterReg::showInstance("prefs_graphics_advanced"); + LLFloaterReg::hideInstance("prefs_graphics_advanced"); - resetDirtyChilds(); - setPresetText(); + resetDirtyChilds(); + setPresetText(); - LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); + LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); presetsMgr->setPresetListChangeCallback(boost::bind(&LLPanelPreferenceGraphics::onPresetsListChange, this)); presetsMgr->createMissingDefault(PRESETS_GRAPHIC); // a no-op after the first time, but that's ok - return LLPanelPreference::postBuild(); + return LLPanelPreference::postBuild(); } void LLPanelPreferenceGraphics::draw() { - setPresetText(); - LLPanelPreference::draw(); + setPresetText(); + LLPanelPreference::draw(); } void LLPanelPreferenceGraphics::onPresetsListChange() { - resetDirtyChilds(); - setPresetText(); + resetDirtyChilds(); + setPresetText(); - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance && !gSavedSettings.getString("PresetGraphicActive").empty()) - { - instance->saveSettings(); //make cancel work correctly after changing the preset - } + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance && !gSavedSettings.getString("PresetGraphicActive").empty()) + { + instance->saveSettings(); //make cancel work correctly after changing the preset + } } void LLPanelPreferenceGraphics::setPresetText() { - LLTextBox* preset_text = getChild("preset_text"); - - std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); - - if (!preset_graphic_active.empty() && preset_graphic_active != preset_text->getText()) - { - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->saveGraphicsPreset(preset_graphic_active); - } - } - - if (hasDirtyChilds() && !preset_graphic_active.empty()) - { - gSavedSettings.setString("PresetGraphicActive", ""); - preset_graphic_active.clear(); - // This doesn't seem to cause an infinite recursion. This trigger is needed to cause the pulldown - // panel to update. - LLPresetsManager::getInstance()->triggerChangeSignal(); - } - - if (!preset_graphic_active.empty()) - { - if (preset_graphic_active == PRESETS_DEFAULT) - { - preset_graphic_active = LLTrans::getString(PRESETS_DEFAULT); - } - preset_text->setText(preset_graphic_active); - } - else - { - preset_text->setText(LLTrans::getString("none_paren_cap")); - } - - preset_text->resetDirty(); + LLTextBox* preset_text = getChild("preset_text"); + + std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); + + if (!preset_graphic_active.empty() && preset_graphic_active != preset_text->getText()) + { + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->saveGraphicsPreset(preset_graphic_active); + } + } + + if (hasDirtyChilds() && !preset_graphic_active.empty()) + { + gSavedSettings.setString("PresetGraphicActive", ""); + preset_graphic_active.clear(); + // This doesn't seem to cause an infinite recursion. This trigger is needed to cause the pulldown + // panel to update. + LLPresetsManager::getInstance()->triggerChangeSignal(); + } + + if (!preset_graphic_active.empty()) + { + if (preset_graphic_active == PRESETS_DEFAULT) + { + preset_graphic_active = LLTrans::getString(PRESETS_DEFAULT); + } + preset_text->setText(preset_graphic_active); + } + else + { + preset_text->setText(LLTrans::getString("none_paren_cap")); + } + + preset_text->resetDirty(); } bool LLPanelPreferenceGraphics::hasDirtyChilds() { - LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); - std::list view_stack; - view_stack.push_back(this); - if (advanced) - { - view_stack.push_back(advanced); - } - while(!view_stack.empty()) - { - // Process view on top of the stack - LLView* curview = view_stack.front(); - view_stack.pop_front(); - - LLUICtrl* ctrl = dynamic_cast(curview); - if (ctrl) - { - if (ctrl->isDirty()) - { - LLControlVariable* control = ctrl->getControlVariable(); - if (control) - { - std::string control_name = control->getName(); - if (!control_name.empty()) - { - return true; - } - } - } - } - // Push children onto the end of the work stack - for (child_list_t::const_iterator iter = curview->getChildList()->begin(); - iter != curview->getChildList()->end(); ++iter) - { - view_stack.push_back(*iter); - } - } - - return false; + LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); + std::list view_stack; + view_stack.push_back(this); + if (advanced) + { + view_stack.push_back(advanced); + } + while(!view_stack.empty()) + { + // Process view on top of the stack + LLView* curview = view_stack.front(); + view_stack.pop_front(); + + LLUICtrl* ctrl = dynamic_cast(curview); + if (ctrl) + { + if (ctrl->isDirty()) + { + LLControlVariable* control = ctrl->getControlVariable(); + if (control) + { + std::string control_name = control->getName(); + if (!control_name.empty()) + { + return true; + } + } + } + } + // Push children onto the end of the work stack + for (child_list_t::const_iterator iter = curview->getChildList()->begin(); + iter != curview->getChildList()->end(); ++iter) + { + view_stack.push_back(*iter); + } + } + + return false; } void LLPanelPreferenceGraphics::resetDirtyChilds() { - LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); - std::list view_stack; - view_stack.push_back(this); - if (advanced) - { - view_stack.push_back(advanced); - } - while(!view_stack.empty()) - { - // Process view on top of the stack - LLView* curview = view_stack.front(); - view_stack.pop_front(); - - LLUICtrl* ctrl = dynamic_cast(curview); - if (ctrl) - { - ctrl->resetDirty(); - } - // Push children onto the end of the work stack - for (child_list_t::const_iterator iter = curview->getChildList()->begin(); - iter != curview->getChildList()->end(); ++iter) - { - view_stack.push_back(*iter); - } - } + LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); + std::list view_stack; + view_stack.push_back(this); + if (advanced) + { + view_stack.push_back(advanced); + } + while(!view_stack.empty()) + { + // Process view on top of the stack + LLView* curview = view_stack.front(); + view_stack.pop_front(); + + LLUICtrl* ctrl = dynamic_cast(curview); + if (ctrl) + { + ctrl->resetDirty(); + } + // Push children onto the end of the work stack + for (child_list_t::const_iterator iter = curview->getChildList()->begin(); + iter != curview->getChildList()->end(); ++iter) + { + view_stack.push_back(*iter); + } + } } void LLPanelPreferenceGraphics::cancel() { - LLPanelPreference::cancel(); + LLPanelPreference::cancel(); } void LLPanelPreferenceGraphics::saveSettings() { - resetDirtyChilds(); - std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); - if (preset_graphic_active.empty()) - { - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - //don't restore previous preset after closing Preferences - instance->saveGraphicsPreset(preset_graphic_active); - } - } - LLPanelPreference::saveSettings(); + resetDirtyChilds(); + std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); + if (preset_graphic_active.empty()) + { + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + //don't restore previous preset after closing Preferences + instance->saveGraphicsPreset(preset_graphic_active); + } + } + LLPanelPreference::saveSettings(); } void LLPanelPreferenceGraphics::setHardwareDefaults() { - resetDirtyChilds(); + resetDirtyChilds(); } LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const LLSD& key) - : LLFloater(key) + : LLFloater(key) { - mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onVertexShaderEnable, this)); - mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxNonImpostors", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors,this)); - mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity,this)); + mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onVertexShaderEnable, this)); + mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxNonImpostors", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors,this)); + mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity,this)); } LLFloaterPreferenceGraphicsAdvanced::~LLFloaterPreferenceGraphicsAdvanced() @@ -2852,12 +2852,12 @@ LLFloaterPreferenceGraphicsAdvanced::~LLFloaterPreferenceGraphicsAdvanced() } LLFloaterPreferenceProxy::LLFloaterPreferenceProxy(const LLSD& key) - : LLFloater(key), - mSocksSettingsDirty(false) + : LLFloater(key), + mSocksSettingsDirty(false) { - mCommitCallbackRegistrar.add("Proxy.OK", boost::bind(&LLFloaterPreferenceProxy::onBtnOk, this)); - mCommitCallbackRegistrar.add("Proxy.Cancel", boost::bind(&LLFloaterPreferenceProxy::onBtnCancel, this)); - mCommitCallbackRegistrar.add("Proxy.Change", boost::bind(&LLFloaterPreferenceProxy::onChangeSocksSettings, this)); + mCommitCallbackRegistrar.add("Proxy.OK", boost::bind(&LLFloaterPreferenceProxy::onBtnOk, this)); + mCommitCallbackRegistrar.add("Proxy.Cancel", boost::bind(&LLFloaterPreferenceProxy::onBtnCancel, this)); + mCommitCallbackRegistrar.add("Proxy.Change", boost::bind(&LLFloaterPreferenceProxy::onChangeSocksSettings, this)); } BOOL LLFloaterPreferenceGraphicsAdvanced::postBuild() @@ -2884,11 +2884,11 @@ void LLFloaterPreferenceGraphicsAdvanced::onOpen(const LLSD& key) void LLFloaterPreferenceGraphicsAdvanced::onClickCloseBtn(bool app_quitting) { - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->cancel(); - } + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->cancel(); + } } LLFloaterPreferenceProxy::~LLFloaterPreferenceProxy() @@ -2897,182 +2897,182 @@ LLFloaterPreferenceProxy::~LLFloaterPreferenceProxy() BOOL LLFloaterPreferenceProxy::postBuild() { - LLRadioGroup* socksAuth = getChild("socks5_auth_type"); - if (!socksAuth) - { - return FALSE; - } - if (socksAuth->getSelectedValue().asString() == "None") - { - getChild("socks5_username")->setEnabled(false); - getChild("socks5_password")->setEnabled(false); - } - else - { - // Populate the SOCKS 5 credential fields with protected values. - LLPointer socks_cred = gSecAPIHandler->loadCredential("SOCKS5"); - getChild("socks5_username")->setValue(socks_cred->getIdentifier()["username"].asString()); - getChild("socks5_password")->setValue(socks_cred->getAuthenticator()["creds"].asString()); - } - - return TRUE; + LLRadioGroup* socksAuth = getChild("socks5_auth_type"); + if (!socksAuth) + { + return FALSE; + } + if (socksAuth->getSelectedValue().asString() == "None") + { + getChild("socks5_username")->setEnabled(false); + getChild("socks5_password")->setEnabled(false); + } + else + { + // Populate the SOCKS 5 credential fields with protected values. + LLPointer socks_cred = gSecAPIHandler->loadCredential("SOCKS5"); + getChild("socks5_username")->setValue(socks_cred->getIdentifier()["username"].asString()); + getChild("socks5_password")->setValue(socks_cred->getAuthenticator()["creds"].asString()); + } + + return TRUE; } void LLFloaterPreferenceProxy::onOpen(const LLSD& key) { - saveSettings(); + saveSettings(); } void LLFloaterPreferenceProxy::onClose(bool app_quitting) { - if(app_quitting) - { - cancel(); - } + if(app_quitting) + { + cancel(); + } - if (mSocksSettingsDirty) - { + if (mSocksSettingsDirty) + { - // If the user plays with the Socks proxy settings after login, it's only fair we let them know - // it will not be updated until next restart. - if (LLStartUp::getStartupState()>STATE_LOGIN_WAIT) - { - LLNotifications::instance().add("ChangeProxySettings", LLSD(), LLSD()); - mSocksSettingsDirty = false; // we have notified the user now be quiet again - } - } + // If the user plays with the Socks proxy settings after login, it's only fair we let them know + // it will not be updated until next restart. + if (LLStartUp::getStartupState()>STATE_LOGIN_WAIT) + { + LLNotifications::instance().add("ChangeProxySettings", LLSD(), LLSD()); + mSocksSettingsDirty = false; // we have notified the user now be quiet again + } + } } void LLFloaterPreferenceProxy::saveSettings() { - // Save the value of all controls in the hierarchy - mSavedValues.clear(); - std::list view_stack; - view_stack.push_back(this); - while(!view_stack.empty()) - { - // Process view on top of the stack - LLView* curview = view_stack.front(); - view_stack.pop_front(); - - LLUICtrl* ctrl = dynamic_cast(curview); - if (ctrl) - { - LLControlVariable* control = ctrl->getControlVariable(); - if (control) - { - mSavedValues[control] = control->getValue(); - } - } - - // Push children onto the end of the work stack - for (child_list_t::const_iterator iter = curview->getChildList()->begin(); - iter != curview->getChildList()->end(); ++iter) - { - view_stack.push_back(*iter); - } - } + // Save the value of all controls in the hierarchy + mSavedValues.clear(); + std::list view_stack; + view_stack.push_back(this); + while(!view_stack.empty()) + { + // Process view on top of the stack + LLView* curview = view_stack.front(); + view_stack.pop_front(); + + LLUICtrl* ctrl = dynamic_cast(curview); + if (ctrl) + { + LLControlVariable* control = ctrl->getControlVariable(); + if (control) + { + mSavedValues[control] = control->getValue(); + } + } + + // Push children onto the end of the work stack + for (child_list_t::const_iterator iter = curview->getChildList()->begin(); + iter != curview->getChildList()->end(); ++iter) + { + view_stack.push_back(*iter); + } + } } void LLFloaterPreferenceProxy::onBtnOk() { - // commit any outstanding text entry - if (hasFocus()) - { - LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); - if (cur_focus && cur_focus->acceptsTextInput()) - { - cur_focus->onCommit(); - } - } - - // Save SOCKS proxy credentials securely if password auth is enabled - LLRadioGroup* socksAuth = getChild("socks5_auth_type"); - if (socksAuth->getSelectedValue().asString() == "UserPass") - { - LLSD socks_id = LLSD::emptyMap(); - socks_id["type"] = "SOCKS5"; - socks_id["username"] = getChild("socks5_username")->getValue().asString(); - - LLSD socks_authenticator = LLSD::emptyMap(); - socks_authenticator["type"] = "SOCKS5"; - socks_authenticator["creds"] = getChild("socks5_password")->getValue().asString(); - - // Using "SOCKS5" as the "grid" argument since the same proxy - // settings will be used for all grids and because there is no - // way to specify the type of credential. - LLPointer socks_cred = gSecAPIHandler->createCredential("SOCKS5", socks_id, socks_authenticator); - gSecAPIHandler->saveCredential(socks_cred, true); - } - else - { - // Clear SOCKS5 credentials since they are no longer needed. - LLPointer socks_cred = new LLCredential("SOCKS5"); - gSecAPIHandler->deleteCredential(socks_cred); - } - - closeFloater(false); + // commit any outstanding text entry + if (hasFocus()) + { + LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); + if (cur_focus && cur_focus->acceptsTextInput()) + { + cur_focus->onCommit(); + } + } + + // Save SOCKS proxy credentials securely if password auth is enabled + LLRadioGroup* socksAuth = getChild("socks5_auth_type"); + if (socksAuth->getSelectedValue().asString() == "UserPass") + { + LLSD socks_id = LLSD::emptyMap(); + socks_id["type"] = "SOCKS5"; + socks_id["username"] = getChild("socks5_username")->getValue().asString(); + + LLSD socks_authenticator = LLSD::emptyMap(); + socks_authenticator["type"] = "SOCKS5"; + socks_authenticator["creds"] = getChild("socks5_password")->getValue().asString(); + + // Using "SOCKS5" as the "grid" argument since the same proxy + // settings will be used for all grids and because there is no + // way to specify the type of credential. + LLPointer socks_cred = gSecAPIHandler->createCredential("SOCKS5", socks_id, socks_authenticator); + gSecAPIHandler->saveCredential(socks_cred, true); + } + else + { + // Clear SOCKS5 credentials since they are no longer needed. + LLPointer socks_cred = new LLCredential("SOCKS5"); + gSecAPIHandler->deleteCredential(socks_cred); + } + + closeFloater(false); } void LLFloaterPreferenceProxy::onBtnCancel() { - if (hasFocus()) - { - LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); - if (cur_focus && cur_focus->acceptsTextInput()) - { - cur_focus->onCommit(); - } - refresh(); - } + if (hasFocus()) + { + LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); + if (cur_focus && cur_focus->acceptsTextInput()) + { + cur_focus->onCommit(); + } + refresh(); + } - cancel(); + cancel(); } void LLFloaterPreferenceProxy::onClickCloseBtn(bool app_quitting) { - cancel(); + cancel(); } void LLFloaterPreferenceProxy::cancel() { - for (control_values_map_t::iterator iter = mSavedValues.begin(); - iter != mSavedValues.end(); ++iter) - { - LLControlVariable* control = iter->first; - LLSD ctrl_value = iter->second; - control->set(ctrl_value); - } - mSocksSettingsDirty = false; - closeFloater(); + for (control_values_map_t::iterator iter = mSavedValues.begin(); + iter != mSavedValues.end(); ++iter) + { + LLControlVariable* control = iter->first; + LLSD ctrl_value = iter->second; + control->set(ctrl_value); + } + mSocksSettingsDirty = false; + closeFloater(); } void LLFloaterPreferenceProxy::onChangeSocksSettings() { - mSocksSettingsDirty = true; - - LLRadioGroup* socksAuth = getChild("socks5_auth_type"); - if (socksAuth->getSelectedValue().asString() == "None") - { - getChild("socks5_username")->setEnabled(false); - getChild("socks5_password")->setEnabled(false); - } - else - { - getChild("socks5_username")->setEnabled(true); - getChild("socks5_password")->setEnabled(true); - } - - // Check for invalid states for the other HTTP proxy radio - LLRadioGroup* otherHttpProxy = getChild("other_http_proxy_type"); - if ((otherHttpProxy->getSelectedValue().asString() == "Socks" && - getChild("socks_proxy_enabled")->get() == FALSE )||( - otherHttpProxy->getSelectedValue().asString() == "Web" && - getChild("web_proxy_enabled")->get() == FALSE ) ) - { - otherHttpProxy->selectFirstItem(); - } + mSocksSettingsDirty = true; + + LLRadioGroup* socksAuth = getChild("socks5_auth_type"); + if (socksAuth->getSelectedValue().asString() == "None") + { + getChild("socks5_username")->setEnabled(false); + getChild("socks5_password")->setEnabled(false); + } + else + { + getChild("socks5_username")->setEnabled(true); + getChild("socks5_password")->setEnabled(true); + } + + // Check for invalid states for the other HTTP proxy radio + LLRadioGroup* otherHttpProxy = getChild("other_http_proxy_type"); + if ((otherHttpProxy->getSelectedValue().asString() == "Socks" && + getChild("socks_proxy_enabled")->get() == FALSE )||( + otherHttpProxy->getSelectedValue().asString() == "Web" && + getChild("web_proxy_enabled")->get() == FALSE ) ) + { + otherHttpProxy->selectFirstItem(); + } } diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index da96e68f5e..0d383c1da0 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -50,308 +50,308 @@ class LLTextBox; typedef std::map notifications_map; typedef enum - { - GS_LOW_GRAPHICS, - GS_MID_GRAPHICS, - GS_HIGH_GRAPHICS, - GS_ULTRA_GRAPHICS - - } EGraphicsSettings; + { + GS_LOW_GRAPHICS, + GS_MID_GRAPHICS, + GS_HIGH_GRAPHICS, + GS_ULTRA_GRAPHICS + + } EGraphicsSettings; // Floater to control preferences (display, audio, bandwidth, general. class LLFloaterPreference : public LLFloater, public LLAvatarPropertiesObserver, public LLConversationLogObserver { public: - LLFloaterPreference(const LLSD& key); - ~LLFloaterPreference(); - - void apply(); - void cancel(); - /*virtual*/ void draw(); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); - /*virtual*/ void changed(); - /*virtual*/ void changed(const LLUUID& session_id, U32 mask) {}; - - // static data update, called from message handler - static void updateUserInfo(const std::string& visibility, bool im_via_email, bool is_verified_email); - - // refresh all the graphics preferences menus - static void refreshEnabledGraphics(); - - // translate user's do not disturb response message according to current locale if message is default, otherwise do nothing - static void initDoNotDisturbResponse(); - - // update Show Favorites checkbox - static void updateShowFavoritesCheckbox(bool val); - - void processProperties( void* pData, EAvatarProcessorType type ); - void processProfileProperties(const LLAvatarData* pAvatarData ); - void storeAvatarProperties( const LLAvatarData* pAvatarData ); - void saveAvatarProperties( void ); - void selectPrivacyPanel(); - void selectChatPanel(); - void getControlNames(std::vector& names); - -protected: - void onBtnOK(const LLSD& userdata); - void onBtnCancel(const LLSD& userdata); - - void onClickClearCache(); // Clear viewer texture cache, vfs, and VO cache on next startup - void onClickBrowserClearCache(); // Clear web history and caches as well as viewer caches above - void onLanguageChange(); - void onNotificationsChange(const std::string& OptionName); - void onNameTagOpacityChange(const LLSD& newvalue); - - // set value of "DoNotDisturbResponseChanged" in account settings depending on whether do not disturb response - // string differs from default after user changes. - void onDoNotDisturbResponseChanged(); - // if the custom settings box is clicked - void onChangeCustom(); - void updateMeterText(LLUICtrl* ctrl); - // callback for defaults - void setHardwareDefaults(); - void setRecommended(); - // callback for when client turns on shaders - void onVertexShaderEnable(); - // callback for when client turns on impostors - void onAvatarImpostorsEnable(); - - // callback for commit in the "Single click on land" and "Double click on land" comboboxes. - void onClickActionChange(); - // updates click/double-click action settings depending on controls values - void updateClickActionSettings(); - // updates click/double-click action controls depending on values from settings.xml - void updateClickActionControls(); + LLFloaterPreference(const LLSD& key); + ~LLFloaterPreference(); + + void apply(); + void cancel(); + /*virtual*/ void draw(); + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void onClose(bool app_quitting); + /*virtual*/ void changed(); + /*virtual*/ void changed(const LLUUID& session_id, U32 mask) {}; + + // static data update, called from message handler + static void updateUserInfo(const std::string& visibility, bool im_via_email, bool is_verified_email); + + // refresh all the graphics preferences menus + static void refreshEnabledGraphics(); + + // translate user's do not disturb response message according to current locale if message is default, otherwise do nothing + static void initDoNotDisturbResponse(); + + // update Show Favorites checkbox + static void updateShowFavoritesCheckbox(bool val); + + void processProperties( void* pData, EAvatarProcessorType type ); + void processProfileProperties(const LLAvatarData* pAvatarData ); + void storeAvatarProperties( const LLAvatarData* pAvatarData ); + void saveAvatarProperties( void ); + void selectPrivacyPanel(); + void selectChatPanel(); + void getControlNames(std::vector& names); + +protected: + void onBtnOK(const LLSD& userdata); + void onBtnCancel(const LLSD& userdata); + + void onClickClearCache(); // Clear viewer texture cache, vfs, and VO cache on next startup + void onClickBrowserClearCache(); // Clear web history and caches as well as viewer caches above + void onLanguageChange(); + void onNotificationsChange(const std::string& OptionName); + void onNameTagOpacityChange(const LLSD& newvalue); + + // set value of "DoNotDisturbResponseChanged" in account settings depending on whether do not disturb response + // string differs from default after user changes. + void onDoNotDisturbResponseChanged(); + // if the custom settings box is clicked + void onChangeCustom(); + void updateMeterText(LLUICtrl* ctrl); + // callback for defaults + void setHardwareDefaults(); + void setRecommended(); + // callback for when client turns on shaders + void onVertexShaderEnable(); + // callback for when client turns on impostors + void onAvatarImpostorsEnable(); + + // callback for commit in the "Single click on land" and "Double click on land" comboboxes. + void onClickActionChange(); + // updates click/double-click action settings depending on controls values + void updateClickActionSettings(); + // updates click/double-click action controls depending on values from settings.xml + void updateClickActionControls(); public: - // This function squirrels away the current values of the controls so that - // cancel() can restore them. - void saveSettings(); - - void setCacheLocation(const LLStringExplicit& location); - - void onClickSetCache(); - void changeCachePath(const std::vector& filenames, std::string proposed_name); - void onClickResetCache(); - void onClickSkin(LLUICtrl* ctrl,const LLSD& userdata); - void onSelectSkin(); - void onClickSetKey(); - void setKey(KEY key); - void onClickSetMiddleMouse(); - void onClickSetSounds(); - void onClickEnablePopup(); - void onClickDisablePopup(); - void resetAllIgnored(); - void setAllIgnored(); - void onClickLogPath(); - void changeLogPath(const std::vector& filenames, std::string proposed_name); - bool moveTranscriptsAndLog(); - void enableHistory(); - void setPersonalInfo(const std::string& visibility, bool im_via_email, bool is_verified_email); - void refreshEnabledState(); - void onCommitWindowedMode(); - void refresh(); // Refresh enable/disable - // if the quality radio buttons are changed - void onChangeQuality(const LLSD& data); - - void refreshUI(); - - void onCommitParcelMediaAutoPlayEnable(); - void onCommitMediaEnabled(); - void onCommitMusicEnabled(); - void applyResolution(); - void onChangeMaturity(); - void onChangeModelFolder(); - void onChangeTextureFolder(); - void onChangeSoundFolder(); - void onChangeAnimationFolder(); - void onClickBlockList(); - void onClickProxySettings(); - void onClickTranslationSettings(); - void onClickPermsDefault(); - void onClickAutoReplace(); - void onClickSpellChecker(); - void onClickRenderExceptions(); - void onClickAdvanced(); - void applyUIColor(LLUICtrl* ctrl, const LLSD& param); - void getUIColor(LLUICtrl* ctrl, const LLSD& param); - void onLogChatHistorySaved(); - void buildPopupLists(); - static void refreshSkin(void* data); - void selectPanel(const LLSD& name); - void saveCameraPreset(std::string& preset); - void saveGraphicsPreset(std::string& preset); + // This function squirrels away the current values of the controls so that + // cancel() can restore them. + void saveSettings(); + + void setCacheLocation(const LLStringExplicit& location); + + void onClickSetCache(); + void changeCachePath(const std::vector& filenames, std::string proposed_name); + void onClickResetCache(); + void onClickSkin(LLUICtrl* ctrl,const LLSD& userdata); + void onSelectSkin(); + void onClickSetKey(); + void setKey(KEY key); + void onClickSetMiddleMouse(); + void onClickSetSounds(); + void onClickEnablePopup(); + void onClickDisablePopup(); + void resetAllIgnored(); + void setAllIgnored(); + void onClickLogPath(); + void changeLogPath(const std::vector& filenames, std::string proposed_name); + bool moveTranscriptsAndLog(); + void enableHistory(); + void setPersonalInfo(const std::string& visibility, bool im_via_email, bool is_verified_email); + void refreshEnabledState(); + void onCommitWindowedMode(); + void refresh(); // Refresh enable/disable + // if the quality radio buttons are changed + void onChangeQuality(const LLSD& data); + + void refreshUI(); + + void onCommitParcelMediaAutoPlayEnable(); + void onCommitMediaEnabled(); + void onCommitMusicEnabled(); + void applyResolution(); + void onChangeMaturity(); + void onChangeModelFolder(); + void onChangeTextureFolder(); + void onChangeSoundFolder(); + void onChangeAnimationFolder(); + void onClickBlockList(); + void onClickProxySettings(); + void onClickTranslationSettings(); + void onClickPermsDefault(); + void onClickAutoReplace(); + void onClickSpellChecker(); + void onClickRenderExceptions(); + void onClickAdvanced(); + void applyUIColor(LLUICtrl* ctrl, const LLSD& param); + void getUIColor(LLUICtrl* ctrl, const LLSD& param); + void onLogChatHistorySaved(); + void buildPopupLists(); + static void refreshSkin(void* data); + void selectPanel(const LLSD& name); + void saveCameraPreset(std::string& preset); + void saveGraphicsPreset(std::string& preset); private: - void onDeleteTranscripts(); - void onDeleteTranscriptsResponse(const LLSD& notification, const LLSD& response); - void updateDeleteTranscriptsButton(); - void updateMaxComplexity(); - - static std::string sSkin; - notifications_map mNotificationOptions; - bool mClickActionDirty; ///< Set to true when the click/double-click options get changed by user. - bool mGotPersonalInfo; - bool mOriginalIMViaEmail; - bool mLanguageChanged; - bool mAvatarDataInitialized; - std::string mPriorInstantMessageLogPath; - - bool mOriginalHideOnlineStatus; - std::string mDirectoryVisibility; - - LLAvatarData mAvatarProperties; - std::string mSavedCameraPreset; - std::string mSavedGraphicsPreset; - LOG_CLASS(LLFloaterPreference); + void onDeleteTranscripts(); + void onDeleteTranscriptsResponse(const LLSD& notification, const LLSD& response); + void updateDeleteTranscriptsButton(); + void updateMaxComplexity(); + + static std::string sSkin; + notifications_map mNotificationOptions; + bool mClickActionDirty; ///< Set to true when the click/double-click options get changed by user. + bool mGotPersonalInfo; + bool mOriginalIMViaEmail; + bool mLanguageChanged; + bool mAvatarDataInitialized; + std::string mPriorInstantMessageLogPath; + + bool mOriginalHideOnlineStatus; + std::string mDirectoryVisibility; + + LLAvatarData mAvatarProperties; + std::string mSavedCameraPreset; + std::string mSavedGraphicsPreset; + LOG_CLASS(LLFloaterPreference); }; class LLPanelPreference : public LLPanel { public: - LLPanelPreference(); - /*virtual*/ BOOL postBuild(); - - virtual ~LLPanelPreference(); + LLPanelPreference(); + /*virtual*/ BOOL postBuild(); + + virtual ~LLPanelPreference(); - virtual void apply(); - virtual void cancel(); - void setControlFalse(const LLSD& user_data); - virtual void setHardwareDefaults(); + virtual void apply(); + virtual void cancel(); + void setControlFalse(const LLSD& user_data); + virtual void setHardwareDefaults(); - // Disables "Allow Media to auto play" check box only when both - // "Streaming Music" and "Media" are unchecked. Otherwise enables it. - void updateMediaAutoPlayCheckbox(LLUICtrl* ctrl); + // Disables "Allow Media to auto play" check box only when both + // "Streaming Music" and "Media" are unchecked. Otherwise enables it. + void updateMediaAutoPlayCheckbox(LLUICtrl* ctrl); - // This function squirrels away the current values of the controls so that - // cancel() can restore them. - virtual void saveSettings(); + // This function squirrels away the current values of the controls so that + // cancel() can restore them. + virtual void saveSettings(); - void deletePreset(const LLSD& user_data); - void savePreset(const LLSD& user_data); - void loadPreset(const LLSD& user_data); + void deletePreset(const LLSD& user_data); + void savePreset(const LLSD& user_data); + void loadPreset(const LLSD& user_data); - class Updater; + class Updater; protected: - typedef std::map control_values_map_t; - control_values_map_t mSavedValues; + typedef std::map control_values_map_t; + control_values_map_t mSavedValues; private: - //for "Only friends and groups can call or IM me" - static void showFriendsOnlyWarning(LLUICtrl*, const LLSD&); + //for "Only friends and groups can call or IM me" + static void showFriendsOnlyWarning(LLUICtrl*, const LLSD&); //for "Allow Multiple Viewers" static void showMultipleViewersWarning(LLUICtrl*, const LLSD&); - //for "Show my Favorite Landmarks at Login" - static void handleFavoritesOnLoginChanged(LLUICtrl* checkbox, const LLSD& value); + //for "Show my Favorite Landmarks at Login" + static void handleFavoritesOnLoginChanged(LLUICtrl* checkbox, const LLSD& value); - static void toggleMuteWhenMinimized(); - typedef std::map string_color_map_t; - string_color_map_t mSavedColors; + static void toggleMuteWhenMinimized(); + typedef std::map string_color_map_t; + string_color_map_t mSavedColors; - Updater* mBandWidthUpdater; - LOG_CLASS(LLPanelPreference); + Updater* mBandWidthUpdater; + LOG_CLASS(LLPanelPreference); }; class LLPanelPreferenceView : public LLPanelPreference { public: - BOOL postBuild(); - void draw(); - void setPresetText(); + BOOL postBuild(); + void draw(); + void setPresetText(); private: - void onPresetsListChangeCamera(); - LOG_CLASS(LLPanelPreferenceView); + void onPresetsListChangeCamera(); + LOG_CLASS(LLPanelPreferenceView); }; class LLPanelPreferenceGraphics : public LLPanelPreference { public: - BOOL postBuild(); - void draw(); - void cancel(); - void saveSettings(); - void resetDirtyChilds(); - void setHardwareDefaults(); - void setPresetText(); + BOOL postBuild(); + void draw(); + void cancel(); + void saveSettings(); + void resetDirtyChilds(); + void setHardwareDefaults(); + void setPresetText(); - static const std::string getPresetsPath(); + static const std::string getPresetsPath(); protected: - bool hasDirtyChilds(); + bool hasDirtyChilds(); private: - void onPresetsListChange(); - LOG_CLASS(LLPanelPreferenceGraphics); + void onPresetsListChange(); + LOG_CLASS(LLPanelPreferenceGraphics); }; class LLFloaterPreferenceGraphicsAdvanced : public LLFloater { public: - LLFloaterPreferenceGraphicsAdvanced(const LLSD& key); - ~LLFloaterPreferenceGraphicsAdvanced(); - /*virtual*/ BOOL postBuild(); - void onOpen(const LLSD& key); - void onClickCloseBtn(bool app_quitting); - void disableUnavailableSettings(); - void refreshEnabledGraphics(); - void refreshEnabledState(); - void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box); - void updateMaxNonImpostors(); - void setMaxNonImpostorsText(U32 value, LLTextBox* text_box); - void updateMaxComplexity(); - void setMaxComplexityText(U32 value, LLTextBox* text_box); - static void setIndirectControls(); - static void setIndirectMaxNonImpostors(); - static void setIndirectMaxArc(); - void refresh(); - // callback for when client turns on shaders - void onVertexShaderEnable(); - LOG_CLASS(LLFloaterPreferenceGraphicsAdvanced); + LLFloaterPreferenceGraphicsAdvanced(const LLSD& key); + ~LLFloaterPreferenceGraphicsAdvanced(); + /*virtual*/ BOOL postBuild(); + void onOpen(const LLSD& key); + void onClickCloseBtn(bool app_quitting); + void disableUnavailableSettings(); + void refreshEnabledGraphics(); + void refreshEnabledState(); + void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box); + void updateMaxNonImpostors(); + void setMaxNonImpostorsText(U32 value, LLTextBox* text_box); + void updateMaxComplexity(); + void setMaxComplexityText(U32 value, LLTextBox* text_box); + static void setIndirectControls(); + static void setIndirectMaxNonImpostors(); + static void setIndirectMaxArc(); + void refresh(); + // callback for when client turns on shaders + void onVertexShaderEnable(); + LOG_CLASS(LLFloaterPreferenceGraphicsAdvanced); }; class LLAvatarComplexityControls { public: - static void updateMax(LLSliderCtrl* slider, LLTextBox* value_label); - static void setText(U32 value, LLTextBox* text_box); - static void setIndirectControls(); - static void setIndirectMaxNonImpostors(); - static void setIndirectMaxArc(); - LOG_CLASS(LLAvatarComplexityControls); + static void updateMax(LLSliderCtrl* slider, LLTextBox* value_label); + static void setText(U32 value, LLTextBox* text_box); + static void setIndirectControls(); + static void setIndirectMaxNonImpostors(); + static void setIndirectMaxArc(); + LOG_CLASS(LLAvatarComplexityControls); }; class LLFloaterPreferenceProxy : public LLFloater { public: - LLFloaterPreferenceProxy(const LLSD& key); - ~LLFloaterPreferenceProxy(); + LLFloaterPreferenceProxy(const LLSD& key); + ~LLFloaterPreferenceProxy(); - /// show off our menu - static void show(); - void cancel(); - + /// show off our menu + static void show(); + void cancel(); + protected: - BOOL postBuild(); - void onOpen(const LLSD& key); - void onClose(bool app_quitting); - void saveSettings(); - void onBtnOk(); - void onBtnCancel(); - void onClickCloseBtn(bool app_quitting = false); + BOOL postBuild(); + void onOpen(const LLSD& key); + void onClose(bool app_quitting); + void saveSettings(); + void onBtnOk(); + void onBtnCancel(); + void onClickCloseBtn(bool app_quitting = false); - void onChangeSocksSettings(); + void onChangeSocksSettings(); private: - - bool mSocksSettingsDirty; - typedef std::map control_values_map_t; - control_values_map_t mSavedValues; - LOG_CLASS(LLFloaterPreferenceProxy); + + bool mSocksSettingsDirty; + typedef std::map control_values_map_t; + control_values_map_t mSavedValues; + LOG_CLASS(LLFloaterPreferenceProxy); }; diff --git a/indra/newview/llfloaterpreferenceviewadvanced.cpp b/indra/newview/llfloaterpreferenceviewadvanced.cpp index 791ff79d87..e740a3a9cf 100644 --- a/indra/newview/llfloaterpreferenceviewadvanced.cpp +++ b/indra/newview/llfloaterpreferenceviewadvanced.cpp @@ -34,11 +34,11 @@ LLFloaterPreferenceViewAdvanced::LLFloaterPreferenceViewAdvanced(const LLSD& key) -: LLFloater(key) +: LLFloater(key) { - mCommitCallbackRegistrar.add("Cancel", boost::bind(&LLFloaterPreferenceViewAdvanced::onClickCancel, this)); - mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterPreferenceViewAdvanced::onCommitSettings, this)); - mCommitCallbackRegistrar.add("Ok", boost::bind(&LLFloaterPreferenceViewAdvanced::onClickOk, this)); + mCommitCallbackRegistrar.add("Cancel", boost::bind(&LLFloaterPreferenceViewAdvanced::onClickCancel, this)); + mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterPreferenceViewAdvanced::onCommitSettings, this)); + mCommitCallbackRegistrar.add("Ok", boost::bind(&LLFloaterPreferenceViewAdvanced::onClickOk, this)); } @@ -47,66 +47,66 @@ LLFloaterPreferenceViewAdvanced::~LLFloaterPreferenceViewAdvanced() void LLFloaterPreferenceViewAdvanced::onClickOk() { - closeFloater(); + closeFloater(); } void LLFloaterPreferenceViewAdvanced::onClickCancel() { - gSavedSettings.setVector3("CameraOffsetRearView", mCameraSaved); - gSavedSettings.setVector3d("FocusOffsetRearView", mFocusSaved); + gSavedSettings.setVector3("CameraOffsetRearView", mCameraSaved); + gSavedSettings.setVector3d("FocusOffsetRearView", mFocusSaved); - updateCameraControl(mCameraSaved); - updateFocusControl(mFocusSaved); + updateCameraControl(mCameraSaved); + updateFocusControl(mFocusSaved); } BOOL LLFloaterPreferenceViewAdvanced::postBuild() { - mCameraSaved = gSavedSettings.getVector3("CameraOffsetRearView"); - mFocusSaved = gSavedSettings.getVector3d("FocusOffsetRearView"); + mCameraSaved = gSavedSettings.getVector3("CameraOffsetRearView"); + mFocusSaved = gSavedSettings.getVector3d("FocusOffsetRearView"); - updateCameraControl(mCameraSaved); - updateFocusControl(mFocusSaved); + updateCameraControl(mCameraSaved); + updateFocusControl(mFocusSaved); - return TRUE; + return TRUE; } void LLFloaterPreferenceViewAdvanced::updateCameraControl(const LLVector3& vector) { - getChild("camera_x")->setValue(vector[VX]); - getChild("camera_y")->setValue(vector[VY]); - getChild("camera_z")->setValue(vector[VZ]); + getChild("camera_x")->setValue(vector[VX]); + getChild("camera_y")->setValue(vector[VY]); + getChild("camera_z")->setValue(vector[VZ]); } void LLFloaterPreferenceViewAdvanced::updateFocusControl(const LLVector3d& vector3d) { - getChild("focus_x")->setValue(vector3d[VX]); - getChild("focus_y")->setValue(vector3d[VY]); - getChild("focus_z")->setValue(vector3d[VZ]); + getChild("focus_x")->setValue(vector3d[VX]); + getChild("focus_y")->setValue(vector3d[VY]); + getChild("focus_z")->setValue(vector3d[VZ]); } void LLFloaterPreferenceViewAdvanced::draw() { - static LLCachedControl camera(gSavedSettings, "CameraOffsetRearView"); - static LLCachedControl focus(gSavedSettings, "FocusOffsetRearView"); + static LLCachedControl camera(gSavedSettings, "CameraOffsetRearView"); + static LLCachedControl focus(gSavedSettings, "FocusOffsetRearView"); - updateCameraControl(camera); - updateFocusControl(focus); + updateCameraControl(camera); + updateFocusControl(focus); - LLFloater::draw(); + LLFloater::draw(); } void LLFloaterPreferenceViewAdvanced::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); + 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/llfloaterpreferenceviewadvanced.h b/indra/newview/llfloaterpreferenceviewadvanced.h index 8f4b594605..9113949273 100644 --- a/indra/newview/llfloaterpreferenceviewadvanced.h +++ b/indra/newview/llfloaterpreferenceviewadvanced.h @@ -31,27 +31,27 @@ #include "llfloater.h" class LLFloaterPreferenceViewAdvanced -: public LLFloater +: public LLFloater { - friend class LLFloaterReg; + friend class LLFloaterReg; public: - LLFloaterPreferenceViewAdvanced(const LLSD& key); - virtual BOOL postBuild(); - virtual void draw(); + LLFloaterPreferenceViewAdvanced(const LLSD& key); + virtual BOOL postBuild(); + virtual void draw(); - void onCommitSettings(); - void onClickCancel(); - void onClickOk(); - void updateCameraControl(const LLVector3& vector); - void updateFocusControl(const LLVector3d& vector3d); + void onCommitSettings(); + void onClickCancel(); + void onClickOk(); + void updateCameraControl(const LLVector3& vector); + void updateFocusControl(const LLVector3d& vector3d); private: - virtual ~LLFloaterPreferenceViewAdvanced(); + virtual ~LLFloaterPreferenceViewAdvanced(); - LLVector3 mCameraSaved; - LLVector3d mFocusSaved; - + LLVector3 mCameraSaved; + LLVector3d mFocusSaved; + }; #endif //LLFLOATERPREFERENCEVIEWADVANCED_H diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index bae7602566..149451c8c4 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -37,78 +37,78 @@ #include "lltrans.h" LLFloaterSavePrefPreset::LLFloaterSavePrefPreset(const LLSD &key) -: LLFloater(key) +: LLFloater(key) { } // virtual BOOL LLFloaterSavePrefPreset::postBuild() { - LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance("preferences"); - if (preferences) - { - preferences->addDependentFloater(this); - } - getChild("preset_combo")->setTextEntryCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); - getChild("preset_combo")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); - getChild("save")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnSave, this)); - getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnCancel, this)); - - LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetsListChange, this)); - - mSaveButton = getChild("save"); - mPresetCombo = getChild("preset_combo"); - - return TRUE; + LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance("preferences"); + if (preferences) + { + preferences->addDependentFloater(this); + } + getChild("preset_combo")->setTextEntryCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); + getChild("preset_combo")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); + getChild("save")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnSave, this)); + getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnCancel, this)); + + LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetsListChange, this)); + + mSaveButton = getChild("save"); + mPresetCombo = getChild("preset_combo"); + + return TRUE; } void LLFloaterSavePrefPreset::onPresetNameEdited() { - // Disable saving a preset having empty name. - std::string name = mPresetCombo->getSimple(); + // Disable saving a preset having empty name. + std::string name = mPresetCombo->getSimple(); - mSaveButton->setEnabled(!name.empty()); + mSaveButton->setEnabled(!name.empty()); } void LLFloaterSavePrefPreset::onOpen(const LLSD& key) { - mSubdirectory = key.asString(); + mSubdirectory = key.asString(); - std::string floater_title = getString(std::string("title_") + mSubdirectory); + std::string floater_title = getString(std::string("title_") + mSubdirectory); - setTitle(floater_title); + setTitle(floater_title); - EDefaultOptions option = DEFAULT_HIDE; - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); + EDefaultOptions option = DEFAULT_HIDE; + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); - onPresetNameEdited(); + onPresetNameEdited(); } void LLFloaterSavePrefPreset::onBtnSave() { - std::string name = mPresetCombo->getSimple(); - - if ((name == LLTrans::getString(PRESETS_DEFAULT)) || (name == PRESETS_DEFAULT)) - { - LLNotificationsUtil::add("DefaultPresetNotSaved"); - } - else if (!LLPresetsManager::getInstance()->savePreset(mSubdirectory, name)) - { - LLSD args; - args["NAME"] = name; - LLNotificationsUtil::add("PresetNotSaved", args); - } - - closeFloater(); + std::string name = mPresetCombo->getSimple(); + + if ((name == LLTrans::getString(PRESETS_DEFAULT)) || (name == PRESETS_DEFAULT)) + { + LLNotificationsUtil::add("DefaultPresetNotSaved"); + } + else if (!LLPresetsManager::getInstance()->savePreset(mSubdirectory, name)) + { + LLSD args; + args["NAME"] = name; + LLNotificationsUtil::add("PresetNotSaved", args); + } + + closeFloater(); } void LLFloaterSavePrefPreset::onPresetsListChange() { - EDefaultOptions option = DEFAULT_HIDE; - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); + EDefaultOptions option = DEFAULT_HIDE; + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); } void LLFloaterSavePrefPreset::onBtnCancel() { - closeFloater(); + closeFloater(); } diff --git a/indra/newview/llnavigationbar.h b/indra/newview/llnavigationbar.h index a44c6dd699..a9d0f1a82e 100755 --- a/indra/newview/llnavigationbar.h +++ b/indra/newview/llnavigationbar.h @@ -47,113 +47,113 @@ class LLSearchComboBox; class LLPullButton: public LLButton { - LOG_CLASS(LLPullButton); + LOG_CLASS(LLPullButton); public: - struct Params: public LLInitParam::Block - { - Optional direction; // left, right, down, up + struct Params: public LLInitParam::Block + { + Optional direction; // left, right, down, up - Params() - : direction("direction", "down") - { - } - }; - - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + Params() + : direction("direction", "down") + { + } + }; + + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); + /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); - boost::signals2::connection setClickDraggingCallback(const commit_signal_t::slot_type& cb); + boost::signals2::connection setClickDraggingCallback(const commit_signal_t::slot_type& cb); protected: - friend class LLUICtrlFactory; - // convert string name into direction vector - void setDirectionFromName(const std::string& name); - LLPullButton(const LLPullButton::Params& params); - - commit_signal_t mClickDraggingSignal; - LLVector2 mLastMouseDown; - LLVector2 mDraggingDirection; + friend class LLUICtrlFactory; + // convert string name into direction vector + void setDirectionFromName(const std::string& name); + LLPullButton(const LLPullButton::Params& params); + + commit_signal_t mClickDraggingSignal; + LLVector2 mLastMouseDown; + LLVector2 mDraggingDirection; }; /** * Web browser-like navigation bar. */ class LLNavigationBar - : public LLPanel, public LLSingleton, private LLDestroyClass + : public LLPanel, public LLSingleton, private LLDestroyClass { - LLSINGLETON(LLNavigationBar); - virtual ~LLNavigationBar(); - LOG_CLASS(LLNavigationBar); - friend class LLDestroyClass; + LLSINGLETON(LLNavigationBar); + virtual ~LLNavigationBar(); + LOG_CLASS(LLNavigationBar); + friend class LLDestroyClass; public: - - /*virtual*/ void draw(); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void setVisible(BOOL visible); - - void handleLoginComplete(); - void clearHistoryCache(); - - int getDefNavBarHeight(); - int getDefFavBarHeight(); - + + /*virtual*/ void draw(); + /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL postBuild(); + /*virtual*/ void setVisible(BOOL visible); + + void handleLoginComplete(); + void clearHistoryCache(); + + int getDefNavBarHeight(); + int getDefFavBarHeight(); + private: - // the distance between navigation panel and favorites panel in pixels - const static S32 FAVBAR_TOP_PADDING = 10; - - void rebuildTeleportHistoryMenu(); - void showTeleportHistoryMenu(LLUICtrl* btn_ctrl); - void invokeSearch(std::string search_text); - void resizeLayoutPanel(); - // callbacks - void onTeleportHistoryMenuItemClicked(const LLSD& userdata); - void onTeleportHistoryChanged(); - void onBackButtonClicked(); - void onBackOrForwardButtonHeldDown(LLUICtrl* ctrl, const LLSD& param); - void onNavigationButtonHeldUp(LLButton* nav_button); - void onForwardButtonClicked(); - void onHomeButtonClicked(); - void onLocationSelection(); - void onLocationPrearrange(const LLSD& data); - void onTeleportFinished(const LLVector3d& global_agent_pos); - void onTeleportFailed(); - void onNavbarResized(); - void onRegionNameResponse( - std::string typed_location, - std::string region_name, - LLVector3 local_coords, - U64 region_handle, const std::string& url, - const LLUUID& snapshot_id, bool teleport); - - static void destroyClass() - { - if (LLNavigationBar::instanceExists()) - { - LLNavigationBar::getInstance()->setEnabled(FALSE); - } - } - - S32 mNavPanWidth; - LLMenuGL* mTeleportHistoryMenu; - LLPullButton* mBtnBack; - LLPullButton* mBtnForward; - LLButton* mBtnHome; - LLLocationInputCtrl* mCmbLocation; - LLRect mDefaultNbRect; - LLRect mDefaultFpRect; - LLLayoutPanel* mNavigationPanel; - LLLayoutPanel* mFavoritePanel; - boost::signals2::connection mTeleportFailedConnection; - boost::signals2::connection mTeleportFinishConnection; - boost::signals2::connection mHistoryMenuConnection; - // if true, save location to location history when teleport finishes - bool mSaveToLocationHistory; + // the distance between navigation panel and favorites panel in pixels + const static S32 FAVBAR_TOP_PADDING = 10; + + void rebuildTeleportHistoryMenu(); + void showTeleportHistoryMenu(LLUICtrl* btn_ctrl); + void invokeSearch(std::string search_text); + void resizeLayoutPanel(); + // callbacks + void onTeleportHistoryMenuItemClicked(const LLSD& userdata); + void onTeleportHistoryChanged(); + void onBackButtonClicked(); + void onBackOrForwardButtonHeldDown(LLUICtrl* ctrl, const LLSD& param); + void onNavigationButtonHeldUp(LLButton* nav_button); + void onForwardButtonClicked(); + void onHomeButtonClicked(); + void onLocationSelection(); + void onLocationPrearrange(const LLSD& data); + void onTeleportFinished(const LLVector3d& global_agent_pos); + void onTeleportFailed(); + void onNavbarResized(); + void onRegionNameResponse( + std::string typed_location, + std::string region_name, + LLVector3 local_coords, + U64 region_handle, const std::string& url, + const LLUUID& snapshot_id, bool teleport); + + static void destroyClass() + { + if (LLNavigationBar::instanceExists()) + { + LLNavigationBar::getInstance()->setEnabled(FALSE); + } + } + + S32 mNavPanWidth; + LLMenuGL* mTeleportHistoryMenu; + LLPullButton* mBtnBack; + LLPullButton* mBtnForward; + LLButton* mBtnHome; + LLLocationInputCtrl* mCmbLocation; + LLRect mDefaultNbRect; + LLRect mDefaultFpRect; + LLLayoutPanel* mNavigationPanel; + LLLayoutPanel* mFavoritePanel; + boost::signals2::connection mTeleportFailedConnection; + boost::signals2::connection mTeleportFinishConnection; + boost::signals2::connection mHistoryMenuConnection; + // if true, save location to location history when teleport finishes + bool mSaveToLocationHistory; }; #endif diff --git a/indra/newview/llpanelpresetscamerapulldown.cpp b/indra/newview/llpanelpresetscamerapulldown.cpp index 7612c428d9..7cdb91388a 100644 --- a/indra/newview/llpanelpresetscamerapulldown.cpp +++ b/indra/newview/llpanelpresetscamerapulldown.cpp @@ -50,85 +50,85 @@ // Default constructor LLPanelPresetsCameraPulldown::LLPanelPresetsCameraPulldown() { - mHoverTimer.stop(); + mHoverTimer.stop(); - mCommitCallbackRegistrar.add("Presets.GoViewPrefs", boost::bind(&LLPanelPresetsCameraPulldown::onViewButtonClick, this, _2)); - mCommitCallbackRegistrar.add("PresetsCamera.RowClick", boost::bind(&LLPanelPresetsCameraPulldown::onRowClick, this, _2)); + 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"); + buildFromFile( "panel_presets_camera_pulldown.xml"); } BOOL LLPanelPresetsCameraPulldown::postBuild() { - LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); - if (presetsMgr) - { - // Make sure there is a default preference file - presetsMgr->createMissingDefault(PRESETS_CAMERA); + LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); + if (presetsMgr) + { + // Make sure there is a default preference file + presetsMgr->createMissingDefault(PRESETS_CAMERA); - presetsMgr->startWatching(PRESETS_CAMERA); + presetsMgr->startWatching(PRESETS_CAMERA); - presetsMgr->setPresetListChangeCameraCallback(boost::bind(&LLPanelPresetsCameraPulldown::populatePanel, this)); - } + presetsMgr->setPresetListChangeCameraCallback(boost::bind(&LLPanelPresetsCameraPulldown::populatePanel, this)); + } - populatePanel(); + populatePanel(); - return LLPanel::postBuild(); + return LLPanel::postBuild(); } void LLPanelPresetsCameraPulldown::populatePanel() { - std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_CAMERA); - LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_TOP); + std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_CAMERA); + LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_TOP); - LLScrollListCtrl* scroll = getChild("preset_camera_list"); + LLScrollListCtrl* scroll = getChild("preset_camera_list"); - if (scroll && mPresetNames.begin() != mPresetNames.end()) - { - scroll->clearRows(); + 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); - } + 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; + 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); - } - } + 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); + mHoverTimer.stop(); + LLPanel::onMouseEnter(x,y,mask); } /*virtual*/ void LLPanelPresetsCameraPulldown::onTopLost() { - setVisible(FALSE); + setVisible(FALSE); } /*virtual*/ @@ -155,45 +155,45 @@ BOOL LLPanelPresetsCameraPulldown::handleDoubleClick(S32 x, S32 y, MASK mask) /*virtual*/ void LLPanelPresetsCameraPulldown::onMouseLeave(S32 x, S32 y, MASK mask) { - mHoverTimer.start(); - LLPanel::onMouseLeave(x,y,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(); - - } + 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"); + LLScrollListCtrl* scroll = getChild("preset_camera_list"); - if (scroll) - { - LLScrollListItem* item = scroll->getFirstSelected(); - if (item) - { - std::string name = item->getColumn(1)->getValue().asString(); + 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); + LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, name); - setVisible(FALSE); - } + setVisible(FALSE); + } else { LL_DEBUGS() << "none selected" << LL_ENDL; } - } + } else { LL_DEBUGS() << "no scroll" << LL_ENDL; @@ -202,36 +202,36 @@ void LLPanelPresetsCameraPulldown::onRowClick(const LLSD& user_data) 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("view"); - if (tabcontainer && graphicspanel) - { - tabcontainer->selectTabPanel(graphicspanel); - } - } + // 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("view"); + 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); + F32 alpha = mHoverTimer.getStarted() + ? clamp_rescale(mHoverTimer.getElapsedTimeF32(), sAutoCloseFadeStartTimeSec, sAutoCloseTotalTimeSec, 1.f, 0.f) + : 1.0f; + LLViewDrawContext context(alpha); - LLPanel::draw(); + LLPanel::draw(); - if (alpha == 0.f) - { - setVisible(FALSE); - } + if (alpha == 0.f) + { + setVisible(FALSE); + } } diff --git a/indra/newview/llpanelpresetscamerapulldown.h b/indra/newview/llpanelpresetscamerapulldown.h index 12d9bc26ec..069d587086 100644 --- a/indra/newview/llpanelpresetscamerapulldown.h +++ b/indra/newview/llpanelpresetscamerapulldown.h @@ -36,26 +36,26 @@ 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); + 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(); - + /*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); + 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; + std::list mPresetNames; + LLFrameTimer mHoverTimer; + static const F32 sAutoCloseFadeStartTimeSec; + static const F32 sAutoCloseTotalTimeSec; LOG_CLASS(LLPanelPresetsCameraPulldown); }; diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index c1702b4132..fb36c5875d 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -48,35 +48,35 @@ LLPresetsManager::LLPresetsManager() LLPresetsManager::~LLPresetsManager() { - mCameraChangedSignal.disconnect(); + mCameraChangedSignal.disconnect(); } void LLPresetsManager::triggerChangeCameraSignal() { - mPresetListChangeCameraSignal(); + mPresetListChangeCameraSignal(); } void LLPresetsManager::triggerChangeSignal() { - mPresetListChangeSignal(); + mPresetListChangeSignal(); } void LLPresetsManager::createMissingDefault(const std::string& subdirectory) { - if(gDirUtilp->getLindenUserDir().empty()) - { - return; - } - - 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 settings as the default + if(gDirUtilp->getLindenUserDir().empty()) + { + return; + } + + 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 settings as the default savePreset(subdirectory, PRESETS_DEFAULT, true); - } + } else { LL_DEBUGS() << "default preset exists; no-op" << LL_ENDL; @@ -85,330 +85,330 @@ void LLPresetsManager::createMissingDefault(const std::string& subdirectory) 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; - 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)); - } - } - } - } + 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; + 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); - - LLFile::mkdir(presets_path); - - std::string dest_path = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, subdirectory); - if (!gDirUtilp->fileExists(dest_path)) - LLFile::mkdir(dest_path); - - if (PRESETS_CAMERA == subdirectory) - { - std::string source_dir = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA); - LLDirIterator dir_iter(source_dir, "*.xml"); - bool found = true; - while (found) - { - std::string file; - found = dir_iter.next(file); - - if (found) - { - std::string source = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA, file); - file = LLURI::escape(file); - std::string dest = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, PRESETS_CAMERA, file); - LLFile::copy(source, dest); - } - } - } - - return dest_path; + std::string presets_path = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR); + + LLFile::mkdir(presets_path); + + std::string dest_path = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, subdirectory); + if (!gDirUtilp->fileExists(dest_path)) + LLFile::mkdir(dest_path); + + if (PRESETS_CAMERA == subdirectory) + { + std::string source_dir = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA); + LLDirIterator dir_iter(source_dir, "*.xml"); + bool found = true; + while (found) + { + std::string file; + found = dir_iter.next(file); + + if (found) + { + std::string source = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA, file); + file = LLURI::escape(file); + std::string dest = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, PRESETS_CAMERA, file); + LLFile::copy(source, dest); + } + } + } + + return dest_path; } void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets, EDefaultOptions default_option) { - LL_INFOS("AppInit") << "Loading list of preset names from " << dir << LL_ENDL; + LL_INFOS("AppInit") << "Loading list of preset names from " << dir << LL_ENDL; - mPresetNames.clear(); + mPresetNames.clear(); - LLDirIterator dir_iter(dir, "*.xml"); - bool found = true; - while (found) - { - std::string file; - found = dir_iter.next(file); + LLDirIterator dir_iter(dir, "*.xml"); + bool found = true; + while (found) + { + std::string file; + found = dir_iter.next(file); - if (found) - { - std::string path = gDirUtilp->add(dir, file); - std::string name = LLURI::unescape(gDirUtilp->getBaseFileName(path, /*strip_exten = */ true)); + if (found) + { + std::string path = gDirUtilp->add(dir, file); + std::string name = LLURI::unescape(gDirUtilp->getBaseFileName(path, /*strip_exten = */ true)); LL_DEBUGS() << " Found preset '" << name << "'" << LL_ENDL; - if (PRESETS_DEFAULT != name) - { - mPresetNames.push_back(name); - } - else - { - switch (default_option) - { - case DEFAULT_SHOW: - mPresetNames.push_back(LLTrans::getString(PRESETS_DEFAULT)); - break; - - case DEFAULT_TOP: - mPresetNames.push_front(LLTrans::getString(PRESETS_DEFAULT)); - break; - - case DEFAULT_HIDE: - default: - break; - } - } - } - } - - presets = mPresetNames; + if (PRESETS_DEFAULT != name) + { + mPresetNames.push_back(name); + } + else + { + switch (default_option) + { + case DEFAULT_SHOW: + mPresetNames.push_back(LLTrans::getString(PRESETS_DEFAULT)); + break; + + case DEFAULT_TOP: + mPresetNames.push_front(LLTrans::getString(PRESETS_DEFAULT)); + break; + + case DEFAULT_HIDE: + default: + break; + } + } + } + } + + presets = mPresetNames; } bool LLPresetsManager::mCameraDirty = false; void LLPresetsManager::setCameraDirty(bool dirty) { - mCameraDirty = dirty; + mCameraDirty = dirty; } bool LLPresetsManager::isCameraDirty() { - return mCameraDirty; + return mCameraDirty; } void LLPresetsManager::settingChanged() { - setCameraDirty(true); + setCameraDirty(true); - gSavedSettings.setString("PresetCameraActive", ""); + gSavedSettings.setString("PresetCameraActive", ""); // Hack call because this is a static routine - LLPresetsManager::getInstance()->triggerChangeCameraSignal(); + LLPresetsManager::getInstance()->triggerChangeCameraSignal(); } void LLPresetsManager::getControlNames(std::vector& names) { - const std::vector camera_controls = boost::assign::list_of - // From panel_preferences_move.xml - ("CameraAngle") - ("CameraOffsetScale") - ("EditCameraMovement") - ("AppearanceCameraMovement") - // From llagentcamera.cpp - ("CameraOffsetBuild") - ("CameraOffsetRearView") - ("FocusOffsetRearView") - ("CameraOffsetScale") - ("TrackFocusObject") + const std::vector camera_controls = boost::assign::list_of + // From panel_preferences_move.xml + ("CameraAngle") + ("CameraOffsetScale") + ("EditCameraMovement") + ("AppearanceCameraMovement") + // From llagentcamera.cpp + ("CameraOffsetBuild") + ("CameraOffsetRearView") + ("FocusOffsetRearView") + ("CameraOffsetScale") + ("TrackFocusObject") ; names = camera_controls; } bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string name, bool createDefault) { - if (LLTrans::getString(PRESETS_DEFAULT) == name) - { - name = PRESETS_DEFAULT; - } - if (!createDefault && name == PRESETS_DEFAULT) - { - LL_WARNS() << "Should not overwrite default" << LL_ENDL; - return false; - } - - bool saved = false; - std::vector name_list; - - if(PRESETS_GRAPHIC == subdirectory) - { - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance && !createDefault) - { - gSavedSettings.setString("PresetGraphicActive", name); - instance->getControlNames(name_list); - LL_DEBUGS() << "saving preset '" << name << "'; " << name_list.size() << " names" << LL_ENDL; - name_list.push_back("PresetGraphicActive"); - } - else + if (LLTrans::getString(PRESETS_DEFAULT) == name) + { + name = PRESETS_DEFAULT; + } + if (!createDefault && name == PRESETS_DEFAULT) + { + LL_WARNS() << "Should not overwrite default" << LL_ENDL; + return false; + } + + bool saved = false; + std::vector name_list; + + if(PRESETS_GRAPHIC == subdirectory) + { + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance && !createDefault) + { + gSavedSettings.setString("PresetGraphicActive", name); + instance->getControlNames(name_list); + LL_DEBUGS() << "saving preset '" << name << "'; " << name_list.size() << " names" << LL_ENDL; + name_list.push_back("PresetGraphicActive"); + } + else { - LL_WARNS("Presets") << "preferences floater instance not found" << LL_ENDL; - } - } - else if(PRESETS_CAMERA == subdirectory) - { - gSavedSettings.setString("PresetGraphicActive", name); - - name_list.clear(); - getControlNames(name_list); - name_list.push_back("PresetCameraActive"); - } - else - { - LL_ERRS() << "Invalid presets directory '" << subdirectory << "'" << LL_ENDL; - } + LL_WARNS("Presets") << "preferences floater instance not found" << LL_ENDL; + } + } + else if(PRESETS_CAMERA == subdirectory) + { + gSavedSettings.setString("PresetGraphicActive", name); + + name_list.clear(); + getControlNames(name_list); + name_list.push_back("PresetCameraActive"); + } + else + { + LL_ERRS() << "Invalid presets directory '" << subdirectory << "'" << LL_ENDL; + } - // make an empty llsd - LLSD paramsData(LLSD::emptyMap()); - - // 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"); + // make an empty llsd + LLSD paramsData(LLSD::emptyMap()); + + // 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; + 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 (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; - } - } + 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 available to be saved" << LL_ENDL; - } + { + LL_INFOS() << "No settings available to be saved" << LL_ENDL; + } - return saved; + return saved; } bool LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option) { - bool sts = true; - - combo->clearRows(); - - std::string presets_dir = getPresetsDir(subdirectory); - - if (!presets_dir.empty()) - { - std::list preset_names; - loadPresetNamesFromDir(presets_dir, preset_names, default_option); - - std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); - - if (preset_names.begin() != preset_names.end()) - { - for (std::list::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it) - { - const std::string& name = *it; - combo->add(name, LLSD().with(0, name)); - } - } - else - { - combo->setLabel(LLTrans::getString("preset_combo_label")); - sts = false; - } - } - return sts; + bool sts = true; + + combo->clearRows(); + + std::string presets_dir = getPresetsDir(subdirectory); + + if (!presets_dir.empty()) + { + std::list preset_names; + loadPresetNamesFromDir(presets_dir, preset_names, default_option); + + std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); + + if (preset_names.begin() != preset_names.end()) + { + for (std::list::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it) + { + const std::string& name = *it; + combo->add(name, LLSD().with(0, name)); + } + } + else + { + combo->setLabel(LLTrans::getString("preset_combo_label")); + sts = false; + } + } + return sts; } void LLPresetsManager::loadPreset(const std::string& subdirectory, std::string name) { - if (LLTrans::getString(PRESETS_DEFAULT) == name) - { - name = PRESETS_DEFAULT; - } + if (LLTrans::getString(PRESETS_DEFAULT) == name) + { + name = PRESETS_DEFAULT; + } - std::string full_path(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); + std::string full_path(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); LL_DEBUGS() << "attempting to load preset '"< 0) - { - if(PRESETS_GRAPHIC == subdirectory) - { - gSavedSettings.setString("PresetGraphicActive", name); - - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->refreshEnabledGraphics(); - } - triggerChangeSignal(); - } - if(PRESETS_CAMERA == subdirectory) - { - gSavedSettings.setString("PresetCameraActive", name); - triggerChangeCameraSignal(); - } - } + if(gSavedSettings.loadFromFile(full_path, false, true) > 0) + { + if(PRESETS_GRAPHIC == subdirectory) + { + gSavedSettings.setString("PresetGraphicActive", name); + + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->refreshEnabledGraphics(); + } + triggerChangeSignal(); + } + if(PRESETS_CAMERA == subdirectory) + { + gSavedSettings.setString("PresetCameraActive", name); + triggerChangeCameraSignal(); + } + } else { LL_WARNS("Presets") << "failed to load preset '"<deleteFilesInDir(getPresetsDir(subdirectory), LLURI::escape(name) + ".xml") < 1) - { - LL_WARNS("Presets") << "Error removing preset " << name << " from disk" << LL_ENDL; - sts = false; - } - - // If you delete the preset that is currently marked as loaded then also indicate that no preset is loaded. - if(PRESETS_GRAPHIC == subdirectory) - { - if (gSavedSettings.getString("PresetGraphicActive") == name) - { - gSavedSettings.setString("PresetGraphicActive", ""); - } - // signal interested parties - triggerChangeSignal(); - } - - if(PRESETS_CAMERA == subdirectory) - { - if (gSavedSettings.getString("PresetCameraActive") == name) - { - gSavedSettings.setString("PresetCameraActive", ""); - } - // signal interested parties - triggerChangeCameraSignal(); - } - - return sts; + if (LLTrans::getString(PRESETS_DEFAULT) == name) + { + name = PRESETS_DEFAULT; + } + + bool sts = true; + + if (PRESETS_DEFAULT == name) + { + // This code should never execute + LL_WARNS("Presets") << "You are not allowed to delete the default preset." << LL_ENDL; + sts = false; + } + + if (gDirUtilp->deleteFilesInDir(getPresetsDir(subdirectory), LLURI::escape(name) + ".xml") < 1) + { + LL_WARNS("Presets") << "Error removing preset " << name << " from disk" << LL_ENDL; + sts = false; + } + + // If you delete the preset that is currently marked as loaded then also indicate that no preset is loaded. + if(PRESETS_GRAPHIC == subdirectory) + { + if (gSavedSettings.getString("PresetGraphicActive") == name) + { + gSavedSettings.setString("PresetGraphicActive", ""); + } + // 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); + return mPresetListChangeCameraSignal.connect(cb); } boost::signals2::connection LLPresetsManager::setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb) { - return mPresetListChangeSignal.connect(cb); + return mPresetListChangeSignal.connect(cb); } diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 7370e0a3b1..c3a6c0795c 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -39,54 +39,54 @@ static const std::string PRESETS_CAMERA = "camera"; enum EDefaultOptions { - DEFAULT_SHOW, - DEFAULT_TOP, - DEFAULT_HIDE // Do not display "Default" in a list + DEFAULT_SHOW, + DEFAULT_TOP, + DEFAULT_HIDE // Do not display "Default" in a list }; class LLPresetsManager : public LLSingleton { - LLSINGLETON(LLPresetsManager); - ~LLPresetsManager(); + LLSINGLETON(LLPresetsManager); + ~LLPresetsManager(); public: - typedef std::list preset_name_list_t; - typedef boost::signals2::signal preset_list_signal_t; + typedef std::list preset_name_list_t; + typedef boost::signals2::signal preset_list_signal_t; - void createMissingDefault(const std::string& subdirectory); - void startWatching(const std::string& subdirectory); - void triggerChangeCameraSignal(); - void triggerChangeSignal(); - static std::string getPresetsDir(const std::string& subdirectory); - 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); + void createMissingDefault(const std::string& subdirectory); + void startWatching(const std::string& subdirectory); + void triggerChangeCameraSignal(); + void triggerChangeSignal(); + static std::string getPresetsDir(const std::string& subdirectory); + 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, 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. + // Emitted when a preset gets loaded or saved. - preset_name_list_t mPresetNames; + preset_name_list_t mPresetNames; - preset_list_signal_t mPresetListChangeCameraSignal; - preset_list_signal_t mPresetListChangeSignal; + preset_list_signal_t mPresetListChangeCameraSignal; + preset_list_signal_t mPresetListChangeSignal; private: - LOG_CLASS(LLPresetsManager); + LOG_CLASS(LLPresetsManager); - void getControlNames(std::vector& names); - static void settingChanged(); + void getControlNames(std::vector& names); + static void settingChanged(); - boost::signals2::connection mCameraChangedSignal; + boost::signals2::connection mCameraChangedSignal; - static bool mCameraDirty; + static bool mCameraDirty; }; #endif // LL_PRESETSMANAGER_H diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 398ec953d7..da495cbf21 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -63,7 +63,7 @@ #include "llworld.h" #include "llstatgraph.h" #include "llviewermedia.h" -#include "llviewermenu.h" // for gMenuBarView +#include "llviewermenu.h" // for gMenuBarView #include "llviewerparcelmgr.h" #include "llviewerthrottle.h" #include "lluictrlfactory.h" @@ -100,42 +100,42 @@ const S32 SIM_STAT_WIDTH = 8; const LLColor4 SIM_OK_COLOR(0.f, 1.f, 0.f, 1.f); const LLColor4 SIM_WARN_COLOR(1.f, 1.f, 0.f, 1.f); const LLColor4 SIM_FULL_COLOR(1.f, 0.f, 0.f, 1.f); -const F32 ICON_TIMER_EXPIRY = 3.f; // How long the balance and health icons should flash after a change. +const F32 ICON_TIMER_EXPIRY = 3.f; // How long the balance and health icons should flash after a change. static void onClickVolume(void*); LLStatusBar::LLStatusBar(const LLRect& rect) -: LLPanel(), - mTextTime(NULL), - mSGBandwidth(NULL), - mSGPacketLoss(NULL), - mBtnVolume(NULL), - mBoxBalance(NULL), - mBalance(0), - mHealth(100), - mSquareMetersCredit(0), - mSquareMetersCommitted(0) +: LLPanel(), + mTextTime(NULL), + mSGBandwidth(NULL), + mSGPacketLoss(NULL), + mBtnVolume(NULL), + mBoxBalance(NULL), + mBalance(0), + mHealth(100), + mSquareMetersCredit(0), + mSquareMetersCommitted(0) { - setRect(rect); - - // status bar can possible overlay menus? - setMouseOpaque(FALSE); + setRect(rect); + + // status bar can possible overlay menus? + setMouseOpaque(FALSE); - mBalanceTimer = new LLFrameTimer(); - mHealthTimer = new LLFrameTimer(); + mBalanceTimer = new LLFrameTimer(); + mHealthTimer = new LLFrameTimer(); - buildFromFile("panel_status_bar.xml"); + buildFromFile("panel_status_bar.xml"); } LLStatusBar::~LLStatusBar() { - delete mBalanceTimer; - mBalanceTimer = NULL; + delete mBalanceTimer; + mBalanceTimer = NULL; - delete mHealthTimer; - mHealthTimer = NULL; + delete mHealthTimer; + mHealthTimer = NULL; - // LLView destructor cleans up children + // LLView destructor cleans up children } //----------------------------------------------------------------------- @@ -145,465 +145,465 @@ LLStatusBar::~LLStatusBar() // virtual void LLStatusBar::draw() { - refresh(); - LLPanel::draw(); + refresh(); + LLPanel::draw(); } BOOL LLStatusBar::handleRightMouseDown(S32 x, S32 y, MASK mask) { - show_navbar_context_menu(this,x,y); - return TRUE; + show_navbar_context_menu(this,x,y); + return TRUE; } BOOL LLStatusBar::postBuild() { - gMenuBarView->setRightMouseDownCallback(boost::bind(&show_navbar_context_menu, _1, _2, _3)); + gMenuBarView->setRightMouseDownCallback(boost::bind(&show_navbar_context_menu, _1, _2, _3)); - mTextTime = getChild("TimeText" ); - - getChild("buyL")->setCommitCallback( - boost::bind(&LLStatusBar::onClickBuyCurrency, this)); + mTextTime = getChild("TimeText" ); + + getChild("buyL")->setCommitCallback( + boost::bind(&LLStatusBar::onClickBuyCurrency, this)); getChild("goShop")->setCommitCallback(boost::bind(&LLWeb::loadURL, gSavedSettings.getString("MarketplaceURL"), LLStringUtil::null, LLStringUtil::null)); - mBoxBalance = getChild("balance"); - mBoxBalance->setClickedCallback( &LLStatusBar::onClickBalance, 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 ); - mBtnVolume->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterVolume, this)); - - mMediaToggle = getChild("media_toggle_btn"); - mMediaToggle->setClickedCallback( &LLStatusBar::onClickMediaToggle, this ); - mMediaToggle->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterNearbyMedia, this)); - - LLHints::registerHintTarget("linden_balance", getChild("balance_bg")->getHandle()); - - gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&LLStatusBar::onVolumeChanged, this, _2)); - - // Adding Net Stat Graph - S32 x = getRect().getWidth() - 2; - S32 y = 0; - LLRect r; - r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); - LLStatGraph::Params sgp; - sgp.name("BandwidthGraph"); - sgp.rect(r); - sgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); - sgp.mouse_opaque(false); - sgp.stat.count_stat_float(&LLStatViewer::ACTIVE_MESSAGE_DATA_RECEIVED); - sgp.units("Kbps"); - sgp.precision(0); - sgp.per_sec(true); - mSGBandwidth = LLUICtrlFactory::create(sgp); - addChild(mSGBandwidth); - x -= SIM_STAT_WIDTH + 2; - - r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); - //these don't seem to like being reused - LLStatGraph::Params pgp; - pgp.name("PacketLossPercent"); - pgp.rect(r); - pgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); - pgp.mouse_opaque(false); - pgp.stat.sample_stat_float(&LLStatViewer::PACKETS_LOST_PERCENT); - pgp.units("%"); - pgp.min(0.f); - pgp.max(5.f); - pgp.precision(1); - pgp.per_sec(false); - LLStatGraph::Thresholds thresholds; - thresholds.threshold.add(LLStatGraph::ThresholdParams().value(0.1).color(LLColor4::green)) - .add(LLStatGraph::ThresholdParams().value(0.25f).color(LLColor4::yellow)) - .add(LLStatGraph::ThresholdParams().value(0.6f).color(LLColor4::red)); - - pgp.thresholds(thresholds); - - 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); - mPanelPresetsPulldown->setVisible(FALSE); - - mPanelVolumePulldown = new LLPanelVolumePulldown(); - addChild(mPanelVolumePulldown); - mPanelVolumePulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); - mPanelVolumePulldown->setVisible(FALSE); - - mPanelNearByMedia = new LLPanelNearByMedia(); - addChild(mPanelNearByMedia); - mPanelNearByMedia->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); - mPanelNearByMedia->setVisible(FALSE); - - return TRUE; + mBoxBalance = getChild("balance"); + mBoxBalance->setClickedCallback( &LLStatusBar::onClickBalance, 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 ); + mBtnVolume->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterVolume, this)); + + mMediaToggle = getChild("media_toggle_btn"); + mMediaToggle->setClickedCallback( &LLStatusBar::onClickMediaToggle, this ); + mMediaToggle->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterNearbyMedia, this)); + + LLHints::registerHintTarget("linden_balance", getChild("balance_bg")->getHandle()); + + gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&LLStatusBar::onVolumeChanged, this, _2)); + + // Adding Net Stat Graph + S32 x = getRect().getWidth() - 2; + S32 y = 0; + LLRect r; + r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); + LLStatGraph::Params sgp; + sgp.name("BandwidthGraph"); + sgp.rect(r); + sgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); + sgp.mouse_opaque(false); + sgp.stat.count_stat_float(&LLStatViewer::ACTIVE_MESSAGE_DATA_RECEIVED); + sgp.units("Kbps"); + sgp.precision(0); + sgp.per_sec(true); + mSGBandwidth = LLUICtrlFactory::create(sgp); + addChild(mSGBandwidth); + x -= SIM_STAT_WIDTH + 2; + + r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); + //these don't seem to like being reused + LLStatGraph::Params pgp; + pgp.name("PacketLossPercent"); + pgp.rect(r); + pgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); + pgp.mouse_opaque(false); + pgp.stat.sample_stat_float(&LLStatViewer::PACKETS_LOST_PERCENT); + pgp.units("%"); + pgp.min(0.f); + pgp.max(5.f); + pgp.precision(1); + pgp.per_sec(false); + LLStatGraph::Thresholds thresholds; + thresholds.threshold.add(LLStatGraph::ThresholdParams().value(0.1).color(LLColor4::green)) + .add(LLStatGraph::ThresholdParams().value(0.25f).color(LLColor4::yellow)) + .add(LLStatGraph::ThresholdParams().value(0.6f).color(LLColor4::red)); + + pgp.thresholds(thresholds); + + 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); + mPanelPresetsPulldown->setVisible(FALSE); + + mPanelVolumePulldown = new LLPanelVolumePulldown(); + addChild(mPanelVolumePulldown); + mPanelVolumePulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); + mPanelVolumePulldown->setVisible(FALSE); + + mPanelNearByMedia = new LLPanelNearByMedia(); + addChild(mPanelNearByMedia); + mPanelNearByMedia->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); + mPanelNearByMedia->setVisible(FALSE); + + return TRUE; } // Per-frame updates of visibility void LLStatusBar::refresh() { - static LLCachedControl show_net_stats(gSavedSettings, "ShowNetStats", false); - bool net_stats_visible = show_net_stats; - - if (net_stats_visible) - { - // Adding Net Stat Meter back in - F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f; - mSGBandwidth->setMin(0.f); - mSGBandwidth->setMax(bwtotal*1.25f); - //mSGBandwidth->setThreshold(0, bwtotal*0.75f); - //mSGBandwidth->setThreshold(1, bwtotal); - //mSGBandwidth->setThreshold(2, bwtotal); - } - - // update clock every 10 seconds - if(mClockUpdateTimer.getElapsedTimeF32() > 10.f) - { - mClockUpdateTimer.reset(); - - // Get current UTC time, adjusted for the user's clock - // being off. - time_t utc_time; - utc_time = time_corrected(); - - std::string timeStr = getString("time"); - LLSD substitution; - substitution["datetime"] = (S32) utc_time; - LLStringUtil::format (timeStr, substitution); - mTextTime->setText(timeStr); - - // set the tooltip to have the date - std::string dtStr = getString("timeTooltip"); - LLStringUtil::format (dtStr, substitution); - mTextTime->setToolTip (dtStr); - } - - LLRect r; - const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge(); - - // reshape menu bar to its content's width - if (MENU_RIGHT != gMenuBarView->getRect().getWidth()) - { - gMenuBarView->reshape(MENU_RIGHT, gMenuBarView->getRect().getHeight()); - } - - mSGBandwidth->setVisible(net_stats_visible); - mSGPacketLoss->setVisible(net_stats_visible); - - // update the master volume button state - bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute(); - mBtnVolume->setToggleState(mute_audio); - - // Disable media toggle if there's no media, parcel media, and no parcel audio - // (or if media is disabled) - bool button_enabled = (gSavedSettings.getBOOL("AudioStreamingMusic")||gSavedSettings.getBOOL("AudioStreamingMedia")) && - (LLViewerMedia::hasInWorldMedia() || LLViewerMedia::hasParcelMedia() || LLViewerMedia::hasParcelAudio()); - mMediaToggle->setEnabled(button_enabled); - // Note the "sense" of the toggle is opposite whether media is playing or not - bool any_media_playing = (LLViewerMedia::isAnyMediaPlaying() || - LLViewerMedia::isParcelMediaPlaying() || - LLViewerMedia::isParcelAudioPlaying()); - mMediaToggle->setValue(!any_media_playing); + static LLCachedControl show_net_stats(gSavedSettings, "ShowNetStats", false); + bool net_stats_visible = show_net_stats; + + if (net_stats_visible) + { + // Adding Net Stat Meter back in + F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f; + mSGBandwidth->setMin(0.f); + mSGBandwidth->setMax(bwtotal*1.25f); + //mSGBandwidth->setThreshold(0, bwtotal*0.75f); + //mSGBandwidth->setThreshold(1, bwtotal); + //mSGBandwidth->setThreshold(2, bwtotal); + } + + // update clock every 10 seconds + if(mClockUpdateTimer.getElapsedTimeF32() > 10.f) + { + mClockUpdateTimer.reset(); + + // Get current UTC time, adjusted for the user's clock + // being off. + time_t utc_time; + utc_time = time_corrected(); + + std::string timeStr = getString("time"); + LLSD substitution; + substitution["datetime"] = (S32) utc_time; + LLStringUtil::format (timeStr, substitution); + mTextTime->setText(timeStr); + + // set the tooltip to have the date + std::string dtStr = getString("timeTooltip"); + LLStringUtil::format (dtStr, substitution); + mTextTime->setToolTip (dtStr); + } + + LLRect r; + const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge(); + + // reshape menu bar to its content's width + if (MENU_RIGHT != gMenuBarView->getRect().getWidth()) + { + gMenuBarView->reshape(MENU_RIGHT, gMenuBarView->getRect().getHeight()); + } + + mSGBandwidth->setVisible(net_stats_visible); + mSGPacketLoss->setVisible(net_stats_visible); + + // update the master volume button state + bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute(); + mBtnVolume->setToggleState(mute_audio); + + // Disable media toggle if there's no media, parcel media, and no parcel audio + // (or if media is disabled) + bool button_enabled = (gSavedSettings.getBOOL("AudioStreamingMusic")||gSavedSettings.getBOOL("AudioStreamingMedia")) && + (LLViewerMedia::hasInWorldMedia() || LLViewerMedia::hasParcelMedia() || LLViewerMedia::hasParcelAudio()); + mMediaToggle->setEnabled(button_enabled); + // Note the "sense" of the toggle is opposite whether media is playing or not + bool any_media_playing = (LLViewerMedia::isAnyMediaPlaying() || + LLViewerMedia::isParcelMediaPlaying() || + LLViewerMedia::isParcelAudioPlaying()); + mMediaToggle->setValue(!any_media_playing); } void LLStatusBar::setVisibleForMouselook(bool visible) { - mTextTime->setVisible(visible); - getChild("balance_bg")->setVisible(visible); - mBoxBalance->setVisible(visible); - mBtnVolume->setVisible(visible); - mMediaToggle->setVisible(visible); - mSGBandwidth->setVisible(visible); - mSGPacketLoss->setVisible(visible); - setBackgroundVisible(visible); - mIconPresetsCamera->setVisible(visible); - mIconPresetsGraphic->setVisible(visible); + mTextTime->setVisible(visible); + getChild("balance_bg")->setVisible(visible); + mBoxBalance->setVisible(visible); + mBtnVolume->setVisible(visible); + mMediaToggle->setVisible(visible); + mSGBandwidth->setVisible(visible); + mSGPacketLoss->setVisible(visible); + setBackgroundVisible(visible); + mIconPresetsCamera->setVisible(visible); + mIconPresetsGraphic->setVisible(visible); } void LLStatusBar::debitBalance(S32 debit) { - setBalance(getBalance() - debit); + setBalance(getBalance() - debit); } void LLStatusBar::creditBalance(S32 credit) { - setBalance(getBalance() + credit); + setBalance(getBalance() + credit); } void LLStatusBar::setBalance(S32 balance) { - if (balance > getBalance() && getBalance() != 0) - { - LLFirstUse::receiveLindens(); - } - - std::string money_str = LLResMgr::getInstance()->getMonetaryString( balance ); - - LLStringUtil::format_map_t string_args; - string_args["[AMT]"] = llformat("%s", money_str.c_str()); - std::string label_str = getString("buycurrencylabel", string_args); - mBoxBalance->setValue(label_str); - - // Resize the L$ balance background to be wide enough for your balance plus the buy button - { - const S32 HPAD = 24; - LLRect balance_rect = mBoxBalance->getTextBoundingRect(); - LLRect buy_rect = getChildView("buyL")->getRect(); - LLRect shop_rect = getChildView("goShop")->getRect(); - LLView* balance_bg_view = getChildView("balance_bg"); - LLRect balance_bg_rect = balance_bg_view->getRect(); - balance_bg_rect.mLeft = balance_bg_rect.mRight - (buy_rect.getWidth() + shop_rect.getWidth() + balance_rect.getWidth() + HPAD); - balance_bg_view->setShape(balance_bg_rect); - } - - if (mBalance && (fabs((F32)(mBalance - balance)) > gSavedSettings.getF32("UISndMoneyChangeThreshold"))) - { - if (mBalance > balance) - make_ui_sound("UISndMoneyChangeDown"); - else - make_ui_sound("UISndMoneyChangeUp"); - } - - if( balance != mBalance ) - { - mBalanceTimer->reset(); - mBalanceTimer->setTimerExpirySec( ICON_TIMER_EXPIRY ); - mBalance = balance; - } + if (balance > getBalance() && getBalance() != 0) + { + LLFirstUse::receiveLindens(); + } + + std::string money_str = LLResMgr::getInstance()->getMonetaryString( balance ); + + LLStringUtil::format_map_t string_args; + string_args["[AMT]"] = llformat("%s", money_str.c_str()); + std::string label_str = getString("buycurrencylabel", string_args); + mBoxBalance->setValue(label_str); + + // Resize the L$ balance background to be wide enough for your balance plus the buy button + { + const S32 HPAD = 24; + LLRect balance_rect = mBoxBalance->getTextBoundingRect(); + LLRect buy_rect = getChildView("buyL")->getRect(); + LLRect shop_rect = getChildView("goShop")->getRect(); + LLView* balance_bg_view = getChildView("balance_bg"); + LLRect balance_bg_rect = balance_bg_view->getRect(); + balance_bg_rect.mLeft = balance_bg_rect.mRight - (buy_rect.getWidth() + shop_rect.getWidth() + balance_rect.getWidth() + HPAD); + balance_bg_view->setShape(balance_bg_rect); + } + + if (mBalance && (fabs((F32)(mBalance - balance)) > gSavedSettings.getF32("UISndMoneyChangeThreshold"))) + { + if (mBalance > balance) + make_ui_sound("UISndMoneyChangeDown"); + else + make_ui_sound("UISndMoneyChangeUp"); + } + + if( balance != mBalance ) + { + mBalanceTimer->reset(); + mBalanceTimer->setTimerExpirySec( ICON_TIMER_EXPIRY ); + mBalance = balance; + } } // static void LLStatusBar::sendMoneyBalanceRequest() { - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_MoneyBalanceRequest); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_MoneyData); - msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null ); - gAgent.sendReliableMessage(); + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_MoneyBalanceRequest); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_MoneyData); + msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null ); + gAgent.sendReliableMessage(); } void LLStatusBar::setHealth(S32 health) { - //LL_INFOS() << "Setting health to: " << buffer << LL_ENDL; - if( mHealth > health ) - { - if (mHealth > (health + gSavedSettings.getF32("UISndHealthReductionThreshold"))) - { - if (isAgentAvatarValid()) - { - if (gAgentAvatarp->getSex() == SEX_FEMALE) - { - make_ui_sound("UISndHealthReductionF"); - } - else - { - make_ui_sound("UISndHealthReductionM"); - } - } - } - - mHealthTimer->reset(); - mHealthTimer->setTimerExpirySec( ICON_TIMER_EXPIRY ); - } - - mHealth = health; + //LL_INFOS() << "Setting health to: " << buffer << LL_ENDL; + if( mHealth > health ) + { + if (mHealth > (health + gSavedSettings.getF32("UISndHealthReductionThreshold"))) + { + if (isAgentAvatarValid()) + { + if (gAgentAvatarp->getSex() == SEX_FEMALE) + { + make_ui_sound("UISndHealthReductionF"); + } + else + { + make_ui_sound("UISndHealthReductionM"); + } + } + } + + mHealthTimer->reset(); + mHealthTimer->setTimerExpirySec( ICON_TIMER_EXPIRY ); + } + + mHealth = health; } S32 LLStatusBar::getBalance() const { - return mBalance; + return mBalance; } S32 LLStatusBar::getHealth() const { - return mHealth; + return mHealth; } void LLStatusBar::setLandCredit(S32 credit) { - mSquareMetersCredit = credit; + mSquareMetersCredit = credit; } void LLStatusBar::setLandCommitted(S32 committed) { - mSquareMetersCommitted = committed; + mSquareMetersCommitted = committed; } BOOL LLStatusBar::isUserTiered() const { - return (mSquareMetersCredit > 0); + return (mSquareMetersCredit > 0); } S32 LLStatusBar::getSquareMetersCredit() const { - return mSquareMetersCredit; + return mSquareMetersCredit; } S32 LLStatusBar::getSquareMetersCommitted() const { - return mSquareMetersCommitted; + return mSquareMetersCommitted; } S32 LLStatusBar::getSquareMetersLeft() const { - return mSquareMetersCredit - mSquareMetersCommitted; + return mSquareMetersCredit - mSquareMetersCommitted; } void LLStatusBar::onClickBuyCurrency() { - // open a currency floater - actual one open depends on - // value specified in settings.xml - LLBuyCurrencyHTML::openCurrencyFloater(); - LLFirstUse::receiveLindens(false); + // open a currency floater - actual one open depends on + // value specified in settings.xml + LLBuyCurrencyHTML::openCurrencyFloater(); + 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); + 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_graphic" ); - LLRect icon_rect = icon->getRect(); - LLRect pulldown_rect = mPanelPresetsPulldown->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); - mPanelPresetsPulldown->setShape(pulldown_rect); - - // show the master presets pull-down - LLUI::clearPopups(); - LLUI::addPopup(mPanelPresetsPulldown); - mPanelNearByMedia->setVisible(FALSE); - mPanelVolumePulldown->setVisible(FALSE); - mPanelPresetsPulldown->setVisible(TRUE); + LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); + LLIconCtrl* icon = getChild( "presets_icon_graphic" ); + LLRect icon_rect = icon->getRect(); + LLRect pulldown_rect = mPanelPresetsPulldown->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); + mPanelPresetsPulldown->setShape(pulldown_rect); + + // show the master presets pull-down + LLUI::clearPopups(); + LLUI::addPopup(mPanelPresetsPulldown); + mPanelNearByMedia->setVisible(FALSE); + mPanelVolumePulldown->setVisible(FALSE); + mPanelPresetsPulldown->setVisible(TRUE); } void LLStatusBar::onMouseEnterVolume() { - LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); - LLButton* volbtn = getChild( "volume_btn" ); - LLRect vol_btn_rect = volbtn->getRect(); - LLRect volume_pulldown_rect = mPanelVolumePulldown->getRect(); - volume_pulldown_rect.setLeftTopAndSize(vol_btn_rect.mLeft - - (volume_pulldown_rect.getWidth() - vol_btn_rect.getWidth()), - vol_btn_rect.mBottom, - volume_pulldown_rect.getWidth(), - volume_pulldown_rect.getHeight()); - - volume_pulldown_rect.translate(popup_holder->getRect().getWidth() - volume_pulldown_rect.mRight, 0); - mPanelVolumePulldown->setShape(volume_pulldown_rect); - - - // show the master volume pull-down - LLUI::clearPopups(); - LLUI::addPopup(mPanelVolumePulldown); - mPanelPresetsCameraPulldown->setVisible(FALSE); - mPanelPresetsPulldown->setVisible(FALSE); - mPanelNearByMedia->setVisible(FALSE); - mPanelVolumePulldown->setVisible(TRUE); + LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); + LLButton* volbtn = getChild( "volume_btn" ); + LLRect vol_btn_rect = volbtn->getRect(); + LLRect volume_pulldown_rect = mPanelVolumePulldown->getRect(); + volume_pulldown_rect.setLeftTopAndSize(vol_btn_rect.mLeft - + (volume_pulldown_rect.getWidth() - vol_btn_rect.getWidth()), + vol_btn_rect.mBottom, + volume_pulldown_rect.getWidth(), + volume_pulldown_rect.getHeight()); + + volume_pulldown_rect.translate(popup_holder->getRect().getWidth() - volume_pulldown_rect.mRight, 0); + mPanelVolumePulldown->setShape(volume_pulldown_rect); + + + // show the master volume pull-down + LLUI::clearPopups(); + LLUI::addPopup(mPanelVolumePulldown); + mPanelPresetsCameraPulldown->setVisible(FALSE); + mPanelPresetsPulldown->setVisible(FALSE); + mPanelNearByMedia->setVisible(FALSE); + mPanelVolumePulldown->setVisible(TRUE); } void LLStatusBar::onMouseEnterNearbyMedia() { - LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); - LLRect nearby_media_rect = mPanelNearByMedia->getRect(); - LLButton* nearby_media_btn = getChild( "media_toggle_btn" ); - LLRect nearby_media_btn_rect = nearby_media_btn->getRect(); - nearby_media_rect.setLeftTopAndSize(nearby_media_btn_rect.mLeft - - (nearby_media_rect.getWidth() - nearby_media_btn_rect.getWidth())/2, - nearby_media_btn_rect.mBottom, - nearby_media_rect.getWidth(), - nearby_media_rect.getHeight()); - // force onscreen - nearby_media_rect.translate(popup_holder->getRect().getWidth() - nearby_media_rect.mRight, 0); - - // show the master volume pull-down - mPanelNearByMedia->setShape(nearby_media_rect); - LLUI::clearPopups(); - LLUI::addPopup(mPanelNearByMedia); - - mPanelPresetsCameraPulldown->setVisible(FALSE); - mPanelPresetsPulldown->setVisible(FALSE); - mPanelVolumePulldown->setVisible(FALSE); - mPanelNearByMedia->setVisible(TRUE); + LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); + LLRect nearby_media_rect = mPanelNearByMedia->getRect(); + LLButton* nearby_media_btn = getChild( "media_toggle_btn" ); + LLRect nearby_media_btn_rect = nearby_media_btn->getRect(); + nearby_media_rect.setLeftTopAndSize(nearby_media_btn_rect.mLeft - + (nearby_media_rect.getWidth() - nearby_media_btn_rect.getWidth())/2, + nearby_media_btn_rect.mBottom, + nearby_media_rect.getWidth(), + nearby_media_rect.getHeight()); + // force onscreen + nearby_media_rect.translate(popup_holder->getRect().getWidth() - nearby_media_rect.mRight, 0); + + // show the master volume pull-down + mPanelNearByMedia->setShape(nearby_media_rect); + LLUI::clearPopups(); + LLUI::addPopup(mPanelNearByMedia); + + mPanelPresetsCameraPulldown->setVisible(FALSE); + mPanelPresetsPulldown->setVisible(FALSE); + mPanelVolumePulldown->setVisible(FALSE); + mPanelNearByMedia->setVisible(TRUE); } static void onClickVolume(void* data) { - // toggle the master mute setting - bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute(); - LLAppViewer::instance()->setMasterSystemAudioMute(!mute_audio); + // toggle the master mute setting + bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute(); + LLAppViewer::instance()->setMasterSystemAudioMute(!mute_audio); } //static void LLStatusBar::onClickBalance(void* ) { - // Force a balance request message: - LLStatusBar::sendMoneyBalanceRequest(); - // The refresh of the display (call to setBalance()) will be done by process_money_balance_reply() + // Force a balance request message: + LLStatusBar::sendMoneyBalanceRequest(); + // The refresh of the display (call to setBalance()) will be done by process_money_balance_reply() } //static void LLStatusBar::onClickMediaToggle(void* data) { - LLStatusBar *status_bar = (LLStatusBar*)data; - // "Selected" means it was showing the "play" icon (so media was playing), and now it shows "pause", so turn off media - bool pause = status_bar->mMediaToggle->getValue(); - LLViewerMedia::setAllMediaPaused(pause); + LLStatusBar *status_bar = (LLStatusBar*)data; + // "Selected" means it was showing the "play" icon (so media was playing), and now it shows "pause", so turn off media + bool pause = status_bar->mMediaToggle->getValue(); + LLViewerMedia::setAllMediaPaused(pause); } BOOL can_afford_transaction(S32 cost) { - return((cost <= 0)||((gStatusBar) && (gStatusBar->getBalance() >=cost))); + return((cost <= 0)||((gStatusBar) && (gStatusBar->getBalance() >=cost))); } void LLStatusBar::onVolumeChanged(const LLSD& newvalue) { - refresh(); + refresh(); } // Implements secondlife:///app/balance/request to request a L$ balance @@ -611,18 +611,18 @@ void LLStatusBar::onVolumeChanged(const LLSD& newvalue) class LLBalanceHandler : public LLCommandHandler { public: - // Requires "trusted" browser/URL source - LLBalanceHandler() : LLCommandHandler("balance", UNTRUSTED_BLOCK) { } - bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) - { - if (tokens.size() == 1 - && tokens[0].asString() == "request") - { - LLStatusBar::sendMoneyBalanceRequest(); - return true; - } - return false; - } + // Requires "trusted" browser/URL source + LLBalanceHandler() : LLCommandHandler("balance", UNTRUSTED_BLOCK) { } + bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) + { + if (tokens.size() == 1 + && tokens[0].asString() == "request") + { + LLStatusBar::sendMoneyBalanceRequest(); + return true; + } + return false; + } }; // register with command dispatch system LLBalanceHandler gBalanceHandler; diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h index 040b7bc949..e9be398601 100644 --- a/indra/newview/llstatusbar.h +++ b/indra/newview/llstatusbar.h @@ -48,82 +48,82 @@ class LLPanelNearByMedia; class LLIconCtrl; class LLStatusBar -: public LLPanel +: public LLPanel { public: - LLStatusBar(const LLRect& rect ); - /*virtual*/ ~LLStatusBar(); - - /*virtual*/ void draw(); + LLStatusBar(const LLRect& rect ); + /*virtual*/ ~LLStatusBar(); + + /*virtual*/ void draw(); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL postBuild(); + /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL postBuild(); - // MANIPULATORS - void setBalance(S32 balance); - void debitBalance(S32 debit); - void creditBalance(S32 credit); + // MANIPULATORS + void setBalance(S32 balance); + void debitBalance(S32 debit); + void creditBalance(S32 credit); - // Request the latest currency balance from the server - static void sendMoneyBalanceRequest(); + // Request the latest currency balance from the server + static void sendMoneyBalanceRequest(); - void setHealth(S32 percent); + void setHealth(S32 percent); - void setLandCredit(S32 credit); - void setLandCommitted(S32 committed); + void setLandCredit(S32 credit); + void setLandCommitted(S32 committed); - void refresh(); - void setVisibleForMouselook(bool visible); - // some elements should hide in mouselook + void refresh(); + void setVisibleForMouselook(bool visible); + // some elements should hide in mouselook - // ACCESSORS - S32 getBalance() const; - S32 getHealth() const; + // ACCESSORS + S32 getBalance() const; + S32 getHealth() const; - BOOL isUserTiered() const; - S32 getSquareMetersCredit() const; - S32 getSquareMetersCommitted() const; - S32 getSquareMetersLeft() const; + BOOL isUserTiered() const; + S32 getSquareMetersCredit() const; + S32 getSquareMetersCommitted() const; + S32 getSquareMetersLeft() const; - LLPanelNearByMedia* getNearbyMediaPanel() { return mPanelNearByMedia; } + LLPanelNearByMedia* getNearbyMediaPanel() { return mPanelNearByMedia; } private: - - void onClickBuyCurrency(); - void onVolumeChanged(const LLSD& newvalue); + + void onClickBuyCurrency(); + void onVolumeChanged(const LLSD& newvalue); - void onMouseEnterPresetsCamera(); - void onMouseEnterPresets(); - void onMouseEnterVolume(); - void onMouseEnterNearbyMedia(); - void onClickScreen(S32 x, S32 y); + void onMouseEnterPresetsCamera(); + void onMouseEnterPresets(); + void onMouseEnterVolume(); + void onMouseEnterNearbyMedia(); + void onClickScreen(S32 x, S32 y); - static void onClickMediaToggle(void* data); - static void onClickBalance(void* data); + static void onClickMediaToggle(void* data); + static void onClickBalance(void* data); private: - LLTextBox *mTextTime; - - LLStatGraph *mSGBandwidth; - LLStatGraph *mSGPacketLoss; - - LLIconCtrl *mIconPresetsCamera; - LLIconCtrl *mIconPresetsGraphic; - LLButton *mBtnVolume; - LLTextBox *mBoxBalance; - LLButton *mMediaToggle; - LLFrameTimer mClockUpdateTimer; - - S32 mBalance; - S32 mHealth; - S32 mSquareMetersCredit; - S32 mSquareMetersCommitted; - LLFrameTimer* mBalanceTimer; - LLFrameTimer* mHealthTimer; - LLPanelPresetsCameraPulldown* mPanelPresetsCameraPulldown; - LLPanelPresetsPulldown* mPanelPresetsPulldown; - LLPanelVolumePulldown* mPanelVolumePulldown; - LLPanelNearByMedia* mPanelNearByMedia; + LLTextBox *mTextTime; + + LLStatGraph *mSGBandwidth; + LLStatGraph *mSGPacketLoss; + + LLIconCtrl *mIconPresetsCamera; + LLIconCtrl *mIconPresetsGraphic; + LLButton *mBtnVolume; + LLTextBox *mBoxBalance; + LLButton *mMediaToggle; + LLFrameTimer mClockUpdateTimer; + + S32 mBalance; + S32 mHealth; + S32 mSquareMetersCredit; + S32 mSquareMetersCommitted; + LLFrameTimer* mBalanceTimer; + LLFrameTimer* mHealthTimer; + LLPanelPresetsCameraPulldown* mPanelPresetsCameraPulldown; + LLPanelPresetsPulldown* mPanelPresetsPulldown; + LLPanelVolumePulldown* mPanelVolumePulldown; + LLPanelNearByMedia* mPanelNearByMedia; }; // *HACK: Status bar owns your cached money balance. JC diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 5237986cd6..968472fe4c 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -166,216 +166,216 @@ class LLFloaterOpenHandler : public LLCommandHandler { public: - // requires trusted browser to trigger - LLFloaterOpenHandler() : LLCommandHandler("openfloater", UNTRUSTED_THROTTLE) { } + // requires trusted browser to trigger + LLFloaterOpenHandler() : LLCommandHandler("openfloater", UNTRUSTED_THROTTLE) { } - bool handle(const LLSD& params, const LLSD& query_map, - LLMediaCtrl* web) - { - if (params.size() != 1) - { - return false; - } + bool handle(const LLSD& params, const LLSD& query_map, + LLMediaCtrl* web) + { + if (params.size() != 1) + { + return false; + } - const std::string floater_name = LLURI::unescape(params[0].asString()); - LLFloaterReg::showInstance(floater_name); + const std::string floater_name = LLURI::unescape(params[0].asString()); + LLFloaterReg::showInstance(floater_name); - return true; - } + return true; + } }; LLFloaterOpenHandler gFloaterOpenHandler; void LLViewerFloaterReg::registerFloaters() { - // *NOTE: Please keep these alphabetized for easier merges + // *NOTE: Please keep these alphabetized for easier merges - LLFloaterAboutUtil::registerFloater(); - LLFloaterReg::add("block_timers", "floater_fast_timers.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("appearance", "floater_my_appearance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("associate_listing", "floater_associate_listing.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("avatar", "floater_avatar.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("avatar_render_settings", "floater_avatar_render_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("avatar_textures", "floater_avatar_textures.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterAboutUtil::registerFloater(); + LLFloaterReg::add("block_timers", "floater_fast_timers.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("appearance", "floater_my_appearance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("associate_listing", "floater_associate_listing.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("avatar", "floater_avatar.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("avatar_render_settings", "floater_avatar_render_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("avatar_textures", "floater_avatar_textures.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("beacons", "floater_beacons.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("bulk_perms", "floater_bulk_perms.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("buy_currency", "floater_buy_currency.xml", &LLFloaterBuyCurrency::buildFloater); - LLFloaterReg::add("buy_currency_html", "floater_buy_currency_html.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("buy_land", "floater_buy_land.xml", &LLFloaterBuyLand::buildFloater); - LLFloaterReg::add("buy_object", "floater_buy_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("buy_object_contents", "floater_buy_contents.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("build", "floater_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("build_options", "floater_build_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("bumps", "floater_bumps.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("beacons", "floater_beacons.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("bulk_perms", "floater_bulk_perms.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("buy_currency", "floater_buy_currency.xml", &LLFloaterBuyCurrency::buildFloater); + LLFloaterReg::add("buy_currency_html", "floater_buy_currency_html.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("buy_land", "floater_buy_land.xml", &LLFloaterBuyLand::buildFloater); + LLFloaterReg::add("buy_object", "floater_buy_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("buy_object_contents", "floater_buy_contents.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("build", "floater_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("build_options", "floater_build_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("bumps", "floater_bumps.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("camera", "floater_camera.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("chat_voice", "floater_voice_chat_volume.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("nearby_chat", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterIMNearbyChat::buildFloater); - LLFloaterReg::add("compile_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("conversation", "floater_conversation_log.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("camera", "floater_camera.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("chat_voice", "floater_voice_chat_volume.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("nearby_chat", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterIMNearbyChat::buildFloater); + LLFloaterReg::add("compile_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("conversation", "floater_conversation_log.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("delete_pref_preset", "floater_delete_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("destinations", "floater_destinations.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("delete_pref_preset", "floater_delete_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("destinations", "floater_destinations.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_post_process", "floater_post_process.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_settings", "floater_environment_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_delete_preset", "floater_delete_env_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_edit_sky", "floater_edit_sky_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_edit_water", "floater_edit_water_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_edit_day_cycle", "floater_edit_day_cycle.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("env_post_process", "floater_post_process.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("env_settings", "floater_environment_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("env_delete_preset", "floater_delete_env_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("env_edit_sky", "floater_edit_sky_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("env_edit_water", "floater_edit_water_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("env_edit_day_cycle", "floater_edit_day_cycle.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("event", "floater_event.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("experiences", "floater_experiences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("experience_profile", "floater_experienceprofile.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("experience_search", "floater_experience_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("experience_profile", "floater_experienceprofile.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("experience_search", "floater_experience_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("font_test", "floater_font_test.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("font_test", "floater_font_test.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("gestures", "floater_gesture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("god_tools", "floater_god_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("grid_status", "floater_grid_status.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("group_picker", "floater_choose_group.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("gestures", "floater_gesture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("god_tools", "floater_god_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("grid_status", "floater_grid_status.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("group_picker", "floater_choose_group.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("help_browser", "floater_help_browser.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("edit_hover_height", "floater_edit_hover_height.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("hud", "floater_hud.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("help_browser", "floater_help_browser.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("edit_hover_height", "floater_edit_hover_height.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("hud", "floater_hud.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("impanel", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("im_container", "floater_im_container.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("im_well_window", "floater_sys_well.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("incoming_call", "floater_incoming_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("inventory", "floater_my_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("inspect", "floater_inspect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("item_properties", "floater_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLInspectAvatarUtil::registerFloater(); - LLInspectGroupUtil::registerFloater(); - LLInspectObjectUtil::registerFloater(); - LLInspectRemoteObjectUtil::registerFloater(); - LLFloaterVoiceVolumeUtil::registerFloater(); - LLNotificationsUI::registerFloater(); - - LLFloaterReg::add("lagmeter", "floater_lagmeter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("land_holdings", "floater_land_holdings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("linkreplace", "floater_linkreplace.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("load_pref_preset", "floater_load_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - - LLFloaterReg::add("mem_leaking", "floater_mem_leaking.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("impanel", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("im_container", "floater_im_container.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("im_well_window", "floater_sys_well.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("incoming_call", "floater_incoming_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("inventory", "floater_my_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("inspect", "floater_inspect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("item_properties", "floater_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLInspectAvatarUtil::registerFloater(); + LLInspectGroupUtil::registerFloater(); + LLInspectObjectUtil::registerFloater(); + LLInspectRemoteObjectUtil::registerFloater(); + LLFloaterVoiceVolumeUtil::registerFloater(); + LLNotificationsUI::registerFloater(); + + LLFloaterReg::add("lagmeter", "floater_lagmeter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("land_holdings", "floater_land_holdings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("linkreplace", "floater_linkreplace.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("load_pref_preset", "floater_load_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + LLFloaterReg::add("mem_leaking", "floater_mem_leaking.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - if(gSavedSettings.getBOOL("TextureFetchDebuggerEnabled")) - { - LLFloaterReg::add("tex_fetch_debugger", "floater_texture_fetch_debugger.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - } - LLFloaterReg::add("media_settings", "floater_media_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("marketplace_listings", "floater_marketplace_listings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("marketplace_validation", "floater_marketplace_validation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("message_critical", "floater_critical.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("message_tos", "floater_tos.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("moveview", "floater_moveview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("mute_object_by_name", "floater_mute_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("mini_map", "floater_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + if(gSavedSettings.getBOOL("TextureFetchDebuggerEnabled")) + { + LLFloaterReg::add("tex_fetch_debugger", "floater_texture_fetch_debugger.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + } + LLFloaterReg::add("media_settings", "floater_media_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("marketplace_listings", "floater_marketplace_listings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("marketplace_validation", "floater_marketplace_validation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("message_critical", "floater_critical.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("message_tos", "floater_tos.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("moveview", "floater_moveview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("mute_object_by_name", "floater_mute_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("mini_map", "floater_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("notifications_console", "floater_notifications_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - - LLFloaterReg::add("notification_well_window", "floater_notifications_tabbed.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("notifications_console", "floater_notifications_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + LLFloaterReg::add("notification_well_window", "floater_notifications_tabbed.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("object_weights", "floater_object_weights.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("openobject", "floater_openobject.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("outgoing_call", "floater_outgoing_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("outfit_photo_preview", "floater_outfit_photo_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterPayUtil::registerFloater(); + LLFloaterReg::add("object_weights", "floater_object_weights.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("openobject", "floater_openobject.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("outgoing_call", "floater_outgoing_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("outfit_photo_preview", "floater_outfit_photo_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterPayUtil::registerFloater(); - LLFloaterReg::add("pathfinding_characters", "floater_pathfinding_characters.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("pathfinding_linksets", "floater_pathfinding_linksets.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("pathfinding_console", "floater_pathfinding_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("people", "floater_people.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("perms_default", "floater_perms_default.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - 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_view_advanced", "floater_preferences_view_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); - LLFloaterReg::add("prefs_spellchecker", "floater_spellcheck.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("prefs_autoreplace", "floater_autoreplace.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("picks", "floater_picks.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("pref_joystick", "floater_joystick.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("preview_anim", "floater_preview_animation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); - LLFloaterReg::add("preview_conversation", "floater_conversation_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("preview_gesture", "floater_preview_gesture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); - LLFloaterReg::add("preview_notecard", "floater_preview_notecard.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); - LLFloaterReg::add("preview_script", "floater_script_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); - LLFloaterReg::add("preview_scriptedit", "floater_live_lsleditor.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); - LLFloaterReg::add("preview_sound", "floater_preview_sound.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); - LLFloaterReg::add("preview_texture", "floater_preview_texture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); - LLFloaterReg::add("preview_trash", "floater_preview_trash.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("properties", "floater_inventory_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("publish_classified", "floater_publish_classified.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("save_pref_preset", "floater_save_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("script_colors", "floater_script_ed_prefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("pathfinding_characters", "floater_pathfinding_characters.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("pathfinding_linksets", "floater_pathfinding_linksets.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("pathfinding_console", "floater_pathfinding_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("people", "floater_people.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("perms_default", "floater_perms_default.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + 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_view_advanced", "floater_preferences_view_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); + LLFloaterReg::add("prefs_spellchecker", "floater_spellcheck.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("prefs_autoreplace", "floater_autoreplace.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("picks", "floater_picks.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("pref_joystick", "floater_joystick.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("preview_anim", "floater_preview_animation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_conversation", "floater_conversation_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("preview_gesture", "floater_preview_gesture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_notecard", "floater_preview_notecard.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_script", "floater_script_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_scriptedit", "floater_live_lsleditor.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_sound", "floater_preview_sound.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_texture", "floater_preview_texture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_trash", "floater_preview_trash.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("properties", "floater_inventory_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("publish_classified", "floater_publish_classified.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("save_pref_preset", "floater_save_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("script_colors", "floater_script_ed_prefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("telehubs", "floater_telehub.xml",&LLFloaterReg::build); - LLFloaterReg::add("test_inspectors", "floater_test_inspectors.xml", &LLFloaterReg::build); - //LLFloaterReg::add("test_list_view", "floater_test_list_view.xml",&LLFloaterReg::build); - LLFloaterReg::add("test_textbox", "floater_test_textbox.xml", &LLFloaterReg::build); - LLFloaterReg::add("test_text_editor", "floater_test_text_editor.xml", &LLFloaterReg::build); - LLFloaterReg::add("test_widgets", "floater_test_widgets.xml", &LLFloaterReg::build); - LLFloaterReg::add("top_objects", "floater_top_objects.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("toybox", "floater_toybox.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - - LLFloaterReg::add("reporter", "floater_report_abuse.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("reset_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("region_debug_console", "floater_region_debug_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("region_info", "floater_region_info.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("region_restarting", "floater_region_restarting.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - - LLFloaterReg::add("script_debug", "floater_script_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("script_debug_output", "floater_script_debug_panel.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("script_floater", "floater_script.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("script_limits", "floater_script_limits.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("sell_land", "floater_sell_land.xml", &LLFloaterSellLand::buildFloater); - LLFloaterReg::add("settings_debug", "floater_settings_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("sound_devices", "floater_sound_devices.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("stats", "floater_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("scene_load_stats", "floater_scene_load_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("telehubs", "floater_telehub.xml",&LLFloaterReg::build); + LLFloaterReg::add("test_inspectors", "floater_test_inspectors.xml", &LLFloaterReg::build); + //LLFloaterReg::add("test_list_view", "floater_test_list_view.xml",&LLFloaterReg::build); + LLFloaterReg::add("test_textbox", "floater_test_textbox.xml", &LLFloaterReg::build); + LLFloaterReg::add("test_text_editor", "floater_test_text_editor.xml", &LLFloaterReg::build); + LLFloaterReg::add("test_widgets", "floater_test_widgets.xml", &LLFloaterReg::build); + LLFloaterReg::add("top_objects", "floater_top_objects.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("toybox", "floater_toybox.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + LLFloaterReg::add("reporter", "floater_report_abuse.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("reset_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("region_debug_console", "floater_region_debug_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("region_info", "floater_region_info.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("region_restarting", "floater_region_restarting.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + LLFloaterReg::add("script_debug", "floater_script_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("script_debug_output", "floater_script_debug_panel.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("script_floater", "floater_script.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("script_limits", "floater_script_limits.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("sell_land", "floater_sell_land.xml", &LLFloaterSellLand::buildFloater); + LLFloaterReg::add("settings_debug", "floater_settings_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("sound_devices", "floater_sound_devices.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("stats", "floater_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("scene_load_stats", "floater_scene_load_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("outfit_snapshot", "floater_outfit_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("my_profile", "floater_my_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create); - LLFloaterReg::add("profile", "floater_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create); - LLFloaterReg::add("how_to", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); + LLFloaterReg::add("my_profile", "floater_my_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create); + LLFloaterReg::add("profile", "floater_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create); + LLFloaterReg::add("how_to", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); - LLFloaterReg::add("fbc_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); - LLFloaterReg::add("flickr_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); - LLFloaterReg::add("twitter_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); - - LLFloaterReg::add("facebook", "floater_facebook.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("flickr", "floater_flickr.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("twitter", "floater_twitter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("big_preview", "floater_big_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - - LLFloaterUIPreviewUtil::registerFloater(); - LLFloaterReg::add("upload_anim_bvh", "floater_animation_bvh_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); - LLFloaterReg::add("upload_anim_anim", "floater_animation_anim_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); - LLFloaterReg::add("upload_image", "floater_image_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); - LLFloaterReg::add("upload_model", "floater_model_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); - LLFloaterReg::add("upload_script", "floater_script_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); - LLFloaterReg::add("upload_sound", "floater_sound_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); + LLFloaterReg::add("fbc_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); + LLFloaterReg::add("flickr_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); + LLFloaterReg::add("twitter_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); + + LLFloaterReg::add("facebook", "floater_facebook.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("flickr", "floater_flickr.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("twitter", "floater_twitter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("big_preview", "floater_big_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + LLFloaterUIPreviewUtil::registerFloater(); + LLFloaterReg::add("upload_anim_bvh", "floater_animation_bvh_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); + LLFloaterReg::add("upload_anim_anim", "floater_animation_anim_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); + LLFloaterReg::add("upload_image", "floater_image_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); + LLFloaterReg::add("upload_model", "floater_model_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); + LLFloaterReg::add("upload_script", "floater_script_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); + LLFloaterReg::add("upload_sound", "floater_sound_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); - LLFloaterReg::add("voice_effect", "floater_voice_effect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("voice_effect", "floater_voice_effect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("web_content", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); - LLFloaterReg::add("whitelist_entry", "floater_whitelist_entry.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("window_size", "floater_window_size.xml", &LLFloaterReg::build); - LLFloaterReg::add("world_map", "floater_world_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("web_content", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); + LLFloaterReg::add("whitelist_entry", "floater_whitelist_entry.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("window_size", "floater_window_size.xml", &LLFloaterReg::build); + LLFloaterReg::add("world_map", "floater_world_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - // *NOTE: Please keep these alphabetized for easier merges - - LLFloaterReg::registerControlVariables(); // Make sure visibility and rect controls get preserved when saving + // *NOTE: Please keep these alphabetized for easier merges + + LLFloaterReg::registerControlVariables(); // Make sure visibility and rect controls get preserved when saving } -- cgit v1.2.3 From ac2fc3029f3b9b6ba182949c29a7919f2f87eb02 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 12 Mar 2019 08:56:26 -0700 Subject: Backout tabs v spaces changes. 'warn-on-failure:no-tabs' --- indra/newview/llagentcamera.cpp | 4578 ++++++++++----------- indra/newview/llagentcamera.h | 564 +-- indra/newview/lldrawpoolwater.cpp | 1178 +++--- indra/newview/llfloatercamera.cpp | 670 +-- indra/newview/llfloatercamera.h | 166 +- indra/newview/llfloaterdeleteprefpreset.cpp | 66 +- indra/newview/llfloaterloadprefpreset.cpp | 50 +- indra/newview/llfloaterpreference.cpp | 4160 +++++++++---------- indra/newview/llfloaterpreference.h | 474 +-- indra/newview/llfloaterpreferenceviewadvanced.cpp | 74 +- indra/newview/llfloaterpreferenceviewadvanced.h | 28 +- indra/newview/llfloatersaveprefpreset.cpp | 86 +- indra/newview/llnavigationbar.h | 178 +- indra/newview/llpanelpresetscamerapulldown.cpp | 192 +- indra/newview/llpanelpresetscamerapulldown.h | 30 +- indra/newview/llpresetsmanager.cpp | 648 +-- indra/newview/llpresetsmanager.h | 62 +- indra/newview/llstatusbar.cpp | 752 ++-- indra/newview/llstatusbar.h | 118 +- indra/newview/llviewerfloaterreg.cpp | 360 +- 20 files changed, 7217 insertions(+), 7217 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 7b395491e6..bbe1354fc3 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -60,8 +60,8 @@ const F32 MIN_ZOOM_FRACTION = 0.25f; const F32 INITIAL_ZOOM_FRACTION = 1.f; const F32 MAX_ZOOM_FRACTION = 8.f; -const F32 CAMERA_ZOOM_HALF_LIFE = 0.07f; // seconds -const F32 FOV_ZOOM_HALF_LIFE = 0.07f; // seconds +const F32 CAMERA_ZOOM_HALF_LIFE = 0.07f; // seconds +const F32 FOV_ZOOM_HALF_LIFE = 0.07f; // seconds const F32 CAMERA_FOCUS_HALF_LIFE = 0.f;//0.02f; const F32 CAMERA_LAG_HALF_LIFE = 0.25f; @@ -107,83 +107,83 @@ LLAgentCamera gAgentCamera; // LLAgentCamera() //----------------------------------------------------------------------------- LLAgentCamera::LLAgentCamera() : - mInitialized(false), - - mDrawDistance( DEFAULT_FAR_PLANE ), - - mLookAt(NULL), - mPointAt(NULL), - - mHUDTargetZoom(1.f), - mHUDCurZoom(1.f), - - mForceMouselook(FALSE), - - mCameraMode( CAMERA_MODE_THIRD_PERSON ), - mLastCameraMode( CAMERA_MODE_THIRD_PERSON ), - - mCameraPreset(CAMERA_PRESET_REAR_VIEW), - - mCameraAnimating( FALSE ), - mAnimationCameraStartGlobal(), - mAnimationFocusStartGlobal(), - mAnimationTimer(), - mAnimationDuration(0.33f), - - mCameraFOVZoomFactor(0.f), - mCameraCurrentFOVZoomFactor(0.f), - mCameraFocusOffset(), - mCameraFOVDefault(DEFAULT_FIELD_OF_VIEW), - - mCameraCollidePlane(), - - mCurrentCameraDistance(2.f), // meters, set in init() - mTargetCameraDistance(2.f), - mCameraZoomFraction(1.f), // deprecated - mThirdPersonHeadOffset(0.f, 0.f, 1.f), - mSitCameraEnabled(FALSE), - mCameraSmoothingLastPositionGlobal(), - mCameraSmoothingLastPositionAgent(), - mCameraSmoothingStop(false), - - mCameraUpVector(LLVector3::z_axis), // default is straight up - - mFocusOnAvatar(TRUE), - mAllowChangeToFollow(FALSE), - mFocusGlobal(), - mFocusTargetGlobal(), - mFocusObject(NULL), - mFocusObjectDist(0.f), - mFocusObjectOffset(), - mFocusDotRadius( 0.1f ), // meters - mTrackFocusObject(TRUE), - - mAtKey(0), // Either 1, 0, or -1... indicates that movement-key is pressed - mWalkKey(0), // like AtKey, but causes less forward thrust - mLeftKey(0), - mUpKey(0), - mYawKey(0.f), - mPitchKey(0.f), - - mOrbitLeftKey(0.f), - mOrbitRightKey(0.f), - mOrbitUpKey(0.f), - mOrbitDownKey(0.f), - mOrbitInKey(0.f), - mOrbitOutKey(0.f), - - mPanUpKey(0.f), - mPanDownKey(0.f), - mPanLeftKey(0.f), - mPanRightKey(0.f), - mPanInKey(0.f), - mPanOutKey(0.f) + mInitialized(false), + + mDrawDistance( DEFAULT_FAR_PLANE ), + + mLookAt(NULL), + mPointAt(NULL), + + mHUDTargetZoom(1.f), + mHUDCurZoom(1.f), + + mForceMouselook(FALSE), + + mCameraMode( CAMERA_MODE_THIRD_PERSON ), + mLastCameraMode( CAMERA_MODE_THIRD_PERSON ), + + mCameraPreset(CAMERA_PRESET_REAR_VIEW), + + mCameraAnimating( FALSE ), + mAnimationCameraStartGlobal(), + mAnimationFocusStartGlobal(), + mAnimationTimer(), + mAnimationDuration(0.33f), + + mCameraFOVZoomFactor(0.f), + mCameraCurrentFOVZoomFactor(0.f), + mCameraFocusOffset(), + mCameraFOVDefault(DEFAULT_FIELD_OF_VIEW), + + mCameraCollidePlane(), + + mCurrentCameraDistance(2.f), // meters, set in init() + mTargetCameraDistance(2.f), + mCameraZoomFraction(1.f), // deprecated + mThirdPersonHeadOffset(0.f, 0.f, 1.f), + mSitCameraEnabled(FALSE), + mCameraSmoothingLastPositionGlobal(), + mCameraSmoothingLastPositionAgent(), + mCameraSmoothingStop(false), + + mCameraUpVector(LLVector3::z_axis), // default is straight up + + mFocusOnAvatar(TRUE), + mAllowChangeToFollow(FALSE), + mFocusGlobal(), + mFocusTargetGlobal(), + mFocusObject(NULL), + mFocusObjectDist(0.f), + mFocusObjectOffset(), + mFocusDotRadius( 0.1f ), // meters + mTrackFocusObject(TRUE), + + mAtKey(0), // Either 1, 0, or -1... indicates that movement-key is pressed + mWalkKey(0), // like AtKey, but causes less forward thrust + mLeftKey(0), + mUpKey(0), + mYawKey(0.f), + mPitchKey(0.f), + + mOrbitLeftKey(0.f), + mOrbitRightKey(0.f), + mOrbitUpKey(0.f), + mOrbitDownKey(0.f), + mOrbitInKey(0.f), + mOrbitOutKey(0.f), + + mPanUpKey(0.f), + mPanDownKey(0.f), + mPanLeftKey(0.f), + mPanRightKey(0.f), + mPanInKey(0.f), + mPanOutKey(0.f) { - mFollowCam.setMaxCameraDistantFromSubject( MAX_CAMERA_DISTANCE_FROM_AGENT ); + mFollowCam.setMaxCameraDistantFromSubject( MAX_CAMERA_DISTANCE_FROM_AGENT ); - clearGeneralKeys(); - clearOrbitKeys(); - clearPanKeys(); + clearGeneralKeys(); + clearOrbitKeys(); + clearPanKeys(); } // Requires gSavedSettings to be initialized. @@ -192,36 +192,36 @@ LLAgentCamera::LLAgentCamera() : //----------------------------------------------------------------------------- void LLAgentCamera::init() { - // *Note: this is where LLViewerCamera::getInstance() used to be constructed. + // *Note: this is where LLViewerCamera::getInstance() used to be constructed. - mDrawDistance = gSavedSettings.getF32("RenderFarClip"); + mDrawDistance = gSavedSettings.getF32("RenderFarClip"); - LLViewerCamera::getInstance()->setView(DEFAULT_FIELD_OF_VIEW); - // Leave at 0.1 meters until we have real near clip management - LLViewerCamera::getInstance()->setNear(0.1f); - LLViewerCamera::getInstance()->setFar(mDrawDistance); // if you want to change camera settings, do so in camera.h - LLViewerCamera::getInstance()->setAspect( gViewerWindow->getWorldViewAspectRatio() ); // default, overridden in LLViewerWindow::reshape - LLViewerCamera::getInstance()->setViewHeightInPixels(768); // default, overridden in LLViewerWindow::reshape + LLViewerCamera::getInstance()->setView(DEFAULT_FIELD_OF_VIEW); + // Leave at 0.1 meters until we have real near clip management + LLViewerCamera::getInstance()->setNear(0.1f); + LLViewerCamera::getInstance()->setFar(mDrawDistance); // if you want to change camera settings, do so in camera.h + LLViewerCamera::getInstance()->setAspect( gViewerWindow->getWorldViewAspectRatio() ); // default, overridden in LLViewerWindow::reshape + LLViewerCamera::getInstance()->setViewHeightInPixels(768); // default, overridden in LLViewerWindow::reshape - mCameraFocusOffsetTarget = LLVector4(gSavedSettings.getVector3("CameraOffsetBuild")); - - mCameraPreset = (ECameraPreset) gSavedSettings.getU32("CameraPreset"); + mCameraFocusOffsetTarget = LLVector4(gSavedSettings.getVector3("CameraOffsetBuild")); + + mCameraPreset = (ECameraPreset) gSavedSettings.getU32("CameraPreset"); - 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_REAR_VIEW] = gSavedSettings.getControl("CameraOffsetRearView"); + mCameraOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("CameraOffsetFrontView"); + mCameraOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("CameraOffsetGroupView"); - 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_REAR_VIEW] = gSavedSettings.getControl("FocusOffsetRearView"); + mFocusOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("FocusOffsetFrontView"); + mFocusOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("FocusOffsetGroupView"); - mCameraCollidePlane.clearVec(); - mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"); - mTargetCameraDistance = mCurrentCameraDistance; - mCameraZoomFraction = 1.f; - mTrackFocusObject = gSavedSettings.getBOOL("TrackFocusObject"); + mCameraCollidePlane.clearVec(); + mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"); + mTargetCameraDistance = mCurrentCameraDistance; + mCameraZoomFraction = 1.f; + mTrackFocusObject = gSavedSettings.getBOOL("TrackFocusObject"); - mInitialized = true; + mInitialized = true; } //----------------------------------------------------------------------------- @@ -229,40 +229,40 @@ void LLAgentCamera::init() //----------------------------------------------------------------------------- void LLAgentCamera::cleanup() { - setSitCamera(LLUUID::null); - - if(mLookAt) - { - mLookAt->markDead() ; - mLookAt = NULL; - } - if(mPointAt) - { - mPointAt->markDead() ; - mPointAt = NULL; - } - setFocusObject(NULL); + setSitCamera(LLUUID::null); + + if(mLookAt) + { + mLookAt->markDead() ; + mLookAt = NULL; + } + if(mPointAt) + { + mPointAt->markDead() ; + mPointAt = NULL; + } + setFocusObject(NULL); } void LLAgentCamera::setAvatarObject(LLVOAvatarSelf* avatar) { - if (!mLookAt) - { - mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT); - } - if (!mPointAt) - { - mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT); - } - - if (!mLookAt.isNull()) - { - mLookAt->setSourceObject(avatar); - } - if (!mPointAt.isNull()) - { - mPointAt->setSourceObject(avatar); - } + if (!mLookAt) + { + mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT); + } + if (!mPointAt) + { + mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT); + } + + if (!mLookAt.isNull()) + { + mLookAt->setSourceObject(avatar); + } + if (!mPointAt.isNull()) + { + mPointAt->setSourceObject(avatar); + } } //----------------------------------------------------------------------------- @@ -270,9 +270,9 @@ void LLAgentCamera::setAvatarObject(LLVOAvatarSelf* avatar) //----------------------------------------------------------------------------- LLAgentCamera::~LLAgentCamera() { - cleanup(); + cleanup(); - // *Note: this is where LLViewerCamera::getInstance() used to be deleted. + // *Note: this is where LLViewerCamera::getInstance() used to be deleted. } // Change camera back to third person, stop the autopilot, @@ -282,74 +282,74 @@ LLAgentCamera::~LLAgentCamera() //----------------------------------------------------------------------------- void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera) { - if (gAgent.getAutoPilot()) - { - gAgent.stopAutoPilot(TRUE); - } - - LLSelectMgr::getInstance()->unhighlightAll(); - - // By popular request, keep land selection while walking around. JC - // LLViewerParcelMgr::getInstance()->deselectLand(); - - // force deselect when walking and attachment is selected - // this is so people don't wig out when their avatar moves without animating - if (LLSelectMgr::getInstance()->getSelection()->isAttachment()) - { - LLSelectMgr::getInstance()->deselectAll(); - } - - if (gMenuHolder != NULL) - { - // Hide all popup menus - gMenuHolder->hideMenus(); - } - - if (change_camera && !gSavedSettings.getBOOL("FreezeTime")) - { - changeCameraToDefault(); - - if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { - handle_toggle_flycam(); - } - - // reset avatar mode from eventual residual motion - if (LLToolMgr::getInstance()->inBuildMode()) - { - LLViewerJoystick::getInstance()->moveAvatar(true); - } - - //Camera Tool is needed for Free Camera Control Mode - if (!LLFloaterCamera::inFreeCameraMode()) - { - LLFloaterReg::hideInstance("build"); - - // Switch back to basic toolset - LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); - } - - gViewerWindow->showCursor(); - } - - - if (reset_camera && !gSavedSettings.getBOOL("FreezeTime")) - { - if (!gViewerWindow->getLeftMouseDown() && cameraThirdPerson()) - { - // leaving mouse-steer mode - LLVector3 agent_at_axis = gAgent.getAtAxis(); - agent_at_axis -= projected_vec(agent_at_axis, gAgent.getReferenceUpVector()); - agent_at_axis.normalize(); - gAgent.resetAxes(lerp(gAgent.getAtAxis(), agent_at_axis, LLSmoothInterpolation::getInterpolant(0.3f))); - } - - setFocusOnAvatar(TRUE, ANIMATE); - - mCameraFOVZoomFactor = 0.f; - } - - mHUDTargetZoom = 1.f; + if (gAgent.getAutoPilot()) + { + gAgent.stopAutoPilot(TRUE); + } + + LLSelectMgr::getInstance()->unhighlightAll(); + + // By popular request, keep land selection while walking around. JC + // LLViewerParcelMgr::getInstance()->deselectLand(); + + // force deselect when walking and attachment is selected + // this is so people don't wig out when their avatar moves without animating + if (LLSelectMgr::getInstance()->getSelection()->isAttachment()) + { + LLSelectMgr::getInstance()->deselectAll(); + } + + if (gMenuHolder != NULL) + { + // Hide all popup menus + gMenuHolder->hideMenus(); + } + + if (change_camera && !gSavedSettings.getBOOL("FreezeTime")) + { + changeCameraToDefault(); + + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + handle_toggle_flycam(); + } + + // reset avatar mode from eventual residual motion + if (LLToolMgr::getInstance()->inBuildMode()) + { + LLViewerJoystick::getInstance()->moveAvatar(true); + } + + //Camera Tool is needed for Free Camera Control Mode + if (!LLFloaterCamera::inFreeCameraMode()) + { + LLFloaterReg::hideInstance("build"); + + // Switch back to basic toolset + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + } + + gViewerWindow->showCursor(); + } + + + if (reset_camera && !gSavedSettings.getBOOL("FreezeTime")) + { + if (!gViewerWindow->getLeftMouseDown() && cameraThirdPerson()) + { + // leaving mouse-steer mode + LLVector3 agent_at_axis = gAgent.getAtAxis(); + agent_at_axis -= projected_vec(agent_at_axis, gAgent.getReferenceUpVector()); + agent_at_axis.normalize(); + gAgent.resetAxes(lerp(gAgent.getAtAxis(), agent_at_axis, LLSmoothInterpolation::getInterpolant(0.3f))); + } + + setFocusOnAvatar(TRUE, ANIMATE); + + mCameraFOVZoomFactor = 0.f; + } + + mHUDTargetZoom = 1.f; } // Allow camera to be moved somewhere other than behind avatar. @@ -358,14 +358,14 @@ void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera) //----------------------------------------------------------------------------- void LLAgentCamera::unlockView() { - if (getFocusOnAvatar()) - { - if (isAgentAvatarValid()) - { - setFocusGlobal(LLVector3d::zero, gAgentAvatarp->mID); - } - setFocusOnAvatar(FALSE, FALSE); // no animation - } + if (getFocusOnAvatar()) + { + if (isAgentAvatarValid()) + { + setFocusGlobal(LLVector3d::zero, gAgentAvatarp->mID); + } + setFocusOnAvatar(FALSE, FALSE); // no animation + } } //----------------------------------------------------------------------------- @@ -373,10 +373,10 @@ void LLAgentCamera::unlockView() //----------------------------------------------------------------------------- void LLAgentCamera::slamLookAt(const LLVector3 &look_at) { - LLVector3 look_at_norm = look_at; - look_at_norm.mV[VZ] = 0.f; - look_at_norm.normalize(); - gAgent.resetAxes(look_at_norm); + LLVector3 look_at_norm = look_at; + look_at_norm.mV[VZ] = 0.f; + look_at_norm.normalize(); + gAgent.resetAxes(look_at_norm); } //----------------------------------------------------------------------------- @@ -384,169 +384,169 @@ void LLAgentCamera::slamLookAt(const LLVector3 &look_at) //----------------------------------------------------------------------------- LLVector3 LLAgentCamera::calcFocusOffset(LLViewerObject *object, LLVector3 original_focus_point, S32 x, S32 y) { - LLMatrix4 obj_matrix = object->getRenderMatrix(); - LLQuaternion obj_rot = object->getRenderRotation(); - LLVector3 obj_pos = object->getRenderPosition(); - - BOOL is_avatar = object->isAvatar(); - // if is avatar - don't do any funk heuristics to position the focal point - // see DEV-30589 - if (is_avatar) - { - return original_focus_point - obj_pos; - } - - LLQuaternion inv_obj_rot = ~obj_rot; // get inverse of rotation - LLVector3 object_extents = object->getScale(); - - // make sure they object extents are non-zero - object_extents.clamp(0.001f, F32_MAX); - - // obj_to_cam_ray is unit vector pointing from object center to camera, in the coordinate frame of the object - LLVector3 obj_to_cam_ray = obj_pos - LLViewerCamera::getInstance()->getOrigin(); - obj_to_cam_ray.rotVec(inv_obj_rot); - obj_to_cam_ray.normalize(); - - // obj_to_cam_ray_proportions are the (positive) ratios of - // the obj_to_cam_ray x,y,z components with the x,y,z object dimensions. - LLVector3 obj_to_cam_ray_proportions; - obj_to_cam_ray_proportions.mV[VX] = llabs(obj_to_cam_ray.mV[VX] / object_extents.mV[VX]); - obj_to_cam_ray_proportions.mV[VY] = llabs(obj_to_cam_ray.mV[VY] / object_extents.mV[VY]); - obj_to_cam_ray_proportions.mV[VZ] = llabs(obj_to_cam_ray.mV[VZ] / object_extents.mV[VZ]); - - // find the largest ratio stored in obj_to_cam_ray_proportions - // this corresponds to the object's local axial plane (XY, YZ, XZ) that is *most* facing the camera - LLVector3 longest_object_axis; - // is x-axis longest? - if (obj_to_cam_ray_proportions.mV[VX] > obj_to_cam_ray_proportions.mV[VY] - && obj_to_cam_ray_proportions.mV[VX] > obj_to_cam_ray_proportions.mV[VZ]) - { - // then grab it - longest_object_axis.setVec(obj_matrix.getFwdRow4()); - } - // is y-axis longest? - else if (obj_to_cam_ray_proportions.mV[VY] > obj_to_cam_ray_proportions.mV[VZ]) - { - // then grab it - longest_object_axis.setVec(obj_matrix.getLeftRow4()); - } - // otherwise, use z axis - else - { - longest_object_axis.setVec(obj_matrix.getUpRow4()); - } - - // Use this axis as the normal to project mouse click on to plane with that normal, at the object center. - // This generates a point behind the mouse cursor that is approximately in the middle of the object in - // terms of depth. - // We do this to allow the camera rotation tool to "tumble" the object by rotating the camera. - // If the focus point were the object surface under the mouse, camera rotation would introduce an undesirable - // eccentricity to the object orientation - LLVector3 focus_plane_normal(longest_object_axis); - focus_plane_normal.normalize(); - - LLVector3d focus_pt_global; - gViewerWindow->mousePointOnPlaneGlobal(focus_pt_global, x, y, gAgent.getPosGlobalFromAgent(obj_pos), focus_plane_normal); - LLVector3 focus_pt = gAgent.getPosAgentFromGlobal(focus_pt_global); - - // find vector from camera to focus point in object space - LLVector3 camera_to_focus_vec = focus_pt - LLViewerCamera::getInstance()->getOrigin(); - camera_to_focus_vec.rotVec(inv_obj_rot); - - // find vector from object origin to focus point in object coordinates - LLVector3 focus_offset_from_object_center = focus_pt - obj_pos; - // convert to object-local space - focus_offset_from_object_center.rotVec(inv_obj_rot); - - // We need to project the focus point back into the bounding box of the focused object. - // Do this by calculating the XYZ scale factors needed to get focus offset back in bounds along the camera_focus axis - LLVector3 clip_fraction; - - // for each axis... - for (U32 axis = VX; axis <= VZ; axis++) - { - //...calculate distance that focus offset sits outside of bounding box along that axis... - //NOTE: dist_out_of_bounds keeps the sign of focus_offset_from_object_center - F32 dist_out_of_bounds; - if (focus_offset_from_object_center.mV[axis] > 0.f) - { - dist_out_of_bounds = llmax(0.f, focus_offset_from_object_center.mV[axis] - (object_extents.mV[axis] * 0.5f)); - } - else - { - dist_out_of_bounds = llmin(0.f, focus_offset_from_object_center.mV[axis] + (object_extents.mV[axis] * 0.5f)); - } - - //...then calculate the scale factor needed to push camera_to_focus_vec back in bounds along current axis - if (llabs(camera_to_focus_vec.mV[axis]) < 0.0001f) - { - // don't divide by very small number - clip_fraction.mV[axis] = 0.f; - } - else - { - clip_fraction.mV[axis] = dist_out_of_bounds / camera_to_focus_vec.mV[axis]; - } - } - - LLVector3 abs_clip_fraction = clip_fraction; - abs_clip_fraction.abs(); - - // find axis of focus offset that is *most* outside the bounding box and use that to - // rescale focus offset to inside object extents - if (abs_clip_fraction.mV[VX] > abs_clip_fraction.mV[VY] - && abs_clip_fraction.mV[VX] > abs_clip_fraction.mV[VZ]) - { - focus_offset_from_object_center -= clip_fraction.mV[VX] * camera_to_focus_vec; - } - else if (abs_clip_fraction.mV[VY] > abs_clip_fraction.mV[VZ]) - { - focus_offset_from_object_center -= clip_fraction.mV[VY] * camera_to_focus_vec; - } - else - { - focus_offset_from_object_center -= clip_fraction.mV[VZ] * camera_to_focus_vec; - } - - // convert back to world space - focus_offset_from_object_center.rotVec(obj_rot); - - // now, based on distance of camera from object relative to object size - // push the focus point towards the near surface of the object when (relatively) close to the objcet - // or keep the focus point in the object middle when (relatively) far - // NOTE: leave focus point in middle of avatars, since the behavior you want when alt-zooming on avatars - // is almost always "tumble about middle" and not "spin around surface point" - if (!is_avatar) - { - LLVector3 obj_rel = original_focus_point - object->getRenderPosition(); - - //now that we have the object relative position, we should bias toward the center of the object - //based on the distance of the camera to the focus point vs. the distance of the camera to the focus - - F32 relDist = llabs(obj_rel * LLViewerCamera::getInstance()->getAtAxis()); - F32 viewDist = dist_vec(obj_pos + obj_rel, LLViewerCamera::getInstance()->getOrigin()); - - - LLBBox obj_bbox = object->getBoundingBoxAgent(); - F32 bias = 0.f; - - // virtual_camera_pos is the camera position we are simulating by backing the camera off - // and adjusting the FOV - LLVector3 virtual_camera_pos = gAgent.getPosAgentFromGlobal(mFocusTargetGlobal + (getCameraPositionGlobal() - mFocusTargetGlobal) / (1.f + mCameraFOVZoomFactor)); - - // if the camera is inside the object (large, hollow objects, for example) - // leave focus point all the way to destination depth, away from object center - if(!obj_bbox.containsPointAgent(virtual_camera_pos)) - { - // perform magic number biasing of focus point towards surface vs. planar center - bias = clamp_rescale(relDist/viewDist, 0.1f, 0.7f, 0.0f, 1.0f); - obj_rel = lerp(focus_offset_from_object_center, obj_rel, bias); - } - - focus_offset_from_object_center = obj_rel; - } - - return focus_offset_from_object_center; + LLMatrix4 obj_matrix = object->getRenderMatrix(); + LLQuaternion obj_rot = object->getRenderRotation(); + LLVector3 obj_pos = object->getRenderPosition(); + + BOOL is_avatar = object->isAvatar(); + // if is avatar - don't do any funk heuristics to position the focal point + // see DEV-30589 + if (is_avatar) + { + return original_focus_point - obj_pos; + } + + LLQuaternion inv_obj_rot = ~obj_rot; // get inverse of rotation + LLVector3 object_extents = object->getScale(); + + // make sure they object extents are non-zero + object_extents.clamp(0.001f, F32_MAX); + + // obj_to_cam_ray is unit vector pointing from object center to camera, in the coordinate frame of the object + LLVector3 obj_to_cam_ray = obj_pos - LLViewerCamera::getInstance()->getOrigin(); + obj_to_cam_ray.rotVec(inv_obj_rot); + obj_to_cam_ray.normalize(); + + // obj_to_cam_ray_proportions are the (positive) ratios of + // the obj_to_cam_ray x,y,z components with the x,y,z object dimensions. + LLVector3 obj_to_cam_ray_proportions; + obj_to_cam_ray_proportions.mV[VX] = llabs(obj_to_cam_ray.mV[VX] / object_extents.mV[VX]); + obj_to_cam_ray_proportions.mV[VY] = llabs(obj_to_cam_ray.mV[VY] / object_extents.mV[VY]); + obj_to_cam_ray_proportions.mV[VZ] = llabs(obj_to_cam_ray.mV[VZ] / object_extents.mV[VZ]); + + // find the largest ratio stored in obj_to_cam_ray_proportions + // this corresponds to the object's local axial plane (XY, YZ, XZ) that is *most* facing the camera + LLVector3 longest_object_axis; + // is x-axis longest? + if (obj_to_cam_ray_proportions.mV[VX] > obj_to_cam_ray_proportions.mV[VY] + && obj_to_cam_ray_proportions.mV[VX] > obj_to_cam_ray_proportions.mV[VZ]) + { + // then grab it + longest_object_axis.setVec(obj_matrix.getFwdRow4()); + } + // is y-axis longest? + else if (obj_to_cam_ray_proportions.mV[VY] > obj_to_cam_ray_proportions.mV[VZ]) + { + // then grab it + longest_object_axis.setVec(obj_matrix.getLeftRow4()); + } + // otherwise, use z axis + else + { + longest_object_axis.setVec(obj_matrix.getUpRow4()); + } + + // Use this axis as the normal to project mouse click on to plane with that normal, at the object center. + // This generates a point behind the mouse cursor that is approximately in the middle of the object in + // terms of depth. + // We do this to allow the camera rotation tool to "tumble" the object by rotating the camera. + // If the focus point were the object surface under the mouse, camera rotation would introduce an undesirable + // eccentricity to the object orientation + LLVector3 focus_plane_normal(longest_object_axis); + focus_plane_normal.normalize(); + + LLVector3d focus_pt_global; + gViewerWindow->mousePointOnPlaneGlobal(focus_pt_global, x, y, gAgent.getPosGlobalFromAgent(obj_pos), focus_plane_normal); + LLVector3 focus_pt = gAgent.getPosAgentFromGlobal(focus_pt_global); + + // find vector from camera to focus point in object space + LLVector3 camera_to_focus_vec = focus_pt - LLViewerCamera::getInstance()->getOrigin(); + camera_to_focus_vec.rotVec(inv_obj_rot); + + // find vector from object origin to focus point in object coordinates + LLVector3 focus_offset_from_object_center = focus_pt - obj_pos; + // convert to object-local space + focus_offset_from_object_center.rotVec(inv_obj_rot); + + // We need to project the focus point back into the bounding box of the focused object. + // Do this by calculating the XYZ scale factors needed to get focus offset back in bounds along the camera_focus axis + LLVector3 clip_fraction; + + // for each axis... + for (U32 axis = VX; axis <= VZ; axis++) + { + //...calculate distance that focus offset sits outside of bounding box along that axis... + //NOTE: dist_out_of_bounds keeps the sign of focus_offset_from_object_center + F32 dist_out_of_bounds; + if (focus_offset_from_object_center.mV[axis] > 0.f) + { + dist_out_of_bounds = llmax(0.f, focus_offset_from_object_center.mV[axis] - (object_extents.mV[axis] * 0.5f)); + } + else + { + dist_out_of_bounds = llmin(0.f, focus_offset_from_object_center.mV[axis] + (object_extents.mV[axis] * 0.5f)); + } + + //...then calculate the scale factor needed to push camera_to_focus_vec back in bounds along current axis + if (llabs(camera_to_focus_vec.mV[axis]) < 0.0001f) + { + // don't divide by very small number + clip_fraction.mV[axis] = 0.f; + } + else + { + clip_fraction.mV[axis] = dist_out_of_bounds / camera_to_focus_vec.mV[axis]; + } + } + + LLVector3 abs_clip_fraction = clip_fraction; + abs_clip_fraction.abs(); + + // find axis of focus offset that is *most* outside the bounding box and use that to + // rescale focus offset to inside object extents + if (abs_clip_fraction.mV[VX] > abs_clip_fraction.mV[VY] + && abs_clip_fraction.mV[VX] > abs_clip_fraction.mV[VZ]) + { + focus_offset_from_object_center -= clip_fraction.mV[VX] * camera_to_focus_vec; + } + else if (abs_clip_fraction.mV[VY] > abs_clip_fraction.mV[VZ]) + { + focus_offset_from_object_center -= clip_fraction.mV[VY] * camera_to_focus_vec; + } + else + { + focus_offset_from_object_center -= clip_fraction.mV[VZ] * camera_to_focus_vec; + } + + // convert back to world space + focus_offset_from_object_center.rotVec(obj_rot); + + // now, based on distance of camera from object relative to object size + // push the focus point towards the near surface of the object when (relatively) close to the objcet + // or keep the focus point in the object middle when (relatively) far + // NOTE: leave focus point in middle of avatars, since the behavior you want when alt-zooming on avatars + // is almost always "tumble about middle" and not "spin around surface point" + if (!is_avatar) + { + LLVector3 obj_rel = original_focus_point - object->getRenderPosition(); + + //now that we have the object relative position, we should bias toward the center of the object + //based on the distance of the camera to the focus point vs. the distance of the camera to the focus + + F32 relDist = llabs(obj_rel * LLViewerCamera::getInstance()->getAtAxis()); + F32 viewDist = dist_vec(obj_pos + obj_rel, LLViewerCamera::getInstance()->getOrigin()); + + + LLBBox obj_bbox = object->getBoundingBoxAgent(); + F32 bias = 0.f; + + // virtual_camera_pos is the camera position we are simulating by backing the camera off + // and adjusting the FOV + LLVector3 virtual_camera_pos = gAgent.getPosAgentFromGlobal(mFocusTargetGlobal + (getCameraPositionGlobal() - mFocusTargetGlobal) / (1.f + mCameraFOVZoomFactor)); + + // if the camera is inside the object (large, hollow objects, for example) + // leave focus point all the way to destination depth, away from object center + if(!obj_bbox.containsPointAgent(virtual_camera_pos)) + { + // perform magic number biasing of focus point towards surface vs. planar center + bias = clamp_rescale(relDist/viewDist, 0.1f, 0.7f, 0.0f, 1.0f); + obj_rel = lerp(focus_offset_from_object_center, obj_rel, bias); + } + + focus_offset_from_object_center = obj_rel; + } + + return focus_offset_from_object_center; } //----------------------------------------------------------------------------- @@ -554,260 +554,260 @@ LLVector3 LLAgentCamera::calcFocusOffset(LLViewerObject *object, LLVector3 origi //----------------------------------------------------------------------------- BOOL LLAgentCamera::calcCameraMinDistance(F32 &obj_min_distance) { - BOOL soft_limit = FALSE; // is the bounding box to be treated literally (volumes) or as an approximation (avatars) - - if (!mFocusObject || mFocusObject->isDead() || - mFocusObject->isMesh() || - gSavedSettings.getBOOL("DisableCameraConstraints")) - { - obj_min_distance = 0.f; - return TRUE; - } - - if (mFocusObject->mDrawable.isNull()) - { + BOOL soft_limit = FALSE; // is the bounding box to be treated literally (volumes) or as an approximation (avatars) + + if (!mFocusObject || mFocusObject->isDead() || + mFocusObject->isMesh() || + gSavedSettings.getBOOL("DisableCameraConstraints")) + { + obj_min_distance = 0.f; + return TRUE; + } + + if (mFocusObject->mDrawable.isNull()) + { #ifdef LL_RELEASE_FOR_DOWNLOAD - LL_WARNS() << "Focus object with no drawable!" << LL_ENDL; + LL_WARNS() << "Focus object with no drawable!" << LL_ENDL; #else - mFocusObject->dump(); - LL_ERRS() << "Focus object with no drawable!" << LL_ENDL; + mFocusObject->dump(); + LL_ERRS() << "Focus object with no drawable!" << LL_ENDL; #endif - obj_min_distance = 0.f; - return TRUE; - } - - LLQuaternion inv_object_rot = ~mFocusObject->getRenderRotation(); - LLVector3 target_offset_origin = mFocusObjectOffset; - LLVector3 camera_offset_target(getCameraPositionAgent() - gAgent.getPosAgentFromGlobal(mFocusTargetGlobal)); - - // convert offsets into object local space - camera_offset_target.rotVec(inv_object_rot); - target_offset_origin.rotVec(inv_object_rot); - - // push around object extents based on target offset - LLVector3 object_extents = mFocusObject->getScale(); - if (mFocusObject->isAvatar()) - { - // fudge factors that lets you zoom in on avatars a bit more (which don't do FOV zoom) - object_extents.mV[VX] *= AVATAR_ZOOM_MIN_X_FACTOR; - object_extents.mV[VY] *= AVATAR_ZOOM_MIN_Y_FACTOR; - object_extents.mV[VZ] *= AVATAR_ZOOM_MIN_Z_FACTOR; - soft_limit = TRUE; - } - LLVector3 abs_target_offset = target_offset_origin; - abs_target_offset.abs(); - - LLVector3 target_offset_dir = target_offset_origin; - - BOOL target_outside_object_extents = FALSE; - - for (U32 i = VX; i <= VZ; i++) - { - if (abs_target_offset.mV[i] * 2.f > object_extents.mV[i] + OBJECT_EXTENTS_PADDING) - { - target_outside_object_extents = TRUE; - } - if (camera_offset_target.mV[i] > 0.f) - { - object_extents.mV[i] -= target_offset_origin.mV[i] * 2.f; - } - else - { - object_extents.mV[i] += target_offset_origin.mV[i] * 2.f; - } - } - - // don't shrink the object extents so far that the object inverts - object_extents.clamp(0.001f, F32_MAX); - - // move into first octant - LLVector3 camera_offset_target_abs_norm = camera_offset_target; - camera_offset_target_abs_norm.abs(); - // make sure offset is non-zero - camera_offset_target_abs_norm.clamp(0.001f, F32_MAX); - camera_offset_target_abs_norm.normalize(); - - // find camera position relative to normalized object extents - LLVector3 camera_offset_target_scaled = camera_offset_target_abs_norm; - camera_offset_target_scaled.mV[VX] /= object_extents.mV[VX]; - camera_offset_target_scaled.mV[VY] /= object_extents.mV[VY]; - camera_offset_target_scaled.mV[VZ] /= object_extents.mV[VZ]; - - if (camera_offset_target_scaled.mV[VX] > camera_offset_target_scaled.mV[VY] && - camera_offset_target_scaled.mV[VX] > camera_offset_target_scaled.mV[VZ]) - { - if (camera_offset_target_abs_norm.mV[VX] < 0.001f) - { - obj_min_distance = object_extents.mV[VX] * 0.5f; - } - else - { - obj_min_distance = object_extents.mV[VX] * 0.5f / camera_offset_target_abs_norm.mV[VX]; - } - } - else if (camera_offset_target_scaled.mV[VY] > camera_offset_target_scaled.mV[VZ]) - { - if (camera_offset_target_abs_norm.mV[VY] < 0.001f) - { - obj_min_distance = object_extents.mV[VY] * 0.5f; - } - else - { - obj_min_distance = object_extents.mV[VY] * 0.5f / camera_offset_target_abs_norm.mV[VY]; - } - } - else - { - if (camera_offset_target_abs_norm.mV[VZ] < 0.001f) - { - obj_min_distance = object_extents.mV[VZ] * 0.5f; - } - else - { - obj_min_distance = object_extents.mV[VZ] * 0.5f / camera_offset_target_abs_norm.mV[VZ]; - } - } - - LLVector3 object_split_axis; - LLVector3 target_offset_scaled = target_offset_origin; - target_offset_scaled.abs(); - target_offset_scaled.normalize(); - target_offset_scaled.mV[VX] /= object_extents.mV[VX]; - target_offset_scaled.mV[VY] /= object_extents.mV[VY]; - target_offset_scaled.mV[VZ] /= object_extents.mV[VZ]; - - if (target_offset_scaled.mV[VX] > target_offset_scaled.mV[VY] && - target_offset_scaled.mV[VX] > target_offset_scaled.mV[VZ]) - { - object_split_axis = LLVector3::x_axis; - } - else if (target_offset_scaled.mV[VY] > target_offset_scaled.mV[VZ]) - { - object_split_axis = LLVector3::y_axis; - } - else - { - object_split_axis = LLVector3::z_axis; - } - - LLVector3 camera_offset_object(getCameraPositionAgent() - mFocusObject->getPositionAgent()); - - - F32 camera_offset_clip = camera_offset_object * object_split_axis; - F32 target_offset_clip = target_offset_dir * object_split_axis; - - // target has moved outside of object extents - // check to see if camera and target are on same side - if (target_outside_object_extents) - { - if (camera_offset_clip > 0.f && target_offset_clip > 0.f) - { - return FALSE; - } - else if (camera_offset_clip < 0.f && target_offset_clip < 0.f) - { - return FALSE; - } - } - - // clamp obj distance to diagonal of 10 by 10 cube - obj_min_distance = llmin(obj_min_distance, 10.f * F_SQRT3); - - obj_min_distance += LLViewerCamera::getInstance()->getNear() + (soft_limit ? 0.1f : 0.2f); - - return TRUE; + obj_min_distance = 0.f; + return TRUE; + } + + LLQuaternion inv_object_rot = ~mFocusObject->getRenderRotation(); + LLVector3 target_offset_origin = mFocusObjectOffset; + LLVector3 camera_offset_target(getCameraPositionAgent() - gAgent.getPosAgentFromGlobal(mFocusTargetGlobal)); + + // convert offsets into object local space + camera_offset_target.rotVec(inv_object_rot); + target_offset_origin.rotVec(inv_object_rot); + + // push around object extents based on target offset + LLVector3 object_extents = mFocusObject->getScale(); + if (mFocusObject->isAvatar()) + { + // fudge factors that lets you zoom in on avatars a bit more (which don't do FOV zoom) + object_extents.mV[VX] *= AVATAR_ZOOM_MIN_X_FACTOR; + object_extents.mV[VY] *= AVATAR_ZOOM_MIN_Y_FACTOR; + object_extents.mV[VZ] *= AVATAR_ZOOM_MIN_Z_FACTOR; + soft_limit = TRUE; + } + LLVector3 abs_target_offset = target_offset_origin; + abs_target_offset.abs(); + + LLVector3 target_offset_dir = target_offset_origin; + + BOOL target_outside_object_extents = FALSE; + + for (U32 i = VX; i <= VZ; i++) + { + if (abs_target_offset.mV[i] * 2.f > object_extents.mV[i] + OBJECT_EXTENTS_PADDING) + { + target_outside_object_extents = TRUE; + } + if (camera_offset_target.mV[i] > 0.f) + { + object_extents.mV[i] -= target_offset_origin.mV[i] * 2.f; + } + else + { + object_extents.mV[i] += target_offset_origin.mV[i] * 2.f; + } + } + + // don't shrink the object extents so far that the object inverts + object_extents.clamp(0.001f, F32_MAX); + + // move into first octant + LLVector3 camera_offset_target_abs_norm = camera_offset_target; + camera_offset_target_abs_norm.abs(); + // make sure offset is non-zero + camera_offset_target_abs_norm.clamp(0.001f, F32_MAX); + camera_offset_target_abs_norm.normalize(); + + // find camera position relative to normalized object extents + LLVector3 camera_offset_target_scaled = camera_offset_target_abs_norm; + camera_offset_target_scaled.mV[VX] /= object_extents.mV[VX]; + camera_offset_target_scaled.mV[VY] /= object_extents.mV[VY]; + camera_offset_target_scaled.mV[VZ] /= object_extents.mV[VZ]; + + if (camera_offset_target_scaled.mV[VX] > camera_offset_target_scaled.mV[VY] && + camera_offset_target_scaled.mV[VX] > camera_offset_target_scaled.mV[VZ]) + { + if (camera_offset_target_abs_norm.mV[VX] < 0.001f) + { + obj_min_distance = object_extents.mV[VX] * 0.5f; + } + else + { + obj_min_distance = object_extents.mV[VX] * 0.5f / camera_offset_target_abs_norm.mV[VX]; + } + } + else if (camera_offset_target_scaled.mV[VY] > camera_offset_target_scaled.mV[VZ]) + { + if (camera_offset_target_abs_norm.mV[VY] < 0.001f) + { + obj_min_distance = object_extents.mV[VY] * 0.5f; + } + else + { + obj_min_distance = object_extents.mV[VY] * 0.5f / camera_offset_target_abs_norm.mV[VY]; + } + } + else + { + if (camera_offset_target_abs_norm.mV[VZ] < 0.001f) + { + obj_min_distance = object_extents.mV[VZ] * 0.5f; + } + else + { + obj_min_distance = object_extents.mV[VZ] * 0.5f / camera_offset_target_abs_norm.mV[VZ]; + } + } + + LLVector3 object_split_axis; + LLVector3 target_offset_scaled = target_offset_origin; + target_offset_scaled.abs(); + target_offset_scaled.normalize(); + target_offset_scaled.mV[VX] /= object_extents.mV[VX]; + target_offset_scaled.mV[VY] /= object_extents.mV[VY]; + target_offset_scaled.mV[VZ] /= object_extents.mV[VZ]; + + if (target_offset_scaled.mV[VX] > target_offset_scaled.mV[VY] && + target_offset_scaled.mV[VX] > target_offset_scaled.mV[VZ]) + { + object_split_axis = LLVector3::x_axis; + } + else if (target_offset_scaled.mV[VY] > target_offset_scaled.mV[VZ]) + { + object_split_axis = LLVector3::y_axis; + } + else + { + object_split_axis = LLVector3::z_axis; + } + + LLVector3 camera_offset_object(getCameraPositionAgent() - mFocusObject->getPositionAgent()); + + + F32 camera_offset_clip = camera_offset_object * object_split_axis; + F32 target_offset_clip = target_offset_dir * object_split_axis; + + // target has moved outside of object extents + // check to see if camera and target are on same side + if (target_outside_object_extents) + { + if (camera_offset_clip > 0.f && target_offset_clip > 0.f) + { + return FALSE; + } + else if (camera_offset_clip < 0.f && target_offset_clip < 0.f) + { + return FALSE; + } + } + + // clamp obj distance to diagonal of 10 by 10 cube + obj_min_distance = llmin(obj_min_distance, 10.f * F_SQRT3); + + obj_min_distance += LLViewerCamera::getInstance()->getNear() + (soft_limit ? 0.1f : 0.2f); + + return TRUE; } F32 LLAgentCamera::getCameraZoomFraction() { - // 0.f -> camera zoomed all the way out - // 1.f -> camera zoomed all the way in - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - // already [0,1] - return mHUDTargetZoom; - } - else if (mFocusOnAvatar && cameraThirdPerson()) - { - return clamp_rescale(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION, 1.f, 0.f); - } - else if (cameraCustomizeAvatar()) - { - F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); - return clamp_rescale(distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM, 1.f, 0.f ); - } - else - { - F32 min_zoom; - F32 max_zoom = getCameraMaxZoomDistance(); - - F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); - if (mFocusObject.notNull()) - { - if (mFocusObject->isAvatar()) - { - min_zoom = AVATAR_MIN_ZOOM; - } - else - { - min_zoom = OBJECT_MIN_ZOOM; - } - } - else - { - min_zoom = LAND_MIN_ZOOM; - } - - return clamp_rescale(distance, min_zoom, max_zoom, 1.f, 0.f); - } + // 0.f -> camera zoomed all the way out + // 1.f -> camera zoomed all the way in + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + // already [0,1] + return mHUDTargetZoom; + } + else if (mFocusOnAvatar && cameraThirdPerson()) + { + return clamp_rescale(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION, 1.f, 0.f); + } + else if (cameraCustomizeAvatar()) + { + F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); + return clamp_rescale(distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM, 1.f, 0.f ); + } + else + { + F32 min_zoom; + F32 max_zoom = getCameraMaxZoomDistance(); + + F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); + if (mFocusObject.notNull()) + { + if (mFocusObject->isAvatar()) + { + min_zoom = AVATAR_MIN_ZOOM; + } + else + { + min_zoom = OBJECT_MIN_ZOOM; + } + } + else + { + min_zoom = LAND_MIN_ZOOM; + } + + return clamp_rescale(distance, min_zoom, max_zoom, 1.f, 0.f); + } } void LLAgentCamera::setCameraZoomFraction(F32 fraction) { - // 0.f -> camera zoomed all the way out - // 1.f -> camera zoomed all the way in - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - - if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - mHUDTargetZoom = fraction; - } - else if (mFocusOnAvatar && cameraThirdPerson()) - { - mCameraZoomFraction = rescale(fraction, 0.f, 1.f, MAX_ZOOM_FRACTION, MIN_ZOOM_FRACTION); - } - else if (cameraCustomizeAvatar()) - { - LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; - camera_offset_dir.normalize(); - mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, APPEARANCE_MAX_ZOOM, APPEARANCE_MIN_ZOOM); - } - else - { - F32 min_zoom = LAND_MIN_ZOOM; - F32 max_zoom = getCameraMaxZoomDistance(); - - if (mFocusObject.notNull()) - { - if (mFocusObject.notNull()) - { - if (mFocusObject->isAvatar()) - { - min_zoom = AVATAR_MIN_ZOOM; - } - else - { - min_zoom = OBJECT_MIN_ZOOM; - } - } - } - - LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; - camera_offset_dir.normalize(); - mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, max_zoom, min_zoom); - } - startCameraAnimation(); + // 0.f -> camera zoomed all the way out + // 1.f -> camera zoomed all the way in + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + + if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + mHUDTargetZoom = fraction; + } + else if (mFocusOnAvatar && cameraThirdPerson()) + { + mCameraZoomFraction = rescale(fraction, 0.f, 1.f, MAX_ZOOM_FRACTION, MIN_ZOOM_FRACTION); + } + else if (cameraCustomizeAvatar()) + { + LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; + camera_offset_dir.normalize(); + mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, APPEARANCE_MAX_ZOOM, APPEARANCE_MIN_ZOOM); + } + else + { + F32 min_zoom = LAND_MIN_ZOOM; + F32 max_zoom = getCameraMaxZoomDistance(); + + if (mFocusObject.notNull()) + { + if (mFocusObject.notNull()) + { + if (mFocusObject->isAvatar()) + { + min_zoom = AVATAR_MIN_ZOOM; + } + else + { + min_zoom = OBJECT_MIN_ZOOM; + } + } + } + + LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; + camera_offset_dir.normalize(); + mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, max_zoom, min_zoom); + } + startCameraAnimation(); } @@ -816,21 +816,21 @@ void LLAgentCamera::setCameraZoomFraction(F32 fraction) //----------------------------------------------------------------------------- void LLAgentCamera::cameraOrbitAround(const F32 radians) { - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - // do nothing for hud selection - } - else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON || mCameraMode == CAMERA_MODE_FOLLOW)) - { - gAgent.yaw(radians); - } - else - { - mCameraFocusOffsetTarget.rotVec(radians, 0.f, 0.f, 1.f); - - cameraZoomIn(1.f); - } + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + // do nothing for hud selection + } + else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON || mCameraMode == CAMERA_MODE_FOLLOW)) + { + gAgent.yaw(radians); + } + else + { + mCameraFocusOffsetTarget.rotVec(radians, 0.f, 0.f, 1.f); + + cameraZoomIn(1.f); + } } @@ -839,29 +839,29 @@ void LLAgentCamera::cameraOrbitAround(const F32 radians) //----------------------------------------------------------------------------- void LLAgentCamera::cameraOrbitOver(const F32 angle) { - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - // do nothing for hud selection - } - else if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON) - { - gAgent.pitch(angle); - } - else - { - LLVector3 camera_offset_unit(mCameraFocusOffsetTarget); - camera_offset_unit.normalize(); - - F32 angle_from_up = acos( camera_offset_unit * gAgent.getReferenceUpVector() ); - - LLVector3d left_axis; - left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); - F32 new_angle = llclamp(angle_from_up - angle, 1.f * DEG_TO_RAD, 179.f * DEG_TO_RAD); - mCameraFocusOffsetTarget.rotVec(angle_from_up - new_angle, left_axis); - - cameraZoomIn(1.f); - } + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + // do nothing for hud selection + } + else if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON) + { + gAgent.pitch(angle); + } + else + { + LLVector3 camera_offset_unit(mCameraFocusOffsetTarget); + camera_offset_unit.normalize(); + + F32 angle_from_up = acos( camera_offset_unit * gAgent.getReferenceUpVector() ); + + LLVector3d left_axis; + left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); + F32 new_angle = llclamp(angle_from_up - angle, 1.f * DEG_TO_RAD, 179.f * DEG_TO_RAD); + mCameraFocusOffsetTarget.rotVec(angle_from_up - new_angle, left_axis); + + cameraZoomIn(1.f); + } } //----------------------------------------------------------------------------- @@ -869,65 +869,65 @@ void LLAgentCamera::cameraOrbitOver(const F32 angle) //----------------------------------------------------------------------------- void LLAgentCamera::cameraZoomIn(const F32 fraction) { - if (gDisconnected) - { - return; - } - - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - if (LLToolMgr::getInstance()->inBuildMode() && selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - // just update hud zoom level - mHUDTargetZoom /= fraction; - return; - } - - - LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); - F32 min_zoom = LAND_MIN_ZOOM; - F32 current_distance = (F32)camera_offset_unit.normalize(); - F32 new_distance = current_distance * fraction; - - // Don't move through focus point - if (mFocusObject) - { - LLVector3 camera_offset_dir((F32)camera_offset_unit.mdV[VX], (F32)camera_offset_unit.mdV[VY], (F32)camera_offset_unit.mdV[VZ]); - - if (mFocusObject->isAvatar()) - { - calcCameraMinDistance(min_zoom); - } - else - { - min_zoom = OBJECT_MIN_ZOOM; - } - } - - new_distance = llmax(new_distance, min_zoom); - - F32 max_distance = getCameraMaxZoomDistance(); + if (gDisconnected) + { + return; + } + + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + if (LLToolMgr::getInstance()->inBuildMode() && selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + // just update hud zoom level + mHUDTargetZoom /= fraction; + return; + } + + + LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); + F32 min_zoom = LAND_MIN_ZOOM; + F32 current_distance = (F32)camera_offset_unit.normalize(); + F32 new_distance = current_distance * fraction; + + // Don't move through focus point + if (mFocusObject) + { + LLVector3 camera_offset_dir((F32)camera_offset_unit.mdV[VX], (F32)camera_offset_unit.mdV[VY], (F32)camera_offset_unit.mdV[VZ]); + + if (mFocusObject->isAvatar()) + { + calcCameraMinDistance(min_zoom); + } + else + { + min_zoom = OBJECT_MIN_ZOOM; + } + } + + new_distance = llmax(new_distance, min_zoom); + + F32 max_distance = getCameraMaxZoomDistance(); max_distance = llmin(max_distance, current_distance * 4.f); //Scaled max relative to current distance. MAINT-3154 - if (new_distance > max_distance) - { - new_distance = max_distance; - - /* - // Unless camera is unlocked - if (!LLViewerCamera::sDisableCameraConstraints) - { - return; - } - */ - } - - if(cameraCustomizeAvatar()) - { - new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); - } - - mCameraFocusOffsetTarget = new_distance * camera_offset_unit; + if (new_distance > max_distance) + { + new_distance = max_distance; + + /* + // Unless camera is unlocked + if (!LLViewerCamera::sDisableCameraConstraints) + { + return; + } + */ + } + + if(cameraCustomizeAvatar()) + { + new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); + } + + mCameraFocusOffsetTarget = new_distance * camera_offset_unit; } //----------------------------------------------------------------------------- @@ -935,62 +935,62 @@ void LLAgentCamera::cameraZoomIn(const F32 fraction) //----------------------------------------------------------------------------- void LLAgentCamera::cameraOrbitIn(const F32 meters) { - if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON) - { - F32 camera_offset_dist = llmax(0.001f, getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale")); - - mCameraZoomFraction = (mTargetCameraDistance - meters) / camera_offset_dist; - - if (!gSavedSettings.getBOOL("FreezeTime") && mCameraZoomFraction < MIN_ZOOM_FRACTION && meters > 0.f) - { - // No need to animate, camera is already there. - changeCameraToMouselook(FALSE); - } - - mCameraZoomFraction = llclamp(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION); - } - else - { - LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); - F32 current_distance = (F32)camera_offset_unit.normalize(); - F32 new_distance = current_distance - meters; - F32 min_zoom = LAND_MIN_ZOOM; - - // Don't move through focus point - if (mFocusObject.notNull()) - { - if (mFocusObject->isAvatar()) - { - min_zoom = AVATAR_MIN_ZOOM; - } - else - { - min_zoom = OBJECT_MIN_ZOOM; - } - } - - new_distance = llmax(new_distance, min_zoom); - - F32 max_distance = getCameraMaxZoomDistance(); - - if (new_distance > max_distance) - { - // Unless camera is unlocked - if (!gSavedSettings.getBOOL("DisableCameraConstraints")) - { - return; - } - } - - if( CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode() ) - { - new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); - } - - // Compute new camera offset - mCameraFocusOffsetTarget = new_distance * camera_offset_unit; - cameraZoomIn(1.f); - } + if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON) + { + F32 camera_offset_dist = llmax(0.001f, getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale")); + + mCameraZoomFraction = (mTargetCameraDistance - meters) / camera_offset_dist; + + if (!gSavedSettings.getBOOL("FreezeTime") && mCameraZoomFraction < MIN_ZOOM_FRACTION && meters > 0.f) + { + // No need to animate, camera is already there. + changeCameraToMouselook(FALSE); + } + + mCameraZoomFraction = llclamp(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION); + } + else + { + LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); + F32 current_distance = (F32)camera_offset_unit.normalize(); + F32 new_distance = current_distance - meters; + F32 min_zoom = LAND_MIN_ZOOM; + + // Don't move through focus point + if (mFocusObject.notNull()) + { + if (mFocusObject->isAvatar()) + { + min_zoom = AVATAR_MIN_ZOOM; + } + else + { + min_zoom = OBJECT_MIN_ZOOM; + } + } + + new_distance = llmax(new_distance, min_zoom); + + F32 max_distance = getCameraMaxZoomDistance(); + + if (new_distance > max_distance) + { + // Unless camera is unlocked + if (!gSavedSettings.getBOOL("DisableCameraConstraints")) + { + return; + } + } + + if( CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode() ) + { + new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); + } + + // Compute new camera offset + mCameraFocusOffsetTarget = new_distance * camera_offset_unit; + cameraZoomIn(1.f); + } } @@ -999,15 +999,15 @@ void LLAgentCamera::cameraOrbitIn(const F32 meters) //----------------------------------------------------------------------------- void LLAgentCamera::cameraPanIn(F32 meters) { - LLVector3d at_axis; - at_axis.setVec(LLViewerCamera::getInstance()->getAtAxis()); - - mFocusTargetGlobal += meters * at_axis; - mFocusGlobal = mFocusTargetGlobal; - // don't enforce zoom constraints as this is the only way for users to get past them easily - updateFocusOffset(); - // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx - mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); + LLVector3d at_axis; + at_axis.setVec(LLViewerCamera::getInstance()->getAtAxis()); + + mFocusTargetGlobal += meters * at_axis; + mFocusGlobal = mFocusTargetGlobal; + // don't enforce zoom constraints as this is the only way for users to get past them easily + updateFocusOffset(); + // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx + mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); } //----------------------------------------------------------------------------- @@ -1015,19 +1015,19 @@ void LLAgentCamera::cameraPanIn(F32 meters) //----------------------------------------------------------------------------- void LLAgentCamera::cameraPanLeft(F32 meters) { - LLVector3d left_axis; - left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); - - mFocusTargetGlobal += meters * left_axis; - mFocusGlobal = mFocusTargetGlobal; - - // disable smoothing for camera pan, which causes some residents unhappiness - mCameraSmoothingStop = true; - - cameraZoomIn(1.f); - updateFocusOffset(); - // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind - Nyx - mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); + LLVector3d left_axis; + left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); + + mFocusTargetGlobal += meters * left_axis; + mFocusGlobal = mFocusTargetGlobal; + + // disable smoothing for camera pan, which causes some residents unhappiness + mCameraSmoothingStop = true; + + cameraZoomIn(1.f); + updateFocusOffset(); + // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind - Nyx + mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); } //----------------------------------------------------------------------------- @@ -1035,19 +1035,19 @@ void LLAgentCamera::cameraPanLeft(F32 meters) //----------------------------------------------------------------------------- void LLAgentCamera::cameraPanUp(F32 meters) { - LLVector3d up_axis; - up_axis.setVec(LLViewerCamera::getInstance()->getUpAxis()); + LLVector3d up_axis; + up_axis.setVec(LLViewerCamera::getInstance()->getUpAxis()); - mFocusTargetGlobal += meters * up_axis; - mFocusGlobal = mFocusTargetGlobal; + mFocusTargetGlobal += meters * up_axis; + mFocusGlobal = mFocusTargetGlobal; - // disable smoothing for camera pan, which causes some residents unhappiness - mCameraSmoothingStop = true; + // disable smoothing for camera pan, which causes some residents unhappiness + mCameraSmoothingStop = true; - cameraZoomIn(1.f); - updateFocusOffset(); - // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx - mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); + cameraZoomIn(1.f); + updateFocusOffset(); + // NOTE: panning movements expect the camera to move exactly with the focus target, not animated behind -Nyx + mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); } //----------------------------------------------------------------------------- @@ -1055,67 +1055,67 @@ void LLAgentCamera::cameraPanUp(F32 meters) //----------------------------------------------------------------------------- void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y) { - static LLVector3 last_at_axis; - - if (!isAgentAvatarValid()) return; - - LLQuaternion av_inv_rot = ~gAgentAvatarp->mRoot->getWorldRotation(); - LLVector3 root_at = LLVector3::x_axis * gAgentAvatarp->mRoot->getWorldRotation(); - - if (LLTrace::get_frame_recording().getLastRecording().getLastValue(*gViewerWindow->getMouseVelocityStat()) < 0.01f - && (root_at * last_at_axis > 0.95f)) - { - LLVector3 vel = gAgentAvatarp->getVelocity(); - if (vel.magVecSquared() > 4.f) - { - setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, vel * av_inv_rot); - } - else - { - // *FIX: rotate mframeagent by sit object's rotation? - LLQuaternion look_rotation = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); // use camera's current rotation - LLVector3 look_offset = LLVector3(2.f, 0.f, 0.f) * look_rotation * av_inv_rot; - setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, look_offset); - } - last_at_axis = root_at; - return; - } - - last_at_axis = root_at; - - if (CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode()) - { - setLookAt(LOOKAT_TARGET_NONE, gAgentAvatarp, LLVector3(-2.f, 0.f, 0.f)); - } - else - { - // Move head based on cursor position - ELookAtType lookAtType = LOOKAT_TARGET_NONE; - LLVector3 headLookAxis; - LLCoordFrame frameCamera = *((LLCoordFrame*)LLViewerCamera::getInstance()); - - if (cameraMouselook()) - { - lookAtType = LOOKAT_TARGET_MOUSELOOK; - } - else if (cameraThirdPerson()) - { - // range from -.5 to .5 - F32 x_from_center = - ((F32) mouse_x / (F32) gViewerWindow->getWorldViewWidthScaled() ) - 0.5f; - F32 y_from_center = - ((F32) mouse_y / (F32) gViewerWindow->getWorldViewHeightScaled() ) - 0.5f; - - frameCamera.yaw( - x_from_center * gSavedSettings.getF32("YawFromMousePosition") * DEG_TO_RAD); - frameCamera.pitch( - y_from_center * gSavedSettings.getF32("PitchFromMousePosition") * DEG_TO_RAD); - lookAtType = LOOKAT_TARGET_FREELOOK; - } - - headLookAxis = frameCamera.getAtAxis(); - // RN: we use world-space offset for mouselook and freelook - //headLookAxis = headLookAxis * av_inv_rot; - setLookAt(lookAtType, gAgentAvatarp, headLookAxis); - } + static LLVector3 last_at_axis; + + if (!isAgentAvatarValid()) return; + + LLQuaternion av_inv_rot = ~gAgentAvatarp->mRoot->getWorldRotation(); + LLVector3 root_at = LLVector3::x_axis * gAgentAvatarp->mRoot->getWorldRotation(); + + if (LLTrace::get_frame_recording().getLastRecording().getLastValue(*gViewerWindow->getMouseVelocityStat()) < 0.01f + && (root_at * last_at_axis > 0.95f)) + { + LLVector3 vel = gAgentAvatarp->getVelocity(); + if (vel.magVecSquared() > 4.f) + { + setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, vel * av_inv_rot); + } + else + { + // *FIX: rotate mframeagent by sit object's rotation? + LLQuaternion look_rotation = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); // use camera's current rotation + LLVector3 look_offset = LLVector3(2.f, 0.f, 0.f) * look_rotation * av_inv_rot; + setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, look_offset); + } + last_at_axis = root_at; + return; + } + + last_at_axis = root_at; + + if (CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode()) + { + setLookAt(LOOKAT_TARGET_NONE, gAgentAvatarp, LLVector3(-2.f, 0.f, 0.f)); + } + else + { + // Move head based on cursor position + ELookAtType lookAtType = LOOKAT_TARGET_NONE; + LLVector3 headLookAxis; + LLCoordFrame frameCamera = *((LLCoordFrame*)LLViewerCamera::getInstance()); + + if (cameraMouselook()) + { + lookAtType = LOOKAT_TARGET_MOUSELOOK; + } + else if (cameraThirdPerson()) + { + // range from -.5 to .5 + F32 x_from_center = + ((F32) mouse_x / (F32) gViewerWindow->getWorldViewWidthScaled() ) - 0.5f; + F32 y_from_center = + ((F32) mouse_y / (F32) gViewerWindow->getWorldViewHeightScaled() ) - 0.5f; + + frameCamera.yaw( - x_from_center * gSavedSettings.getF32("YawFromMousePosition") * DEG_TO_RAD); + frameCamera.pitch( - y_from_center * gSavedSettings.getF32("PitchFromMousePosition") * DEG_TO_RAD); + lookAtType = LOOKAT_TARGET_FREELOOK; + } + + headLookAxis = frameCamera.getAtAxis(); + // RN: we use world-space offset for mouselook and freelook + //headLookAxis = headLookAxis * av_inv_rot; + setLookAt(lookAtType, gAgentAvatarp, headLookAxis); + } } static LLTrace::BlockTimerStatHandle FTM_UPDATE_CAMERA("Camera"); @@ -1125,373 +1125,373 @@ static LLTrace::BlockTimerStatHandle FTM_UPDATE_CAMERA("Camera"); //----------------------------------------------------------------------------- void LLAgentCamera::updateCamera() { - LL_RECORD_BLOCK_TIME(FTM_UPDATE_CAMERA); - - // - changed camera_skyward to the new global "mCameraUpVector" - mCameraUpVector = LLVector3::z_axis; - //LLVector3 camera_skyward(0.f, 0.f, 1.f); - - U32 camera_mode = mCameraAnimating ? mLastCameraMode : mCameraMode; - - validateFocusObject(); - - if (isAgentAvatarValid() && - gAgentAvatarp->isSitting() && - camera_mode == CAMERA_MODE_MOUSELOOK) - { - //changed camera_skyward to the new global "mCameraUpVector" - mCameraUpVector = mCameraUpVector * gAgentAvatarp->getRenderRotation(); - } - - if (cameraThirdPerson() && (mFocusOnAvatar || mAllowChangeToFollow) && LLFollowCamMgr::getActiveFollowCamParams()) - { - mAllowChangeToFollow = FALSE; - mFocusOnAvatar = TRUE; - changeCameraToFollow(); - } - - //NOTE - this needs to be integrated into a general upVector system here within llAgent. - if ( camera_mode == CAMERA_MODE_FOLLOW && mFocusOnAvatar ) - { - mCameraUpVector = mFollowCam.getUpVector(); - } - - if (mSitCameraEnabled) - { - if (mSitCameraReferenceObject->isDead()) - { - setSitCamera(LLUUID::null); - } - } - - // Update UI with our camera inputs - LLFloaterCamera* camera_floater = LLFloaterReg::findTypedInstance("camera"); - if (camera_floater) - { - camera_floater->mRotate->setToggleState(gAgentCamera.getOrbitRightKey() > 0.f, // left - gAgentCamera.getOrbitUpKey() > 0.f, // top - gAgentCamera.getOrbitLeftKey() > 0.f, // right - gAgentCamera.getOrbitDownKey() > 0.f); // bottom - - camera_floater->mTrack->setToggleState(gAgentCamera.getPanLeftKey() > 0.f, // left - gAgentCamera.getPanUpKey() > 0.f, // top - gAgentCamera.getPanRightKey() > 0.f, // right - gAgentCamera.getPanDownKey() > 0.f); // bottom - } - - // Handle camera movement based on keyboard. - const F32 ORBIT_OVER_RATE = 90.f * DEG_TO_RAD; // radians per second - const F32 ORBIT_AROUND_RATE = 90.f * DEG_TO_RAD; // radians per second - const F32 PAN_RATE = 5.f; // meters per second - - if (gAgentCamera.getOrbitUpKey() || gAgentCamera.getOrbitDownKey()) - { - F32 input_rate = gAgentCamera.getOrbitUpKey() - gAgentCamera.getOrbitDownKey(); - cameraOrbitOver( input_rate * ORBIT_OVER_RATE / gFPSClamped ); - } - - if (gAgentCamera.getOrbitLeftKey() || gAgentCamera.getOrbitRightKey()) - { - F32 input_rate = gAgentCamera.getOrbitLeftKey() - gAgentCamera.getOrbitRightKey(); - cameraOrbitAround(input_rate * ORBIT_AROUND_RATE / gFPSClamped); - } - - if (gAgentCamera.getOrbitInKey() || gAgentCamera.getOrbitOutKey()) - { - F32 input_rate = gAgentCamera.getOrbitInKey() - gAgentCamera.getOrbitOutKey(); - - LLVector3d to_focus = gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()) - calcFocusPositionTargetGlobal(); - F32 distance_to_focus = (F32)to_focus.magVec(); - // Move at distance (in meters) meters per second - cameraOrbitIn( input_rate * distance_to_focus / gFPSClamped ); - } - - if (gAgentCamera.getPanInKey() || gAgentCamera.getPanOutKey()) - { - F32 input_rate = gAgentCamera.getPanInKey() - gAgentCamera.getPanOutKey(); - cameraPanIn(input_rate * PAN_RATE / gFPSClamped); - } - - if (gAgentCamera.getPanRightKey() || gAgentCamera.getPanLeftKey()) - { - F32 input_rate = gAgentCamera.getPanRightKey() - gAgentCamera.getPanLeftKey(); - cameraPanLeft(input_rate * -PAN_RATE / gFPSClamped ); - } - - if (gAgentCamera.getPanUpKey() || gAgentCamera.getPanDownKey()) - { - F32 input_rate = gAgentCamera.getPanUpKey() - gAgentCamera.getPanDownKey(); - cameraPanUp(input_rate * PAN_RATE / gFPSClamped ); - } - - // Clear camera keyboard keys. - gAgentCamera.clearOrbitKeys(); - gAgentCamera.clearPanKeys(); - - // lerp camera focus offset - mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLSmoothInterpolation::getInterpolant(CAMERA_FOCUS_HALF_LIFE)); - - if ( mCameraMode == CAMERA_MODE_FOLLOW ) - { - if (isAgentAvatarValid()) - { - //-------------------------------------------------------------------------------- - // this is where the avatar's position and rotation are given to followCam, and - // where it is updated. All three of its attributes are updated: (1) position, - // (2) focus, and (3) upvector. They can then be queried elsewhere in llAgent. - //-------------------------------------------------------------------------------- - // *TODO: use combined rotation of frameagent and sit object - LLQuaternion avatarRotationForFollowCam = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); - - LLFollowCamParams* current_cam = LLFollowCamMgr::getActiveFollowCamParams(); - if (current_cam) - { - mFollowCam.copyParams(*current_cam); - mFollowCam.setSubjectPositionAndRotation( gAgentAvatarp->getRenderPosition(), avatarRotationForFollowCam ); - mFollowCam.update(); - LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true); - } - else - { - changeCameraToThirdPerson(TRUE); - } - } - } - - BOOL hit_limit; - LLVector3d camera_pos_global; - LLVector3d camera_target_global = calcCameraPositionTargetGlobal(&hit_limit); - mCameraVirtualPositionAgent = gAgent.getPosAgentFromGlobal(camera_target_global); - LLVector3d focus_target_global = calcFocusPositionTargetGlobal(); - - // perform field of view correction - mCameraFOVZoomFactor = calcCameraFOVZoomFactor(); - camera_target_global = focus_target_global + (camera_target_global - focus_target_global) * (1.f + mCameraFOVZoomFactor); - - gAgent.setShowAvatar(TRUE); // can see avatar by default - - // Adjust position for animation - if (mCameraAnimating) - { - F32 time = mAnimationTimer.getElapsedTimeF32(); - - // yet another instance of critically damped motion, hooray! - // F32 fraction_of_animation = 1.f - pow(2.f, -time / CAMERA_ZOOM_HALF_LIFE); - - // linear interpolation - F32 fraction_of_animation = time / mAnimationDuration; - - BOOL isfirstPerson = mCameraMode == CAMERA_MODE_MOUSELOOK; - BOOL wasfirstPerson = mLastCameraMode == CAMERA_MODE_MOUSELOOK; - F32 fraction_animation_to_skip; - - if (mAnimationCameraStartGlobal == camera_target_global) - { - fraction_animation_to_skip = 0.f; - } - else - { - LLVector3d cam_delta = mAnimationCameraStartGlobal - camera_target_global; - fraction_animation_to_skip = HEAD_BUFFER_SIZE / (F32)cam_delta.magVec(); - } - F32 animation_start_fraction = (wasfirstPerson) ? fraction_animation_to_skip : 0.f; - F32 animation_finish_fraction = (isfirstPerson) ? (1.f - fraction_animation_to_skip) : 1.f; - - if (fraction_of_animation < animation_finish_fraction) - { - if (fraction_of_animation < animation_start_fraction || fraction_of_animation > animation_finish_fraction ) - { - gAgent.setShowAvatar(FALSE); - } - - // ...adjust position for animation - F32 smooth_fraction_of_animation = llsmoothstep(0.0f, 1.0f, fraction_of_animation); - camera_pos_global = lerp(mAnimationCameraStartGlobal, camera_target_global, smooth_fraction_of_animation); - mFocusGlobal = lerp(mAnimationFocusStartGlobal, focus_target_global, smooth_fraction_of_animation); - } - else - { - // ...animation complete - mCameraAnimating = FALSE; - - camera_pos_global = camera_target_global; - mFocusGlobal = focus_target_global; - - gAgent.endAnimationUpdateUI(); - gAgent.setShowAvatar(TRUE); - } - - if (isAgentAvatarValid() && (mCameraMode != CAMERA_MODE_MOUSELOOK)) - { - gAgentAvatarp->updateAttachmentVisibility(mCameraMode); - } - } - else - { - camera_pos_global = camera_target_global; - mFocusGlobal = focus_target_global; - gAgent.setShowAvatar(TRUE); - } - - // smoothing - if (TRUE) - { - LLVector3d agent_pos = gAgent.getPositionGlobal(); - LLVector3d camera_pos_agent = camera_pos_global - agent_pos; - // Sitting on what you're manipulating can cause camera jitter with smoothing. - // This turns off smoothing while editing. -MG - bool in_build_mode = LLToolMgr::getInstance()->inBuildMode(); - mCameraSmoothingStop = mCameraSmoothingStop || in_build_mode; - - if (cameraThirdPerson() && !mCameraSmoothingStop) - { - const F32 SMOOTHING_HALF_LIFE = 0.02f; - - F32 smoothing = LLSmoothInterpolation::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, FALSE); - - if (!mFocusObject) // we differentiate on avatar mode - { - // for avatar-relative focus, we smooth in avatar space - - // the avatar moves too jerkily w/r/t global space to smooth there. - - LLVector3d delta = camera_pos_agent - mCameraSmoothingLastPositionAgent; - if (delta.magVec() < MAX_CAMERA_SMOOTH_DISTANCE) // only smooth over short distances please - { - camera_pos_agent = lerp(mCameraSmoothingLastPositionAgent, camera_pos_agent, smoothing); - camera_pos_global = camera_pos_agent + agent_pos; - } - } - else - { - LLVector3d delta = camera_pos_global - mCameraSmoothingLastPositionGlobal; - if (delta.magVec() < MAX_CAMERA_SMOOTH_DISTANCE) // only smooth over short distances please - { - camera_pos_global = lerp(mCameraSmoothingLastPositionGlobal, camera_pos_global, smoothing); - } - } - } - - mCameraSmoothingLastPositionGlobal = camera_pos_global; - mCameraSmoothingLastPositionAgent = camera_pos_agent; - mCameraSmoothingStop = false; - } - - - mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLSmoothInterpolation::getInterpolant(FOV_ZOOM_HALF_LIFE)); - -// LL_INFOS() << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << LL_ENDL; - - LLVector3 focus_agent = gAgent.getPosAgentFromGlobal(mFocusGlobal); - - mCameraPositionAgent = gAgent.getPosAgentFromGlobal(camera_pos_global); - - // Move the camera - - LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, mCameraUpVector, focus_agent); - //LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, camera_skyward, focus_agent); - - // Change FOV - LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / (1.f + mCameraCurrentFOVZoomFactor)); - - // follow camera when in customize mode - if (cameraCustomizeAvatar()) - { - setLookAt(LOOKAT_TARGET_FOCUS, NULL, mCameraPositionAgent); - } - - // update the travel distance stat - // this isn't directly related to the camera - // but this seemed like the best place to do this - LLVector3d global_pos = gAgent.getPositionGlobal(); - if (!gAgent.getLastPositionGlobal().isExactlyZero()) - { - LLVector3d delta = global_pos - gAgent.getLastPositionGlobal(); - gAgent.setDistanceTraveled(gAgent.getDistanceTraveled() + delta.magVec()); - } - gAgent.setLastPositionGlobal(global_pos); - - if (LLVOAvatar::sVisibleInFirstPerson && isAgentAvatarValid() && !gAgentAvatarp->isSitting() && cameraMouselook()) - { - LLVector3 head_pos = gAgentAvatarp->mHeadp->getWorldPosition() + - LLVector3(0.08f, 0.f, 0.05f) * gAgentAvatarp->mHeadp->getWorldRotation() + - LLVector3(0.1f, 0.f, 0.f) * gAgentAvatarp->mPelvisp->getWorldRotation(); - LLVector3 diff = mCameraPositionAgent - head_pos; - diff = diff * ~gAgentAvatarp->mRoot->getWorldRotation(); - - LLJoint* torso_joint = gAgentAvatarp->mTorsop; - LLJoint* chest_joint = gAgentAvatarp->mChestp; - LLVector3 torso_scale = torso_joint->getScale(); - LLVector3 chest_scale = chest_joint->getScale(); - - // shorten avatar skeleton to avoid foot interpenetration - if (!gAgentAvatarp->mInAir) - { - LLVector3 chest_offset = LLVector3(0.f, 0.f, chest_joint->getPosition().mV[VZ]) * torso_joint->getWorldRotation(); - F32 z_compensate = llclamp(-diff.mV[VZ], -0.2f, 1.f); - F32 scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / chest_offset.mV[VZ]), 0.5f, 1.2f); - torso_joint->setScale(LLVector3(1.f, 1.f, scale_factor)); - - LLJoint* neck_joint = gAgentAvatarp->mNeckp; - LLVector3 neck_offset = LLVector3(0.f, 0.f, neck_joint->getPosition().mV[VZ]) * chest_joint->getWorldRotation(); - scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / neck_offset.mV[VZ]), 0.5f, 1.2f); - chest_joint->setScale(LLVector3(1.f, 1.f, scale_factor)); - diff.mV[VZ] = 0.f; - } - - // SL-315 - gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff); - - gAgentAvatarp->mRoot->updateWorldMatrixChildren(); - - for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); - iter != gAgentAvatarp->mAttachmentPoints.end(); ) - { - LLVOAvatar::attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); - attachment_iter != attachment->mAttachedObjects.end(); - ++attachment_iter) - { - LLViewerObject *attached_object = (*attachment_iter); - if (attached_object && !attached_object->isDead() && attached_object->mDrawable.notNull()) - { - // clear any existing "early" movements of attachment - attached_object->mDrawable->clearState(LLDrawable::EARLY_MOVE); - gPipeline.updateMoveNormalAsync(attached_object->mDrawable); - attached_object->updateText(); - } - } - } - - torso_joint->setScale(torso_scale); - chest_joint->setScale(chest_scale); - } + LL_RECORD_BLOCK_TIME(FTM_UPDATE_CAMERA); + + // - changed camera_skyward to the new global "mCameraUpVector" + mCameraUpVector = LLVector3::z_axis; + //LLVector3 camera_skyward(0.f, 0.f, 1.f); + + U32 camera_mode = mCameraAnimating ? mLastCameraMode : mCameraMode; + + validateFocusObject(); + + if (isAgentAvatarValid() && + gAgentAvatarp->isSitting() && + camera_mode == CAMERA_MODE_MOUSELOOK) + { + //changed camera_skyward to the new global "mCameraUpVector" + mCameraUpVector = mCameraUpVector * gAgentAvatarp->getRenderRotation(); + } + + if (cameraThirdPerson() && (mFocusOnAvatar || mAllowChangeToFollow) && LLFollowCamMgr::getActiveFollowCamParams()) + { + mAllowChangeToFollow = FALSE; + mFocusOnAvatar = TRUE; + changeCameraToFollow(); + } + + //NOTE - this needs to be integrated into a general upVector system here within llAgent. + if ( camera_mode == CAMERA_MODE_FOLLOW && mFocusOnAvatar ) + { + mCameraUpVector = mFollowCam.getUpVector(); + } + + if (mSitCameraEnabled) + { + if (mSitCameraReferenceObject->isDead()) + { + setSitCamera(LLUUID::null); + } + } + + // Update UI with our camera inputs + LLFloaterCamera* camera_floater = LLFloaterReg::findTypedInstance("camera"); + if (camera_floater) + { + camera_floater->mRotate->setToggleState(gAgentCamera.getOrbitRightKey() > 0.f, // left + gAgentCamera.getOrbitUpKey() > 0.f, // top + gAgentCamera.getOrbitLeftKey() > 0.f, // right + gAgentCamera.getOrbitDownKey() > 0.f); // bottom + + camera_floater->mTrack->setToggleState(gAgentCamera.getPanLeftKey() > 0.f, // left + gAgentCamera.getPanUpKey() > 0.f, // top + gAgentCamera.getPanRightKey() > 0.f, // right + gAgentCamera.getPanDownKey() > 0.f); // bottom + } + + // Handle camera movement based on keyboard. + const F32 ORBIT_OVER_RATE = 90.f * DEG_TO_RAD; // radians per second + const F32 ORBIT_AROUND_RATE = 90.f * DEG_TO_RAD; // radians per second + const F32 PAN_RATE = 5.f; // meters per second + + if (gAgentCamera.getOrbitUpKey() || gAgentCamera.getOrbitDownKey()) + { + F32 input_rate = gAgentCamera.getOrbitUpKey() - gAgentCamera.getOrbitDownKey(); + cameraOrbitOver( input_rate * ORBIT_OVER_RATE / gFPSClamped ); + } + + if (gAgentCamera.getOrbitLeftKey() || gAgentCamera.getOrbitRightKey()) + { + F32 input_rate = gAgentCamera.getOrbitLeftKey() - gAgentCamera.getOrbitRightKey(); + cameraOrbitAround(input_rate * ORBIT_AROUND_RATE / gFPSClamped); + } + + if (gAgentCamera.getOrbitInKey() || gAgentCamera.getOrbitOutKey()) + { + F32 input_rate = gAgentCamera.getOrbitInKey() - gAgentCamera.getOrbitOutKey(); + + LLVector3d to_focus = gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()) - calcFocusPositionTargetGlobal(); + F32 distance_to_focus = (F32)to_focus.magVec(); + // Move at distance (in meters) meters per second + cameraOrbitIn( input_rate * distance_to_focus / gFPSClamped ); + } + + if (gAgentCamera.getPanInKey() || gAgentCamera.getPanOutKey()) + { + F32 input_rate = gAgentCamera.getPanInKey() - gAgentCamera.getPanOutKey(); + cameraPanIn(input_rate * PAN_RATE / gFPSClamped); + } + + if (gAgentCamera.getPanRightKey() || gAgentCamera.getPanLeftKey()) + { + F32 input_rate = gAgentCamera.getPanRightKey() - gAgentCamera.getPanLeftKey(); + cameraPanLeft(input_rate * -PAN_RATE / gFPSClamped ); + } + + if (gAgentCamera.getPanUpKey() || gAgentCamera.getPanDownKey()) + { + F32 input_rate = gAgentCamera.getPanUpKey() - gAgentCamera.getPanDownKey(); + cameraPanUp(input_rate * PAN_RATE / gFPSClamped ); + } + + // Clear camera keyboard keys. + gAgentCamera.clearOrbitKeys(); + gAgentCamera.clearPanKeys(); + + // lerp camera focus offset + mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLSmoothInterpolation::getInterpolant(CAMERA_FOCUS_HALF_LIFE)); + + if ( mCameraMode == CAMERA_MODE_FOLLOW ) + { + if (isAgentAvatarValid()) + { + //-------------------------------------------------------------------------------- + // this is where the avatar's position and rotation are given to followCam, and + // where it is updated. All three of its attributes are updated: (1) position, + // (2) focus, and (3) upvector. They can then be queried elsewhere in llAgent. + //-------------------------------------------------------------------------------- + // *TODO: use combined rotation of frameagent and sit object + LLQuaternion avatarRotationForFollowCam = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); + + LLFollowCamParams* current_cam = LLFollowCamMgr::getActiveFollowCamParams(); + if (current_cam) + { + mFollowCam.copyParams(*current_cam); + mFollowCam.setSubjectPositionAndRotation( gAgentAvatarp->getRenderPosition(), avatarRotationForFollowCam ); + mFollowCam.update(); + LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true); + } + else + { + changeCameraToThirdPerson(TRUE); + } + } + } + + BOOL hit_limit; + LLVector3d camera_pos_global; + LLVector3d camera_target_global = calcCameraPositionTargetGlobal(&hit_limit); + mCameraVirtualPositionAgent = gAgent.getPosAgentFromGlobal(camera_target_global); + LLVector3d focus_target_global = calcFocusPositionTargetGlobal(); + + // perform field of view correction + mCameraFOVZoomFactor = calcCameraFOVZoomFactor(); + camera_target_global = focus_target_global + (camera_target_global - focus_target_global) * (1.f + mCameraFOVZoomFactor); + + gAgent.setShowAvatar(TRUE); // can see avatar by default + + // Adjust position for animation + if (mCameraAnimating) + { + F32 time = mAnimationTimer.getElapsedTimeF32(); + + // yet another instance of critically damped motion, hooray! + // F32 fraction_of_animation = 1.f - pow(2.f, -time / CAMERA_ZOOM_HALF_LIFE); + + // linear interpolation + F32 fraction_of_animation = time / mAnimationDuration; + + BOOL isfirstPerson = mCameraMode == CAMERA_MODE_MOUSELOOK; + BOOL wasfirstPerson = mLastCameraMode == CAMERA_MODE_MOUSELOOK; + F32 fraction_animation_to_skip; + + if (mAnimationCameraStartGlobal == camera_target_global) + { + fraction_animation_to_skip = 0.f; + } + else + { + LLVector3d cam_delta = mAnimationCameraStartGlobal - camera_target_global; + fraction_animation_to_skip = HEAD_BUFFER_SIZE / (F32)cam_delta.magVec(); + } + F32 animation_start_fraction = (wasfirstPerson) ? fraction_animation_to_skip : 0.f; + F32 animation_finish_fraction = (isfirstPerson) ? (1.f - fraction_animation_to_skip) : 1.f; + + if (fraction_of_animation < animation_finish_fraction) + { + if (fraction_of_animation < animation_start_fraction || fraction_of_animation > animation_finish_fraction ) + { + gAgent.setShowAvatar(FALSE); + } + + // ...adjust position for animation + F32 smooth_fraction_of_animation = llsmoothstep(0.0f, 1.0f, fraction_of_animation); + camera_pos_global = lerp(mAnimationCameraStartGlobal, camera_target_global, smooth_fraction_of_animation); + mFocusGlobal = lerp(mAnimationFocusStartGlobal, focus_target_global, smooth_fraction_of_animation); + } + else + { + // ...animation complete + mCameraAnimating = FALSE; + + camera_pos_global = camera_target_global; + mFocusGlobal = focus_target_global; + + gAgent.endAnimationUpdateUI(); + gAgent.setShowAvatar(TRUE); + } + + if (isAgentAvatarValid() && (mCameraMode != CAMERA_MODE_MOUSELOOK)) + { + gAgentAvatarp->updateAttachmentVisibility(mCameraMode); + } + } + else + { + camera_pos_global = camera_target_global; + mFocusGlobal = focus_target_global; + gAgent.setShowAvatar(TRUE); + } + + // smoothing + if (TRUE) + { + LLVector3d agent_pos = gAgent.getPositionGlobal(); + LLVector3d camera_pos_agent = camera_pos_global - agent_pos; + // Sitting on what you're manipulating can cause camera jitter with smoothing. + // This turns off smoothing while editing. -MG + bool in_build_mode = LLToolMgr::getInstance()->inBuildMode(); + mCameraSmoothingStop = mCameraSmoothingStop || in_build_mode; + + if (cameraThirdPerson() && !mCameraSmoothingStop) + { + const F32 SMOOTHING_HALF_LIFE = 0.02f; + + F32 smoothing = LLSmoothInterpolation::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, FALSE); + + if (!mFocusObject) // we differentiate on avatar mode + { + // for avatar-relative focus, we smooth in avatar space - + // the avatar moves too jerkily w/r/t global space to smooth there. + + LLVector3d delta = camera_pos_agent - mCameraSmoothingLastPositionAgent; + if (delta.magVec() < MAX_CAMERA_SMOOTH_DISTANCE) // only smooth over short distances please + { + camera_pos_agent = lerp(mCameraSmoothingLastPositionAgent, camera_pos_agent, smoothing); + camera_pos_global = camera_pos_agent + agent_pos; + } + } + else + { + LLVector3d delta = camera_pos_global - mCameraSmoothingLastPositionGlobal; + if (delta.magVec() < MAX_CAMERA_SMOOTH_DISTANCE) // only smooth over short distances please + { + camera_pos_global = lerp(mCameraSmoothingLastPositionGlobal, camera_pos_global, smoothing); + } + } + } + + mCameraSmoothingLastPositionGlobal = camera_pos_global; + mCameraSmoothingLastPositionAgent = camera_pos_agent; + mCameraSmoothingStop = false; + } + + + mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLSmoothInterpolation::getInterpolant(FOV_ZOOM_HALF_LIFE)); + +// LL_INFOS() << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << LL_ENDL; + + LLVector3 focus_agent = gAgent.getPosAgentFromGlobal(mFocusGlobal); + + mCameraPositionAgent = gAgent.getPosAgentFromGlobal(camera_pos_global); + + // Move the camera + + LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, mCameraUpVector, focus_agent); + //LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, camera_skyward, focus_agent); + + // Change FOV + LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / (1.f + mCameraCurrentFOVZoomFactor)); + + // follow camera when in customize mode + if (cameraCustomizeAvatar()) + { + setLookAt(LOOKAT_TARGET_FOCUS, NULL, mCameraPositionAgent); + } + + // update the travel distance stat + // this isn't directly related to the camera + // but this seemed like the best place to do this + LLVector3d global_pos = gAgent.getPositionGlobal(); + if (!gAgent.getLastPositionGlobal().isExactlyZero()) + { + LLVector3d delta = global_pos - gAgent.getLastPositionGlobal(); + gAgent.setDistanceTraveled(gAgent.getDistanceTraveled() + delta.magVec()); + } + gAgent.setLastPositionGlobal(global_pos); + + if (LLVOAvatar::sVisibleInFirstPerson && isAgentAvatarValid() && !gAgentAvatarp->isSitting() && cameraMouselook()) + { + LLVector3 head_pos = gAgentAvatarp->mHeadp->getWorldPosition() + + LLVector3(0.08f, 0.f, 0.05f) * gAgentAvatarp->mHeadp->getWorldRotation() + + LLVector3(0.1f, 0.f, 0.f) * gAgentAvatarp->mPelvisp->getWorldRotation(); + LLVector3 diff = mCameraPositionAgent - head_pos; + diff = diff * ~gAgentAvatarp->mRoot->getWorldRotation(); + + LLJoint* torso_joint = gAgentAvatarp->mTorsop; + LLJoint* chest_joint = gAgentAvatarp->mChestp; + LLVector3 torso_scale = torso_joint->getScale(); + LLVector3 chest_scale = chest_joint->getScale(); + + // shorten avatar skeleton to avoid foot interpenetration + if (!gAgentAvatarp->mInAir) + { + LLVector3 chest_offset = LLVector3(0.f, 0.f, chest_joint->getPosition().mV[VZ]) * torso_joint->getWorldRotation(); + F32 z_compensate = llclamp(-diff.mV[VZ], -0.2f, 1.f); + F32 scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / chest_offset.mV[VZ]), 0.5f, 1.2f); + torso_joint->setScale(LLVector3(1.f, 1.f, scale_factor)); + + LLJoint* neck_joint = gAgentAvatarp->mNeckp; + LLVector3 neck_offset = LLVector3(0.f, 0.f, neck_joint->getPosition().mV[VZ]) * chest_joint->getWorldRotation(); + scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / neck_offset.mV[VZ]), 0.5f, 1.2f); + chest_joint->setScale(LLVector3(1.f, 1.f, scale_factor)); + diff.mV[VZ] = 0.f; + } + + // SL-315 + gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff); + + gAgentAvatarp->mRoot->updateWorldMatrixChildren(); + + for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + iter != gAgentAvatarp->mAttachmentPoints.end(); ) + { + LLVOAvatar::attachment_map_t::iterator curiter = iter++; + LLViewerJointAttachment* attachment = curiter->second; + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); + attachment_iter != attachment->mAttachedObjects.end(); + ++attachment_iter) + { + LLViewerObject *attached_object = (*attachment_iter); + if (attached_object && !attached_object->isDead() && attached_object->mDrawable.notNull()) + { + // clear any existing "early" movements of attachment + attached_object->mDrawable->clearState(LLDrawable::EARLY_MOVE); + gPipeline.updateMoveNormalAsync(attached_object->mDrawable); + attached_object->updateText(); + } + } + } + + torso_joint->setScale(torso_scale); + chest_joint->setScale(chest_scale); + } } void LLAgentCamera::updateLastCamera() { - mLastCameraMode = mCameraMode; + mLastCameraMode = mCameraMode; } void LLAgentCamera::updateFocusOffset() { - validateFocusObject(); - if (mFocusObject.notNull()) - { - LLVector3d obj_pos = gAgent.getPosGlobalFromAgent(mFocusObject->getRenderPosition()); - mFocusObjectOffset.setVec(mFocusTargetGlobal - obj_pos); - } + validateFocusObject(); + if (mFocusObject.notNull()) + { + LLVector3d obj_pos = gAgent.getPosGlobalFromAgent(mFocusObject->getRenderPosition()); + mFocusObjectOffset.setVec(mFocusTargetGlobal - obj_pos); + } } void LLAgentCamera::validateFocusObject() { - if (mFocusObject.notNull() && - mFocusObject->isDead()) - { - mFocusObjectOffset.clearVec(); - clearFocusObject(); - mCameraFOVZoomFactor = 0.f; - } + if (mFocusObject.notNull() && + mFocusObject->isDead()) + { + mFocusObjectOffset.clearVec(); + clearFocusObject(); + mCameraFOVZoomFactor = 0.f; + } } //----------------------------------------------------------------------------- @@ -1499,124 +1499,124 @@ void LLAgentCamera::validateFocusObject() //----------------------------------------------------------------------------- LLVector3d LLAgentCamera::calcFocusPositionTargetGlobal() { - if (mFocusObject.notNull() && mFocusObject->isDead()) - { - clearFocusObject(); - } - - if (mCameraMode == CAMERA_MODE_FOLLOW && mFocusOnAvatar) - { - mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(mFollowCam.getSimulatedFocus()); - return mFocusTargetGlobal; - } - else if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - LLVector3d at_axis(1.0, 0.0, 0.0); - LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion(); - if (isAgentAvatarValid() && gAgentAvatarp->getParent()) - { - LLViewerObject* root_object = (LLViewerObject*)gAgentAvatarp->getRoot(); - if (!root_object->flagCameraDecoupled()) - { - agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation(); - } - } - at_axis = at_axis * agent_rot; - mFocusTargetGlobal = calcCameraPositionTargetGlobal() + at_axis; - return mFocusTargetGlobal; - } - else if (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR) - { - if (mFocusOnAvatar) - { - LLVector3 focus_target = isAgentAvatarValid() - ? gAgentAvatarp->mHeadp->getWorldPosition() - : gAgent.getPositionAgent(); - LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target); - mFocusTargetGlobal = focus_target_global; - } - return mFocusTargetGlobal; - } - else if (!mFocusOnAvatar) - { - if (mFocusObject.notNull() && !mFocusObject->isDead() && mFocusObject->mDrawable.notNull()) - { - LLDrawable* drawablep = mFocusObject->mDrawable; - - if (mTrackFocusObject && - drawablep && - drawablep->isActive()) - { - if (!mFocusObject->isAvatar()) - { - if (mFocusObject->isSelected()) - { - gPipeline.updateMoveNormalAsync(drawablep); - } - else - { - if (drawablep->isState(LLDrawable::MOVE_UNDAMPED)) - { - gPipeline.updateMoveNormalAsync(drawablep); - } - else - { - gPipeline.updateMoveDampedAsync(drawablep); - } - } - } - } - // if not tracking object, update offset based on new object position - else - { - updateFocusOffset(); - } - LLVector3 focus_agent = mFocusObject->getRenderPosition() + mFocusObjectOffset; - mFocusTargetGlobal.setVec(gAgent.getPosGlobalFromAgent(focus_agent)); - } - return mFocusTargetGlobal; - } - else if (mSitCameraEnabled && isAgentAvatarValid() && gAgentAvatarp->isSitting() && mSitCameraReferenceObject.notNull()) - { - // sit camera - LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition(); - LLQuaternion object_rot = mSitCameraReferenceObject->getRenderRotation(); - - LLVector3 target_pos = object_pos + (mSitCameraFocus * object_rot); - return gAgent.getPosGlobalFromAgent(target_pos); - } - else - { - return gAgent.getPositionGlobal() + calcThirdPersonFocusOffset(); - } + if (mFocusObject.notNull() && mFocusObject->isDead()) + { + clearFocusObject(); + } + + if (mCameraMode == CAMERA_MODE_FOLLOW && mFocusOnAvatar) + { + mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(mFollowCam.getSimulatedFocus()); + return mFocusTargetGlobal; + } + else if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + LLVector3d at_axis(1.0, 0.0, 0.0); + LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion(); + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + LLViewerObject* root_object = (LLViewerObject*)gAgentAvatarp->getRoot(); + if (!root_object->flagCameraDecoupled()) + { + agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation(); + } + } + at_axis = at_axis * agent_rot; + mFocusTargetGlobal = calcCameraPositionTargetGlobal() + at_axis; + return mFocusTargetGlobal; + } + else if (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR) + { + if (mFocusOnAvatar) + { + LLVector3 focus_target = isAgentAvatarValid() + ? gAgentAvatarp->mHeadp->getWorldPosition() + : gAgent.getPositionAgent(); + LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target); + mFocusTargetGlobal = focus_target_global; + } + return mFocusTargetGlobal; + } + else if (!mFocusOnAvatar) + { + if (mFocusObject.notNull() && !mFocusObject->isDead() && mFocusObject->mDrawable.notNull()) + { + LLDrawable* drawablep = mFocusObject->mDrawable; + + if (mTrackFocusObject && + drawablep && + drawablep->isActive()) + { + if (!mFocusObject->isAvatar()) + { + if (mFocusObject->isSelected()) + { + gPipeline.updateMoveNormalAsync(drawablep); + } + else + { + if (drawablep->isState(LLDrawable::MOVE_UNDAMPED)) + { + gPipeline.updateMoveNormalAsync(drawablep); + } + else + { + gPipeline.updateMoveDampedAsync(drawablep); + } + } + } + } + // if not tracking object, update offset based on new object position + else + { + updateFocusOffset(); + } + LLVector3 focus_agent = mFocusObject->getRenderPosition() + mFocusObjectOffset; + mFocusTargetGlobal.setVec(gAgent.getPosGlobalFromAgent(focus_agent)); + } + return mFocusTargetGlobal; + } + else if (mSitCameraEnabled && isAgentAvatarValid() && gAgentAvatarp->isSitting() && mSitCameraReferenceObject.notNull()) + { + // sit camera + LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition(); + LLQuaternion object_rot = mSitCameraReferenceObject->getRenderRotation(); + + LLVector3 target_pos = object_pos + (mSitCameraFocus * object_rot); + return gAgent.getPosGlobalFromAgent(target_pos); + } + else + { + return gAgent.getPositionGlobal() + calcThirdPersonFocusOffset(); + } } LLVector3d LLAgentCamera::calcThirdPersonFocusOffset() { - // ...offset from avatar - LLVector3d focus_offset; - LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion(); - if (isAgentAvatarValid() && gAgentAvatarp->getParent()) - { - agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation(); - } - - focus_offset = convert_from_llsd(mFocusOffsetInitial[mCameraPreset]->get(), TYPE_VEC3D, ""); - return focus_offset * agent_rot; + // ...offset from avatar + LLVector3d focus_offset; + LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion(); + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation(); + } + + focus_offset = convert_from_llsd(mFocusOffsetInitial[mCameraPreset]->get(), TYPE_VEC3D, ""); + return focus_offset * agent_rot; } void LLAgentCamera::setupSitCamera() { - // agent frame entering this function is in world coordinates - if (isAgentAvatarValid() && gAgentAvatarp->getParent()) - { - LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); - // slam agent coordinate frame to proper parent local version - LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis(); - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - gAgent.resetAxes(at_axis * ~parent_rot); - } + // agent frame entering this function is in world coordinates + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); + // slam agent coordinate frame to proper parent local version + LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis(); + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis * ~parent_rot); + } } //----------------------------------------------------------------------------- @@ -1624,7 +1624,7 @@ void LLAgentCamera::setupSitCamera() //----------------------------------------------------------------------------- const LLVector3 &LLAgentCamera::getCameraPositionAgent() const { - return LLViewerCamera::getInstance()->getOrigin(); + return LLViewerCamera::getInstance()->getOrigin(); } //----------------------------------------------------------------------------- @@ -1632,39 +1632,39 @@ const LLVector3 &LLAgentCamera::getCameraPositionAgent() const //----------------------------------------------------------------------------- LLVector3d LLAgentCamera::getCameraPositionGlobal() const { - return gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()); + return gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()); } //----------------------------------------------------------------------------- // calcCameraFOVZoomFactor() //----------------------------------------------------------------------------- -F32 LLAgentCamera::calcCameraFOVZoomFactor() +F32 LLAgentCamera::calcCameraFOVZoomFactor() { - LLVector3 camera_offset_dir; - camera_offset_dir.setVec(mCameraFocusOffset); - - if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - return 0.f; - } - else if (mFocusObject.notNull() && !mFocusObject->isAvatar() && !mFocusOnAvatar) - { - // don't FOV zoom on mostly transparent objects - F32 obj_min_dist = 0.f; - calcCameraMinDistance(obj_min_dist); - F32 current_distance = llmax(0.001f, camera_offset_dir.magVec()); - - mFocusObjectDist = obj_min_dist - current_distance; - - F32 new_fov_zoom = llclamp(mFocusObjectDist / current_distance, 0.f, 1000.f); - return new_fov_zoom; - } - else // focusing on land or avatar - { - // keep old field of view until user changes focus explicitly - return mCameraFOVZoomFactor; - //return 0.f; - } + LLVector3 camera_offset_dir; + camera_offset_dir.setVec(mCameraFocusOffset); + + if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + return 0.f; + } + else if (mFocusObject.notNull() && !mFocusObject->isAvatar() && !mFocusOnAvatar) + { + // don't FOV zoom on mostly transparent objects + F32 obj_min_dist = 0.f; + calcCameraMinDistance(obj_min_dist); + F32 current_distance = llmax(0.001f, camera_offset_dir.magVec()); + + mFocusObjectDist = obj_min_dist - current_distance; + + F32 new_fov_zoom = llclamp(mFocusObjectDist / current_distance, 0.f, 1000.f); + return new_fov_zoom; + } + else // focusing on land or avatar + { + // keep old field of view until user changes focus explicitly + return mCameraFOVZoomFactor; + //return 0.f; + } } //----------------------------------------------------------------------------- @@ -1672,268 +1672,268 @@ F32 LLAgentCamera::calcCameraFOVZoomFactor() //----------------------------------------------------------------------------- LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) { - // Compute base camera position and look-at points. - F32 camera_land_height; - LLVector3d frame_center_global = !isAgentAvatarValid() ? - gAgent.getPositionGlobal() : - gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot->getWorldPosition()); - - BOOL isConstrained = FALSE; - LLVector3d head_offset; - head_offset.setVec(mThirdPersonHeadOffset); - - LLVector3d camera_position_global; - - if (mCameraMode == CAMERA_MODE_FOLLOW && mFocusOnAvatar) - { - camera_position_global = gAgent.getPosGlobalFromAgent(mFollowCam.getSimulatedPosition()); - } - else if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - if (!isAgentAvatarValid() || gAgentAvatarp->mDrawable.isNull()) - { - LL_WARNS() << "Null avatar drawable!" << LL_ENDL; - return LLVector3d::zero; - } - head_offset.clearVec(); - if (gAgentAvatarp->isSitting() && gAgentAvatarp->getParent()) - { - gAgentAvatarp->updateHeadOffset(); - head_offset.mdV[VX] = gAgentAvatarp->mHeadOffset.mV[VX]; - head_offset.mdV[VY] = gAgentAvatarp->mHeadOffset.mV[VY]; - head_offset.mdV[VZ] = gAgentAvatarp->mHeadOffset.mV[VZ] + 0.1f; - const LLMatrix4& mat = ((LLViewerObject*) gAgentAvatarp->getParent())->getRenderMatrix(); - camera_position_global = gAgent.getPosGlobalFromAgent - ((gAgentAvatarp->getPosition()+ - LLVector3(head_offset)*gAgentAvatarp->getRotation()) * mat); - } - else - { - head_offset.mdV[VZ] = gAgentAvatarp->mHeadOffset.mV[VZ]; - if (gAgentAvatarp->isSitting()) - { - head_offset.mdV[VZ] += 0.1; - } - camera_position_global = gAgent.getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition());//frame_center_global; - head_offset = head_offset * gAgentAvatarp->getRenderRotation(); - camera_position_global = camera_position_global + head_offset; - } - } - else if (mCameraMode == CAMERA_MODE_THIRD_PERSON && mFocusOnAvatar) - { - LLVector3 local_camera_offset; - F32 camera_distance = 0.f; - - if (mSitCameraEnabled - && isAgentAvatarValid() - && gAgentAvatarp->isSitting() - && mSitCameraReferenceObject.notNull()) - { - // sit camera - LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition(); - LLQuaternion object_rot = mSitCameraReferenceObject->getRenderRotation(); - - LLVector3 target_pos = object_pos + (mSitCameraPos * object_rot); - - camera_position_global = gAgent.getPosGlobalFromAgent(target_pos); - } - else - { - local_camera_offset = mCameraZoomFraction * getCameraOffsetInitial() * gSavedSettings.getF32("CameraOffsetScale"); - - // are we sitting down? - if (isAgentAvatarValid() && gAgentAvatarp->getParent()) - { - LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); - // slam agent coordinate frame to proper parent local version - LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis() * parent_rot; - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - gAgent.resetAxes(at_axis * ~parent_rot); - - local_camera_offset = local_camera_offset * gAgent.getFrameAgent().getQuaternion() * parent_rot; - } - else - { - local_camera_offset = gAgent.getFrameAgent().rotateToAbsolute( local_camera_offset ); - } - - if (!mCameraCollidePlane.isExactlyZero() && (!isAgentAvatarValid() || !gAgentAvatarp->isSitting())) - { - LLVector3 plane_normal; - plane_normal.setVec(mCameraCollidePlane.mV); - - F32 offset_dot_norm = local_camera_offset * plane_normal; - if (llabs(offset_dot_norm) < 0.001f) - { - offset_dot_norm = 0.001f; - } - - camera_distance = local_camera_offset.normalize(); - - F32 pos_dot_norm = gAgent.getPosAgentFromGlobal(frame_center_global + head_offset) * plane_normal; - - // if agent is outside the colliding half-plane - if (pos_dot_norm > mCameraCollidePlane.mV[VW]) - { - // check to see if camera is on the opposite side (inside) the half-plane - if (offset_dot_norm + pos_dot_norm < mCameraCollidePlane.mV[VW]) - { - // diminish offset by factor to push it back outside the half-plane - camera_distance *= (pos_dot_norm - mCameraCollidePlane.mV[VW] - CAMERA_COLLIDE_EPSILON) / -offset_dot_norm; - } - } - else - { - if (offset_dot_norm + pos_dot_norm > mCameraCollidePlane.mV[VW]) - { - camera_distance *= (mCameraCollidePlane.mV[VW] - pos_dot_norm - CAMERA_COLLIDE_EPSILON) / offset_dot_norm; - } - } - } - else - { - camera_distance = local_camera_offset.normalize(); - } - - mTargetCameraDistance = llmax(camera_distance, MIN_CAMERA_DISTANCE); - - if (mTargetCameraDistance != mCurrentCameraDistance) - { - F32 camera_lerp_amt = LLSmoothInterpolation::getInterpolant(CAMERA_ZOOM_HALF_LIFE); - - mCurrentCameraDistance = lerp(mCurrentCameraDistance, mTargetCameraDistance, camera_lerp_amt); - } - - // Make the camera distance current - local_camera_offset *= mCurrentCameraDistance; - - // set the global camera position - LLVector3d camera_offset; - - camera_offset.setVec( local_camera_offset ); - camera_position_global = frame_center_global + head_offset + camera_offset; - - if (isAgentAvatarValid()) - { - LLVector3d camera_lag_d; - F32 lag_interp = LLSmoothInterpolation::getInterpolant(CAMERA_LAG_HALF_LIFE); - LLVector3 target_lag; - LLVector3 vel = gAgent.getVelocity(); - - // lag by appropriate amount for flying - F32 time_in_air = gAgentAvatarp->mTimeInAir.getElapsedTimeF32(); - if(!mCameraAnimating && gAgentAvatarp->mInAir && time_in_air > GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME) - { - LLVector3 frame_at_axis = gAgent.getFrameAgent().getAtAxis(); - frame_at_axis -= projected_vec(frame_at_axis, gAgent.getReferenceUpVector()); - frame_at_axis.normalize(); - - //transition smoothly in air mode, to avoid camera pop - F32 u = (time_in_air - GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME) / GROUND_TO_AIR_CAMERA_TRANSITION_TIME; - u = llclamp(u, 0.f, 1.f); - - lag_interp *= u; - - if (gViewerWindow->getLeftMouseDown() && gViewerWindow->getLastPick().mObjectID == gAgentAvatarp->getID()) - { - // disable camera lag when using mouse-directed steering - target_lag.clearVec(); - } - else - { - target_lag = vel * gSavedSettings.getF32("DynamicCameraStrength") / 30.f; - } - - mCameraLag = lerp(mCameraLag, target_lag, lag_interp); - - F32 lag_dist = mCameraLag.magVec(); - if (lag_dist > MAX_CAMERA_LAG) - { - mCameraLag = mCameraLag * MAX_CAMERA_LAG / lag_dist; - } - - // clamp camera lag so that avatar is always in front - F32 dot = (mCameraLag - (frame_at_axis * (MIN_CAMERA_LAG * u))) * frame_at_axis; - if (dot < -(MIN_CAMERA_LAG * u)) - { - mCameraLag -= (dot + (MIN_CAMERA_LAG * u)) * frame_at_axis; - } - } - else - { - mCameraLag = lerp(mCameraLag, LLVector3::zero, LLSmoothInterpolation::getInterpolant(0.15f)); - } - - camera_lag_d.setVec(mCameraLag); - camera_position_global = camera_position_global - camera_lag_d; - } - } - } - else - { - LLVector3d focusPosGlobal = calcFocusPositionTargetGlobal(); - // camera gets pushed out later wrt mCameraFOVZoomFactor...this is "raw" value - camera_position_global = focusPosGlobal + mCameraFocusOffset; - } - - if (!gSavedSettings.getBOOL("DisableCameraConstraints") && !gAgent.isGodlike()) - { - LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global); - bool constrain = true; - if(regionp && regionp->canManageEstate()) - { - constrain = false; - } - if(constrain) - { - F32 max_dist = (CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode) ? APPEARANCE_MAX_ZOOM : mDrawDistance; - - LLVector3d camera_offset = camera_position_global - gAgent.getPositionGlobal(); - F32 camera_distance = (F32)camera_offset.magVec(); - - if(camera_distance > max_dist) - { - camera_position_global = gAgent.getPositionGlobal() + (max_dist/camera_distance)*camera_offset; - isConstrained = TRUE; - } - } + // Compute base camera position and look-at points. + F32 camera_land_height; + LLVector3d frame_center_global = !isAgentAvatarValid() ? + gAgent.getPositionGlobal() : + gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot->getWorldPosition()); + + BOOL isConstrained = FALSE; + LLVector3d head_offset; + head_offset.setVec(mThirdPersonHeadOffset); + + LLVector3d camera_position_global; + + if (mCameraMode == CAMERA_MODE_FOLLOW && mFocusOnAvatar) + { + camera_position_global = gAgent.getPosGlobalFromAgent(mFollowCam.getSimulatedPosition()); + } + else if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + if (!isAgentAvatarValid() || gAgentAvatarp->mDrawable.isNull()) + { + LL_WARNS() << "Null avatar drawable!" << LL_ENDL; + return LLVector3d::zero; + } + head_offset.clearVec(); + if (gAgentAvatarp->isSitting() && gAgentAvatarp->getParent()) + { + gAgentAvatarp->updateHeadOffset(); + head_offset.mdV[VX] = gAgentAvatarp->mHeadOffset.mV[VX]; + head_offset.mdV[VY] = gAgentAvatarp->mHeadOffset.mV[VY]; + head_offset.mdV[VZ] = gAgentAvatarp->mHeadOffset.mV[VZ] + 0.1f; + const LLMatrix4& mat = ((LLViewerObject*) gAgentAvatarp->getParent())->getRenderMatrix(); + camera_position_global = gAgent.getPosGlobalFromAgent + ((gAgentAvatarp->getPosition()+ + LLVector3(head_offset)*gAgentAvatarp->getRotation()) * mat); + } + else + { + head_offset.mdV[VZ] = gAgentAvatarp->mHeadOffset.mV[VZ]; + if (gAgentAvatarp->isSitting()) + { + head_offset.mdV[VZ] += 0.1; + } + camera_position_global = gAgent.getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition());//frame_center_global; + head_offset = head_offset * gAgentAvatarp->getRenderRotation(); + camera_position_global = camera_position_global + head_offset; + } + } + else if (mCameraMode == CAMERA_MODE_THIRD_PERSON && mFocusOnAvatar) + { + LLVector3 local_camera_offset; + F32 camera_distance = 0.f; + + if (mSitCameraEnabled + && isAgentAvatarValid() + && gAgentAvatarp->isSitting() + && mSitCameraReferenceObject.notNull()) + { + // sit camera + LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition(); + LLQuaternion object_rot = mSitCameraReferenceObject->getRenderRotation(); + + LLVector3 target_pos = object_pos + (mSitCameraPos * object_rot); + + camera_position_global = gAgent.getPosGlobalFromAgent(target_pos); + } + else + { + local_camera_offset = mCameraZoomFraction * getCameraOffsetInitial() * gSavedSettings.getF32("CameraOffsetScale"); + + // are we sitting down? + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); + // slam agent coordinate frame to proper parent local version + LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis() * parent_rot; + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis * ~parent_rot); + + local_camera_offset = local_camera_offset * gAgent.getFrameAgent().getQuaternion() * parent_rot; + } + else + { + local_camera_offset = gAgent.getFrameAgent().rotateToAbsolute( local_camera_offset ); + } + + if (!mCameraCollidePlane.isExactlyZero() && (!isAgentAvatarValid() || !gAgentAvatarp->isSitting())) + { + LLVector3 plane_normal; + plane_normal.setVec(mCameraCollidePlane.mV); + + F32 offset_dot_norm = local_camera_offset * plane_normal; + if (llabs(offset_dot_norm) < 0.001f) + { + offset_dot_norm = 0.001f; + } + + camera_distance = local_camera_offset.normalize(); + + F32 pos_dot_norm = gAgent.getPosAgentFromGlobal(frame_center_global + head_offset) * plane_normal; + + // if agent is outside the colliding half-plane + if (pos_dot_norm > mCameraCollidePlane.mV[VW]) + { + // check to see if camera is on the opposite side (inside) the half-plane + if (offset_dot_norm + pos_dot_norm < mCameraCollidePlane.mV[VW]) + { + // diminish offset by factor to push it back outside the half-plane + camera_distance *= (pos_dot_norm - mCameraCollidePlane.mV[VW] - CAMERA_COLLIDE_EPSILON) / -offset_dot_norm; + } + } + else + { + if (offset_dot_norm + pos_dot_norm > mCameraCollidePlane.mV[VW]) + { + camera_distance *= (mCameraCollidePlane.mV[VW] - pos_dot_norm - CAMERA_COLLIDE_EPSILON) / offset_dot_norm; + } + } + } + else + { + camera_distance = local_camera_offset.normalize(); + } + + mTargetCameraDistance = llmax(camera_distance, MIN_CAMERA_DISTANCE); + + if (mTargetCameraDistance != mCurrentCameraDistance) + { + F32 camera_lerp_amt = LLSmoothInterpolation::getInterpolant(CAMERA_ZOOM_HALF_LIFE); + + mCurrentCameraDistance = lerp(mCurrentCameraDistance, mTargetCameraDistance, camera_lerp_amt); + } + + // Make the camera distance current + local_camera_offset *= mCurrentCameraDistance; + + // set the global camera position + LLVector3d camera_offset; + + camera_offset.setVec( local_camera_offset ); + camera_position_global = frame_center_global + head_offset + camera_offset; + + if (isAgentAvatarValid()) + { + LLVector3d camera_lag_d; + F32 lag_interp = LLSmoothInterpolation::getInterpolant(CAMERA_LAG_HALF_LIFE); + LLVector3 target_lag; + LLVector3 vel = gAgent.getVelocity(); + + // lag by appropriate amount for flying + F32 time_in_air = gAgentAvatarp->mTimeInAir.getElapsedTimeF32(); + if(!mCameraAnimating && gAgentAvatarp->mInAir && time_in_air > GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME) + { + LLVector3 frame_at_axis = gAgent.getFrameAgent().getAtAxis(); + frame_at_axis -= projected_vec(frame_at_axis, gAgent.getReferenceUpVector()); + frame_at_axis.normalize(); + + //transition smoothly in air mode, to avoid camera pop + F32 u = (time_in_air - GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME) / GROUND_TO_AIR_CAMERA_TRANSITION_TIME; + u = llclamp(u, 0.f, 1.f); + + lag_interp *= u; + + if (gViewerWindow->getLeftMouseDown() && gViewerWindow->getLastPick().mObjectID == gAgentAvatarp->getID()) + { + // disable camera lag when using mouse-directed steering + target_lag.clearVec(); + } + else + { + target_lag = vel * gSavedSettings.getF32("DynamicCameraStrength") / 30.f; + } + + mCameraLag = lerp(mCameraLag, target_lag, lag_interp); + + F32 lag_dist = mCameraLag.magVec(); + if (lag_dist > MAX_CAMERA_LAG) + { + mCameraLag = mCameraLag * MAX_CAMERA_LAG / lag_dist; + } + + // clamp camera lag so that avatar is always in front + F32 dot = (mCameraLag - (frame_at_axis * (MIN_CAMERA_LAG * u))) * frame_at_axis; + if (dot < -(MIN_CAMERA_LAG * u)) + { + mCameraLag -= (dot + (MIN_CAMERA_LAG * u)) * frame_at_axis; + } + } + else + { + mCameraLag = lerp(mCameraLag, LLVector3::zero, LLSmoothInterpolation::getInterpolant(0.15f)); + } + + camera_lag_d.setVec(mCameraLag); + camera_position_global = camera_position_global - camera_lag_d; + } + } + } + else + { + LLVector3d focusPosGlobal = calcFocusPositionTargetGlobal(); + // camera gets pushed out later wrt mCameraFOVZoomFactor...this is "raw" value + camera_position_global = focusPosGlobal + mCameraFocusOffset; + } + + if (!gSavedSettings.getBOOL("DisableCameraConstraints") && !gAgent.isGodlike()) + { + LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global); + bool constrain = true; + if(regionp && regionp->canManageEstate()) + { + constrain = false; + } + if(constrain) + { + F32 max_dist = (CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode) ? APPEARANCE_MAX_ZOOM : mDrawDistance; + + LLVector3d camera_offset = camera_position_global - gAgent.getPositionGlobal(); + F32 camera_distance = (F32)camera_offset.magVec(); + + if(camera_distance > max_dist) + { + camera_position_global = gAgent.getPositionGlobal() + (max_dist/camera_distance)*camera_offset; + isConstrained = TRUE; + } + } // JC - Could constrain camera based on parcel stuff here. -// LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global); -// -// if (regionp && !regionp->mParcelOverlay->isBuildCameraAllowed(regionp->getPosRegionFromGlobal(camera_position_global))) -// { -// camera_position_global = last_position_global; +// LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global); +// +// if (regionp && !regionp->mParcelOverlay->isBuildCameraAllowed(regionp->getPosRegionFromGlobal(camera_position_global))) +// { +// camera_position_global = last_position_global; // -// isConstrained = TRUE; -// } - } +// isConstrained = TRUE; +// } + } - // Don't let camera go underground - F32 camera_min_off_ground = getCameraMinOffGround(); + // Don't let camera go underground + F32 camera_min_off_ground = getCameraMinOffGround(); - camera_land_height = LLWorld::getInstance()->resolveLandHeightGlobal(camera_position_global); + camera_land_height = LLWorld::getInstance()->resolveLandHeightGlobal(camera_position_global); - if (camera_position_global.mdV[VZ] < camera_land_height + camera_min_off_ground) - { - camera_position_global.mdV[VZ] = camera_land_height + camera_min_off_ground; - isConstrained = TRUE; - } + if (camera_position_global.mdV[VZ] < camera_land_height + camera_min_off_ground) + { + camera_position_global.mdV[VZ] = camera_land_height + camera_min_off_ground; + isConstrained = TRUE; + } - if (hit_limit) - { - *hit_limit = isConstrained; - } + if (hit_limit) + { + *hit_limit = isConstrained; + } - return camera_position_global; + return camera_position_global; } LLVector3 LLAgentCamera::getCameraOffsetInitial() { - return convert_from_llsd(mCameraOffsetInitial[mCameraPreset]->get(), TYPE_VEC3, ""); + return convert_from_llsd(mCameraOffsetInitial[mCameraPreset]->get(), TYPE_VEC3, ""); } F32 LLAgentCamera::getCameraMaxZoomDistance() @@ -1949,48 +1949,48 @@ F32 LLAgentCamera::getCameraMaxZoomDistance() //----------------------------------------------------------------------------- void LLAgentCamera::handleScrollWheel(S32 clicks) { - if (mCameraMode == CAMERA_MODE_FOLLOW && getFocusOnAvatar()) - { - if (!mFollowCam.getPositionLocked()) // not if the followCam position is locked in place - { - mFollowCam.zoom(clicks); - if (mFollowCam.isZoomedToMinimumDistance()) - { - changeCameraToMouselook(FALSE); - } - } - } - else - { - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - const F32 ROOT_ROOT_TWO = sqrt(F_SQRT2); - - // Block if camera is animating - if (mCameraAnimating) - { - return; - } - - if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) - { - F32 zoom_factor = (F32)pow(0.8, -clicks); - cameraZoomIn(zoom_factor); - } - else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON)) - { - F32 camera_offset_initial_mag = getCameraOffsetInitial().magVec(); - - F32 current_zoom_fraction = mTargetCameraDistance / (camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale")); - current_zoom_fraction *= 1.f - pow(ROOT_ROOT_TWO, clicks); - - cameraOrbitIn(current_zoom_fraction * camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale")); - } - else - { - F32 current_zoom_fraction = (F32)mCameraFocusOffsetTarget.magVec(); - cameraOrbitIn(current_zoom_fraction * (1.f - pow(ROOT_ROOT_TWO, clicks))); - } - } + if (mCameraMode == CAMERA_MODE_FOLLOW && getFocusOnAvatar()) + { + if (!mFollowCam.getPositionLocked()) // not if the followCam position is locked in place + { + mFollowCam.zoom(clicks); + if (mFollowCam.isZoomedToMinimumDistance()) + { + changeCameraToMouselook(FALSE); + } + } + } + else + { + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + const F32 ROOT_ROOT_TWO = sqrt(F_SQRT2); + + // Block if camera is animating + if (mCameraAnimating) + { + return; + } + + if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) + { + F32 zoom_factor = (F32)pow(0.8, -clicks); + cameraZoomIn(zoom_factor); + } + else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON)) + { + F32 camera_offset_initial_mag = getCameraOffsetInitial().magVec(); + + F32 current_zoom_fraction = mTargetCameraDistance / (camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale")); + current_zoom_fraction *= 1.f - pow(ROOT_ROOT_TWO, clicks); + + cameraOrbitIn(current_zoom_fraction * camera_offset_initial_mag * gSavedSettings.getF32("CameraOffsetScale")); + } + else + { + F32 current_zoom_fraction = (F32)mCameraFocusOffsetTarget.magVec(); + cameraOrbitIn(current_zoom_fraction * (1.f - pow(ROOT_ROOT_TWO, clicks))); + } + } } @@ -1999,21 +1999,21 @@ void LLAgentCamera::handleScrollWheel(S32 clicks) //----------------------------------------------------------------------------- F32 LLAgentCamera::getCameraMinOffGround() { - if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - return 0.f; - } - else - { - if (gSavedSettings.getBOOL("DisableCameraConstraints")) - { - return -1000.f; - } - else - { - return 0.5f; - } - } + if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + return 0.f; + } + else + { + if (gSavedSettings.getBOOL("DisableCameraConstraints")) + { + return -1000.f; + } + else + { + return 0.5f; + } + } } @@ -2022,15 +2022,15 @@ F32 LLAgentCamera::getCameraMinOffGround() //----------------------------------------------------------------------------- void LLAgentCamera::resetCamera() { - // Remove any pitch from the avatar - LLVector3 at = gAgent.getFrameAgent().getAtAxis(); - at.mV[VZ] = 0.f; - at.normalize(); - gAgent.resetAxes(at); - // have to explicitly clear field of view zoom now - mCameraFOVZoomFactor = 0.f; - - updateCamera(); + // Remove any pitch from the avatar + LLVector3 at = gAgent.getFrameAgent().getAtAxis(); + at.mV[VZ] = 0.f; + at.normalize(); + gAgent.resetAxes(at); + // have to explicitly clear field of view zoom now + mCameraFOVZoomFactor = 0.f; + + updateCamera(); } //----------------------------------------------------------------------------- @@ -2038,58 +2038,58 @@ void LLAgentCamera::resetCamera() //----------------------------------------------------------------------------- void LLAgentCamera::changeCameraToMouselook(BOOL animate) { - if (!gSavedSettings.getBOOL("EnableMouselook") - || LLViewerJoystick::getInstance()->getOverrideCamera()) - { - return; - } - - // visibility changes at end of animation - gViewerWindow->getWindow()->resetBusyCount(); - - // Menus should not remain open on switching to mouselook... - LLMenuGL::sMenuContainer->hideMenus(); - LLUI::clearPopups(); - - // unpause avatar animation - gAgent.unpauseAnimation(); - - LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset); - - if (isAgentAvatarValid()) - { - gAgentAvatarp->stopMotion(ANIM_AGENT_BODY_NOISE); - gAgentAvatarp->stopMotion(ANIM_AGENT_BREATHE_ROT); - } - - //gViewerWindow->stopGrab(); - LLSelectMgr::getInstance()->deselectAll(); - gViewerWindow->hideCursor(); - gViewerWindow->moveCursorToCenter(); - - if (mCameraMode != CAMERA_MODE_MOUSELOOK) - { - gFocusMgr.setKeyboardFocus(NULL); - - updateLastCamera(); - mCameraMode = CAMERA_MODE_MOUSELOOK; - const U32 old_flags = gAgent.getControlFlags(); - gAgent.setControlFlags(AGENT_CONTROL_MOUSELOOK); - if (old_flags != gAgent.getControlFlags()) - { - gAgent.setFlagsDirty(); - } - - if (animate) - { - startCameraAnimation(); - } - else - { - mCameraAnimating = FALSE; - gAgent.endAnimationUpdateUI(); - } - } + if (!gSavedSettings.getBOOL("EnableMouselook") + || LLViewerJoystick::getInstance()->getOverrideCamera()) + { + return; + } + + // visibility changes at end of animation + gViewerWindow->getWindow()->resetBusyCount(); + + // Menus should not remain open on switching to mouselook... + LLMenuGL::sMenuContainer->hideMenus(); + LLUI::clearPopups(); + + // unpause avatar animation + gAgent.unpauseAnimation(); + + LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset); + + if (isAgentAvatarValid()) + { + gAgentAvatarp->stopMotion(ANIM_AGENT_BODY_NOISE); + gAgentAvatarp->stopMotion(ANIM_AGENT_BREATHE_ROT); + } + + //gViewerWindow->stopGrab(); + LLSelectMgr::getInstance()->deselectAll(); + gViewerWindow->hideCursor(); + gViewerWindow->moveCursorToCenter(); + + if (mCameraMode != CAMERA_MODE_MOUSELOOK) + { + gFocusMgr.setKeyboardFocus(NULL); + + updateLastCamera(); + mCameraMode = CAMERA_MODE_MOUSELOOK; + const U32 old_flags = gAgent.getControlFlags(); + gAgent.setControlFlags(AGENT_CONTROL_MOUSELOOK); + if (old_flags != gAgent.getControlFlags()) + { + gAgent.setFlagsDirty(); + } + + if (animate) + { + startCameraAnimation(); + } + else + { + mCameraAnimating = FALSE; + gAgent.endAnimationUpdateUI(); + } + } } @@ -2098,24 +2098,24 @@ void LLAgentCamera::changeCameraToMouselook(BOOL animate) //----------------------------------------------------------------------------- void LLAgentCamera::changeCameraToDefault() { - if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { - return; - } - - if (LLFollowCamMgr::getActiveFollowCamParams()) - { - changeCameraToFollow(); - } - else - { - changeCameraToThirdPerson(); - } - if (gSavedSettings.getBOOL("HideUIControls")) - { - gViewerWindow->setUIVisibility(false); - LLPanelStandStopFlying::getInstance()->setVisible(false); - } + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + return; + } + + if (LLFollowCamMgr::getActiveFollowCamParams()) + { + changeCameraToFollow(); + } + else + { + changeCameraToThirdPerson(); + } + if (gSavedSettings.getBOOL("HideUIControls")) + { + gViewerWindow->setUIVisibility(false); + LLPanelStandStopFlying::getInstance()->setVisible(false); + } } @@ -2124,53 +2124,53 @@ void LLAgentCamera::changeCameraToDefault() //----------------------------------------------------------------------------- void LLAgentCamera::changeCameraToFollow(BOOL animate) { - if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { - return; - } - - if(mCameraMode != CAMERA_MODE_FOLLOW) - { - if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - animate = FALSE; - } - startCameraAnimation(); - - updateLastCamera(); - mCameraMode = CAMERA_MODE_FOLLOW; - - // bang-in the current focus, position, and up vector of the follow cam - mFollowCam.reset(mCameraPositionAgent, LLViewerCamera::getInstance()->getPointOfInterest(), LLVector3::z_axis); - - if (gBasicToolset) - { - LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); - } - - if (isAgentAvatarValid()) - { - // SL-315 - gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero); - gAgentAvatarp->startMotion( ANIM_AGENT_BODY_NOISE ); - gAgentAvatarp->startMotion( ANIM_AGENT_BREATHE_ROT ); - } - - // unpause avatar animation - gAgent.unpauseAnimation(); - - gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); - - if (animate) - { - startCameraAnimation(); - } - else - { - mCameraAnimating = FALSE; - gAgent.endAnimationUpdateUI(); - } - } + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + return; + } + + if(mCameraMode != CAMERA_MODE_FOLLOW) + { + if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + animate = FALSE; + } + startCameraAnimation(); + + updateLastCamera(); + mCameraMode = CAMERA_MODE_FOLLOW; + + // bang-in the current focus, position, and up vector of the follow cam + mFollowCam.reset(mCameraPositionAgent, LLViewerCamera::getInstance()->getPointOfInterest(), LLVector3::z_axis); + + if (gBasicToolset) + { + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + } + + if (isAgentAvatarValid()) + { + // SL-315 + gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero); + gAgentAvatarp->startMotion( ANIM_AGENT_BODY_NOISE ); + gAgentAvatarp->startMotion( ANIM_AGENT_BREATHE_ROT ); + } + + // unpause avatar animation + gAgent.unpauseAnimation(); + + gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); + + if (animate) + { + startCameraAnimation(); + } + else + { + mCameraAnimating = FALSE; + gAgent.endAnimationUpdateUI(); + } + } } //----------------------------------------------------------------------------- @@ -2178,77 +2178,77 @@ void LLAgentCamera::changeCameraToFollow(BOOL animate) //----------------------------------------------------------------------------- void LLAgentCamera::changeCameraToThirdPerson(BOOL animate) { - if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { - return; - } - - gViewerWindow->getWindow()->resetBusyCount(); - - mCameraZoomFraction = INITIAL_ZOOM_FRACTION; - - if (isAgentAvatarValid()) - { - if (!gAgentAvatarp->isSitting()) - { - // SL-315 - gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero); - } - gAgentAvatarp->startMotion(ANIM_AGENT_BODY_NOISE); - gAgentAvatarp->startMotion(ANIM_AGENT_BREATHE_ROT); - } - - LLVector3 at_axis; - - // unpause avatar animation - gAgent.unpauseAnimation(); - - if (mCameraMode != CAMERA_MODE_THIRD_PERSON) - { - if (gBasicToolset) - { - LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); - } - - mCameraLag.clearVec(); - if (mCameraMode == CAMERA_MODE_MOUSELOOK) - { - mCurrentCameraDistance = MIN_CAMERA_DISTANCE; - mTargetCameraDistance = MIN_CAMERA_DISTANCE; - animate = FALSE; - } - updateLastCamera(); - mCameraMode = CAMERA_MODE_THIRD_PERSON; - gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); - } - - // Remove any pitch from the avatar - if (isAgentAvatarValid() && gAgentAvatarp->getParent()) - { - LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); - at_axis = LLViewerCamera::getInstance()->getAtAxis(); - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - gAgent.resetAxes(at_axis * ~obj_rot); - } - else - { - at_axis = gAgent.getFrameAgent().getAtAxis(); - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - gAgent.resetAxes(at_axis); - } - - - if (animate) - { - startCameraAnimation(); - } - else - { - mCameraAnimating = FALSE; - gAgent.endAnimationUpdateUI(); - } + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + return; + } + + gViewerWindow->getWindow()->resetBusyCount(); + + mCameraZoomFraction = INITIAL_ZOOM_FRACTION; + + if (isAgentAvatarValid()) + { + if (!gAgentAvatarp->isSitting()) + { + // SL-315 + gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero); + } + gAgentAvatarp->startMotion(ANIM_AGENT_BODY_NOISE); + gAgentAvatarp->startMotion(ANIM_AGENT_BREATHE_ROT); + } + + LLVector3 at_axis; + + // unpause avatar animation + gAgent.unpauseAnimation(); + + if (mCameraMode != CAMERA_MODE_THIRD_PERSON) + { + if (gBasicToolset) + { + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + } + + mCameraLag.clearVec(); + if (mCameraMode == CAMERA_MODE_MOUSELOOK) + { + mCurrentCameraDistance = MIN_CAMERA_DISTANCE; + mTargetCameraDistance = MIN_CAMERA_DISTANCE; + animate = FALSE; + } + updateLastCamera(); + mCameraMode = CAMERA_MODE_THIRD_PERSON; + gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); + } + + // Remove any pitch from the avatar + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); + at_axis = LLViewerCamera::getInstance()->getAtAxis(); + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis * ~obj_rot); + } + else + { + at_axis = gAgent.getFrameAgent().getAtAxis(); + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis); + } + + + if (animate) + { + startCameraAnimation(); + } + else + { + mCameraAnimating = FALSE; + gAgent.endAnimationUpdateUI(); + } } //----------------------------------------------------------------------------- @@ -2256,81 +2256,81 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate) //----------------------------------------------------------------------------- void LLAgentCamera::changeCameraToCustomizeAvatar() { - if (LLViewerJoystick::getInstance()->getOverrideCamera() || !isAgentAvatarValid()) - { - return; - } - - gAgent.standUp(); // force stand up - gViewerWindow->getWindow()->resetBusyCount(); - - if (gFaceEditToolset) - { - LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset); - } - - startCameraAnimation(); - - if (mCameraMode != CAMERA_MODE_CUSTOMIZE_AVATAR) - { - updateLastCamera(); - mCameraMode = CAMERA_MODE_CUSTOMIZE_AVATAR; - gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); - - gFocusMgr.setKeyboardFocus( NULL ); - gFocusMgr.setMouseCapture( NULL ); - if( gMorphView ) - { - gMorphView->setVisible( TRUE ); - } - // Remove any pitch or rotation from the avatar - LLVector3 at = gAgent.getAtAxis(); - at.mV[VZ] = 0.f; - at.normalize(); - gAgent.resetAxes(at); - - gAgent.sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START); - gAgent.setCustomAnim(TRUE); - gAgentAvatarp->startMotion(ANIM_AGENT_CUSTOMIZE); - LLMotion* turn_motion = gAgentAvatarp->findMotion(ANIM_AGENT_CUSTOMIZE); - - if (turn_motion) - { - // delay camera animation long enough to play through turn animation - setAnimationDuration(turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP); - } - } - - LLVector3 agent_at = gAgent.getAtAxis(); - agent_at.mV[VZ] = 0.f; - agent_at.normalize(); - - // default focus point for customize avatar - LLVector3 focus_target = isAgentAvatarValid() - ? gAgentAvatarp->mHeadp->getWorldPosition() - : gAgent.getPositionAgent(); - - LLVector3d camera_offset(agent_at * -1.0); - // push camera up and out from avatar - camera_offset.mdV[VZ] = 0.1f; - camera_offset *= CUSTOMIZE_AVATAR_CAMERA_DEFAULT_DIST; - LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target); - setAnimationDuration(gSavedSettings.getF32("ZoomTime")); - setCameraPosAndFocusGlobal(focus_target_global + camera_offset, focus_target_global, gAgent.getID()); + if (LLViewerJoystick::getInstance()->getOverrideCamera() || !isAgentAvatarValid()) + { + return; + } + + gAgent.standUp(); // force stand up + gViewerWindow->getWindow()->resetBusyCount(); + + if (gFaceEditToolset) + { + LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset); + } + + startCameraAnimation(); + + if (mCameraMode != CAMERA_MODE_CUSTOMIZE_AVATAR) + { + updateLastCamera(); + mCameraMode = CAMERA_MODE_CUSTOMIZE_AVATAR; + gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); + + gFocusMgr.setKeyboardFocus( NULL ); + gFocusMgr.setMouseCapture( NULL ); + if( gMorphView ) + { + gMorphView->setVisible( TRUE ); + } + // Remove any pitch or rotation from the avatar + LLVector3 at = gAgent.getAtAxis(); + at.mV[VZ] = 0.f; + at.normalize(); + gAgent.resetAxes(at); + + gAgent.sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START); + gAgent.setCustomAnim(TRUE); + gAgentAvatarp->startMotion(ANIM_AGENT_CUSTOMIZE); + LLMotion* turn_motion = gAgentAvatarp->findMotion(ANIM_AGENT_CUSTOMIZE); + + if (turn_motion) + { + // delay camera animation long enough to play through turn animation + setAnimationDuration(turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP); + } + } + + LLVector3 agent_at = gAgent.getAtAxis(); + agent_at.mV[VZ] = 0.f; + agent_at.normalize(); + + // default focus point for customize avatar + LLVector3 focus_target = isAgentAvatarValid() + ? gAgentAvatarp->mHeadp->getWorldPosition() + : gAgent.getPositionAgent(); + + LLVector3d camera_offset(agent_at * -1.0); + // push camera up and out from avatar + camera_offset.mdV[VZ] = 0.1f; + camera_offset *= CUSTOMIZE_AVATAR_CAMERA_DEFAULT_DIST; + LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target); + setAnimationDuration(gSavedSettings.getF32("ZoomTime")); + setCameraPosAndFocusGlobal(focus_target_global + camera_offset, focus_target_global, gAgent.getID()); } void LLAgentCamera::switchCameraPreset(ECameraPreset preset) { - //zoom is supposed to be reset for the front and group views - mCameraZoomFraction = 1.f; + //zoom is supposed to be reset for the front and group views + mCameraZoomFraction = 1.f; - //focusing on avatar in that case means following him on movements - mFocusOnAvatar = TRUE; + //focusing on avatar in that case means following him on movements + mFocusOnAvatar = TRUE; - mCameraPreset = preset; + mCameraPreset = preset; - gSavedSettings.setU32("CameraPreset", mCameraPreset); + gSavedSettings.setU32("CameraPreset", mCameraPreset); } @@ -2340,16 +2340,16 @@ void LLAgentCamera::switchCameraPreset(ECameraPreset preset) void LLAgentCamera::setAnimationDuration(F32 duration) { - if (mCameraAnimating) - { - // do not cut any existing camera animation short - F32 animation_left = llmax(0.f, mAnimationDuration - mAnimationTimer.getElapsedTimeF32()); - mAnimationDuration = llmax(duration, animation_left); - } - else - { - mAnimationDuration = duration; - } + if (mCameraAnimating) + { + // do not cut any existing camera animation short + F32 animation_left = llmax(0.f, mAnimationDuration - mAnimationTimer.getElapsedTimeF32()); + mAnimationDuration = llmax(duration, animation_left); + } + else + { + mAnimationDuration = duration; + } } //----------------------------------------------------------------------------- @@ -2357,11 +2357,11 @@ void LLAgentCamera::setAnimationDuration(F32 duration) //----------------------------------------------------------------------------- void LLAgentCamera::startCameraAnimation() { - mAnimationCameraStartGlobal = getCameraPositionGlobal(); - mAnimationFocusStartGlobal = mFocusGlobal; - setAnimationDuration(gSavedSettings.getF32("ZoomTime")); - mAnimationTimer.reset(); - mCameraAnimating = TRUE; + mAnimationCameraStartGlobal = getCameraPositionGlobal(); + mAnimationFocusStartGlobal = mFocusGlobal; + setAnimationDuration(gSavedSettings.getF32("ZoomTime")); + mAnimationTimer.reset(); + mCameraAnimating = TRUE; } //----------------------------------------------------------------------------- @@ -2369,23 +2369,23 @@ void LLAgentCamera::startCameraAnimation() //----------------------------------------------------------------------------- void LLAgentCamera::stopCameraAnimation() { - mCameraAnimating = FALSE; + mCameraAnimating = FALSE; } void LLAgentCamera::clearFocusObject() { - if (mFocusObject.notNull()) - { - startCameraAnimation(); + if (mFocusObject.notNull()) + { + startCameraAnimation(); - setFocusObject(NULL); - mFocusObjectOffset.clearVec(); - } + setFocusObject(NULL); + mFocusObjectOffset.clearVec(); + } } void LLAgentCamera::setFocusObject(LLViewerObject* object) { - mFocusObject = object; + mFocusObject = object; } // Focus on a point, but try to keep camera position stable. @@ -2394,104 +2394,104 @@ void LLAgentCamera::setFocusObject(LLViewerObject* object) //----------------------------------------------------------------------------- void LLAgentCamera::setFocusGlobal(const LLPickInfo& pick) { - LLViewerObject* objectp = gObjectList.findObject(pick.mObjectID); - - if (objectp) - { - // focus on object plus designated offset - // which may or may not be same as pick.mPosGlobal - setFocusGlobal(objectp->getPositionGlobal() + LLVector3d(pick.mObjectOffset), pick.mObjectID); - } - else - { - // focus directly on point where user clicked - setFocusGlobal(pick.mPosGlobal, pick.mObjectID); - } + LLViewerObject* objectp = gObjectList.findObject(pick.mObjectID); + + if (objectp) + { + // focus on object plus designated offset + // which may or may not be same as pick.mPosGlobal + setFocusGlobal(objectp->getPositionGlobal() + LLVector3d(pick.mObjectOffset), pick.mObjectID); + } + else + { + // focus directly on point where user clicked + setFocusGlobal(pick.mPosGlobal, pick.mObjectID); + } } void LLAgentCamera::setFocusGlobal(const LLVector3d& focus, const LLUUID &object_id) { - setFocusObject(gObjectList.findObject(object_id)); - LLVector3d old_focus = mFocusTargetGlobal; - LLViewerObject *focus_obj = mFocusObject; - - // if focus has changed - if (old_focus != focus) - { - if (focus.isExactlyZero()) - { - if (isAgentAvatarValid()) - { - mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition()); - } - else - { - mFocusTargetGlobal = gAgent.getPositionGlobal(); - } - mCameraFocusOffsetTarget = getCameraPositionGlobal() - mFocusTargetGlobal; - mCameraFocusOffset = mCameraFocusOffsetTarget; - setLookAt(LOOKAT_TARGET_CLEAR); - } - else - { - mFocusTargetGlobal = focus; - if (!focus_obj) - { - mCameraFOVZoomFactor = 0.f; - } - - mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(mCameraVirtualPositionAgent) - mFocusTargetGlobal; - - startCameraAnimation(); - - if (focus_obj) - { - if (focus_obj->isAvatar()) - { - setLookAt(LOOKAT_TARGET_FOCUS, focus_obj); - } - else - { - setLookAt(LOOKAT_TARGET_FOCUS, focus_obj, (gAgent.getPosAgentFromGlobal(focus) - focus_obj->getRenderPosition()) * ~focus_obj->getRenderRotation()); - } - } - else - { - setLookAt(LOOKAT_TARGET_FOCUS, NULL, gAgent.getPosAgentFromGlobal(mFocusTargetGlobal)); - } - } - } - else // focus == mFocusTargetGlobal - { - if (focus.isExactlyZero()) - { - if (isAgentAvatarValid()) - { - mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition()); - } - else - { - mFocusTargetGlobal = gAgent.getPositionGlobal(); - } - } - mCameraFocusOffsetTarget = (getCameraPositionGlobal() - mFocusTargetGlobal) / (1.f + mCameraFOVZoomFactor);; - mCameraFocusOffset = mCameraFocusOffsetTarget; - } - - if (mFocusObject.notNull()) - { - // for attachments, make offset relative to avatar, not the attachment - if (mFocusObject->isAttachment()) - { - while (mFocusObject.notNull() && !mFocusObject->isAvatar()) - { - mFocusObject = (LLViewerObject*) mFocusObject->getParent(); - } - setFocusObject((LLViewerObject*)mFocusObject); - } - updateFocusOffset(); - } + setFocusObject(gObjectList.findObject(object_id)); + LLVector3d old_focus = mFocusTargetGlobal; + LLViewerObject *focus_obj = mFocusObject; + + // if focus has changed + if (old_focus != focus) + { + if (focus.isExactlyZero()) + { + if (isAgentAvatarValid()) + { + mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition()); + } + else + { + mFocusTargetGlobal = gAgent.getPositionGlobal(); + } + mCameraFocusOffsetTarget = getCameraPositionGlobal() - mFocusTargetGlobal; + mCameraFocusOffset = mCameraFocusOffsetTarget; + setLookAt(LOOKAT_TARGET_CLEAR); + } + else + { + mFocusTargetGlobal = focus; + if (!focus_obj) + { + mCameraFOVZoomFactor = 0.f; + } + + mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(mCameraVirtualPositionAgent) - mFocusTargetGlobal; + + startCameraAnimation(); + + if (focus_obj) + { + if (focus_obj->isAvatar()) + { + setLookAt(LOOKAT_TARGET_FOCUS, focus_obj); + } + else + { + setLookAt(LOOKAT_TARGET_FOCUS, focus_obj, (gAgent.getPosAgentFromGlobal(focus) - focus_obj->getRenderPosition()) * ~focus_obj->getRenderRotation()); + } + } + else + { + setLookAt(LOOKAT_TARGET_FOCUS, NULL, gAgent.getPosAgentFromGlobal(mFocusTargetGlobal)); + } + } + } + else // focus == mFocusTargetGlobal + { + if (focus.isExactlyZero()) + { + if (isAgentAvatarValid()) + { + mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition()); + } + else + { + mFocusTargetGlobal = gAgent.getPositionGlobal(); + } + } + mCameraFocusOffsetTarget = (getCameraPositionGlobal() - mFocusTargetGlobal) / (1.f + mCameraFOVZoomFactor);; + mCameraFocusOffset = mCameraFocusOffsetTarget; + } + + if (mFocusObject.notNull()) + { + // for attachments, make offset relative to avatar, not the attachment + if (mFocusObject->isAttachment()) + { + while (mFocusObject.notNull() && !mFocusObject->isAvatar()) + { + mFocusObject = (LLViewerObject*) mFocusObject->getParent(); + } + setFocusObject((LLViewerObject*)mFocusObject); + } + updateFocusOffset(); + } } // Used for avatar customization @@ -2500,48 +2500,48 @@ void LLAgentCamera::setFocusGlobal(const LLVector3d& focus, const LLUUID &object //----------------------------------------------------------------------------- void LLAgentCamera::setCameraPosAndFocusGlobal(const LLVector3d& camera_pos, const LLVector3d& focus, const LLUUID &object_id) { - LLVector3d old_focus = mFocusTargetGlobal.isExactlyZero() ? focus : mFocusTargetGlobal; - - F64 focus_delta_squared = (old_focus - focus).magVecSquared(); - const F64 ANIM_EPSILON_SQUARED = 0.0001; - if (focus_delta_squared > ANIM_EPSILON_SQUARED) - { - startCameraAnimation(); - } - - //LLViewerCamera::getInstance()->setOrigin( gAgent.getPosAgentFromGlobal( camera_pos ) ); - setFocusObject(gObjectList.findObject(object_id)); - mFocusTargetGlobal = focus; - mCameraFocusOffsetTarget = camera_pos - focus; - mCameraFocusOffset = mCameraFocusOffsetTarget; - - if (mFocusObject) - { - if (mFocusObject->isAvatar()) - { - setLookAt(LOOKAT_TARGET_FOCUS, mFocusObject); - } - else - { - setLookAt(LOOKAT_TARGET_FOCUS, mFocusObject, (gAgent.getPosAgentFromGlobal(focus) - mFocusObject->getRenderPosition()) * ~mFocusObject->getRenderRotation()); - } - } - else - { - setLookAt(LOOKAT_TARGET_FOCUS, NULL, gAgent.getPosAgentFromGlobal(mFocusTargetGlobal)); - } - - if (mCameraAnimating) - { - const F64 ANIM_METERS_PER_SECOND = 10.0; - const F64 MIN_ANIM_SECONDS = 0.5; - const F64 MAX_ANIM_SECONDS = 10.0; - F64 anim_duration = llmax( MIN_ANIM_SECONDS, sqrt(focus_delta_squared) / ANIM_METERS_PER_SECOND ); - anim_duration = llmin( anim_duration, MAX_ANIM_SECONDS ); - setAnimationDuration( (F32)anim_duration ); - } - - updateFocusOffset(); + LLVector3d old_focus = mFocusTargetGlobal.isExactlyZero() ? focus : mFocusTargetGlobal; + + F64 focus_delta_squared = (old_focus - focus).magVecSquared(); + const F64 ANIM_EPSILON_SQUARED = 0.0001; + if (focus_delta_squared > ANIM_EPSILON_SQUARED) + { + startCameraAnimation(); + } + + //LLViewerCamera::getInstance()->setOrigin( gAgent.getPosAgentFromGlobal( camera_pos ) ); + setFocusObject(gObjectList.findObject(object_id)); + mFocusTargetGlobal = focus; + mCameraFocusOffsetTarget = camera_pos - focus; + mCameraFocusOffset = mCameraFocusOffsetTarget; + + if (mFocusObject) + { + if (mFocusObject->isAvatar()) + { + setLookAt(LOOKAT_TARGET_FOCUS, mFocusObject); + } + else + { + setLookAt(LOOKAT_TARGET_FOCUS, mFocusObject, (gAgent.getPosAgentFromGlobal(focus) - mFocusObject->getRenderPosition()) * ~mFocusObject->getRenderRotation()); + } + } + else + { + setLookAt(LOOKAT_TARGET_FOCUS, NULL, gAgent.getPosAgentFromGlobal(mFocusTargetGlobal)); + } + + if (mCameraAnimating) + { + const F64 ANIM_METERS_PER_SECOND = 10.0; + const F64 MIN_ANIM_SECONDS = 0.5; + const F64 MAX_ANIM_SECONDS = 10.0; + F64 anim_duration = llmax( MIN_ANIM_SECONDS, sqrt(focus_delta_squared) / ANIM_METERS_PER_SECOND ); + anim_duration = llmin( anim_duration, MAX_ANIM_SECONDS ); + setAnimationDuration( (F32)anim_duration ); + } + + updateFocusOffset(); } //----------------------------------------------------------------------------- @@ -2549,27 +2549,27 @@ void LLAgentCamera::setCameraPosAndFocusGlobal(const LLVector3d& camera_pos, con //----------------------------------------------------------------------------- void LLAgentCamera::setSitCamera(const LLUUID &object_id, const LLVector3 &camera_pos, const LLVector3 &camera_focus) { - BOOL camera_enabled = !object_id.isNull(); - - if (camera_enabled) - { - LLViewerObject *reference_object = gObjectList.findObject(object_id); - if (reference_object) - { - //convert to root object relative? - mSitCameraPos = camera_pos; - mSitCameraFocus = camera_focus; - mSitCameraReferenceObject = reference_object; - mSitCameraEnabled = TRUE; - } - } - else - { - mSitCameraPos.clearVec(); - mSitCameraFocus.clearVec(); - mSitCameraReferenceObject = NULL; - mSitCameraEnabled = FALSE; - } + BOOL camera_enabled = !object_id.isNull(); + + if (camera_enabled) + { + LLViewerObject *reference_object = gObjectList.findObject(object_id); + if (reference_object) + { + //convert to root object relative? + mSitCameraPos = camera_pos; + mSitCameraFocus = camera_focus; + mSitCameraReferenceObject = reference_object; + mSitCameraEnabled = TRUE; + } + } + else + { + mSitCameraPos.clearVec(); + mSitCameraFocus.clearVec(); + mSitCameraReferenceObject = NULL; + mSitCameraEnabled = FALSE; + } } //----------------------------------------------------------------------------- @@ -2577,80 +2577,80 @@ void LLAgentCamera::setSitCamera(const LLUUID &object_id, const LLVector3 &camer //----------------------------------------------------------------------------- void LLAgentCamera::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate) { - if (focus_on_avatar != mFocusOnAvatar) - { - if (animate) - { - startCameraAnimation(); - } - else - { - stopCameraAnimation(); - } - } - - //RN: when focused on the avatar, we're not "looking" at it - // looking implies intent while focusing on avatar means - // you're just walking around with a camera on you...eesh. - if (!mFocusOnAvatar && focus_on_avatar) - { - setFocusGlobal(LLVector3d::zero); - mCameraFOVZoomFactor = 0.f; - if (mCameraMode == CAMERA_MODE_THIRD_PERSON) - { - LLVector3 at_axis; - if (isAgentAvatarValid() && gAgentAvatarp->getParent()) - { - LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); - at_axis = LLViewerCamera::getInstance()->getAtAxis(); - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - gAgent.resetAxes(at_axis * ~obj_rot); - } - else - { - at_axis = LLViewerCamera::getInstance()->getAtAxis(); - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - gAgent.resetAxes(at_axis); - } - } - } - // unlocking camera from avatar - else if (mFocusOnAvatar && !focus_on_avatar) - { - // keep camera focus point consistent, even though it is now unlocked - setFocusGlobal(gAgent.getPositionGlobal() + calcThirdPersonFocusOffset(), gAgent.getID()); - mAllowChangeToFollow = FALSE; - } - - mFocusOnAvatar = focus_on_avatar; + if (focus_on_avatar != mFocusOnAvatar) + { + if (animate) + { + startCameraAnimation(); + } + else + { + stopCameraAnimation(); + } + } + + //RN: when focused on the avatar, we're not "looking" at it + // looking implies intent while focusing on avatar means + // you're just walking around with a camera on you...eesh. + if (!mFocusOnAvatar && focus_on_avatar) + { + setFocusGlobal(LLVector3d::zero); + mCameraFOVZoomFactor = 0.f; + if (mCameraMode == CAMERA_MODE_THIRD_PERSON) + { + LLVector3 at_axis; + if (isAgentAvatarValid() && gAgentAvatarp->getParent()) + { + LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation(); + at_axis = LLViewerCamera::getInstance()->getAtAxis(); + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis * ~obj_rot); + } + else + { + at_axis = LLViewerCamera::getInstance()->getAtAxis(); + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis); + } + } + } + // unlocking camera from avatar + else if (mFocusOnAvatar && !focus_on_avatar) + { + // keep camera focus point consistent, even though it is now unlocked + setFocusGlobal(gAgent.getPositionGlobal() + calcThirdPersonFocusOffset(), gAgent.getID()); + mAllowChangeToFollow = FALSE; + } + + mFocusOnAvatar = focus_on_avatar; } BOOL LLAgentCamera::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position) { - if(object && object->isAttachment()) - { - LLViewerObject* parent = object; - while(parent) - { - if (parent == gAgentAvatarp) - { - // looking at an attachment on ourselves, which we don't want to do - object = gAgentAvatarp; - position.clearVec(); - } - parent = (LLViewerObject*)parent->getParent(); - } - } - if(!mLookAt || mLookAt->isDead()) - { - mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT); - mLookAt->setSourceObject(gAgentAvatarp); - } - - return mLookAt->setLookAt(target_type, object, position); + if(object && object->isAttachment()) + { + LLViewerObject* parent = object; + while(parent) + { + if (parent == gAgentAvatarp) + { + // looking at an attachment on ourselves, which we don't want to do + object = gAgentAvatarp; + position.clearVec(); + } + parent = (LLViewerObject*)parent->getParent(); + } + } + if(!mLookAt || mLookAt->isDead()) + { + mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT); + mLookAt->setSourceObject(gAgentAvatarp); + } + + return mLookAt->setLookAt(target_type, object, position); } //----------------------------------------------------------------------------- @@ -2658,157 +2658,157 @@ BOOL LLAgentCamera::setLookAt(ELookAtType target_type, LLViewerObject *object, L //----------------------------------------------------------------------------- void LLAgentCamera::lookAtLastChat() { - // Block if camera is animating or not in normal third person camera mode - if (mCameraAnimating || !cameraThirdPerson()) - { - return; - } - - LLViewerObject *chatter = gObjectList.findObject(gAgent.getLastChatter()); - if (!chatter) - { - return; - } - - LLVector3 delta_pos; - if (chatter->isAvatar()) - { - LLVOAvatar *chatter_av = (LLVOAvatar*)chatter; - if (isAgentAvatarValid() && chatter_av->mHeadp) - { - delta_pos = chatter_av->mHeadp->getWorldPosition() - gAgentAvatarp->mHeadp->getWorldPosition(); - } - else - { - delta_pos = chatter->getPositionAgent() - gAgent.getPositionAgent(); - } - delta_pos.normalize(); - - gAgent.setControlFlags(AGENT_CONTROL_STOP); - - changeCameraToThirdPerson(); - - LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition(); - LLVector3 left = delta_pos % LLVector3::z_axis; - left.normalize(); - LLVector3 up = left % delta_pos; - up.normalize(); - new_camera_pos -= delta_pos * 0.4f; - new_camera_pos += left * 0.3f; - new_camera_pos += up * 0.2f; - - setFocusOnAvatar(FALSE, FALSE); - - if (chatter_av->mHeadp) - { - setFocusGlobal(gAgent.getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition()), gAgent.getLastChatter()); - mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - gAgent.getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition()); - } - else - { - setFocusGlobal(chatter->getPositionGlobal(), gAgent.getLastChatter()); - mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal(); - } - } - else - { - delta_pos = chatter->getRenderPosition() - gAgent.getPositionAgent(); - delta_pos.normalize(); - - gAgent.setControlFlags(AGENT_CONTROL_STOP); - - changeCameraToThirdPerson(); - - LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition(); - LLVector3 left = delta_pos % LLVector3::z_axis; - left.normalize(); - LLVector3 up = left % delta_pos; - up.normalize(); - new_camera_pos -= delta_pos * 0.4f; - new_camera_pos += left * 0.3f; - new_camera_pos += up * 0.2f; - - setFocusOnAvatar(FALSE, FALSE); - - setFocusGlobal(chatter->getPositionGlobal(), gAgent.getLastChatter()); - mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal(); - } + // Block if camera is animating or not in normal third person camera mode + if (mCameraAnimating || !cameraThirdPerson()) + { + return; + } + + LLViewerObject *chatter = gObjectList.findObject(gAgent.getLastChatter()); + if (!chatter) + { + return; + } + + LLVector3 delta_pos; + if (chatter->isAvatar()) + { + LLVOAvatar *chatter_av = (LLVOAvatar*)chatter; + if (isAgentAvatarValid() && chatter_av->mHeadp) + { + delta_pos = chatter_av->mHeadp->getWorldPosition() - gAgentAvatarp->mHeadp->getWorldPosition(); + } + else + { + delta_pos = chatter->getPositionAgent() - gAgent.getPositionAgent(); + } + delta_pos.normalize(); + + gAgent.setControlFlags(AGENT_CONTROL_STOP); + + changeCameraToThirdPerson(); + + LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition(); + LLVector3 left = delta_pos % LLVector3::z_axis; + left.normalize(); + LLVector3 up = left % delta_pos; + up.normalize(); + new_camera_pos -= delta_pos * 0.4f; + new_camera_pos += left * 0.3f; + new_camera_pos += up * 0.2f; + + setFocusOnAvatar(FALSE, FALSE); + + if (chatter_av->mHeadp) + { + setFocusGlobal(gAgent.getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition()), gAgent.getLastChatter()); + mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - gAgent.getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition()); + } + else + { + setFocusGlobal(chatter->getPositionGlobal(), gAgent.getLastChatter()); + mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal(); + } + } + else + { + delta_pos = chatter->getRenderPosition() - gAgent.getPositionAgent(); + delta_pos.normalize(); + + gAgent.setControlFlags(AGENT_CONTROL_STOP); + + changeCameraToThirdPerson(); + + LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition(); + LLVector3 left = delta_pos % LLVector3::z_axis; + left.normalize(); + LLVector3 up = left % delta_pos; + up.normalize(); + new_camera_pos -= delta_pos * 0.4f; + new_camera_pos += left * 0.3f; + new_camera_pos += up * 0.2f; + + setFocusOnAvatar(FALSE, FALSE); + + setFocusGlobal(chatter->getPositionGlobal(), gAgent.getLastChatter()); + mCameraFocusOffsetTarget = gAgent.getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal(); + } } bool LLAgentCamera::isfollowCamLocked() { - return mFollowCam.getPositionLocked(); + return mFollowCam.getPositionLocked(); } BOOL LLAgentCamera::setPointAt(EPointAtType target_type, LLViewerObject *object, LLVector3 position) { - // disallow pointing at attachments and avatars - if (object && (object->isAttachment() || object->isAvatar())) - { - return FALSE; - } - if (!mPointAt || mPointAt->isDead()) - { - mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT); - mPointAt->setSourceObject(gAgentAvatarp); - } - return mPointAt->setPointAt(target_type, object, position); + // disallow pointing at attachments and avatars + if (object && (object->isAttachment() || object->isAvatar())) + { + return FALSE; + } + if (!mPointAt || mPointAt->isDead()) + { + mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT); + mPointAt->setSourceObject(gAgentAvatarp); + } + return mPointAt->setPointAt(target_type, object, position); } ELookAtType LLAgentCamera::getLookAtType() { - if (mLookAt) - { - return mLookAt->getLookAtType(); - } - return LOOKAT_TARGET_NONE; + if (mLookAt) + { + return mLookAt->getLookAtType(); + } + return LOOKAT_TARGET_NONE; } EPointAtType LLAgentCamera::getPointAtType() { - if (mPointAt) - { - return mPointAt->getPointAtType(); - } - return POINTAT_TARGET_NONE; + if (mPointAt) + { + return mPointAt->getPointAtType(); + } + return POINTAT_TARGET_NONE; } void LLAgentCamera::clearGeneralKeys() { - mAtKey = 0; - mWalkKey = 0; - mLeftKey = 0; - mUpKey = 0; - mYawKey = 0.f; - mPitchKey = 0.f; + mAtKey = 0; + mWalkKey = 0; + mLeftKey = 0; + mUpKey = 0; + mYawKey = 0.f; + mPitchKey = 0.f; } void LLAgentCamera::clearOrbitKeys() { - mOrbitLeftKey = 0.f; - mOrbitRightKey = 0.f; - mOrbitUpKey = 0.f; - mOrbitDownKey = 0.f; - mOrbitInKey = 0.f; - mOrbitOutKey = 0.f; + mOrbitLeftKey = 0.f; + mOrbitRightKey = 0.f; + mOrbitUpKey = 0.f; + mOrbitDownKey = 0.f; + mOrbitInKey = 0.f; + mOrbitOutKey = 0.f; } void LLAgentCamera::clearPanKeys() { - mPanRightKey = 0.f; - mPanLeftKey = 0.f; - mPanUpKey = 0.f; - mPanDownKey = 0.f; - mPanInKey = 0.f; - mPanOutKey = 0.f; + mPanRightKey = 0.f; + mPanLeftKey = 0.f; + mPanUpKey = 0.f; + mPanDownKey = 0.f; + mPanInKey = 0.f; + mPanOutKey = 0.f; } // static S32 LLAgentCamera::directionToKey(S32 direction) { - if (direction > 0) return 1; - if (direction < 0) return -1; - return 0; + if (direction > 0) return 1; + if (direction < 0) return -1; + return 0; } diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 27a9891030..4575c1501a 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -27,9 +27,9 @@ #ifndef LL_LLAGENTCAMERA_H #define LL_LLAGENTCAMERA_H -#include "llfollowcam.h" // Ventrella -#include "llhudeffectlookat.h" // EPointAtType -#include "llhudeffectpointat.h" // ELookAtType +#include "llfollowcam.h" // Ventrella +#include "llhudeffectlookat.h" // EPointAtType +#include "llhudeffectpointat.h" // ELookAtType class LLPickInfo; class LLVOAvatarSelf; @@ -40,26 +40,26 @@ class LLControlVariable; //-------------------------------------------------------------------- enum ECameraMode { - CAMERA_MODE_THIRD_PERSON, - CAMERA_MODE_MOUSELOOK, - CAMERA_MODE_CUSTOMIZE_AVATAR, - CAMERA_MODE_FOLLOW + CAMERA_MODE_THIRD_PERSON, + CAMERA_MODE_MOUSELOOK, + CAMERA_MODE_CUSTOMIZE_AVATAR, + CAMERA_MODE_FOLLOW }; /** Camera Presets for CAMERA_MODE_THIRD_PERSON */ enum ECameraPreset { - /** Default preset, what the Third Person Mode actually was */ - CAMERA_PRESET_REAR_VIEW, - - /** "Looking at the Avatar from the front" */ - CAMERA_PRESET_FRONT_VIEW, + /** Default preset, what the Third Person Mode actually was */ + CAMERA_PRESET_REAR_VIEW, + + /** "Looking at the Avatar from the front" */ + CAMERA_PRESET_FRONT_VIEW, - /** "Above and to the left, over the shoulder, pulled back a little on the zoom" */ - CAMERA_PRESET_GROUP_VIEW, + /** "Above and to the left, over the shoulder, pulled back a little on the zoom" */ + CAMERA_PRESET_GROUP_VIEW, - /** Current view when a preset is saved */ - CAMERA_PRESET_CUSTOM0 + /** Current view when a preset is saved */ + CAMERA_PRESET_CUSTOM0 }; //------------------------------------------------------------------------ @@ -67,243 +67,243 @@ enum ECameraPreset //------------------------------------------------------------------------ class LLAgentCamera { - LOG_CLASS(LLAgentCamera); + LOG_CLASS(LLAgentCamera); public: - //-------------------------------------------------------------------- - // Constructors / Destructors - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Constructors / Destructors + //-------------------------------------------------------------------- public: - LLAgentCamera(); - virtual ~LLAgentCamera(); - void init(); - void cleanup(); - void setAvatarObject(LLVOAvatarSelf* avatar); - bool isInitialized() { return mInitialized; } + LLAgentCamera(); + virtual ~LLAgentCamera(); + void init(); + void cleanup(); + void setAvatarObject(LLVOAvatarSelf* avatar); + bool isInitialized() { return mInitialized; } private: - bool mInitialized; + bool mInitialized; - //-------------------------------------------------------------------- - // Mode - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Mode + //-------------------------------------------------------------------- public: - void changeCameraToDefault(); - void changeCameraToMouselook(BOOL animate = TRUE); - void changeCameraToThirdPerson(BOOL animate = TRUE); - void changeCameraToCustomizeAvatar(); // Trigger transition animation - void changeCameraToFollow(BOOL animate = TRUE); // Ventrella - BOOL cameraThirdPerson() const { return (mCameraMode == CAMERA_MODE_THIRD_PERSON && mLastCameraMode == CAMERA_MODE_THIRD_PERSON); } - BOOL cameraMouselook() const { return (mCameraMode == CAMERA_MODE_MOUSELOOK && mLastCameraMode == CAMERA_MODE_MOUSELOOK); } - BOOL cameraCustomizeAvatar() const { return (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR /*&& !mCameraAnimating*/); } - BOOL cameraFollow() const { return (mCameraMode == CAMERA_MODE_FOLLOW && mLastCameraMode == CAMERA_MODE_FOLLOW); } - ECameraMode getCameraMode() const { return mCameraMode; } - ECameraMode getLastCameraMode() const { return mLastCameraMode; } - void updateCamera(); // Call once per frame to update camera location/orientation - void resetCamera(); // Slam camera into its default position - void updateLastCamera(); // Set last camera to current camera + void changeCameraToDefault(); + void changeCameraToMouselook(BOOL animate = TRUE); + void changeCameraToThirdPerson(BOOL animate = TRUE); + void changeCameraToCustomizeAvatar(); // Trigger transition animation + void changeCameraToFollow(BOOL animate = TRUE); // Ventrella + BOOL cameraThirdPerson() const { return (mCameraMode == CAMERA_MODE_THIRD_PERSON && mLastCameraMode == CAMERA_MODE_THIRD_PERSON); } + BOOL cameraMouselook() const { return (mCameraMode == CAMERA_MODE_MOUSELOOK && mLastCameraMode == CAMERA_MODE_MOUSELOOK); } + BOOL cameraCustomizeAvatar() const { return (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR /*&& !mCameraAnimating*/); } + BOOL cameraFollow() const { return (mCameraMode == CAMERA_MODE_FOLLOW && mLastCameraMode == CAMERA_MODE_FOLLOW); } + ECameraMode getCameraMode() const { return mCameraMode; } + ECameraMode getLastCameraMode() const { return mLastCameraMode; } + void updateCamera(); // Call once per frame to update camera location/orientation + void resetCamera(); // Slam camera into its default position + void updateLastCamera(); // Set last camera to current camera private: - ECameraMode mCameraMode; // Target mode after transition animation is done - ECameraMode mLastCameraMode; + ECameraMode mCameraMode; // Target mode after transition animation is done + ECameraMode mLastCameraMode; - //-------------------------------------------------------------------- - // Preset - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Preset + //-------------------------------------------------------------------- public: - void switchCameraPreset(ECameraPreset preset); + void switchCameraPreset(ECameraPreset preset); private: - /** Determines default camera offset depending on the current camera preset */ - LLVector3 getCameraOffsetInitial(); - /** Determines maximum camera distance from target for mouselook, opposite to LAND_MIN_ZOOM */ - F32 getCameraMaxZoomDistance(); + /** Determines default camera offset depending on the current camera preset */ + LLVector3 getCameraOffsetInitial(); + /** Determines maximum camera distance from target for mouselook, opposite to LAND_MIN_ZOOM */ + F32 getCameraMaxZoomDistance(); - /** Camera preset in Third Person Mode */ - ECameraPreset mCameraPreset; + /** Camera preset in Third Person Mode */ + ECameraPreset mCameraPreset; - /** Initial camera offsets */ - std::map > mCameraOffsetInitial; + /** Initial camera offsets */ + std::map > mCameraOffsetInitial; - /** Initial focus offsets */ - std::map > mFocusOffsetInitial; + /** Initial focus offsets */ + std::map > mFocusOffsetInitial; - //-------------------------------------------------------------------- - // Position - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Position + //-------------------------------------------------------------------- public: - LLVector3d getCameraPositionGlobal() const; - const LLVector3 &getCameraPositionAgent() const; - LLVector3d calcCameraPositionTargetGlobal(BOOL *hit_limit = NULL); // Calculate the camera position target - F32 getCameraMinOffGround(); // Minimum height off ground for this mode, meters - void setCameraCollidePlane(const LLVector4 &plane) { mCameraCollidePlane = plane; } - BOOL calcCameraMinDistance(F32 &obj_min_distance); - F32 getCurrentCameraBuildOffset() { return (F32)mCameraFocusOffset.length(); } - void clearCameraLag() { mCameraLag.clearVec(); } + LLVector3d getCameraPositionGlobal() const; + const LLVector3 &getCameraPositionAgent() const; + LLVector3d calcCameraPositionTargetGlobal(BOOL *hit_limit = NULL); // Calculate the camera position target + F32 getCameraMinOffGround(); // Minimum height off ground for this mode, meters + void setCameraCollidePlane(const LLVector4 &plane) { mCameraCollidePlane = plane; } + BOOL calcCameraMinDistance(F32 &obj_min_distance); + F32 getCurrentCameraBuildOffset() { return (F32)mCameraFocusOffset.length(); } + void clearCameraLag() { mCameraLag.clearVec(); } private: - F32 mCurrentCameraDistance; // Current camera offset from avatar - F32 mTargetCameraDistance; // Target camera offset from avatar - F32 mCameraFOVZoomFactor; // Amount of fov zoom applied to camera when zeroing in on an object - F32 mCameraCurrentFOVZoomFactor; // Interpolated fov zoom - F32 mCameraFOVDefault; // Default field of view that is basis for FOV zoom effect - LLVector4 mCameraCollidePlane; // Colliding plane for camera - F32 mCameraZoomFraction; // Mousewheel driven fraction of zoom - LLVector3 mCameraPositionAgent; // Camera position in agent coordinates - LLVector3 mCameraVirtualPositionAgent; // Camera virtual position (target) before performing FOV zoom - LLVector3d mCameraSmoothingLastPositionGlobal; - LLVector3d mCameraSmoothingLastPositionAgent; - bool mCameraSmoothingStop; - LLVector3 mCameraLag; // Third person camera lag - LLVector3 mCameraUpVector; // Camera's up direction in world coordinates (determines the 'roll' of the view) - - //-------------------------------------------------------------------- - // Follow - //-------------------------------------------------------------------- + F32 mCurrentCameraDistance; // Current camera offset from avatar + F32 mTargetCameraDistance; // Target camera offset from avatar + F32 mCameraFOVZoomFactor; // Amount of fov zoom applied to camera when zeroing in on an object + F32 mCameraCurrentFOVZoomFactor; // Interpolated fov zoom + F32 mCameraFOVDefault; // Default field of view that is basis for FOV zoom effect + LLVector4 mCameraCollidePlane; // Colliding plane for camera + F32 mCameraZoomFraction; // Mousewheel driven fraction of zoom + LLVector3 mCameraPositionAgent; // Camera position in agent coordinates + LLVector3 mCameraVirtualPositionAgent; // Camera virtual position (target) before performing FOV zoom + LLVector3d mCameraSmoothingLastPositionGlobal; + LLVector3d mCameraSmoothingLastPositionAgent; + bool mCameraSmoothingStop; + LLVector3 mCameraLag; // Third person camera lag + LLVector3 mCameraUpVector; // Camera's up direction in world coordinates (determines the 'roll' of the view) + + //-------------------------------------------------------------------- + // Follow + //-------------------------------------------------------------------- public: - void setUsingFollowCam(bool using_follow_cam); - bool isfollowCamLocked(); + void setUsingFollowCam(bool using_follow_cam); + bool isfollowCamLocked(); private: - LLFollowCam mFollowCam; // Ventrella + LLFollowCam mFollowCam; // Ventrella - //-------------------------------------------------------------------- - // Sit - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Sit + //-------------------------------------------------------------------- public: - void setupSitCamera(); - BOOL sitCameraEnabled() { return mSitCameraEnabled; } - void setSitCamera(const LLUUID &object_id, - const LLVector3 &camera_pos = LLVector3::zero, const LLVector3 &camera_focus = LLVector3::zero); + void setupSitCamera(); + BOOL sitCameraEnabled() { return mSitCameraEnabled; } + void setSitCamera(const LLUUID &object_id, + const LLVector3 &camera_pos = LLVector3::zero, const LLVector3 &camera_focus = LLVector3::zero); private: - LLPointer mSitCameraReferenceObject; // Object to which camera is related when sitting - BOOL mSitCameraEnabled; // Use provided camera information when sitting? - LLVector3 mSitCameraPos; // Root relative camera pos when sitting - LLVector3 mSitCameraFocus; // Root relative camera target when sitting - - //-------------------------------------------------------------------- - // Animation - //-------------------------------------------------------------------- + LLPointer mSitCameraReferenceObject; // Object to which camera is related when sitting + BOOL mSitCameraEnabled; // Use provided camera information when sitting? + LLVector3 mSitCameraPos; // Root relative camera pos when sitting + LLVector3 mSitCameraFocus; // Root relative camera target when sitting + + //-------------------------------------------------------------------- + // Animation + //-------------------------------------------------------------------- public: - void setCameraAnimating(BOOL b) { mCameraAnimating = b; } - BOOL getCameraAnimating() { return mCameraAnimating; } - void setAnimationDuration(F32 seconds); - void startCameraAnimation(); - void stopCameraAnimation(); + void setCameraAnimating(BOOL b) { mCameraAnimating = b; } + BOOL getCameraAnimating() { return mCameraAnimating; } + void setAnimationDuration(F32 seconds); + void startCameraAnimation(); + void stopCameraAnimation(); private: - LLFrameTimer mAnimationTimer; // Seconds that transition animation has been active - F32 mAnimationDuration; // In seconds - BOOL mCameraAnimating; // Camera is transitioning from one mode to another - LLVector3d mAnimationCameraStartGlobal; // Camera start position, global coords - LLVector3d mAnimationFocusStartGlobal; // Camera focus point, global coords - - //-------------------------------------------------------------------- - // Focus - //-------------------------------------------------------------------- + LLFrameTimer mAnimationTimer; // Seconds that transition animation has been active + F32 mAnimationDuration; // In seconds + BOOL mCameraAnimating; // Camera is transitioning from one mode to another + LLVector3d mAnimationCameraStartGlobal; // Camera start position, global coords + LLVector3d mAnimationFocusStartGlobal; // Camera focus point, global coords + + //-------------------------------------------------------------------- + // Focus + //-------------------------------------------------------------------- public: - LLVector3d calcFocusPositionTargetGlobal(); - LLVector3 calcFocusOffset(LLViewerObject *object, LLVector3 pos_agent, S32 x, S32 y); - BOOL getFocusOnAvatar() const { return mFocusOnAvatar; } - LLPointer& getFocusObject() { return mFocusObject; } - F32 getFocusObjectDist() const { return mFocusObjectDist; } - void updateFocusOffset(); - void validateFocusObject(); - void setFocusGlobal(const LLPickInfo& pick); - void setFocusGlobal(const LLVector3d &focus, const LLUUID &object_id = LLUUID::null); - void setFocusOnAvatar(BOOL focus, BOOL animate); - void setCameraPosAndFocusGlobal(const LLVector3d& pos, const LLVector3d& focus, const LLUUID &object_id); - void clearFocusObject(); - void setFocusObject(LLViewerObject* object); - void setAllowChangeToFollow(BOOL focus) { mAllowChangeToFollow = focus; } - void setObjectTracking(BOOL track) { mTrackFocusObject = track; } - const LLVector3d &getFocusGlobal() const { return mFocusGlobal; } - const LLVector3d &getFocusTargetGlobal() const { return mFocusTargetGlobal; } + LLVector3d calcFocusPositionTargetGlobal(); + LLVector3 calcFocusOffset(LLViewerObject *object, LLVector3 pos_agent, S32 x, S32 y); + BOOL getFocusOnAvatar() const { return mFocusOnAvatar; } + LLPointer& getFocusObject() { return mFocusObject; } + F32 getFocusObjectDist() const { return mFocusObjectDist; } + void updateFocusOffset(); + void validateFocusObject(); + void setFocusGlobal(const LLPickInfo& pick); + void setFocusGlobal(const LLVector3d &focus, const LLUUID &object_id = LLUUID::null); + void setFocusOnAvatar(BOOL focus, BOOL animate); + void setCameraPosAndFocusGlobal(const LLVector3d& pos, const LLVector3d& focus, const LLUUID &object_id); + void clearFocusObject(); + void setFocusObject(LLViewerObject* object); + void setAllowChangeToFollow(BOOL focus) { mAllowChangeToFollow = focus; } + void setObjectTracking(BOOL track) { mTrackFocusObject = track; } + const LLVector3d &getFocusGlobal() const { return mFocusGlobal; } + const LLVector3d &getFocusTargetGlobal() const { return mFocusTargetGlobal; } private: - LLVector3d mCameraFocusOffset; // Offset from focus point in build mode - LLVector3d mCameraFocusOffsetTarget; // Target towards which we are lerping the camera's focus offset - BOOL mFocusOnAvatar; - BOOL mAllowChangeToFollow; - LLVector3d mFocusGlobal; - LLVector3d mFocusTargetGlobal; - LLPointer mFocusObject; - F32 mFocusObjectDist; - LLVector3 mFocusObjectOffset; - F32 mFocusDotRadius; // Meters - BOOL mTrackFocusObject; - - //-------------------------------------------------------------------- - // Lookat / Pointat - //-------------------------------------------------------------------- + LLVector3d mCameraFocusOffset; // Offset from focus point in build mode + LLVector3d mCameraFocusOffsetTarget; // Target towards which we are lerping the camera's focus offset + BOOL mFocusOnAvatar; + BOOL mAllowChangeToFollow; + LLVector3d mFocusGlobal; + LLVector3d mFocusTargetGlobal; + LLPointer mFocusObject; + F32 mFocusObjectDist; + LLVector3 mFocusObjectOffset; + F32 mFocusDotRadius; // Meters + BOOL mTrackFocusObject; + + //-------------------------------------------------------------------- + // Lookat / Pointat + //-------------------------------------------------------------------- public: - void updateLookAt(const S32 mouse_x, const S32 mouse_y); - BOOL setLookAt(ELookAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); - ELookAtType getLookAtType(); - void lookAtLastChat(); - void slamLookAt(const LLVector3 &look_at); // Set the physics data - BOOL setPointAt(EPointAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); - EPointAtType getPointAtType(); + void updateLookAt(const S32 mouse_x, const S32 mouse_y); + BOOL setLookAt(ELookAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); + ELookAtType getLookAtType(); + void lookAtLastChat(); + void slamLookAt(const LLVector3 &look_at); // Set the physics data + BOOL setPointAt(EPointAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); + EPointAtType getPointAtType(); public: - LLPointer mLookAt; - LLPointer mPointAt; + LLPointer mLookAt; + LLPointer mPointAt; - //-------------------------------------------------------------------- - // Third person - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Third person + //-------------------------------------------------------------------- public: - LLVector3d calcThirdPersonFocusOffset(); - void setThirdPersonHeadOffset(LLVector3 offset) { mThirdPersonHeadOffset = offset; } + LLVector3d calcThirdPersonFocusOffset(); + void setThirdPersonHeadOffset(LLVector3 offset) { mThirdPersonHeadOffset = offset; } private: - LLVector3 mThirdPersonHeadOffset; // Head offset for third person camera position + LLVector3 mThirdPersonHeadOffset; // Head offset for third person camera position - //-------------------------------------------------------------------- - // Orbit - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Orbit + //-------------------------------------------------------------------- public: - void cameraOrbitAround(const F32 radians); // Rotate camera CCW radians about build focus point - void cameraOrbitOver(const F32 radians); // Rotate camera forward radians over build focus point - void cameraOrbitIn(const F32 meters); // Move camera in toward build focus point + void cameraOrbitAround(const F32 radians); // Rotate camera CCW radians about build focus point + void cameraOrbitOver(const F32 radians); // Rotate camera forward radians over build focus point + void cameraOrbitIn(const F32 meters); // Move camera in toward build focus point - //-------------------------------------------------------------------- - // Zoom - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Zoom + //-------------------------------------------------------------------- public: - void handleScrollWheel(S32 clicks); // Mousewheel driven zoom - void cameraZoomIn(const F32 factor); // Zoom in by fraction of current distance - F32 getCameraZoomFraction(); // Get camera zoom as fraction of minimum and maximum zoom - void setCameraZoomFraction(F32 fraction); // Set camera zoom as fraction of minimum and maximum zoom - F32 calcCameraFOVZoomFactor(); - - //-------------------------------------------------------------------- - // Pan - //-------------------------------------------------------------------- + void handleScrollWheel(S32 clicks); // Mousewheel driven zoom + void cameraZoomIn(const F32 factor); // Zoom in by fraction of current distance + F32 getCameraZoomFraction(); // Get camera zoom as fraction of minimum and maximum zoom + void setCameraZoomFraction(F32 fraction); // Set camera zoom as fraction of minimum and maximum zoom + F32 calcCameraFOVZoomFactor(); + + //-------------------------------------------------------------------- + // Pan + //-------------------------------------------------------------------- public: - void cameraPanIn(const F32 meters); - void cameraPanLeft(const F32 meters); - void cameraPanUp(const F32 meters); - - //-------------------------------------------------------------------- - // View - //-------------------------------------------------------------------- + void cameraPanIn(const F32 meters); + void cameraPanLeft(const F32 meters); + void cameraPanUp(const F32 meters); + + //-------------------------------------------------------------------- + // View + //-------------------------------------------------------------------- public: - // Called whenever the agent moves. Puts camera back in default position, deselects items, etc. - void resetView(BOOL reset_camera = TRUE, BOOL change_camera = FALSE); - // Called on camera movement. Unlocks camera from the default position behind the avatar. - void unlockView(); + // Called whenever the agent moves. Puts camera back in default position, deselects items, etc. + void resetView(BOOL reset_camera = TRUE, BOOL change_camera = FALSE); + // Called on camera movement. Unlocks camera from the default position behind the avatar. + void unlockView(); public: - F32 mDrawDistance; + F32 mDrawDistance; - //-------------------------------------------------------------------- - // Mouselook - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Mouselook + //-------------------------------------------------------------------- public: - BOOL getForceMouselook() const { return mForceMouselook; } - void setForceMouselook(BOOL mouselook) { mForceMouselook = mouselook; } + BOOL getForceMouselook() const { return mForceMouselook; } + void setForceMouselook(BOOL mouselook) { mForceMouselook = mouselook; } private: - BOOL mForceMouselook; - - //-------------------------------------------------------------------- - // HUD - //-------------------------------------------------------------------- + BOOL mForceMouselook; + + //-------------------------------------------------------------------- + // HUD + //-------------------------------------------------------------------- public: - F32 mHUDTargetZoom; // Target zoom level for HUD objects (used when editing) - F32 mHUDCurZoom; // Current animated zoom level for HUD objects + F32 mHUDTargetZoom; // Target zoom level for HUD objects (used when editing) + F32 mHUDCurZoom; // Current animated zoom level for HUD objects /******************************************************************************** @@ -312,84 +312,84 @@ public: **/ public: - S32 getAtKey() const { return mAtKey; } - S32 getWalkKey() const { return mWalkKey; } - S32 getLeftKey() const { return mLeftKey; } - S32 getUpKey() const { return mUpKey; } - F32 getYawKey() const { return mYawKey; } - F32 getPitchKey() const { return mPitchKey; } - - void setAtKey(S32 mag) { mAtKey = mag; } - void setWalkKey(S32 mag) { mWalkKey = mag; } - void setLeftKey(S32 mag) { mLeftKey = mag; } - void setUpKey(S32 mag) { mUpKey = mag; } - void setYawKey(F32 mag) { mYawKey = mag; } - void setPitchKey(F32 mag) { mPitchKey = mag; } - - void clearGeneralKeys(); - static S32 directionToKey(S32 direction); // Changes direction to -1/0/1 + S32 getAtKey() const { return mAtKey; } + S32 getWalkKey() const { return mWalkKey; } + S32 getLeftKey() const { return mLeftKey; } + S32 getUpKey() const { return mUpKey; } + F32 getYawKey() const { return mYawKey; } + F32 getPitchKey() const { return mPitchKey; } + + void setAtKey(S32 mag) { mAtKey = mag; } + void setWalkKey(S32 mag) { mWalkKey = mag; } + void setLeftKey(S32 mag) { mLeftKey = mag; } + void setUpKey(S32 mag) { mUpKey = mag; } + void setYawKey(F32 mag) { mYawKey = mag; } + void setPitchKey(F32 mag) { mPitchKey = mag; } + + void clearGeneralKeys(); + static S32 directionToKey(S32 direction); // Changes direction to -1/0/1 private: - S32 mAtKey; // Either 1, 0, or -1. Indicates that movement key is pressed - S32 mWalkKey; // Like AtKey, but causes less forward thrust - S32 mLeftKey; - S32 mUpKey; - F32 mYawKey; - F32 mPitchKey; - - //-------------------------------------------------------------------- - // Orbit - //-------------------------------------------------------------------- + S32 mAtKey; // Either 1, 0, or -1. Indicates that movement key is pressed + S32 mWalkKey; // Like AtKey, but causes less forward thrust + S32 mLeftKey; + S32 mUpKey; + F32 mYawKey; + F32 mPitchKey; + + //-------------------------------------------------------------------- + // Orbit + //-------------------------------------------------------------------- public: - F32 getOrbitLeftKey() const { return mOrbitLeftKey; } - F32 getOrbitRightKey() const { return mOrbitRightKey; } - F32 getOrbitUpKey() const { return mOrbitUpKey; } - F32 getOrbitDownKey() const { return mOrbitDownKey; } - F32 getOrbitInKey() const { return mOrbitInKey; } - F32 getOrbitOutKey() const { return mOrbitOutKey; } - - void setOrbitLeftKey(F32 mag) { mOrbitLeftKey = mag; } - void setOrbitRightKey(F32 mag) { mOrbitRightKey = mag; } - void setOrbitUpKey(F32 mag) { mOrbitUpKey = mag; } - void setOrbitDownKey(F32 mag) { mOrbitDownKey = mag; } - void setOrbitInKey(F32 mag) { mOrbitInKey = mag; } - void setOrbitOutKey(F32 mag) { mOrbitOutKey = mag; } - - void clearOrbitKeys(); + F32 getOrbitLeftKey() const { return mOrbitLeftKey; } + F32 getOrbitRightKey() const { return mOrbitRightKey; } + F32 getOrbitUpKey() const { return mOrbitUpKey; } + F32 getOrbitDownKey() const { return mOrbitDownKey; } + F32 getOrbitInKey() const { return mOrbitInKey; } + F32 getOrbitOutKey() const { return mOrbitOutKey; } + + void setOrbitLeftKey(F32 mag) { mOrbitLeftKey = mag; } + void setOrbitRightKey(F32 mag) { mOrbitRightKey = mag; } + void setOrbitUpKey(F32 mag) { mOrbitUpKey = mag; } + void setOrbitDownKey(F32 mag) { mOrbitDownKey = mag; } + void setOrbitInKey(F32 mag) { mOrbitInKey = mag; } + void setOrbitOutKey(F32 mag) { mOrbitOutKey = mag; } + + void clearOrbitKeys(); private: - F32 mOrbitLeftKey; - F32 mOrbitRightKey; - F32 mOrbitUpKey; - F32 mOrbitDownKey; - F32 mOrbitInKey; - F32 mOrbitOutKey; - - //-------------------------------------------------------------------- - // Pan - //-------------------------------------------------------------------- + F32 mOrbitLeftKey; + F32 mOrbitRightKey; + F32 mOrbitUpKey; + F32 mOrbitDownKey; + F32 mOrbitInKey; + F32 mOrbitOutKey; + + //-------------------------------------------------------------------- + // Pan + //-------------------------------------------------------------------- public: - F32 getPanLeftKey() const { return mPanLeftKey; } - F32 getPanRightKey() const { return mPanRightKey; } - F32 getPanUpKey() const { return mPanUpKey; } - F32 getPanDownKey() const { return mPanDownKey; } - F32 getPanInKey() const { return mPanInKey; } - F32 getPanOutKey() const { return mPanOutKey; } - - void setPanLeftKey(F32 mag) { mPanLeftKey = mag; } - void setPanRightKey(F32 mag) { mPanRightKey = mag; } - void setPanUpKey(F32 mag) { mPanUpKey = mag; } - void setPanDownKey(F32 mag) { mPanDownKey = mag; } - void setPanInKey(F32 mag) { mPanInKey = mag; } - void setPanOutKey(F32 mag) { mPanOutKey = mag; } - - void clearPanKeys(); + F32 getPanLeftKey() const { return mPanLeftKey; } + F32 getPanRightKey() const { return mPanRightKey; } + F32 getPanUpKey() const { return mPanUpKey; } + F32 getPanDownKey() const { return mPanDownKey; } + F32 getPanInKey() const { return mPanInKey; } + F32 getPanOutKey() const { return mPanOutKey; } + + void setPanLeftKey(F32 mag) { mPanLeftKey = mag; } + void setPanRightKey(F32 mag) { mPanRightKey = mag; } + void setPanUpKey(F32 mag) { mPanUpKey = mag; } + void setPanDownKey(F32 mag) { mPanDownKey = mag; } + void setPanInKey(F32 mag) { mPanInKey = mag; } + void setPanOutKey(F32 mag) { mPanOutKey = mag; } + + void clearPanKeys(); private: - F32 mPanUpKey; - F32 mPanDownKey; - F32 mPanLeftKey; - F32 mPanRightKey; - F32 mPanInKey; - F32 mPanOutKey; + F32 mPanUpKey; + F32 mPanDownKey; + F32 mPanLeftKey; + F32 mPanRightKey; + F32 mPanInKey; + F32 mPanOutKey; /** Keys ** ** diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 9848a1af0b..df06ad31e6 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -34,7 +34,7 @@ #include "m3math.h" #include "llrender.h" -#include "llagent.h" // for gAgent for getRegion for getWaterHeight +#include "llagent.h" // for gAgent for getRegion for getWaterHeight #include "llcubemap.h" #include "lldrawable.h" #include "llface.h" @@ -64,26 +64,26 @@ F32 LLDrawPoolWater::sWaterFogEnd = 0.f; LLVector3 LLDrawPoolWater::sLightDir; LLDrawPoolWater::LLDrawPoolWater() : - LLFacePool(POOL_WATER) + LLFacePool(POOL_WATER) { - mHBTex[0] = LLViewerTextureManager::getFetchedTexture(gSunTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); - gGL.getTexUnit(0)->bind(mHBTex[0]) ; - mHBTex[0]->setAddressMode(LLTexUnit::TAM_CLAMP); + mHBTex[0] = LLViewerTextureManager::getFetchedTexture(gSunTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + gGL.getTexUnit(0)->bind(mHBTex[0]) ; + mHBTex[0]->setAddressMode(LLTexUnit::TAM_CLAMP); - mHBTex[1] = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); - gGL.getTexUnit(0)->bind(mHBTex[1]); - mHBTex[1]->setAddressMode(LLTexUnit::TAM_CLAMP); + mHBTex[1] = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + gGL.getTexUnit(0)->bind(mHBTex[1]); + mHBTex[1]->setAddressMode(LLTexUnit::TAM_CLAMP); - mWaterImagep = LLViewerTextureManager::getFetchedTexture(TRANSPARENT_WATER_TEXTURE); - llassert(mWaterImagep); - mWaterImagep->setNoDelete(); - mOpaqueWaterImagep = LLViewerTextureManager::getFetchedTexture(OPAQUE_WATER_TEXTURE); - llassert(mOpaqueWaterImagep); - mWaterNormp = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL); - mWaterNormp->setNoDelete(); + mWaterImagep = LLViewerTextureManager::getFetchedTexture(TRANSPARENT_WATER_TEXTURE); + llassert(mWaterImagep); + mWaterImagep->setNoDelete(); + mOpaqueWaterImagep = LLViewerTextureManager::getFetchedTexture(OPAQUE_WATER_TEXTURE); + llassert(mOpaqueWaterImagep); + mWaterNormp = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL); + mWaterNormp->setNoDelete(); - restoreGL(); + restoreGL(); } LLDrawPoolWater::~LLDrawPoolWater() @@ -93,48 +93,48 @@ LLDrawPoolWater::~LLDrawPoolWater() //static void LLDrawPoolWater::restoreGL() { - + } LLDrawPool *LLDrawPoolWater::instancePool() { - LL_ERRS() << "Should never be calling instancePool on a water pool!" << LL_ENDL; - return NULL; + LL_ERRS() << "Should never be calling instancePool on a water pool!" << LL_ENDL; + return NULL; } void LLDrawPoolWater::prerender() { - mVertexShaderLevel = (gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps) ? - LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_WATER) : 0; + mVertexShaderLevel = (gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps) ? + LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_WATER) : 0; - // got rid of modulation by light color since it got a little too - // green at sunset and sl-57047 (underwater turns black at 8:00) - sWaterFogColor = LLWaterParamManager::instance().getFogColor(); - sWaterFogColor.mV[3] = 0; + // got rid of modulation by light color since it got a little too + // green at sunset and sl-57047 (underwater turns black at 8:00) + sWaterFogColor = LLWaterParamManager::instance().getFogColor(); + sWaterFogColor.mV[3] = 0; } S32 LLDrawPoolWater::getNumPasses() { - if (LLViewerCamera::getInstance()->getOrigin().mV[2] < 1024.f) - { - return 1; - } + if (LLViewerCamera::getInstance()->getOrigin().mV[2] < 1024.f) + { + return 1; + } - return 0; + return 0; } void LLDrawPoolWater::beginPostDeferredPass(S32 pass) { - beginRenderPass(pass); - deferred_render = TRUE; + beginRenderPass(pass); + deferred_render = TRUE; } void LLDrawPoolWater::endPostDeferredPass(S32 pass) { - endRenderPass(pass); - deferred_render = FALSE; + endRenderPass(pass); + deferred_render = FALSE; } //=============================== @@ -142,591 +142,591 @@ void LLDrawPoolWater::endPostDeferredPass(S32 pass) //=============================== void LLDrawPoolWater::renderDeferred(S32 pass) { - LL_RECORD_BLOCK_TIME(FTM_RENDER_WATER); - deferred_render = TRUE; - shade(); - deferred_render = FALSE; + LL_RECORD_BLOCK_TIME(FTM_RENDER_WATER); + deferred_render = TRUE; + shade(); + deferred_render = FALSE; } //========================================= void LLDrawPoolWater::render(S32 pass) { - LL_RECORD_BLOCK_TIME(FTM_RENDER_WATER); - if (mDrawFace.empty() || LLDrawable::getCurrentFrame() <= 1) - { - return; - } - - //do a quick 'n dirty depth sort - for (std::vector::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace* facep = *iter; - facep->mDistance = -facep->mCenterLocal.mV[2]; - } - - std::sort(mDrawFace.begin(), mDrawFace.end(), LLFace::CompareDistanceGreater()); - - // See if we are rendering water as opaque or not - if (!gSavedSettings.getBOOL("RenderTransparentWater")) - { - // render water for low end hardware - renderOpaqueLegacyWater(); - return; - } - - LLGLEnable blend(GL_BLEND); - - if ((mVertexShaderLevel > 0) && !sSkipScreenCopy) - { - shade(); - return; - } - - LLVOSky *voskyp = gSky.mVOSkyp; - - stop_glerror(); - - if (!gGLManager.mHasMultitexture) - { - // Ack! No multitexture! Bail! - return; - } - - LLFace* refl_face = voskyp->getReflFace(); - - gPipeline.disableLights(); - - LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); - - LLGLDisable cullFace(GL_CULL_FACE); - - // Set up second pass first - mWaterImagep->addTextureStats(1024.f*1024.f); - gGL.getTexUnit(1)->activate(); - gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->bind(mWaterImagep) ; - - LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); - F32 up_dot = camera_up * LLVector3::z_axis; - - LLColor4 water_color; - if (LLViewerCamera::getInstance()->cameraUnderWater()) - { - water_color.setVec(1.f, 1.f, 1.f, 0.4f); - } - else - { - water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot)); - } - - gGL.diffuseColor4fv(water_color.mV); - - // Automatically generate texture coords for detail map - glEnable(GL_TEXTURE_GEN_S); //texture unit 1 - glEnable(GL_TEXTURE_GEN_T); //texture unit 1 - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - - // Slowly move over time. - F32 offset = fmod(gFrameTimeSeconds*2.f, 100.f); - F32 tp0[4] = {16.f/256.f, 0.0f, 0.0f, offset*0.01f}; - F32 tp1[4] = {0.0f, 16.f/256.f, 0.0f, offset*0.01f}; - glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); - glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); - - gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR); - gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA); - - gGL.getTexUnit(0)->activate(); - - glClearStencil(1); - glClear(GL_STENCIL_BUFFER_BIT); - LLGLEnable gls_stencil(GL_STENCIL_TEST); - glStencilOp(GL_KEEP, GL_REPLACE, GL_KEEP); - glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFF); - - for (std::vector::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace *face = *iter; - if (voskyp->isReflFace(face)) - { - continue; - } - gGL.getTexUnit(0)->bind(face->getTexture()); - face->renderIndexed(); - } - - // Now, disable texture coord generation on texture state 1 - gGL.getTexUnit(1)->activate(); - gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->disable(); - glDisable(GL_TEXTURE_GEN_S); //texture unit 1 - glDisable(GL_TEXTURE_GEN_T); //texture unit 1 - - // Disable texture coordinate and color arrays - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - stop_glerror(); - - if (gSky.mVOSkyp->getCubeMap()) - { - gSky.mVOSkyp->getCubeMap()->enable(0); - gSky.mVOSkyp->getCubeMap()->bind(); - - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadIdentity(); - LLMatrix4 camera_mat = LLViewerCamera::getInstance()->getModelview(); - LLMatrix4 camera_rot(camera_mat.getMat3()); - camera_rot.invert(); - - gGL.loadMatrix((F32 *)camera_rot.mMatrix); - - gGL.matrixMode(LLRender::MM_MODELVIEW); - LLOverrideFaceColor overrid(this, 1.f, 1.f, 1.f, 0.5f*up_dot); - - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - - for (std::vector::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace *face = *iter; - if (voskyp->isReflFace(face)) - { - //refl_face = face; - continue; - } - - if (face->getGeomCount() > 0) - { - face->renderIndexed(); - } - } - - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - - gSky.mVOSkyp->getCubeMap()->disable(); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); - gGL.matrixMode(LLRender::MM_TEXTURE); - gGL.loadIdentity(); - gGL.matrixMode(LLRender::MM_MODELVIEW); - - } - - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); + LL_RECORD_BLOCK_TIME(FTM_RENDER_WATER); + if (mDrawFace.empty() || LLDrawable::getCurrentFrame() <= 1) + { + return; + } + + //do a quick 'n dirty depth sort + for (std::vector::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace* facep = *iter; + facep->mDistance = -facep->mCenterLocal.mV[2]; + } + + std::sort(mDrawFace.begin(), mDrawFace.end(), LLFace::CompareDistanceGreater()); + + // See if we are rendering water as opaque or not + if (!gSavedSettings.getBOOL("RenderTransparentWater")) + { + // render water for low end hardware + renderOpaqueLegacyWater(); + return; + } + + LLGLEnable blend(GL_BLEND); + + if ((mVertexShaderLevel > 0) && !sSkipScreenCopy) + { + shade(); + return; + } + + LLVOSky *voskyp = gSky.mVOSkyp; + + stop_glerror(); + + if (!gGLManager.mHasMultitexture) + { + // Ack! No multitexture! Bail! + return; + } + + LLFace* refl_face = voskyp->getReflFace(); + + gPipeline.disableLights(); + + LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); + + LLGLDisable cullFace(GL_CULL_FACE); + + // Set up second pass first + mWaterImagep->addTextureStats(1024.f*1024.f); + gGL.getTexUnit(1)->activate(); + gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->bind(mWaterImagep) ; + + LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); + F32 up_dot = camera_up * LLVector3::z_axis; + + LLColor4 water_color; + if (LLViewerCamera::getInstance()->cameraUnderWater()) + { + water_color.setVec(1.f, 1.f, 1.f, 0.4f); + } + else + { + water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot)); + } + + gGL.diffuseColor4fv(water_color.mV); + + // Automatically generate texture coords for detail map + glEnable(GL_TEXTURE_GEN_S); //texture unit 1 + glEnable(GL_TEXTURE_GEN_T); //texture unit 1 + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + + // Slowly move over time. + F32 offset = fmod(gFrameTimeSeconds*2.f, 100.f); + F32 tp0[4] = {16.f/256.f, 0.0f, 0.0f, offset*0.01f}; + F32 tp1[4] = {0.0f, 16.f/256.f, 0.0f, offset*0.01f}; + glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); + glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); + + gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR); + gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA); + + gGL.getTexUnit(0)->activate(); + + glClearStencil(1); + glClear(GL_STENCIL_BUFFER_BIT); + LLGLEnable gls_stencil(GL_STENCIL_TEST); + glStencilOp(GL_KEEP, GL_REPLACE, GL_KEEP); + glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFF); + + for (std::vector::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace *face = *iter; + if (voskyp->isReflFace(face)) + { + continue; + } + gGL.getTexUnit(0)->bind(face->getTexture()); + face->renderIndexed(); + } + + // Now, disable texture coord generation on texture state 1 + gGL.getTexUnit(1)->activate(); + gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->disable(); + glDisable(GL_TEXTURE_GEN_S); //texture unit 1 + glDisable(GL_TEXTURE_GEN_T); //texture unit 1 + + // Disable texture coordinate and color arrays + gGL.getTexUnit(0)->activate(); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + stop_glerror(); + + if (gSky.mVOSkyp->getCubeMap()) + { + gSky.mVOSkyp->getCubeMap()->enable(0); + gSky.mVOSkyp->getCubeMap()->bind(); + + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + LLMatrix4 camera_mat = LLViewerCamera::getInstance()->getModelview(); + LLMatrix4 camera_rot(camera_mat.getMat3()); + camera_rot.invert(); + + gGL.loadMatrix((F32 *)camera_rot.mMatrix); + + gGL.matrixMode(LLRender::MM_MODELVIEW); + LLOverrideFaceColor overrid(this, 1.f, 1.f, 1.f, 0.5f*up_dot); + + gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); + + for (std::vector::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace *face = *iter; + if (voskyp->isReflFace(face)) + { + //refl_face = face; + continue; + } + + if (face->getGeomCount() > 0) + { + face->renderIndexed(); + } + } + + gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); + + gSky.mVOSkyp->getCubeMap()->disable(); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + + } + + glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); if (refl_face) - { - glStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFF); - renderReflection(refl_face); - } + { + glStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFF); + renderReflection(refl_face); + } - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); + gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } // for low end hardware void LLDrawPoolWater::renderOpaqueLegacyWater() { - LLVOSky *voskyp = gSky.mVOSkyp; - - LLGLSLShader* shader = NULL; - if (LLGLSLShader::sNoFixedFunction) - { - if (LLPipeline::sUnderWaterRender) - { - shader = &gObjectSimpleNonIndexedTexGenWaterProgram; - } - else - { - shader = &gObjectSimpleNonIndexedTexGenProgram; - } - - shader->bind(); - } - - stop_glerror(); - - // Depth sorting and write to depth buffer - // since this is opaque, we should see nothing - // behind the water. No blending because - // of no transparency. And no face culling so - // that the underside of the water is also opaque. - LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE); - LLGLDisable no_cull(GL_CULL_FACE); - LLGLDisable no_blend(GL_BLEND); - - gPipeline.disableLights(); - - mOpaqueWaterImagep->addTextureStats(1024.f*1024.f); - - // Activate the texture binding and bind one - // texture since all images will have the same texture - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->bind(mOpaqueWaterImagep); - - // Automatically generate texture coords for water texture - if (!shader) - { - glEnable(GL_TEXTURE_GEN_S); //texture unit 0 - glEnable(GL_TEXTURE_GEN_T); //texture unit 0 - glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGenf(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - } - - // Use the fact that we know all water faces are the same size - // to save some computation - - // Slowly move texture coordinates over time so the watter appears - // to be moving. - F32 movement_period_secs = 50.f; - - F32 offset = fmod(gFrameTimeSeconds, movement_period_secs); - - if (movement_period_secs != 0) - { - offset /= movement_period_secs; - } - else - { - offset = 0; - } - - F32 tp0[4] = { 16.f / 256.f, 0.0f, 0.0f, offset }; - F32 tp1[4] = { 0.0f, 16.f / 256.f, 0.0f, offset }; - - if (!shader) - { - glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); - glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); - } - else - { - shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0); - shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1); - } - - gGL.diffuseColor3f(1.f, 1.f, 1.f); - - for (std::vector::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace *face = *iter; - if (voskyp->isReflFace(face)) - { - continue; - } - - face->renderIndexed(); - } - - stop_glerror(); - - if (!shader) - { - // Reset the settings back to expected values - glDisable(GL_TEXTURE_GEN_S); //texture unit 0 - glDisable(GL_TEXTURE_GEN_T); //texture unit 0 - } - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); + LLVOSky *voskyp = gSky.mVOSkyp; + + LLGLSLShader* shader = NULL; + if (LLGLSLShader::sNoFixedFunction) + { + if (LLPipeline::sUnderWaterRender) + { + shader = &gObjectSimpleNonIndexedTexGenWaterProgram; + } + else + { + shader = &gObjectSimpleNonIndexedTexGenProgram; + } + + shader->bind(); + } + + stop_glerror(); + + // Depth sorting and write to depth buffer + // since this is opaque, we should see nothing + // behind the water. No blending because + // of no transparency. And no face culling so + // that the underside of the water is also opaque. + LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE); + LLGLDisable no_cull(GL_CULL_FACE); + LLGLDisable no_blend(GL_BLEND); + + gPipeline.disableLights(); + + mOpaqueWaterImagep->addTextureStats(1024.f*1024.f); + + // Activate the texture binding and bind one + // texture since all images will have the same texture + gGL.getTexUnit(0)->activate(); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->bind(mOpaqueWaterImagep); + + // Automatically generate texture coords for water texture + if (!shader) + { + glEnable(GL_TEXTURE_GEN_S); //texture unit 0 + glEnable(GL_TEXTURE_GEN_T); //texture unit 0 + glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glTexGenf(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + } + + // Use the fact that we know all water faces are the same size + // to save some computation + + // Slowly move texture coordinates over time so the watter appears + // to be moving. + F32 movement_period_secs = 50.f; + + F32 offset = fmod(gFrameTimeSeconds, movement_period_secs); + + if (movement_period_secs != 0) + { + offset /= movement_period_secs; + } + else + { + offset = 0; + } + + F32 tp0[4] = { 16.f / 256.f, 0.0f, 0.0f, offset }; + F32 tp1[4] = { 0.0f, 16.f / 256.f, 0.0f, offset }; + + if (!shader) + { + glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); + glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); + } + else + { + shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0); + shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1); + } + + gGL.diffuseColor3f(1.f, 1.f, 1.f); + + for (std::vector::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace *face = *iter; + if (voskyp->isReflFace(face)) + { + continue; + } + + face->renderIndexed(); + } + + stop_glerror(); + + if (!shader) + { + // Reset the settings back to expected values + glDisable(GL_TEXTURE_GEN_S); //texture unit 0 + glDisable(GL_TEXTURE_GEN_T); //texture unit 0 + } + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } void LLDrawPoolWater::renderReflection(LLFace* face) { - LLVOSky *voskyp = gSky.mVOSkyp; - - if (!voskyp) - { - return; - } - - if (!face->getGeomCount()) - { - return; - } - - S8 dr = voskyp->getDrawRefl(); - if (dr < 0) - { - return; - } - - LLGLSNoFog noFog; - - gGL.getTexUnit(0)->bind(mHBTex[dr]); - - LLOverrideFaceColor override(this, LLColor4(face->getFaceColor().mV)); - face->renderIndexed(); + LLVOSky *voskyp = gSky.mVOSkyp; + + if (!voskyp) + { + return; + } + + if (!face->getGeomCount()) + { + return; + } + + S8 dr = voskyp->getDrawRefl(); + if (dr < 0) + { + return; + } + + LLGLSNoFog noFog; + + gGL.getTexUnit(0)->bind(mHBTex[dr]); + + LLOverrideFaceColor override(this, LLColor4(face->getFaceColor().mV)); + face->renderIndexed(); } void LLDrawPoolWater::shade() { - if (!deferred_render) - { - gGL.setColorMask(true, true); - } - - LLVOSky *voskyp = gSky.mVOSkyp; - - if(voskyp == NULL) - { - return; - } - - LLGLDisable blend(GL_BLEND); - - LLColor3 light_diffuse(0,0,0); - F32 light_exp = 0.0f; - LLVector3 light_dir; - LLColor3 light_color; - - if (gSky.getSunDirection().mV[2] > LLSky::NIGHTTIME_ELEVATION_COS) - { - light_dir = gSky.getSunDirection(); - light_dir.normVec(); - light_color = gSky.getSunDiffuseColor(); - if(gSky.mVOSkyp) { - light_diffuse = gSky.mVOSkyp->getSun().getColorCached(); - light_diffuse.normVec(); - } - light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0); - light_diffuse *= light_exp + 0.25f; - } - else - { - light_dir = gSky.getMoonDirection(); - light_dir.normVec(); - light_color = gSky.getMoonDiffuseColor(); - light_diffuse = gSky.mVOSkyp->getMoon().getColorCached(); - light_diffuse.normVec(); - light_diffuse *= 0.5f; - light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0); - } - - light_exp *= light_exp; - light_exp *= light_exp; - light_exp *= light_exp; - light_exp *= light_exp; - light_exp *= 256.f; - light_exp = light_exp > 32.f ? light_exp : 32.f; - - LLGLSLShader* shader; - - F32 eyedepth = LLViewerCamera::getInstance()->getOrigin().mV[2] - gAgent.getRegion()->getWaterHeight(); - - if (eyedepth < 0.f && LLPipeline::sWaterReflections) - { - if (deferred_render) - { - shader = &gDeferredUnderWaterProgram; - } - else - { - shader = &gUnderWaterProgram; - } - } - else if (deferred_render) - { - shader = &gDeferredWaterProgram; - } - else - { - shader = &gWaterProgram; - } - - if (deferred_render) - { - gPipeline.bindDeferredShader(*shader); - } - else - { - shader->bind(); - } - - sTime = (F32)LLFrameTimer::getElapsedSeconds()*0.5f; - - S32 reftex = shader->enableTexture(LLShaderMgr::WATER_REFTEX); - - if (reftex > -1) - { - gGL.getTexUnit(reftex)->activate(); - gGL.getTexUnit(reftex)->bind(&gPipeline.mWaterRef); - gGL.getTexUnit(0)->activate(); - } - - //bind normal map - S32 bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP); - - LLWaterParamManager * param_mgr = &LLWaterParamManager::instance(); - - // change mWaterNormp if needed - if (mWaterNormp->getID() != param_mgr->getNormalMapID()) - { - mWaterNormp = LLViewerTextureManager::getFetchedTexture(param_mgr->getNormalMapID()); - } - - mWaterNormp->addTextureStats(1024.f*1024.f); - gGL.getTexUnit(bumpTex)->bind(mWaterNormp) ; - if (gSavedSettings.getBOOL("RenderWaterMipNormal")) - { - mWaterNormp->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC); - } - else - { - mWaterNormp->setFilteringOption(LLTexUnit::TFO_POINT); - } - - S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX); - - if (screentex > -1) - { - shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV); - shader->uniform1f(LLShaderMgr::WATER_FOGDENSITY, - param_mgr->getFogDensity()); - gPipeline.mWaterDis.bindTexture(0, screentex); - } - - stop_glerror(); - - gGL.getTexUnit(screentex)->bind(&gPipeline.mWaterDis); - - if (mVertexShaderLevel == 1) - { - sWaterFogColor.mV[3] = param_mgr->mDensitySliderValue; - shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV); - } - - F32 screenRes[] = - { - 1.f/gGLViewport[2], - 1.f/gGLViewport[3] - }; - shader->uniform2fv(LLShaderMgr::DEFERRED_SCREEN_RES, 1, screenRes); - stop_glerror(); - - S32 diffTex = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP); - stop_glerror(); - - light_dir.normVec(); - sLightDir = light_dir; - - light_diffuse *= 6.f; - - //shader->uniformMatrix4fv("inverse_ref", 1, GL_FALSE, (GLfloat*) gGLObliqueProjectionInverse.mMatrix); - shader->uniform1f(LLShaderMgr::WATER_WATERHEIGHT, eyedepth); - shader->uniform1f(LLShaderMgr::WATER_TIME, sTime); - shader->uniform3fv(LLShaderMgr::WATER_EYEVEC, 1, LLViewerCamera::getInstance()->getOrigin().mV); - shader->uniform3fv(LLShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV); - shader->uniform1f(LLShaderMgr::WATER_SPECULAR_EXP, light_exp); - shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, param_mgr->getWave1Dir().mV); - shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR2, 1, param_mgr->getWave2Dir().mV); - shader->uniform3fv(LLShaderMgr::WATER_LIGHT_DIR, 1, light_dir.mV); - - shader->uniform3fv(LLShaderMgr::WATER_NORM_SCALE, 1, param_mgr->getNormalScale().mV); - shader->uniform1f(LLShaderMgr::WATER_FRESNEL_SCALE, param_mgr->getFresnelScale()); - shader->uniform1f(LLShaderMgr::WATER_FRESNEL_OFFSET, param_mgr->getFresnelOffset()); - shader->uniform1f(LLShaderMgr::WATER_BLUR_MULTIPLIER, param_mgr->getBlurMultiplier()); - - F32 sunAngle = llmax(0.f, light_dir.mV[2]); - F32 scaledAngle = 1.f - sunAngle; - - shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE, sunAngle); - shader->uniform1f(LLShaderMgr::WATER_SCALED_ANGLE, scaledAngle); - shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE2, 0.1f + 0.2f*sunAngle); - - LLColor4 water_color; - LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); - F32 up_dot = camera_up * LLVector3::z_axis; - if (LLViewerCamera::getInstance()->cameraUnderWater()) - { - water_color.setVec(1.f, 1.f, 1.f, 0.4f); - shader->uniform1f(LLShaderMgr::WATER_REFSCALE, param_mgr->getScaleBelow()); - } - else - { - water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot)); - shader->uniform1f(LLShaderMgr::WATER_REFSCALE, param_mgr->getScaleAbove()); - } - - if (water_color.mV[3] > 0.9f) - { - water_color.mV[3] = 0.9f; - } - - { - LLGLEnable depth_clamp(gGLManager.mHasDepthClamp ? GL_DEPTH_CLAMP : 0); - LLGLDisable cullface(GL_CULL_FACE); - for (std::vector::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace *face = *iter; - - if (voskyp->isReflFace(face)) - { - continue; - } - - LLVOWater* water = (LLVOWater*) face->getViewerObject(); - gGL.getTexUnit(diffTex)->bind(face->getTexture()); - - sNeedsReflectionUpdate = TRUE; - - if (water->getUseTexture() || !water->getIsEdgePatch()) - { - sNeedsDistortionUpdate = TRUE; - face->renderIndexed(); - } - else if (gGLManager.mHasDepthClamp || deferred_render) - { - face->renderIndexed(); - } - else - { - LLGLSquashToFarClip far_clip(glh_get_current_projection()); - face->renderIndexed(); - } - } - } - - shader->disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); - shader->disableTexture(LLShaderMgr::WATER_SCREENTEX); - shader->disableTexture(LLShaderMgr::BUMP_MAP); - shader->disableTexture(LLShaderMgr::DIFFUSE_MAP); - shader->disableTexture(LLShaderMgr::WATER_REFTEX); - shader->disableTexture(LLShaderMgr::WATER_SCREENDEPTH); - - if (deferred_render) - { - gPipeline.unbindDeferredShader(*shader); - } - else - { - shader->unbind(); - } - - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); - if (!deferred_render) - { - gGL.setColorMask(true, false); - } + if (!deferred_render) + { + gGL.setColorMask(true, true); + } + + LLVOSky *voskyp = gSky.mVOSkyp; + + if(voskyp == NULL) + { + return; + } + + LLGLDisable blend(GL_BLEND); + + LLColor3 light_diffuse(0,0,0); + F32 light_exp = 0.0f; + LLVector3 light_dir; + LLColor3 light_color; + + if (gSky.getSunDirection().mV[2] > LLSky::NIGHTTIME_ELEVATION_COS) + { + light_dir = gSky.getSunDirection(); + light_dir.normVec(); + light_color = gSky.getSunDiffuseColor(); + if(gSky.mVOSkyp) { + light_diffuse = gSky.mVOSkyp->getSun().getColorCached(); + light_diffuse.normVec(); + } + light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0); + light_diffuse *= light_exp + 0.25f; + } + else + { + light_dir = gSky.getMoonDirection(); + light_dir.normVec(); + light_color = gSky.getMoonDiffuseColor(); + light_diffuse = gSky.mVOSkyp->getMoon().getColorCached(); + light_diffuse.normVec(); + light_diffuse *= 0.5f; + light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0); + } + + light_exp *= light_exp; + light_exp *= light_exp; + light_exp *= light_exp; + light_exp *= light_exp; + light_exp *= 256.f; + light_exp = light_exp > 32.f ? light_exp : 32.f; + + LLGLSLShader* shader; + + F32 eyedepth = LLViewerCamera::getInstance()->getOrigin().mV[2] - gAgent.getRegion()->getWaterHeight(); + + if (eyedepth < 0.f && LLPipeline::sWaterReflections) + { + if (deferred_render) + { + shader = &gDeferredUnderWaterProgram; + } + else + { + shader = &gUnderWaterProgram; + } + } + else if (deferred_render) + { + shader = &gDeferredWaterProgram; + } + else + { + shader = &gWaterProgram; + } + + if (deferred_render) + { + gPipeline.bindDeferredShader(*shader); + } + else + { + shader->bind(); + } + + sTime = (F32)LLFrameTimer::getElapsedSeconds()*0.5f; + + S32 reftex = shader->enableTexture(LLShaderMgr::WATER_REFTEX); + + if (reftex > -1) + { + gGL.getTexUnit(reftex)->activate(); + gGL.getTexUnit(reftex)->bind(&gPipeline.mWaterRef); + gGL.getTexUnit(0)->activate(); + } + + //bind normal map + S32 bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP); + + LLWaterParamManager * param_mgr = &LLWaterParamManager::instance(); + + // change mWaterNormp if needed + if (mWaterNormp->getID() != param_mgr->getNormalMapID()) + { + mWaterNormp = LLViewerTextureManager::getFetchedTexture(param_mgr->getNormalMapID()); + } + + mWaterNormp->addTextureStats(1024.f*1024.f); + gGL.getTexUnit(bumpTex)->bind(mWaterNormp) ; + if (gSavedSettings.getBOOL("RenderWaterMipNormal")) + { + mWaterNormp->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC); + } + else + { + mWaterNormp->setFilteringOption(LLTexUnit::TFO_POINT); + } + + S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX); + + if (screentex > -1) + { + shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV); + shader->uniform1f(LLShaderMgr::WATER_FOGDENSITY, + param_mgr->getFogDensity()); + gPipeline.mWaterDis.bindTexture(0, screentex); + } + + stop_glerror(); + + gGL.getTexUnit(screentex)->bind(&gPipeline.mWaterDis); + + if (mVertexShaderLevel == 1) + { + sWaterFogColor.mV[3] = param_mgr->mDensitySliderValue; + shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV); + } + + F32 screenRes[] = + { + 1.f/gGLViewport[2], + 1.f/gGLViewport[3] + }; + shader->uniform2fv(LLShaderMgr::DEFERRED_SCREEN_RES, 1, screenRes); + stop_glerror(); + + S32 diffTex = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP); + stop_glerror(); + + light_dir.normVec(); + sLightDir = light_dir; + + light_diffuse *= 6.f; + + //shader->uniformMatrix4fv("inverse_ref", 1, GL_FALSE, (GLfloat*) gGLObliqueProjectionInverse.mMatrix); + shader->uniform1f(LLShaderMgr::WATER_WATERHEIGHT, eyedepth); + shader->uniform1f(LLShaderMgr::WATER_TIME, sTime); + shader->uniform3fv(LLShaderMgr::WATER_EYEVEC, 1, LLViewerCamera::getInstance()->getOrigin().mV); + shader->uniform3fv(LLShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV); + shader->uniform1f(LLShaderMgr::WATER_SPECULAR_EXP, light_exp); + shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, param_mgr->getWave1Dir().mV); + shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR2, 1, param_mgr->getWave2Dir().mV); + shader->uniform3fv(LLShaderMgr::WATER_LIGHT_DIR, 1, light_dir.mV); + + shader->uniform3fv(LLShaderMgr::WATER_NORM_SCALE, 1, param_mgr->getNormalScale().mV); + shader->uniform1f(LLShaderMgr::WATER_FRESNEL_SCALE, param_mgr->getFresnelScale()); + shader->uniform1f(LLShaderMgr::WATER_FRESNEL_OFFSET, param_mgr->getFresnelOffset()); + shader->uniform1f(LLShaderMgr::WATER_BLUR_MULTIPLIER, param_mgr->getBlurMultiplier()); + + F32 sunAngle = llmax(0.f, light_dir.mV[2]); + F32 scaledAngle = 1.f - sunAngle; + + shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE, sunAngle); + shader->uniform1f(LLShaderMgr::WATER_SCALED_ANGLE, scaledAngle); + shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE2, 0.1f + 0.2f*sunAngle); + + LLColor4 water_color; + LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); + F32 up_dot = camera_up * LLVector3::z_axis; + if (LLViewerCamera::getInstance()->cameraUnderWater()) + { + water_color.setVec(1.f, 1.f, 1.f, 0.4f); + shader->uniform1f(LLShaderMgr::WATER_REFSCALE, param_mgr->getScaleBelow()); + } + else + { + water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot)); + shader->uniform1f(LLShaderMgr::WATER_REFSCALE, param_mgr->getScaleAbove()); + } + + if (water_color.mV[3] > 0.9f) + { + water_color.mV[3] = 0.9f; + } + + { + LLGLEnable depth_clamp(gGLManager.mHasDepthClamp ? GL_DEPTH_CLAMP : 0); + LLGLDisable cullface(GL_CULL_FACE); + for (std::vector::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace *face = *iter; + + if (voskyp->isReflFace(face)) + { + continue; + } + + LLVOWater* water = (LLVOWater*) face->getViewerObject(); + gGL.getTexUnit(diffTex)->bind(face->getTexture()); + + sNeedsReflectionUpdate = TRUE; + + if (water->getUseTexture() || !water->getIsEdgePatch()) + { + sNeedsDistortionUpdate = TRUE; + face->renderIndexed(); + } + else if (gGLManager.mHasDepthClamp || deferred_render) + { + face->renderIndexed(); + } + else + { + LLGLSquashToFarClip far_clip(glh_get_current_projection()); + face->renderIndexed(); + } + } + } + + shader->disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); + shader->disableTexture(LLShaderMgr::WATER_SCREENTEX); + shader->disableTexture(LLShaderMgr::BUMP_MAP); + shader->disableTexture(LLShaderMgr::DIFFUSE_MAP); + shader->disableTexture(LLShaderMgr::WATER_REFTEX); + shader->disableTexture(LLShaderMgr::WATER_SCREENDEPTH); + + if (deferred_render) + { + gPipeline.unbindDeferredShader(*shader); + } + else + { + shader->unbind(); + } + + gGL.getTexUnit(0)->activate(); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + if (!deferred_render) + { + gGL.setColorMask(true, false); + } } LLViewerTexture *LLDrawPoolWater::getDebugTexture() { - return LLViewerFetchedTexture::sSmokeImagep; + return LLViewerFetchedTexture::sSmokeImagep; } LLColor3 LLDrawPoolWater::getDebugColor() const { - return LLColor3(0.f, 1.f, 1.f); + return LLColor3(0.f, 1.f, 1.f); } diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 2582715dd9..c12ccb386e 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -46,7 +46,7 @@ static LLDefaultChildRegistry::Register r("panel_camera_item"); -const F32 NUDGE_TIME = 0.25f; // in seconds +const F32 NUDGE_TIME = 0.25f; // in seconds const F32 ORBIT_NUDGE_RATE = 0.05f; // fraction of normal speed // constants @@ -61,94 +61,94 @@ bool LLFloaterCamera::sAppearanceEditing = false; // Zoom the camera in and out class LLPanelCameraZoom -: public LLPanel +: public LLPanel { - LOG_CLASS(LLPanelCameraZoom); + LOG_CLASS(LLPanelCameraZoom); public: - LLPanelCameraZoom(); + LLPanelCameraZoom(); - /* virtual */ BOOL postBuild(); - /* virtual */ void draw(); + /* virtual */ BOOL postBuild(); + /* virtual */ void draw(); protected: - void onZoomPlusHeldDown(); - void onZoomMinusHeldDown(); - void onSliderValueChanged(); - void onCameraTrack(); - void onCameraRotate(); - F32 getOrbitRate(F32 time); + void onZoomPlusHeldDown(); + void onZoomMinusHeldDown(); + void onSliderValueChanged(); + void onCameraTrack(); + void onCameraRotate(); + F32 getOrbitRate(F32 time); private: - LLButton* mPlusBtn; - LLButton* mMinusBtn; - LLSlider* mSlider; + LLButton* mPlusBtn; + LLButton* mMinusBtn; + LLSlider* mSlider; }; LLPanelCameraItem::Params::Params() -: icon_over("icon_over"), - icon_selected("icon_selected"), - picture("picture"), - text("text"), - selected_picture("selected_picture"), - mousedown_callback("mousedown_callback") +: icon_over("icon_over"), + icon_selected("icon_selected"), + picture("picture"), + text("text"), + selected_picture("selected_picture"), + mousedown_callback("mousedown_callback") { } LLPanelCameraItem::LLPanelCameraItem(const LLPanelCameraItem::Params& p) -: LLPanel(p) +: LLPanel(p) { - LLIconCtrl::Params icon_params = p.picture; - mPicture = LLUICtrlFactory::create(icon_params); - addChild(mPicture); + LLIconCtrl::Params icon_params = p.picture; + mPicture = LLUICtrlFactory::create(icon_params); + addChild(mPicture); - icon_params = p.icon_over; - mIconOver = LLUICtrlFactory::create(icon_params); - addChild(mIconOver); + icon_params = p.icon_over; + mIconOver = LLUICtrlFactory::create(icon_params); + addChild(mIconOver); - icon_params = p.icon_selected; - mIconSelected = LLUICtrlFactory::create(icon_params); - addChild(mIconSelected); + icon_params = p.icon_selected; + mIconSelected = LLUICtrlFactory::create(icon_params); + addChild(mIconSelected); - icon_params = p.selected_picture; - mPictureSelected = LLUICtrlFactory::create(icon_params); - addChild(mPictureSelected); + icon_params = p.selected_picture; + mPictureSelected = LLUICtrlFactory::create(icon_params); + addChild(mPictureSelected); - LLTextBox::Params text_params = p.text; - mText = LLUICtrlFactory::create(text_params); - addChild(mText); + LLTextBox::Params text_params = p.text; + mText = LLUICtrlFactory::create(text_params); + addChild(mText); - if (p.mousedown_callback.isProvided()) - { - setCommitCallback(initCommitCallback(p.mousedown_callback)); - } + if (p.mousedown_callback.isProvided()) + { + setCommitCallback(initCommitCallback(p.mousedown_callback)); + } } void set_view_visible(LLView* parent, const std::string& name, bool visible) { - parent->getChildView(name)->setVisible(visible); + parent->getChildView(name)->setVisible(visible); } BOOL LLPanelCameraItem::postBuild() { - setMouseEnterCallback(boost::bind(set_view_visible, this, "hovered_icon", true)); - setMouseLeaveCallback(boost::bind(set_view_visible, this, "hovered_icon", false)); - setMouseDownCallback(boost::bind(&LLPanelCameraItem::onAnyMouseClick, this)); - setRightMouseDownCallback(boost::bind(&LLPanelCameraItem::onAnyMouseClick, this)); - return TRUE; + setMouseEnterCallback(boost::bind(set_view_visible, this, "hovered_icon", true)); + setMouseLeaveCallback(boost::bind(set_view_visible, this, "hovered_icon", false)); + setMouseDownCallback(boost::bind(&LLPanelCameraItem::onAnyMouseClick, this)); + setRightMouseDownCallback(boost::bind(&LLPanelCameraItem::onAnyMouseClick, this)); + return TRUE; } void LLPanelCameraItem::onAnyMouseClick() { - if (mCommitSignal) (*mCommitSignal)(this, LLSD()); + if (mCommitSignal) (*mCommitSignal)(this, LLSD()); } void LLPanelCameraItem::setValue(const LLSD& value) { - if (!value.isMap()) return;; - if (!value.has("selected")) return; - getChildView("selected_icon")->setVisible( value["selected"]); - getChildView("picture")->setVisible( !value["selected"]); - getChildView("selected_picture")->setVisible( value["selected"]); + if (!value.isMap()) return;; + if (!value.has("selected")) return; + getChildView("selected_icon")->setVisible( value["selected"]); + getChildView("picture")->setVisible( !value["selected"]); + getChildView("selected_picture")->setVisible( value["selected"]); } static LLPanelInjector t_camera_zoom_panel("camera_zoom_panel"); @@ -158,85 +158,85 @@ static LLPanelInjector t_camera_zoom_panel("camera_zoom_panel //------------------------------------------------------------------------------- LLPanelCameraZoom::LLPanelCameraZoom() -: mPlusBtn( NULL ), - mMinusBtn( NULL ), - mSlider( NULL ) +: mPlusBtn( NULL ), + mMinusBtn( NULL ), + mSlider( NULL ) { - mCommitCallbackRegistrar.add("Zoom.minus", boost::bind(&LLPanelCameraZoom::onZoomMinusHeldDown, this)); - mCommitCallbackRegistrar.add("Zoom.plus", boost::bind(&LLPanelCameraZoom::onZoomPlusHeldDown, this)); - mCommitCallbackRegistrar.add("Slider.value_changed", boost::bind(&LLPanelCameraZoom::onSliderValueChanged, this)); - mCommitCallbackRegistrar.add("Camera.track", boost::bind(&LLPanelCameraZoom::onCameraTrack, this)); - mCommitCallbackRegistrar.add("Camera.rotate", boost::bind(&LLPanelCameraZoom::onCameraRotate, this)); + mCommitCallbackRegistrar.add("Zoom.minus", boost::bind(&LLPanelCameraZoom::onZoomMinusHeldDown, this)); + mCommitCallbackRegistrar.add("Zoom.plus", boost::bind(&LLPanelCameraZoom::onZoomPlusHeldDown, this)); + mCommitCallbackRegistrar.add("Slider.value_changed", boost::bind(&LLPanelCameraZoom::onSliderValueChanged, this)); + mCommitCallbackRegistrar.add("Camera.track", boost::bind(&LLPanelCameraZoom::onCameraTrack, this)); + mCommitCallbackRegistrar.add("Camera.rotate", boost::bind(&LLPanelCameraZoom::onCameraRotate, this)); } BOOL LLPanelCameraZoom::postBuild() { - mPlusBtn = getChild ("zoom_plus_btn"); - mMinusBtn = getChild ("zoom_minus_btn"); - mSlider = getChild ("zoom_slider"); - return LLPanel::postBuild(); + mPlusBtn = getChild ("zoom_plus_btn"); + mMinusBtn = getChild ("zoom_minus_btn"); + mSlider = getChild ("zoom_slider"); + return LLPanel::postBuild(); } void LLPanelCameraZoom::draw() { - mSlider->setValue(gAgentCamera.getCameraZoomFraction()); - LLPanel::draw(); + mSlider->setValue(gAgentCamera.getCameraZoomFraction()); + LLPanel::draw(); } void LLPanelCameraZoom::onZoomPlusHeldDown() { - F32 val = mSlider->getValueF32(); - F32 inc = mSlider->getIncrement(); - mSlider->setValue(val - inc); - F32 time = mPlusBtn->getHeldDownTime(); - gAgentCamera.unlockView(); - gAgentCamera.setOrbitInKey(getOrbitRate(time)); + F32 val = mSlider->getValueF32(); + F32 inc = mSlider->getIncrement(); + mSlider->setValue(val - inc); + F32 time = mPlusBtn->getHeldDownTime(); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitInKey(getOrbitRate(time)); } void LLPanelCameraZoom::onZoomMinusHeldDown() { - F32 val = mSlider->getValueF32(); - F32 inc = mSlider->getIncrement(); - mSlider->setValue(val + inc); - F32 time = mMinusBtn->getHeldDownTime(); - gAgentCamera.unlockView(); - gAgentCamera.setOrbitOutKey(getOrbitRate(time)); + F32 val = mSlider->getValueF32(); + F32 inc = mSlider->getIncrement(); + mSlider->setValue(val + inc); + F32 time = mMinusBtn->getHeldDownTime(); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitOutKey(getOrbitRate(time)); } void LLPanelCameraZoom::onCameraTrack() { - // EXP-202 when camera panning activated, remove the hint - LLFirstUse::viewPopup( false ); + // EXP-202 when camera panning activated, remove the hint + LLFirstUse::viewPopup( false ); } void LLPanelCameraZoom::onCameraRotate() { - // EXP-202 when camera rotation activated, remove the hint - LLFirstUse::viewPopup( false ); + // EXP-202 when camera rotation activated, remove the hint + LLFirstUse::viewPopup( false ); } F32 LLPanelCameraZoom::getOrbitRate(F32 time) { - if( time < NUDGE_TIME ) - { - F32 rate = ORBIT_NUDGE_RATE + time * (1 - ORBIT_NUDGE_RATE)/ NUDGE_TIME; - return rate; - } - else - { - return 1; - } + if( time < NUDGE_TIME ) + { + F32 rate = ORBIT_NUDGE_RATE + time * (1 - ORBIT_NUDGE_RATE)/ NUDGE_TIME; + return rate; + } + else + { + return 1; + } } void LLPanelCameraZoom::onSliderValueChanged() { - F32 zoom_level = mSlider->getValueF32(); - gAgentCamera.setCameraZoomFraction(zoom_level); + F32 zoom_level = mSlider->getValueF32(); + gAgentCamera.setCameraZoomFraction(zoom_level); } void activate_camera_tool() { - LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance()); + LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance()); }; // @@ -245,375 +245,375 @@ void activate_camera_tool() /*static*/ bool LLFloaterCamera::inFreeCameraMode() { - LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); - if (floater_camera && floater_camera->mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA && gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) - { - return true; - } - return false; + LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); + if (floater_camera && floater_camera->mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA && gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) + { + return true; + } + return false; } void LLFloaterCamera::resetCameraMode() { - LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); - if (!floater_camera) return; - floater_camera->switchMode(CAMERA_CTRL_MODE_PAN); + LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); + if (!floater_camera) return; + floater_camera->switchMode(CAMERA_CTRL_MODE_PAN); } void LLFloaterCamera::onAvatarEditingAppearance(bool editing) { - sAppearanceEditing = editing; - LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); - if (!floater_camera) return; - floater_camera->handleAvatarEditingAppearance(editing); + sAppearanceEditing = editing; + LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); + if (!floater_camera) return; + floater_camera->handleAvatarEditingAppearance(editing); } void LLFloaterCamera::handleAvatarEditingAppearance(bool editing) { - //camera presets (rear, front, etc.) - getChildView("preset_views_list")->setEnabled(!editing); - getChildView("presets_btn")->setEnabled(!editing); + //camera presets (rear, front, etc.) + getChildView("preset_views_list")->setEnabled(!editing); + getChildView("presets_btn")->setEnabled(!editing); - //camera modes (object view, mouselook view) - getChildView("camera_modes_list")->setEnabled(!editing); - getChildView("avatarview_btn")->setEnabled(!editing); + //camera modes (object view, mouselook view) + getChildView("camera_modes_list")->setEnabled(!editing); + getChildView("avatarview_btn")->setEnabled(!editing); } void LLFloaterCamera::update() { - ECameraControlMode mode = determineMode(); - if (mode != mCurrMode) setMode(mode); + ECameraControlMode mode = determineMode(); + if (mode != mCurrMode) setMode(mode); } void LLFloaterCamera::toPrevMode() { - switchMode(mPrevMode); + switchMode(mPrevMode); } /*static*/ void LLFloaterCamera::onLeavingMouseLook() { - LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); - if (floater_camera) - { - floater_camera->updateItemsSelection(); - if(floater_camera->inFreeCameraMode()) - { - activate_camera_tool(); - } - } + LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); + if (floater_camera) + { + floater_camera->updateItemsSelection(); + if(floater_camera->inFreeCameraMode()) + { + activate_camera_tool(); + } + } } LLFloaterCamera* LLFloaterCamera::findInstance() { - return LLFloaterReg::findTypedInstance("camera"); + return LLFloaterReg::findTypedInstance("camera"); } void LLFloaterCamera::onOpen(const LLSD& key) { - LLFirstUse::viewPopup(); + LLFirstUse::viewPopup(); - mZoom->onOpen(key); + mZoom->onOpen(key); - // Returns to previous mode, see EXT-2727(View tool should remember state). - // In case floater was just hidden and it isn't reset the mode - // just update state to current one. Else go to previous. - if ( !mClosed ) - updateState(); - else - toPrevMode(); - mClosed = FALSE; + // Returns to previous mode, see EXT-2727(View tool should remember state). + // In case floater was just hidden and it isn't reset the mode + // just update state to current one. Else go to previous. + if ( !mClosed ) + updateState(); + else + toPrevMode(); + mClosed = FALSE; } void LLFloaterCamera::onClose(bool app_quitting) { - //We don't care of camera mode if app is quitting - if(app_quitting) - return; - // It is necessary to reset mCurrMode to CAMERA_CTRL_MODE_PAN so - // to avoid seeing an empty floater when reopening the control. - if (mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA) - mCurrMode = CAMERA_CTRL_MODE_PAN; - // When mCurrMode is in CAMERA_CTRL_MODE_PAN - // switchMode won't modify mPrevMode, so force it here. - // It is needed to correctly return to previous mode on open, see EXT-2727. - if (mCurrMode == CAMERA_CTRL_MODE_PAN) - mPrevMode = CAMERA_CTRL_MODE_PAN; + //We don't care of camera mode if app is quitting + if(app_quitting) + return; + // It is necessary to reset mCurrMode to CAMERA_CTRL_MODE_PAN so + // to avoid seeing an empty floater when reopening the control. + if (mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA) + mCurrMode = CAMERA_CTRL_MODE_PAN; + // When mCurrMode is in CAMERA_CTRL_MODE_PAN + // switchMode won't modify mPrevMode, so force it here. + // It is needed to correctly return to previous mode on open, see EXT-2727. + if (mCurrMode == CAMERA_CTRL_MODE_PAN) + mPrevMode = CAMERA_CTRL_MODE_PAN; - switchMode(CAMERA_CTRL_MODE_PAN); - mClosed = TRUE; + switchMode(CAMERA_CTRL_MODE_PAN); + mClosed = TRUE; - gAgent.setMovementLocked(FALSE); + gAgent.setMovementLocked(FALSE); } LLFloaterCamera::LLFloaterCamera(const LLSD& val) -: LLFloater(val), - mClosed(FALSE), - mCurrMode(CAMERA_CTRL_MODE_PAN), - mPrevMode(CAMERA_CTRL_MODE_PAN) +: LLFloater(val), + mClosed(FALSE), + mCurrMode(CAMERA_CTRL_MODE_PAN), + mPrevMode(CAMERA_CTRL_MODE_PAN) { - LLHints::registerHintTarget("view_popup", getHandle()); - mCommitCallbackRegistrar.add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2)); - mCommitCallbackRegistrar.add("Presets.GoViewPrefs", boost::bind(&LLFloaterCamera::onViewButtonClick, this, _2)); + 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 BOOL LLFloaterCamera::postBuild() { - updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730) + updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730) - mRotate = getChild(ORBIT); - mZoom = findChild(ZOOM); - mTrack = getChild(PAN); + mRotate = getChild(ORBIT); + mZoom = findChild(ZOOM); + mTrack = getChild(PAN); - assignButton2Mode(CAMERA_CTRL_MODE_MODES, "avatarview_btn"); - assignButton2Mode(CAMERA_CTRL_MODE_PAN, "pan_btn"); - assignButton2Mode(CAMERA_CTRL_MODE_PRESETS, "presets_btn"); + assignButton2Mode(CAMERA_CTRL_MODE_MODES, "avatarview_btn"); + assignButton2Mode(CAMERA_CTRL_MODE_PAN, "pan_btn"); + assignButton2Mode(CAMERA_CTRL_MODE_PRESETS, "presets_btn"); - update(); + update(); - // ensure that appearance mode is handled while building. See EXT-7796. - handleAvatarEditingAppearance(sAppearanceEditing); + // ensure that appearance mode is handled while building. See EXT-7796. + handleAvatarEditingAppearance(sAppearanceEditing); - return LLFloater::postBuild(); + return LLFloater::postBuild(); } -F32 LLFloaterCamera::getCurrentTransparency() +F32 LLFloaterCamera::getCurrentTransparency() { - static LLCachedControl camera_opacity(gSavedSettings, "CameraOpacity"); - static LLCachedControl active_floater_transparency(gSavedSettings, "ActiveFloaterTransparency"); - return llmin(camera_opacity(), active_floater_transparency()); + 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 - 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("view"); - if (tabcontainer && graphicspanel) - { - tabcontainer->selectTabPanel(graphicspanel); - } - } + // 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("view"); + 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 - // is changed in process - const child_list_t child_list = *panel->getChildList(); - child_list_t::const_reverse_iterator iter = child_list.rbegin(); - child_list_t::const_reverse_iterator end = child_list.rend(); - for ( ; iter != end; ++iter) - { - LLView* view = *iter; - LLPanel* item = dynamic_cast(view); - if (panel) - list->addItem(item); - } + // copying child list and then iterating over a copy, because list itself + // is changed in process + const child_list_t child_list = *panel->getChildList(); + child_list_t::const_reverse_iterator iter = child_list.rbegin(); + child_list_t::const_reverse_iterator end = child_list.rend(); + for ( ; iter != end; ++iter) + { + LLView* view = *iter; + LLPanel* item = dynamic_cast(view); + if (panel) + list->addItem(item); + } } ECameraControlMode LLFloaterCamera::determineMode() { - if (sAppearanceEditing) - { - // this is the only enabled camera mode while editing agent appearance. - return CAMERA_CTRL_MODE_PAN; - } + if (sAppearanceEditing) + { + // this is the only enabled camera mode while editing agent appearance. + return CAMERA_CTRL_MODE_PAN; + } - LLTool* curr_tool = LLToolMgr::getInstance()->getCurrentTool(); - if (curr_tool == LLToolCamera::getInstance()) - { - return CAMERA_CTRL_MODE_FREE_CAMERA; - } + LLTool* curr_tool = LLToolMgr::getInstance()->getCurrentTool(); + if (curr_tool == LLToolCamera::getInstance()) + { + return CAMERA_CTRL_MODE_FREE_CAMERA; + } - if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) - { - return CAMERA_CTRL_MODE_PRESETS; - } + if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) + { + return CAMERA_CTRL_MODE_PRESETS; + } - return CAMERA_CTRL_MODE_PAN; + return CAMERA_CTRL_MODE_PAN; } void clear_camera_tool() { - LLToolMgr* tool_mgr = LLToolMgr::getInstance(); - if (tool_mgr->usingTransientTool() && - tool_mgr->getCurrentTool() == LLToolCamera::getInstance()) - { - tool_mgr->clearTransientTool(); - } + LLToolMgr* tool_mgr = LLToolMgr::getInstance(); + if (tool_mgr->usingTransientTool() && + tool_mgr->getCurrentTool() == LLToolCamera::getInstance()) + { + tool_mgr->clearTransientTool(); + } } void LLFloaterCamera::setMode(ECameraControlMode mode) { - if (mode != mCurrMode) - { - mPrevMode = mCurrMode; - mCurrMode = mode; - } - - updateState(); + if (mode != mCurrMode) + { + mPrevMode = mCurrMode; + mCurrMode = mode; + } + + updateState(); } void LLFloaterCamera::switchMode(ECameraControlMode mode) { - setMode(mode); + setMode(mode); - switch (mode) - { - case CAMERA_CTRL_MODE_MODES: - if(sFreeCamera) - { - switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); - } - break; + switch (mode) + { + case CAMERA_CTRL_MODE_MODES: + if(sFreeCamera) + { + switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); + } + break; - case CAMERA_CTRL_MODE_PAN: - sFreeCamera = false; - clear_camera_tool(); - break; + case CAMERA_CTRL_MODE_PAN: + sFreeCamera = false; + clear_camera_tool(); + break; - case CAMERA_CTRL_MODE_FREE_CAMERA: - sFreeCamera = true; - activate_camera_tool(); - break; + case CAMERA_CTRL_MODE_FREE_CAMERA: + sFreeCamera = true; + activate_camera_tool(); + break; - case CAMERA_CTRL_MODE_PRESETS: - if(sFreeCamera) - { - switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); - } - break; + case CAMERA_CTRL_MODE_PRESETS: + if(sFreeCamera) + { + switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); + } + break; - default: - //normally we won't occur here - llassert_always(FALSE); - } + default: + //normally we won't occur here + llassert_always(FALSE); + } } void LLFloaterCamera::onClickBtn(ECameraControlMode mode) { - // check for a click on active button - if (mCurrMode == mode) mMode2Button[mode]->setToggleState(TRUE); - - switchMode(mode); + // check for a click on active button + if (mCurrMode == mode) mMode2Button[mode]->setToggleState(TRUE); + + switchMode(mode); } void LLFloaterCamera::assignButton2Mode(ECameraControlMode mode, const std::string& button_name) { - LLButton* button = getChild(button_name); - - button->setClickedCallback(boost::bind(&LLFloaterCamera::onClickBtn, this, mode)); - mMode2Button[mode] = button; + LLButton* button = getChild(button_name); + + button->setClickedCallback(boost::bind(&LLFloaterCamera::onClickBtn, this, mode)); + mMode2Button[mode] = button; } void LLFloaterCamera::updateState() { - getChildView(ZOOM)->setVisible(CAMERA_CTRL_MODE_PAN == mCurrMode); - - bool show_presets = (CAMERA_CTRL_MODE_PRESETS == mCurrMode) || (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode - && CAMERA_CTRL_MODE_PRESETS == mPrevMode); - getChildView(PRESETS)->setVisible(show_presets); - - bool show_camera_modes = CAMERA_CTRL_MODE_MODES == mCurrMode || (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode - && CAMERA_CTRL_MODE_MODES == mPrevMode); - getChildView("camera_modes_list")->setVisible( show_camera_modes); + getChildView(ZOOM)->setVisible(CAMERA_CTRL_MODE_PAN == mCurrMode); + + bool show_presets = (CAMERA_CTRL_MODE_PRESETS == mCurrMode) || (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode + && CAMERA_CTRL_MODE_PRESETS == mPrevMode); + getChildView(PRESETS)->setVisible(show_presets); + + bool show_camera_modes = CAMERA_CTRL_MODE_MODES == mCurrMode || (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode + && CAMERA_CTRL_MODE_MODES == mPrevMode); + getChildView("camera_modes_list")->setVisible( show_camera_modes); - updateItemsSelection(); + updateItemsSelection(); - if (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode) - { - return; - } + if (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode) + { + return; + } - //updating buttons - std::map::const_iterator iter = mMode2Button.begin(); - for (; iter != mMode2Button.end(); ++iter) - { - iter->second->setToggleState(iter->first == mCurrMode); - } + //updating buttons + std::map::const_iterator iter = mMode2Button.begin(); + for (; iter != mMode2Button.end(); ++iter) + { + iter->second->setToggleState(iter->first == mCurrMode); + } } void LLFloaterCamera::updateItemsSelection() { - ECameraPreset preset = (ECameraPreset) gSavedSettings.getU32("CameraPreset"); - LLSD argument; - argument["selected"] = preset == CAMERA_PRESET_REAR_VIEW; - getChild("rear_view")->setValue(argument); - argument["selected"] = preset == CAMERA_PRESET_GROUP_VIEW; - getChild("group_view")->setValue(argument); - argument["selected"] = preset == CAMERA_PRESET_FRONT_VIEW; - getChild("front_view")->setValue(argument); - argument["selected"] = gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK; - getChild("mouselook_view")->setValue(argument); - argument["selected"] = mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA; - getChild("object_view")->setValue(argument); + ECameraPreset preset = (ECameraPreset) gSavedSettings.getU32("CameraPreset"); + LLSD argument; + argument["selected"] = preset == CAMERA_PRESET_REAR_VIEW; + getChild("rear_view")->setValue(argument); + argument["selected"] = preset == CAMERA_PRESET_GROUP_VIEW; + getChild("group_view")->setValue(argument); + argument["selected"] = preset == CAMERA_PRESET_FRONT_VIEW; + getChild("front_view")->setValue(argument); + argument["selected"] = gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK; + getChild("mouselook_view")->setValue(argument); + argument["selected"] = mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA; + getChild("object_view")->setValue(argument); } void LLFloaterCamera::onClickCameraItem(const LLSD& param) { - std::string name = param.asString(); - - if ("mouselook_view" == name) - { - gAgentCamera.changeCameraToMouselook(); - } - else if ("object_view" == name) - { - LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance(); - if (camera_floater) - camera_floater->switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); - } - else - { - switchToPreset(name); - } - - LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance(); - if (camera_floater) - { - camera_floater->updateItemsSelection(); - camera_floater->fromFreeToPresets(); - } + std::string name = param.asString(); + + if ("mouselook_view" == name) + { + gAgentCamera.changeCameraToMouselook(); + } + else if ("object_view" == name) + { + LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance(); + if (camera_floater) + camera_floater->switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); + } + else + { + switchToPreset(name); + } + + LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance(); + if (camera_floater) + { + camera_floater->updateItemsSelection(); + camera_floater->fromFreeToPresets(); + } } /*static*/ void LLFloaterCamera::switchToPreset(const std::string& name) { - sFreeCamera = false; - clear_camera_tool(); - if ("rear_view" == name) - { - gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); - } - else if ("group_view" == name) - { - gAgentCamera.switchCameraPreset(CAMERA_PRESET_GROUP_VIEW); - } - else if ("front_view" == name) - { - gAgentCamera.switchCameraPreset(CAMERA_PRESET_FRONT_VIEW); - } + sFreeCamera = false; + clear_camera_tool(); + if ("rear_view" == name) + { + gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); + } + else if ("group_view" == name) + { + gAgentCamera.switchCameraPreset(CAMERA_PRESET_GROUP_VIEW); + } + else if ("front_view" == name) + { + gAgentCamera.switchCameraPreset(CAMERA_PRESET_FRONT_VIEW); + } } void LLFloaterCamera::fromFreeToPresets() { - if (!sFreeCamera && mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA && mPrevMode == CAMERA_CTRL_MODE_PRESETS) - { - switchMode(CAMERA_CTRL_MODE_PRESETS); - } + if (!sFreeCamera && mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA && mPrevMode == CAMERA_CTRL_MODE_PRESETS) + { + switchMode(CAMERA_CTRL_MODE_PRESETS); + } } diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index 1b24b143bf..481e9aec1b 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -39,95 +39,95 @@ class LLPanelCameraZoom; enum ECameraControlMode { - CAMERA_CTRL_MODE_MODES, - CAMERA_CTRL_MODE_PAN, - CAMERA_CTRL_MODE_FREE_CAMERA, - CAMERA_CTRL_MODE_PRESETS + CAMERA_CTRL_MODE_MODES, + CAMERA_CTRL_MODE_PAN, + CAMERA_CTRL_MODE_FREE_CAMERA, + CAMERA_CTRL_MODE_PRESETS }; class LLFloaterCamera : public LLFloater { - friend class LLFloaterReg; - + friend class LLFloaterReg; + public: - /* whether in free camera mode */ - static bool inFreeCameraMode(); - /* callback for camera items selection changing */ - static void onClickCameraItem(const LLSD& param); + /* whether in free camera mode */ + static bool inFreeCameraMode(); + /* callback for camera items selection changing */ + static void onClickCameraItem(const LLSD& param); - static void onLeavingMouseLook(); + static void onLeavingMouseLook(); - /** resets current camera mode to orbit mode */ - static void resetCameraMode(); + /** resets current camera mode to orbit mode */ + static void resetCameraMode(); - /** Called when Avatar is entered/exited editing appearance mode */ - static void onAvatarEditingAppearance(bool editing); + /** Called when Avatar is entered/exited editing appearance mode */ + static void onAvatarEditingAppearance(bool editing); - /* determines actual mode and updates ui */ - void update(); + /* determines actual mode and updates ui */ + void update(); - /*switch to one of the camera presets (front, rear, side)*/ - static void switchToPreset(const std::string& name); + /*switch to one of the camera presets (front, rear, side)*/ + static void switchToPreset(const std::string& name); - /* move to CAMERA_CTRL_MODE_PRESETS from CAMERA_CTRL_MODE_FREE_CAMERA if we are on presets panel and - are not in free camera mode*/ - void fromFreeToPresets(); + /* move to CAMERA_CTRL_MODE_PRESETS from CAMERA_CTRL_MODE_FREE_CAMERA if we are on presets panel and + are not in free camera mode*/ + void fromFreeToPresets(); - virtual void onOpen(const LLSD& key); - virtual void onClose(bool app_quitting); + virtual void onOpen(const LLSD& key); + virtual void onClose(bool app_quitting); - LLJoystickCameraRotate* mRotate; - LLPanelCameraZoom* mZoom; - LLJoystickCameraTrack* mTrack; + LLJoystickCameraRotate* mRotate; + LLPanelCameraZoom* mZoom; + LLJoystickCameraTrack* mTrack; private: - LLFloaterCamera(const LLSD& val); - ~LLFloaterCamera() {}; + LLFloaterCamera(const LLSD& val); + ~LLFloaterCamera() {}; - /* return instance if it exists - created by LLFloaterReg */ - static LLFloaterCamera* findInstance(); + /* return instance if it exists - created by LLFloaterReg */ + static LLFloaterCamera* findInstance(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ BOOL postBuild(); - F32 getCurrentTransparency(); + F32 getCurrentTransparency(); - void onViewButtonClick(const LLSD& user_data); + void onViewButtonClick(const LLSD& user_data); - ECameraControlMode determineMode(); + ECameraControlMode determineMode(); - /* resets to the previous mode */ - void toPrevMode(); + /* resets to the previous mode */ + void toPrevMode(); - /* sets a new mode and performs related actions */ - void switchMode(ECameraControlMode mode); + /* sets a new mode and performs related actions */ + void switchMode(ECameraControlMode mode); - /* sets a new mode preserving previous one and updates ui*/ - void setMode(ECameraControlMode mode); + /* sets a new mode preserving previous one and updates ui*/ + void setMode(ECameraControlMode mode); - /* updates the state (UI) according to the current mode */ - void updateState(); + /* updates the state (UI) according to the current mode */ + void updateState(); - /* update camera modes items selection and camera preset items selection according to the currently selected preset */ - void updateItemsSelection(); + /* update camera modes items selection and camera preset items selection according to the currently selected preset */ + void updateItemsSelection(); - void onClickBtn(ECameraControlMode mode); - void assignButton2Mode(ECameraControlMode mode, const std::string& button_name); - - // fills flatlist with items from given panel - void fillFlatlistFromPanel (LLFlatListView* list, LLPanel* panel); + void onClickBtn(ECameraControlMode mode); + void assignButton2Mode(ECameraControlMode mode, const std::string& button_name); + + // fills flatlist with items from given panel + void fillFlatlistFromPanel (LLFlatListView* list, LLPanel* panel); - void handleAvatarEditingAppearance(bool editing); + void handleAvatarEditingAppearance(bool editing); - // set to true when free camera mode is selected in modes list - // remains true until preset camera mode is chosen, or pan button is clicked, or escape pressed - static bool sFreeCamera; - static bool sAppearanceEditing; - BOOL mClosed; - ECameraControlMode mPrevMode; - ECameraControlMode mCurrMode; - std::map mMode2Button; + // set to true when free camera mode is selected in modes list + // remains true until preset camera mode is chosen, or pan button is clicked, or escape pressed + static bool sFreeCamera; + static bool sAppearanceEditing; + BOOL mClosed; + ECameraControlMode mPrevMode; + ECameraControlMode mCurrMode; + std::map mMode2Button; }; /** @@ -138,33 +138,33 @@ private: * it's items are used inside of flatlist. */ class LLPanelCameraItem - : public LLPanel + : public LLPanel { public: - struct Params : public LLInitParam::Block - { - Optional icon_over; - Optional icon_selected; - Optional picture; - Optional selected_picture; - - Optional text; - Optional mousedown_callback; - Params(); - }; - /*virtual*/ BOOL postBuild(); - /** setting on/off background icon to indicate selected state */ - /*virtual*/ void setValue(const LLSD& value); - // sends commit signal - void onAnyMouseClick(); + struct Params : public LLInitParam::Block + { + Optional icon_over; + Optional icon_selected; + Optional picture; + Optional selected_picture; + + Optional text; + Optional mousedown_callback; + Params(); + }; + /*virtual*/ BOOL postBuild(); + /** setting on/off background icon to indicate selected state */ + /*virtual*/ void setValue(const LLSD& value); + // sends commit signal + void onAnyMouseClick(); protected: - friend class LLUICtrlFactory; - LLPanelCameraItem(const Params&); - LLIconCtrl* mIconOver; - LLIconCtrl* mIconSelected; - LLIconCtrl* mPicture; - LLIconCtrl* mPictureSelected; - LLTextBox* mText; + friend class LLUICtrlFactory; + LLPanelCameraItem(const Params&); + LLIconCtrl* mIconOver; + LLIconCtrl* mIconSelected; + LLIconCtrl* mPicture; + LLIconCtrl* mPictureSelected; + LLTextBox* mText; }; #endif diff --git a/indra/newview/llfloaterdeleteprefpreset.cpp b/indra/newview/llfloaterdeleteprefpreset.cpp index dd8117f95f..bd62849b42 100644 --- a/indra/newview/llfloaterdeleteprefpreset.cpp +++ b/indra/newview/llfloaterdeleteprefpreset.cpp @@ -37,65 +37,65 @@ #include "llfloaterreg.h" LLFloaterDeletePrefPreset::LLFloaterDeletePrefPreset(const LLSD &key) -: LLFloater(key) +: LLFloater(key) { } // virtual BOOL LLFloaterDeletePrefPreset::postBuild() { - LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance("preferences"); - if (preferences) - { - preferences->addDependentFloater(this); - } - getChild("delete")->setCommitCallback(boost::bind(&LLFloaterDeletePrefPreset::onBtnDelete, this)); - getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterDeletePrefPreset::onBtnCancel, this)); - LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterDeletePrefPreset::onPresetsListChange, this)); - - return TRUE; + LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance("preferences"); + if (preferences) + { + preferences->addDependentFloater(this); + } + getChild("delete")->setCommitCallback(boost::bind(&LLFloaterDeletePrefPreset::onBtnDelete, this)); + getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterDeletePrefPreset::onBtnCancel, this)); + LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterDeletePrefPreset::onPresetsListChange, this)); + + return TRUE; } void LLFloaterDeletePrefPreset::onOpen(const LLSD& key) { - mSubdirectory = key.asString(); - std::string floater_title = getString(std::string("title_") + mSubdirectory); - setTitle(floater_title); + mSubdirectory = key.asString(); + std::string floater_title = getString(std::string("title_") + mSubdirectory); + setTitle(floater_title); - LLComboBox* combo = getChild("preset_combo"); - EDefaultOptions option = DEFAULT_HIDE; - bool action; - action = LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); + LLComboBox* combo = getChild("preset_combo"); + EDefaultOptions option = DEFAULT_HIDE; + bool action; + action = LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); - LLButton* delete_btn = getChild("delete"); - delete_btn->setEnabled(action); + LLButton* delete_btn = getChild("delete"); + delete_btn->setEnabled(action); } void LLFloaterDeletePrefPreset::onBtnDelete() { - LLComboBox* combo = getChild("preset_combo"); - std::string name = combo->getSimple(); + LLComboBox* combo = getChild("preset_combo"); + std::string name = combo->getSimple(); - if (!LLPresetsManager::getInstance()->deletePreset(mSubdirectory, name)) - { - LLSD args; - args["NAME"] = name; - LLNotificationsUtil::add("PresetNotDeleted", args); - } + if (!LLPresetsManager::getInstance()->deletePreset(mSubdirectory, name)) + { + LLSD args; + args["NAME"] = name; + LLNotificationsUtil::add("PresetNotDeleted", args); + } - closeFloater(); + closeFloater(); } void LLFloaterDeletePrefPreset::onPresetsListChange() { - LLComboBox* combo = getChild("preset_combo"); + LLComboBox* combo = getChild("preset_combo"); - EDefaultOptions option = DEFAULT_HIDE; + EDefaultOptions option = DEFAULT_HIDE; - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); } void LLFloaterDeletePrefPreset::onBtnCancel() { - closeFloater(); + closeFloater(); } diff --git a/indra/newview/llfloaterloadprefpreset.cpp b/indra/newview/llfloaterloadprefpreset.cpp index 0584bf7e09..fa17a9d40e 100644 --- a/indra/newview/llfloaterloadprefpreset.cpp +++ b/indra/newview/llfloaterloadprefpreset.cpp @@ -36,57 +36,57 @@ #include "llviewercontrol.h" LLFloaterLoadPrefPreset::LLFloaterLoadPrefPreset(const LLSD &key) -: LLFloater(key) +: LLFloater(key) { } // virtual BOOL LLFloaterLoadPrefPreset::postBuild() { - LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance("preferences"); - if (preferences) - { - preferences->addDependentFloater(this); - } - getChild("ok")->setCommitCallback(boost::bind(&LLFloaterLoadPrefPreset::onBtnOk, this)); - getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterLoadPrefPreset::onBtnCancel, this)); - LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterLoadPrefPreset::onPresetsListChange, this)); - - return TRUE; + LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance("preferences"); + if (preferences) + { + preferences->addDependentFloater(this); + } + getChild("ok")->setCommitCallback(boost::bind(&LLFloaterLoadPrefPreset::onBtnOk, this)); + getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterLoadPrefPreset::onBtnCancel, this)); + LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterLoadPrefPreset::onPresetsListChange, this)); + + return TRUE; } void LLFloaterLoadPrefPreset::onOpen(const LLSD& key) { - mSubdirectory = key.asString(); - std::string floater_title = getString(std::string("title_") + mSubdirectory); + mSubdirectory = key.asString(); + std::string floater_title = getString(std::string("title_") + mSubdirectory); - setTitle(floater_title); + setTitle(floater_title); - LLComboBox* combo = getChild("preset_combo"); + LLComboBox* combo = getChild("preset_combo"); - EDefaultOptions option = DEFAULT_TOP; - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); + EDefaultOptions option = DEFAULT_TOP; + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); } void LLFloaterLoadPrefPreset::onPresetsListChange() { - LLComboBox* combo = getChild("preset_combo"); + LLComboBox* combo = getChild("preset_combo"); - EDefaultOptions option = DEFAULT_TOP; - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); + EDefaultOptions option = DEFAULT_TOP; + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo, option); } void LLFloaterLoadPrefPreset::onBtnCancel() { - closeFloater(); + closeFloater(); } void LLFloaterLoadPrefPreset::onBtnOk() { - LLComboBox* combo = getChild("preset_combo"); - std::string name = combo->getSimple(); + LLComboBox* combo = getChild("preset_combo"); + std::string name = combo->getSimple(); - LLPresetsManager::getInstance()->loadPreset(mSubdirectory, name); + LLPresetsManager::getInstance()->loadPreset(mSubdirectory, name); - closeFloater(); + closeFloater(); } diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index ee85a46405..6b4e4ceeac 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -139,35 +139,35 @@ static const F32 ARC_LIMIT_MAP_SCALE = (MAX_ARC_LOG - MIN_ARC_LOG) / (MAX_INDIRE class LLVoiceSetKeyDialog : public LLModalDialog { public: - LLVoiceSetKeyDialog(const LLSD& key); - ~LLVoiceSetKeyDialog(); - - /*virtual*/ BOOL postBuild(); - - void setParent(LLFloaterPreference* parent) { mParent = parent; } - - BOOL handleKeyHere(KEY key, MASK mask); - static void onCancel(void* user_data); - + LLVoiceSetKeyDialog(const LLSD& key); + ~LLVoiceSetKeyDialog(); + + /*virtual*/ BOOL postBuild(); + + void setParent(LLFloaterPreference* parent) { mParent = parent; } + + BOOL handleKeyHere(KEY key, MASK mask); + static void onCancel(void* user_data); + private: - LLFloaterPreference* mParent; + LLFloaterPreference* mParent; }; LLVoiceSetKeyDialog::LLVoiceSetKeyDialog(const LLSD& key) : LLModalDialog(key), - mParent(NULL) + mParent(NULL) { } //virtual BOOL LLVoiceSetKeyDialog::postBuild() { - childSetAction("Cancel", onCancel, this); - getChild("Cancel")->setFocus(TRUE); - - gFocusMgr.setKeystrokesOnly(TRUE); - - return TRUE; + childSetAction("Cancel", onCancel, this); + getChild("Cancel")->setFocus(TRUE); + + gFocusMgr.setKeystrokesOnly(TRUE); + + return TRUE; } LLVoiceSetKeyDialog::~LLVoiceSetKeyDialog() @@ -176,25 +176,25 @@ LLVoiceSetKeyDialog::~LLVoiceSetKeyDialog() BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask) { - BOOL result = TRUE; - - if (key == 'Q' && mask == MASK_CONTROL) - { - result = FALSE; - } - else if (mParent) - { - mParent->setKey(key); - } - closeFloater(); - return result; + BOOL result = TRUE; + + if (key == 'Q' && mask == MASK_CONTROL) + { + result = FALSE; + } + else if (mParent) + { + mParent->setKey(key); + } + closeFloater(); + return result; } //static void LLVoiceSetKeyDialog::onCancel(void* user_data) { - LLVoiceSetKeyDialog* self = (LLVoiceSetKeyDialog*)user_data; - self->closeFloater(); + LLVoiceSetKeyDialog* self = (LLVoiceSetKeyDialog*)user_data; + self->closeFloater(); } @@ -204,8 +204,8 @@ void LLVoiceSetKeyDialog::onCancel(void* user_data) // if creating/destroying these is too slow, we'll need to create // a static member and update all our static callbacks -void handleNameTagOptionChanged(const LLSD& newvalue); -void handleDisplayNamesOptionChanged(const LLSD& newvalue); +void handleNameTagOptionChanged(const LLSD& newvalue); +void handleDisplayNamesOptionChanged(const LLSD& newvalue); bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response); bool callback_clear_cache(const LLSD& notification, const LLSD& response); @@ -216,110 +216,110 @@ void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator); bool callback_clear_cache(const LLSD& notification, const LLSD& response) { - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if ( option == 0 ) // YES - { - // flag client texture cache for clearing next time the client runs - gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE); - LLNotificationsUtil::add("CacheWillClear"); - } + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if ( option == 0 ) // YES + { + // flag client texture cache for clearing next time the client runs + gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE); + LLNotificationsUtil::add("CacheWillClear"); + } - return false; + return false; } bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response) { - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if ( option == 0 ) // YES - { - // clean web - LLViewerMedia::clearAllCaches(); - LLViewerMedia::clearAllCookies(); - - // clean nav bar history - LLNavigationBar::getInstance()->clearHistoryCache(); - - // flag client texture cache for clearing next time the client runs - gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE); - LLNotificationsUtil::add("CacheWillClear"); - - LLSearchHistory::getInstance()->clearHistory(); - LLSearchHistory::getInstance()->save(); - LLSearchComboBox* search_ctrl = LLNavigationBar::getInstance()->getChild("search_combo_box"); - search_ctrl->clearHistory(); - - LLTeleportHistoryStorage::getInstance()->purgeItems(); - LLTeleportHistoryStorage::getInstance()->save(); - } - - return false; + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if ( option == 0 ) // YES + { + // clean web + LLViewerMedia::clearAllCaches(); + LLViewerMedia::clearAllCookies(); + + // clean nav bar history + LLNavigationBar::getInstance()->clearHistoryCache(); + + // flag client texture cache for clearing next time the client runs + gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE); + LLNotificationsUtil::add("CacheWillClear"); + + LLSearchHistory::getInstance()->clearHistory(); + LLSearchHistory::getInstance()->save(); + LLSearchComboBox* search_ctrl = LLNavigationBar::getInstance()->getChild("search_combo_box"); + search_ctrl->clearHistory(); + + LLTeleportHistoryStorage::getInstance()->purgeItems(); + LLTeleportHistoryStorage::getInstance()->save(); + } + + return false; } void handleNameTagOptionChanged(const LLSD& newvalue) { - LLAvatarNameCache::setUseUsernames(gSavedSettings.getBOOL("NameTagShowUsernames")); - LLVOAvatar::invalidateNameTags(); + LLAvatarNameCache::setUseUsernames(gSavedSettings.getBOOL("NameTagShowUsernames")); + LLVOAvatar::invalidateNameTags(); } void handleDisplayNamesOptionChanged(const LLSD& newvalue) { - LLAvatarNameCache::setUseDisplayNames(newvalue.asBoolean()); - LLVOAvatar::invalidateNameTags(); + LLAvatarNameCache::setUseDisplayNames(newvalue.asBoolean()); + LLVOAvatar::invalidateNameTags(); } void handleAppearanceCameraMovementChanged(const LLSD& newvalue) { - if(!newvalue.asBoolean() && gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR) - { - gAgentCamera.changeCameraToDefault(); - gAgentCamera.resetView(); - } + if(!newvalue.asBoolean() && gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR) + { + gAgentCamera.changeCameraToDefault(); + gAgentCamera.resetView(); + } } /*bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater) { - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (0 == option && floater ) - { - if ( floater ) - { - floater->setAllIgnored(); - // LLFirstUse::disableFirstUse(); - floater->buildPopupLists(); - } - } - return false; + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (0 == option && floater ) + { + if ( floater ) + { + floater->setAllIgnored(); + // LLFirstUse::disableFirstUse(); + floater->buildPopupLists(); + } + } + return false; } bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater) { - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if ( 0 == option && floater ) - { - if ( floater ) - { - floater->resetAllIgnored(); - //LLFirstUse::resetFirstUse(); - floater->buildPopupLists(); - } - } - return false; + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if ( 0 == option && floater ) + { + if ( floater ) + { + floater->resetAllIgnored(); + //LLFirstUse::resetFirstUse(); + floater->buildPopupLists(); + } + } + return false; } */ void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator) { - numerator = 0; - denominator = 0; - for (F32 test_denominator = 1.f; test_denominator < 30.f; test_denominator += 1.f) - { - if (fmodf((decimal_val * test_denominator) + 0.01f, 1.f) < 0.02f) - { - numerator = ll_round(decimal_val * test_denominator); - denominator = ll_round(test_denominator); - break; - } - } + numerator = 0; + denominator = 0; + for (F32 test_denominator = 1.f; test_denominator < 30.f; test_denominator += 1.f) + { + if (fmodf((decimal_val * test_denominator) + 0.01f, 1.f) < 0.02f) + { + numerator = ll_round(decimal_val * test_denominator); + denominator = ll_round(test_denominator); + break; + } + } } // static std::string LLFloaterPreference::sSkin = ""; @@ -327,1537 +327,1537 @@ std::string LLFloaterPreference::sSkin = ""; // LLFloaterPreference LLFloaterPreference::LLFloaterPreference(const LLSD& key) - : LLFloater(key), - mGotPersonalInfo(false), - mOriginalIMViaEmail(false), - mLanguageChanged(false), - mAvatarDataInitialized(false), - mClickActionDirty(false) -{ - LLConversationLog::instance().addObserver(this); - - //Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - - static bool registered_dialog = false; - if (!registered_dialog) - { - LLFloaterReg::add("voice_set_key", "floater_select_key.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - registered_dialog = true; - } - - mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreference::onBtnCancel, this, _2)); - mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreference::onBtnOK, this, _2)); - - mCommitCallbackRegistrar.add("Pref.ClearCache", boost::bind(&LLFloaterPreference::onClickClearCache, this)); - mCommitCallbackRegistrar.add("Pref.WebClearCache", boost::bind(&LLFloaterPreference::onClickBrowserClearCache, this)); - mCommitCallbackRegistrar.add("Pref.SetCache", boost::bind(&LLFloaterPreference::onClickSetCache, this)); - mCommitCallbackRegistrar.add("Pref.ResetCache", boost::bind(&LLFloaterPreference::onClickResetCache, this)); - mCommitCallbackRegistrar.add("Pref.ClickSkin", boost::bind(&LLFloaterPreference::onClickSkin, this,_1, _2)); - mCommitCallbackRegistrar.add("Pref.SelectSkin", boost::bind(&LLFloaterPreference::onSelectSkin, this)); - mCommitCallbackRegistrar.add("Pref.VoiceSetKey", boost::bind(&LLFloaterPreference::onClickSetKey, this)); - mCommitCallbackRegistrar.add("Pref.VoiceSetMiddleMouse", boost::bind(&LLFloaterPreference::onClickSetMiddleMouse, this)); - mCommitCallbackRegistrar.add("Pref.SetSounds", boost::bind(&LLFloaterPreference::onClickSetSounds, this)); - mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this)); - mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this)); - mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this)); - mCommitCallbackRegistrar.add("Pref.RenderExceptions", boost::bind(&LLFloaterPreference::onClickRenderExceptions, this)); - mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this)); - mCommitCallbackRegistrar.add("Pref.AvatarImpostorsEnable", boost::bind(&LLFloaterPreference::onAvatarImpostorsEnable, this)); - mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreference::updateMaxComplexity, this)); - mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreference::onVertexShaderEnable, this)); - mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this)); - mCommitCallbackRegistrar.add("Pref.UpdateSliderText", boost::bind(&LLFloaterPreference::refreshUI,this)); - mCommitCallbackRegistrar.add("Pref.QualityPerformance", boost::bind(&LLFloaterPreference::onChangeQuality, this, _2)); - mCommitCallbackRegistrar.add("Pref.applyUIColor", boost::bind(&LLFloaterPreference::applyUIColor, this ,_1, _2)); - mCommitCallbackRegistrar.add("Pref.getUIColor", boost::bind(&LLFloaterPreference::getUIColor, this ,_1, _2)); - mCommitCallbackRegistrar.add("Pref.MaturitySettings", boost::bind(&LLFloaterPreference::onChangeMaturity, this)); - mCommitCallbackRegistrar.add("Pref.BlockList", boost::bind(&LLFloaterPreference::onClickBlockList, this)); - mCommitCallbackRegistrar.add("Pref.Proxy", boost::bind(&LLFloaterPreference::onClickProxySettings, this)); - mCommitCallbackRegistrar.add("Pref.TranslationSettings", boost::bind(&LLFloaterPreference::onClickTranslationSettings, this)); - mCommitCallbackRegistrar.add("Pref.AutoReplace", boost::bind(&LLFloaterPreference::onClickAutoReplace, this)); - mCommitCallbackRegistrar.add("Pref.PermsDefault", boost::bind(&LLFloaterPreference::onClickPermsDefault, this)); - mCommitCallbackRegistrar.add("Pref.SpellChecker", boost::bind(&LLFloaterPreference::onClickSpellChecker, this)); - mCommitCallbackRegistrar.add("Pref.Advanced", boost::bind(&LLFloaterPreference::onClickAdvanced, this)); - - sSkin = gSavedSettings.getString("SkinCurrent"); - - mCommitCallbackRegistrar.add("Pref.ClickActionChange", boost::bind(&LLFloaterPreference::onClickActionChange, this)); - - gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); - gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); - gSavedSettings.getControl("UseDisplayNames")->getCommitSignal()->connect(boost::bind(&handleDisplayNamesOptionChanged, _2)); - - gSavedSettings.getControl("AppearanceCameraMovement")->getCommitSignal()->connect(boost::bind(&handleAppearanceCameraMovementChanged, _2)); - - LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this ); - - mCommitCallbackRegistrar.add("Pref.ClearLog", boost::bind(&LLConversationLog::onClearLog, &LLConversationLog::instance())); - mCommitCallbackRegistrar.add("Pref.DeleteTranscripts", boost::bind(&LLFloaterPreference::onDeleteTranscripts, this)); + : LLFloater(key), + mGotPersonalInfo(false), + mOriginalIMViaEmail(false), + mLanguageChanged(false), + mAvatarDataInitialized(false), + mClickActionDirty(false) +{ + LLConversationLog::instance().addObserver(this); + + //Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + static bool registered_dialog = false; + if (!registered_dialog) + { + LLFloaterReg::add("voice_set_key", "floater_select_key.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + registered_dialog = true; + } + + mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreference::onBtnCancel, this, _2)); + mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreference::onBtnOK, this, _2)); + + mCommitCallbackRegistrar.add("Pref.ClearCache", boost::bind(&LLFloaterPreference::onClickClearCache, this)); + mCommitCallbackRegistrar.add("Pref.WebClearCache", boost::bind(&LLFloaterPreference::onClickBrowserClearCache, this)); + mCommitCallbackRegistrar.add("Pref.SetCache", boost::bind(&LLFloaterPreference::onClickSetCache, this)); + mCommitCallbackRegistrar.add("Pref.ResetCache", boost::bind(&LLFloaterPreference::onClickResetCache, this)); + mCommitCallbackRegistrar.add("Pref.ClickSkin", boost::bind(&LLFloaterPreference::onClickSkin, this,_1, _2)); + mCommitCallbackRegistrar.add("Pref.SelectSkin", boost::bind(&LLFloaterPreference::onSelectSkin, this)); + mCommitCallbackRegistrar.add("Pref.VoiceSetKey", boost::bind(&LLFloaterPreference::onClickSetKey, this)); + mCommitCallbackRegistrar.add("Pref.VoiceSetMiddleMouse", boost::bind(&LLFloaterPreference::onClickSetMiddleMouse, this)); + mCommitCallbackRegistrar.add("Pref.SetSounds", boost::bind(&LLFloaterPreference::onClickSetSounds, this)); + mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this)); + mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this)); + mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this)); + mCommitCallbackRegistrar.add("Pref.RenderExceptions", boost::bind(&LLFloaterPreference::onClickRenderExceptions, this)); + mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this)); + mCommitCallbackRegistrar.add("Pref.AvatarImpostorsEnable", boost::bind(&LLFloaterPreference::onAvatarImpostorsEnable, this)); + mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreference::updateMaxComplexity, this)); + mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreference::onVertexShaderEnable, this)); + mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this)); + mCommitCallbackRegistrar.add("Pref.UpdateSliderText", boost::bind(&LLFloaterPreference::refreshUI,this)); + mCommitCallbackRegistrar.add("Pref.QualityPerformance", boost::bind(&LLFloaterPreference::onChangeQuality, this, _2)); + mCommitCallbackRegistrar.add("Pref.applyUIColor", boost::bind(&LLFloaterPreference::applyUIColor, this ,_1, _2)); + mCommitCallbackRegistrar.add("Pref.getUIColor", boost::bind(&LLFloaterPreference::getUIColor, this ,_1, _2)); + mCommitCallbackRegistrar.add("Pref.MaturitySettings", boost::bind(&LLFloaterPreference::onChangeMaturity, this)); + mCommitCallbackRegistrar.add("Pref.BlockList", boost::bind(&LLFloaterPreference::onClickBlockList, this)); + mCommitCallbackRegistrar.add("Pref.Proxy", boost::bind(&LLFloaterPreference::onClickProxySettings, this)); + mCommitCallbackRegistrar.add("Pref.TranslationSettings", boost::bind(&LLFloaterPreference::onClickTranslationSettings, this)); + mCommitCallbackRegistrar.add("Pref.AutoReplace", boost::bind(&LLFloaterPreference::onClickAutoReplace, this)); + mCommitCallbackRegistrar.add("Pref.PermsDefault", boost::bind(&LLFloaterPreference::onClickPermsDefault, this)); + mCommitCallbackRegistrar.add("Pref.SpellChecker", boost::bind(&LLFloaterPreference::onClickSpellChecker, this)); + mCommitCallbackRegistrar.add("Pref.Advanced", boost::bind(&LLFloaterPreference::onClickAdvanced, this)); + + sSkin = gSavedSettings.getString("SkinCurrent"); + + mCommitCallbackRegistrar.add("Pref.ClickActionChange", boost::bind(&LLFloaterPreference::onClickActionChange, this)); + + gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); + gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); + gSavedSettings.getControl("UseDisplayNames")->getCommitSignal()->connect(boost::bind(&handleDisplayNamesOptionChanged, _2)); + + gSavedSettings.getControl("AppearanceCameraMovement")->getCommitSignal()->connect(boost::bind(&handleAppearanceCameraMovementChanged, _2)); + + LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this ); + + mCommitCallbackRegistrar.add("Pref.ClearLog", boost::bind(&LLConversationLog::onClearLog, &LLConversationLog::instance())); + mCommitCallbackRegistrar.add("Pref.DeleteTranscripts", boost::bind(&LLFloaterPreference::onDeleteTranscripts, this)); } void LLFloaterPreference::processProperties( void* pData, EAvatarProcessorType type ) { - if ( APT_PROPERTIES == type ) - { - const LLAvatarData* pAvatarData = static_cast( pData ); - if (pAvatarData && (gAgent.getID() == pAvatarData->avatar_id) && (pAvatarData->avatar_id != LLUUID::null)) - { - storeAvatarProperties( pAvatarData ); - processProfileProperties( pAvatarData ); - } - } + if ( APT_PROPERTIES == type ) + { + const LLAvatarData* pAvatarData = static_cast( pData ); + if (pAvatarData && (gAgent.getID() == pAvatarData->avatar_id) && (pAvatarData->avatar_id != LLUUID::null)) + { + storeAvatarProperties( pAvatarData ); + processProfileProperties( pAvatarData ); + } + } } void LLFloaterPreference::storeAvatarProperties( const LLAvatarData* pAvatarData ) { - if (LLStartUp::getStartupState() == STATE_STARTED) - { - mAvatarProperties.avatar_id = pAvatarData->avatar_id; - mAvatarProperties.image_id = pAvatarData->image_id; - mAvatarProperties.fl_image_id = pAvatarData->fl_image_id; - mAvatarProperties.about_text = pAvatarData->about_text; - mAvatarProperties.fl_about_text = pAvatarData->fl_about_text; - mAvatarProperties.profile_url = pAvatarData->profile_url; - mAvatarProperties.flags = pAvatarData->flags; - mAvatarProperties.allow_publish = pAvatarData->flags & AVATAR_ALLOW_PUBLISH; - - mAvatarDataInitialized = true; - } + if (LLStartUp::getStartupState() == STATE_STARTED) + { + mAvatarProperties.avatar_id = pAvatarData->avatar_id; + mAvatarProperties.image_id = pAvatarData->image_id; + mAvatarProperties.fl_image_id = pAvatarData->fl_image_id; + mAvatarProperties.about_text = pAvatarData->about_text; + mAvatarProperties.fl_about_text = pAvatarData->fl_about_text; + mAvatarProperties.profile_url = pAvatarData->profile_url; + mAvatarProperties.flags = pAvatarData->flags; + mAvatarProperties.allow_publish = pAvatarData->flags & AVATAR_ALLOW_PUBLISH; + + mAvatarDataInitialized = true; + } } void LLFloaterPreference::processProfileProperties(const LLAvatarData* pAvatarData ) { - getChild("online_searchresults")->setValue( (bool)(pAvatarData->flags & AVATAR_ALLOW_PUBLISH) ); + getChild("online_searchresults")->setValue( (bool)(pAvatarData->flags & AVATAR_ALLOW_PUBLISH) ); } void LLFloaterPreference::saveAvatarProperties( void ) { - const BOOL allowPublish = getChild("online_searchresults")->getValue(); + const BOOL allowPublish = getChild("online_searchresults")->getValue(); - if (allowPublish) - { - mAvatarProperties.flags |= AVATAR_ALLOW_PUBLISH; - } + if (allowPublish) + { + mAvatarProperties.flags |= AVATAR_ALLOW_PUBLISH; + } - // - // NOTE: We really don't want to send the avatar properties unless we absolutely - // need to so we can avoid the accidental profile reset bug, so, if we're - // logged in, the avatar data has been initialized and we have a state change - // for the "allow publish" flag, then set the flag to its new value and send - // the properties update. - // - // NOTE: The only reason we can not remove this update altogether is because of the - // "allow publish" flag, the last remaining profile setting in the viewer - // that doesn't exist in the web profile. - // - if ((LLStartUp::getStartupState() == STATE_STARTED) && mAvatarDataInitialized && (allowPublish != mAvatarProperties.allow_publish)) - { - mAvatarProperties.allow_publish = allowPublish; + // + // NOTE: We really don't want to send the avatar properties unless we absolutely + // need to so we can avoid the accidental profile reset bug, so, if we're + // logged in, the avatar data has been initialized and we have a state change + // for the "allow publish" flag, then set the flag to its new value and send + // the properties update. + // + // NOTE: The only reason we can not remove this update altogether is because of the + // "allow publish" flag, the last remaining profile setting in the viewer + // that doesn't exist in the web profile. + // + if ((LLStartUp::getStartupState() == STATE_STARTED) && mAvatarDataInitialized && (allowPublish != mAvatarProperties.allow_publish)) + { + mAvatarProperties.allow_publish = allowPublish; - LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate( &mAvatarProperties ); - } + LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate( &mAvatarProperties ); + } } BOOL LLFloaterPreference::postBuild() { - gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false)); + gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false)); - gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLViewerChat::signalChatFontChanged)); + gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLViewerChat::signalChatFontChanged)); - gSavedSettings.getControl("ChatBubbleOpacity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onNameTagOpacityChange, this, _2)); + gSavedSettings.getControl("ChatBubbleOpacity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onNameTagOpacityChange, this, _2)); - gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeMaturity, this)); + gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeMaturity, this)); - gSavedPerAccountSettings.getControl("ModelUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeModelFolder, this)); - gSavedPerAccountSettings.getControl("TextureUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeTextureFolder, this)); - gSavedPerAccountSettings.getControl("SoundUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeSoundFolder, this)); - gSavedPerAccountSettings.getControl("AnimationUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeAnimationFolder, this)); + gSavedPerAccountSettings.getControl("ModelUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeModelFolder, this)); + gSavedPerAccountSettings.getControl("TextureUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeTextureFolder, this)); + gSavedPerAccountSettings.getControl("SoundUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeSoundFolder, this)); + gSavedPerAccountSettings.getControl("AnimationUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeAnimationFolder, this)); - LLTabContainer* tabcontainer = getChild("pref core"); - if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab"))) - tabcontainer->selectFirstTab(); + LLTabContainer* tabcontainer = getChild("pref core"); + if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab"))) + tabcontainer->selectFirstTab(); - getChild("cache_location")->setEnabled(FALSE); // make it read-only but selectable (STORM-227) - std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); - setCacheLocation(cache_location); + getChild("cache_location")->setEnabled(FALSE); // make it read-only but selectable (STORM-227) + std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); + setCacheLocation(cache_location); - getChild("log_path_string")->setEnabled(FALSE); // make it read-only but selectable + getChild("log_path_string")->setEnabled(FALSE); // make it read-only but selectable - getChild("language_combobox")->setCommitCallback(boost::bind(&LLFloaterPreference::onLanguageChange, this)); + getChild("language_combobox")->setCommitCallback(boost::bind(&LLFloaterPreference::onLanguageChange, this)); - getChild("FriendIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"FriendIMOptions")); - getChild("NonFriendIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"NonFriendIMOptions")); - getChild("ConferenceIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"ConferenceIMOptions")); - getChild("GroupChatOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"GroupChatOptions")); - getChild("NearbyChatOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"NearbyChatOptions")); - getChild("ObjectIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"ObjectIMOptions")); + getChild("FriendIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"FriendIMOptions")); + getChild("NonFriendIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"NonFriendIMOptions")); + getChild("ConferenceIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"ConferenceIMOptions")); + getChild("GroupChatOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"GroupChatOptions")); + getChild("NearbyChatOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"NearbyChatOptions")); + getChild("ObjectIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"ObjectIMOptions")); - // if floater is opened before login set default localized do not disturb message - if (LLStartUp::getStartupState() < STATE_STARTED) - { - gSavedPerAccountSettings.setString("DoNotDisturbModeResponse", LLTrans::getString("DoNotDisturbModeResponseDefault")); - } + // if floater is opened before login set default localized do not disturb message + if (LLStartUp::getStartupState() < STATE_STARTED) + { + gSavedPerAccountSettings.setString("DoNotDisturbModeResponse", LLTrans::getString("DoNotDisturbModeResponseDefault")); + } - // set 'enable' property for 'Clear log...' button - changed(); + // set 'enable' property for 'Clear log...' button + changed(); - LLLogChat::setSaveHistorySignal(boost::bind(&LLFloaterPreference::onLogChatHistorySaved, this)); + LLLogChat::setSaveHistorySignal(boost::bind(&LLFloaterPreference::onLogChatHistorySaved, this)); - LLSliderCtrl* fov_slider = getChild("camera_fov"); - fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView()); - fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView()); + LLSliderCtrl* fov_slider = getChild("camera_fov"); + fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView()); + fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView()); - return TRUE; + return TRUE; } void LLFloaterPreference::updateDeleteTranscriptsButton() { - std::vector list_of_transcriptions_file_names; - LLLogChat::getListOfTranscriptFiles(list_of_transcriptions_file_names); - getChild("delete_transcripts")->setEnabled(list_of_transcriptions_file_names.size() > 0); + std::vector list_of_transcriptions_file_names; + LLLogChat::getListOfTranscriptFiles(list_of_transcriptions_file_names); + getChild("delete_transcripts")->setEnabled(list_of_transcriptions_file_names.size() > 0); } void LLFloaterPreference::onDoNotDisturbResponseChanged() { - // set "DoNotDisturbResponseChanged" TRUE if user edited message differs from default, FALSE otherwise - bool response_changed_flag = - LLTrans::getString("DoNotDisturbModeResponseDefault") - != getChild("do_not_disturb_response")->getValue().asString(); + // set "DoNotDisturbResponseChanged" TRUE if user edited message differs from default, FALSE otherwise + bool response_changed_flag = + LLTrans::getString("DoNotDisturbModeResponseDefault") + != getChild("do_not_disturb_response")->getValue().asString(); - gSavedPerAccountSettings.setBOOL("DoNotDisturbResponseChanged", response_changed_flag ); + gSavedPerAccountSettings.setBOOL("DoNotDisturbResponseChanged", response_changed_flag ); } LLFloaterPreference::~LLFloaterPreference() { - LLConversationLog::instance().removeObserver(this); + LLConversationLog::instance().removeObserver(this); } void LLFloaterPreference::draw() { - BOOL has_first_selected = (getChildRef("disabled_popups").getFirstSelected()!=NULL); - gSavedSettings.setBOOL("FirstSelectedDisabledPopups", has_first_selected); - - has_first_selected = (getChildRef("enabled_popups").getFirstSelected()!=NULL); - gSavedSettings.setBOOL("FirstSelectedEnabledPopups", has_first_selected); - - LLFloater::draw(); + BOOL has_first_selected = (getChildRef("disabled_popups").getFirstSelected()!=NULL); + gSavedSettings.setBOOL("FirstSelectedDisabledPopups", has_first_selected); + + has_first_selected = (getChildRef("enabled_popups").getFirstSelected()!=NULL); + gSavedSettings.setBOOL("FirstSelectedEnabledPopups", has_first_selected); + + LLFloater::draw(); } void LLFloaterPreference::saveSettings() { - LLTabContainer* tabcontainer = getChild("pref core"); - child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); - child_list_t::const_iterator end = tabcontainer->getChildList()->end(); - for ( ; iter != end; ++iter) - { - LLView* view = *iter; - LLPanelPreference* panel = dynamic_cast(view); - if (panel) - panel->saveSettings(); - } -} + LLTabContainer* tabcontainer = getChild("pref core"); + child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); + child_list_t::const_iterator end = tabcontainer->getChildList()->end(); + for ( ; iter != end; ++iter) + { + LLView* view = *iter; + LLPanelPreference* panel = dynamic_cast(view); + if (panel) + panel->saveSettings(); + } +} void LLFloaterPreference::apply() { - LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this ); - - LLTabContainer* tabcontainer = getChild("pref core"); - if (sSkin != gSavedSettings.getString("SkinCurrent")) - { - LLNotificationsUtil::add("ChangeSkin"); - refreshSkin(this); - } - // Call apply() on all panels that derive from LLPanelPreference - for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); - iter != tabcontainer->getChildList()->end(); ++iter) - { - LLView* view = *iter; - LLPanelPreference* panel = dynamic_cast(view); - if (panel) - panel->apply(); - } - - gViewerWindow->requestResolutionUpdate(); // for UIScaleFactor - - LLSliderCtrl* fov_slider = getChild("camera_fov"); - fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView()); - fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView()); - - std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); - setCacheLocation(cache_location); - - LLViewerMedia::setCookiesEnabled(getChild("cookies_enabled")->getValue()); - - if (hasChild("web_proxy_enabled", TRUE) &&hasChild("web_proxy_editor", TRUE) && hasChild("web_proxy_port", TRUE)) - { - bool proxy_enable = getChild("web_proxy_enabled")->getValue(); - std::string proxy_address = getChild("web_proxy_editor")->getValue(); - int proxy_port = getChild("web_proxy_port")->getValue(); - LLViewerMedia::setProxyConfig(proxy_enable, proxy_address, proxy_port); - } - - if (mGotPersonalInfo) - { - bool new_im_via_email = getChild("send_im_to_email")->getValue().asBoolean(); - bool new_hide_online = getChild("online_visibility")->getValue().asBoolean(); - - if ((new_im_via_email != mOriginalIMViaEmail) - ||(new_hide_online != mOriginalHideOnlineStatus)) - { - // This hack is because we are representing several different - // possible strings with a single checkbox. Since most users - // can only select between 2 values, we represent it as a - // checkbox. This breaks down a little bit for liaisons, but - // works out in the end. - if (new_hide_online != mOriginalHideOnlineStatus) - { - if (new_hide_online) mDirectoryVisibility = VISIBILITY_HIDDEN; - else mDirectoryVisibility = VISIBILITY_DEFAULT; - //Update showonline value, otherwise multiple applys won't work - mOriginalHideOnlineStatus = new_hide_online; - } - gAgent.sendAgentUpdateUserInfo(new_im_via_email,mDirectoryVisibility); - } - } - - saveAvatarProperties(); - - if (mClickActionDirty) - { - updateClickActionSettings(); - mClickActionDirty = false; - } + LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this ); + + LLTabContainer* tabcontainer = getChild("pref core"); + if (sSkin != gSavedSettings.getString("SkinCurrent")) + { + LLNotificationsUtil::add("ChangeSkin"); + refreshSkin(this); + } + // Call apply() on all panels that derive from LLPanelPreference + for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); + iter != tabcontainer->getChildList()->end(); ++iter) + { + LLView* view = *iter; + LLPanelPreference* panel = dynamic_cast(view); + if (panel) + panel->apply(); + } + + gViewerWindow->requestResolutionUpdate(); // for UIScaleFactor + + LLSliderCtrl* fov_slider = getChild("camera_fov"); + fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView()); + fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView()); + + std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); + setCacheLocation(cache_location); + + LLViewerMedia::setCookiesEnabled(getChild("cookies_enabled")->getValue()); + + if (hasChild("web_proxy_enabled", TRUE) &&hasChild("web_proxy_editor", TRUE) && hasChild("web_proxy_port", TRUE)) + { + bool proxy_enable = getChild("web_proxy_enabled")->getValue(); + std::string proxy_address = getChild("web_proxy_editor")->getValue(); + int proxy_port = getChild("web_proxy_port")->getValue(); + LLViewerMedia::setProxyConfig(proxy_enable, proxy_address, proxy_port); + } + + if (mGotPersonalInfo) + { + bool new_im_via_email = getChild("send_im_to_email")->getValue().asBoolean(); + bool new_hide_online = getChild("online_visibility")->getValue().asBoolean(); + + if ((new_im_via_email != mOriginalIMViaEmail) + ||(new_hide_online != mOriginalHideOnlineStatus)) + { + // This hack is because we are representing several different + // possible strings with a single checkbox. Since most users + // can only select between 2 values, we represent it as a + // checkbox. This breaks down a little bit for liaisons, but + // works out in the end. + if (new_hide_online != mOriginalHideOnlineStatus) + { + if (new_hide_online) mDirectoryVisibility = VISIBILITY_HIDDEN; + else mDirectoryVisibility = VISIBILITY_DEFAULT; + //Update showonline value, otherwise multiple applys won't work + mOriginalHideOnlineStatus = new_hide_online; + } + gAgent.sendAgentUpdateUserInfo(new_im_via_email,mDirectoryVisibility); + } + } + + saveAvatarProperties(); + + if (mClickActionDirty) + { + updateClickActionSettings(); + mClickActionDirty = false; + } } void LLFloaterPreference::cancel() { - LLTabContainer* tabcontainer = getChild("pref core"); - // Call cancel() on all panels that derive from LLPanelPreference - for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); - iter != tabcontainer->getChildList()->end(); ++iter) - { - LLView* view = *iter; - LLPanelPreference* panel = dynamic_cast(view); - if (panel) - panel->cancel(); - } - // hide joystick pref floater - LLFloaterReg::hideInstance("pref_joystick"); - - // hide translation settings floater - LLFloaterReg::hideInstance("prefs_translation"); - - // hide autoreplace settings floater - LLFloaterReg::hideInstance("prefs_autoreplace"); - - // hide spellchecker settings folder - LLFloaterReg::hideInstance("prefs_spellchecker"); - - // hide advanced graphics floater - LLFloaterReg::hideInstance("prefs_graphics_advanced"); - - // reverts any changes to current skin - gSavedSettings.setString("SkinCurrent", sSkin); - - if (mClickActionDirty) - { - updateClickActionControls(); - mClickActionDirty = false; - } - - LLFloaterPreferenceProxy * advanced_proxy_settings = LLFloaterReg::findTypedInstance("prefs_proxy"); - if (advanced_proxy_settings) - { - advanced_proxy_settings->cancel(); - } - //Need to reload the navmesh if the pathing console is up - LLHandle pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle(); - if ( !pathfindingConsoleHandle.isDead() ) - { - LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get(); - pPathfindingConsole->onRegionBoundaryCross(); - } - - if (!mSavedGraphicsPreset.empty()) - { - gSavedSettings.setString("PresetGraphicActive", mSavedGraphicsPreset); - LLPresetsManager::getInstance()->triggerChangeSignal(); - } + LLTabContainer* tabcontainer = getChild("pref core"); + // Call cancel() on all panels that derive from LLPanelPreference + for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); + iter != tabcontainer->getChildList()->end(); ++iter) + { + LLView* view = *iter; + LLPanelPreference* panel = dynamic_cast(view); + if (panel) + panel->cancel(); + } + // hide joystick pref floater + LLFloaterReg::hideInstance("pref_joystick"); + + // hide translation settings floater + LLFloaterReg::hideInstance("prefs_translation"); + + // hide autoreplace settings floater + LLFloaterReg::hideInstance("prefs_autoreplace"); + + // hide spellchecker settings folder + LLFloaterReg::hideInstance("prefs_spellchecker"); + + // hide advanced graphics floater + LLFloaterReg::hideInstance("prefs_graphics_advanced"); + + // reverts any changes to current skin + gSavedSettings.setString("SkinCurrent", sSkin); + + if (mClickActionDirty) + { + updateClickActionControls(); + mClickActionDirty = false; + } + + LLFloaterPreferenceProxy * advanced_proxy_settings = LLFloaterReg::findTypedInstance("prefs_proxy"); + if (advanced_proxy_settings) + { + advanced_proxy_settings->cancel(); + } + //Need to reload the navmesh if the pathing console is up + LLHandle pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle(); + if ( !pathfindingConsoleHandle.isDead() ) + { + LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get(); + pPathfindingConsole->onRegionBoundaryCross(); + } + + if (!mSavedGraphicsPreset.empty()) + { + gSavedSettings.setString("PresetGraphicActive", mSavedGraphicsPreset); + LLPresetsManager::getInstance()->triggerChangeSignal(); + } } void LLFloaterPreference::onOpen(const LLSD& key) { - // this variable and if that follows it are used to properly handle do not disturb mode response message - static bool initialized = FALSE; - // if user is logged in and we haven't initialized do not disturb mode response yet, do it - if (!initialized && LLStartUp::getStartupState() == STATE_STARTED) - { - // Special approach is used for do not disturb response localization, because "DoNotDisturbModeResponse" is - // in non-localizable xml, and also because it may be changed by user and in this case it shouldn't be localized. - // To keep track of whether do not disturb response is default or changed by user additional setting DoNotDisturbResponseChanged - // was added into per account settings. - - // initialization should happen once,so setting variable to TRUE - initialized = TRUE; - // this connection is needed to properly set "DoNotDisturbResponseChanged" setting when user makes changes in - // do not disturb response message. - gSavedPerAccountSettings.getControl("DoNotDisturbModeResponse")->getSignal()->connect(boost::bind(&LLFloaterPreference::onDoNotDisturbResponseChanged, this)); - } - gAgent.sendAgentUserInfoRequest(); - - /////////////////////////// From LLPanelGeneral ////////////////////////// - // if we have no agent, we can't let them choose anything - // if we have an agent, then we only let them choose if they have a choice - bool can_choose_maturity = - gAgent.getID().notNull() && - (gAgent.isMature() || gAgent.isGodlike()); - - LLComboBox* maturity_combo = getChild("maturity_desired_combobox"); - LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest( gAgent.getID() ); - if (can_choose_maturity) - { - // if they're not adult or a god, they shouldn't see the adult selection, so delete it - if (!gAgent.isAdult() && !gAgent.isGodlikeWithoutAdminMenuFakery()) - { - // we're going to remove the adult entry from the combo - LLScrollListCtrl* maturity_list = maturity_combo->findChild("ComboBox"); - if (maturity_list) - { - maturity_list->deleteItems(LLSD(SIM_ACCESS_ADULT)); - } - } - getChildView("maturity_desired_combobox")->setEnabled( true); - getChildView("maturity_desired_textbox")->setVisible( false); - } - else - { - getChild("maturity_desired_textbox")->setValue(maturity_combo->getSelectedItemLabel()); - getChildView("maturity_desired_combobox")->setEnabled( false); - } - - // Forget previous language changes. - mLanguageChanged = false; - - // Display selected maturity icons. - onChangeMaturity(); - - onChangeModelFolder(); - onChangeTextureFolder(); - onChangeSoundFolder(); - onChangeAnimationFolder(); - - // Load (double-)click to walk/teleport settings. - updateClickActionControls(); - - // Enabled/disabled popups, might have been changed by user actions - // while preferences floater was closed. - buildPopupLists(); - - - //get the options that were checked - onNotificationsChange("FriendIMOptions"); - onNotificationsChange("NonFriendIMOptions"); - onNotificationsChange("ConferenceIMOptions"); - onNotificationsChange("GroupChatOptions"); - onNotificationsChange("NearbyChatOptions"); - onNotificationsChange("ObjectIMOptions"); - - LLPanelLogin::setAlwaysRefresh(true); - refresh(); - - // Make sure the current state of prefs are saved away when - // when the floater is opened. That will make cancel do its - // job - saveSettings(); - - // Make sure there is a default preference file - LLPresetsManager::getInstance()->createMissingDefault(PRESETS_CAMERA); - LLPresetsManager::getInstance()->createMissingDefault(PRESETS_GRAPHIC); - - bool started = (LLStartUp::getStartupState() == STATE_STARTED); - - LLButton* load_btn = findChild("PrefLoadButton"); - LLButton* save_btn = findChild("PrefSaveButton"); - LLButton* delete_btn = findChild("PrefDeleteButton"); - LLButton* exceptions_btn = findChild("RenderExceptionsButton"); - - if (load_btn && save_btn && delete_btn && exceptions_btn) - { - load_btn->setEnabled(started); - save_btn->setEnabled(started); - delete_btn->setEnabled(started); - exceptions_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); - } + // this variable and if that follows it are used to properly handle do not disturb mode response message + static bool initialized = FALSE; + // if user is logged in and we haven't initialized do not disturb mode response yet, do it + if (!initialized && LLStartUp::getStartupState() == STATE_STARTED) + { + // Special approach is used for do not disturb response localization, because "DoNotDisturbModeResponse" is + // in non-localizable xml, and also because it may be changed by user and in this case it shouldn't be localized. + // To keep track of whether do not disturb response is default or changed by user additional setting DoNotDisturbResponseChanged + // was added into per account settings. + + // initialization should happen once,so setting variable to TRUE + initialized = TRUE; + // this connection is needed to properly set "DoNotDisturbResponseChanged" setting when user makes changes in + // do not disturb response message. + gSavedPerAccountSettings.getControl("DoNotDisturbModeResponse")->getSignal()->connect(boost::bind(&LLFloaterPreference::onDoNotDisturbResponseChanged, this)); + } + gAgent.sendAgentUserInfoRequest(); + + /////////////////////////// From LLPanelGeneral ////////////////////////// + // if we have no agent, we can't let them choose anything + // if we have an agent, then we only let them choose if they have a choice + bool can_choose_maturity = + gAgent.getID().notNull() && + (gAgent.isMature() || gAgent.isGodlike()); + + LLComboBox* maturity_combo = getChild("maturity_desired_combobox"); + LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest( gAgent.getID() ); + if (can_choose_maturity) + { + // if they're not adult or a god, they shouldn't see the adult selection, so delete it + if (!gAgent.isAdult() && !gAgent.isGodlikeWithoutAdminMenuFakery()) + { + // we're going to remove the adult entry from the combo + LLScrollListCtrl* maturity_list = maturity_combo->findChild("ComboBox"); + if (maturity_list) + { + maturity_list->deleteItems(LLSD(SIM_ACCESS_ADULT)); + } + } + getChildView("maturity_desired_combobox")->setEnabled( true); + getChildView("maturity_desired_textbox")->setVisible( false); + } + else + { + getChild("maturity_desired_textbox")->setValue(maturity_combo->getSelectedItemLabel()); + getChildView("maturity_desired_combobox")->setEnabled( false); + } + + // Forget previous language changes. + mLanguageChanged = false; + + // Display selected maturity icons. + onChangeMaturity(); + + onChangeModelFolder(); + onChangeTextureFolder(); + onChangeSoundFolder(); + onChangeAnimationFolder(); + + // Load (double-)click to walk/teleport settings. + updateClickActionControls(); + + // Enabled/disabled popups, might have been changed by user actions + // while preferences floater was closed. + buildPopupLists(); + + + //get the options that were checked + onNotificationsChange("FriendIMOptions"); + onNotificationsChange("NonFriendIMOptions"); + onNotificationsChange("ConferenceIMOptions"); + onNotificationsChange("GroupChatOptions"); + onNotificationsChange("NearbyChatOptions"); + onNotificationsChange("ObjectIMOptions"); + + LLPanelLogin::setAlwaysRefresh(true); + refresh(); + + // Make sure the current state of prefs are saved away when + // when the floater is opened. That will make cancel do its + // job + saveSettings(); + + // Make sure there is a default preference file + LLPresetsManager::getInstance()->createMissingDefault(PRESETS_CAMERA); + LLPresetsManager::getInstance()->createMissingDefault(PRESETS_GRAPHIC); + + bool started = (LLStartUp::getStartupState() == STATE_STARTED); + + LLButton* load_btn = findChild("PrefLoadButton"); + LLButton* save_btn = findChild("PrefSaveButton"); + LLButton* delete_btn = findChild("PrefDeleteButton"); + LLButton* exceptions_btn = findChild("RenderExceptionsButton"); + + if (load_btn && save_btn && delete_btn && exceptions_btn) + { + load_btn->setEnabled(started); + save_btn->setEnabled(started); + delete_btn->setEnabled(started); + exceptions_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() { - refreshEnabledGraphics(); + refreshEnabledGraphics(); } void LLFloaterPreferenceGraphicsAdvanced::onVertexShaderEnable() { - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->refresh(); - } + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->refresh(); + } - refreshEnabledGraphics(); + refreshEnabledGraphics(); } void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledGraphics() { - refreshEnabledState(); + refreshEnabledState(); } void LLFloaterPreference::onAvatarImpostorsEnable() { - refreshEnabledGraphics(); + refreshEnabledGraphics(); } //static void LLFloaterPreference::initDoNotDisturbResponse() - { - if (!gSavedPerAccountSettings.getBOOL("DoNotDisturbResponseChanged")) - { - //LLTrans::getString("DoNotDisturbModeResponseDefault") is used here for localization (EXT-5885) - gSavedPerAccountSettings.setString("DoNotDisturbModeResponse", LLTrans::getString("DoNotDisturbModeResponseDefault")); - } - } + { + if (!gSavedPerAccountSettings.getBOOL("DoNotDisturbResponseChanged")) + { + //LLTrans::getString("DoNotDisturbModeResponseDefault") is used here for localization (EXT-5885) + gSavedPerAccountSettings.setString("DoNotDisturbModeResponse", LLTrans::getString("DoNotDisturbModeResponseDefault")); + } + } //static void LLFloaterPreference::updateShowFavoritesCheckbox(bool val) { - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->getChild("favorites_on_login_check")->setValue(val); - } + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->getChild("favorites_on_login_check")->setValue(val); + } } void LLFloaterPreference::setHardwareDefaults() { - std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); - if (!preset_graphic_active.empty()) - { - saveGraphicsPreset(preset_graphic_active); - saveSettings(); // save here to be able to return to the previous preset by Cancel - } + std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); + if (!preset_graphic_active.empty()) + { + saveGraphicsPreset(preset_graphic_active); + saveSettings(); // save here to be able to return to the previous preset by Cancel + } - LLFeatureManager::getInstance()->applyRecommendedSettings(); + LLFeatureManager::getInstance()->applyRecommendedSettings(); - // reset indirects before refresh because we may have changed what they control - LLAvatarComplexityControls::setIndirectControls(); + // reset indirects before refresh because we may have changed what they control + LLAvatarComplexityControls::setIndirectControls(); - refreshEnabledGraphics(); - gSavedSettings.setString("PresetGraphicActive", ""); - LLPresetsManager::getInstance()->triggerChangeSignal(); + refreshEnabledGraphics(); + gSavedSettings.setString("PresetGraphicActive", ""); + LLPresetsManager::getInstance()->triggerChangeSignal(); - LLTabContainer* tabcontainer = getChild("pref core"); - child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); - child_list_t::const_iterator end = tabcontainer->getChildList()->end(); - for ( ; iter != end; ++iter) - { - LLView* view = *iter; - LLPanelPreference* panel = dynamic_cast(view); - if (panel) - { - panel->setHardwareDefaults(); - } - } + LLTabContainer* tabcontainer = getChild("pref core"); + child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); + child_list_t::const_iterator end = tabcontainer->getChildList()->end(); + for ( ; iter != end; ++iter) + { + LLView* view = *iter; + LLPanelPreference* panel = dynamic_cast(view); + if (panel) + { + panel->setHardwareDefaults(); + } + } } void LLFloaterPreference::getControlNames(std::vector& names) { - LLView* view = findChild("display"); - LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); - if (view && advanced) - { - std::list stack; - stack.push_back(view); - stack.push_back(advanced); - while(!stack.empty()) - { - // Process view on top of the stack - LLView* curview = stack.front(); - stack.pop_front(); - - LLUICtrl* ctrl = dynamic_cast(curview); - if (ctrl) - { - LLControlVariable* control = ctrl->getControlVariable(); - if (control) - { - std::string control_name = control->getName(); - if (std::find(names.begin(), names.end(), control_name) == names.end()) - { - names.push_back(control_name); - } - } - } - - for (child_list_t::const_iterator iter = curview->getChildList()->begin(); - iter != curview->getChildList()->end(); ++iter) - { - stack.push_back(*iter); - } - } - } + LLView* view = findChild("display"); + LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); + if (view && advanced) + { + std::list stack; + stack.push_back(view); + stack.push_back(advanced); + while(!stack.empty()) + { + // Process view on top of the stack + LLView* curview = stack.front(); + stack.pop_front(); + + LLUICtrl* ctrl = dynamic_cast(curview); + if (ctrl) + { + LLControlVariable* control = ctrl->getControlVariable(); + if (control) + { + std::string control_name = control->getName(); + if (std::find(names.begin(), names.end(), control_name) == names.end()) + { + names.push_back(control_name); + } + } + } + + for (child_list_t::const_iterator iter = curview->getChildList()->begin(); + iter != curview->getChildList()->end(); ++iter) + { + stack.push_back(*iter); + } + } + } } //virtual void LLFloaterPreference::onClose(bool app_quitting) { - gSavedSettings.setS32("LastPrefTab", getChild("pref core")->getCurrentPanelIndex()); - LLPanelLogin::setAlwaysRefresh(false); - if (!app_quitting) - { - cancel(); - } + gSavedSettings.setS32("LastPrefTab", getChild("pref core")->getCurrentPanelIndex()); + LLPanelLogin::setAlwaysRefresh(false); + if (!app_quitting) + { + cancel(); + } } // static void LLFloaterPreference::onBtnOK(const LLSD& userdata) { - // commit any outstanding text entry - if (hasFocus()) - { - LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); - if (cur_focus && cur_focus->acceptsTextInput()) - { - cur_focus->onCommit(); - } - } - - if (canClose()) - { - saveSettings(); - apply(); - - if (userdata.asString() == "closeadvanced") - { - LLFloaterReg::hideInstance("prefs_graphics_advanced"); - } - else - { - closeFloater(false); - } - - //Conversation transcript and log path changed so reload conversations based on new location - if(mPriorInstantMessageLogPath.length()) - { - if(moveTranscriptsAndLog()) - { - //When floaters are empty but have a chat history files, reload chat history into them - LLFloaterIMSessionTab::reloadEmptyFloaters(); - } - //Couldn't move files so restore the old path and show a notification - else - { - gSavedPerAccountSettings.setString("InstantMessageLogPath", mPriorInstantMessageLogPath); - LLNotificationsUtil::add("PreferenceChatPathChanged"); - } - mPriorInstantMessageLogPath.clear(); - } - - LLUIColorTable::instance().saveUserSettings(); - gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); - - //Only save once logged in and loaded per account settings - if(mGotPersonalInfo) - { - gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE); - } - } - else - { - // Show beep, pop up dialog, etc. - LL_INFOS() << "Can't close preferences!" << LL_ENDL; - } - - LLPanelLogin::updateLocationSelectorsVisibility(); - //Need to reload the navmesh if the pathing console is up - LLHandle pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle(); - if ( !pathfindingConsoleHandle.isDead() ) - { - LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get(); - pPathfindingConsole->onRegionBoundaryCross(); - } + // commit any outstanding text entry + if (hasFocus()) + { + LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); + if (cur_focus && cur_focus->acceptsTextInput()) + { + cur_focus->onCommit(); + } + } + + if (canClose()) + { + saveSettings(); + apply(); + + if (userdata.asString() == "closeadvanced") + { + LLFloaterReg::hideInstance("prefs_graphics_advanced"); + } + else + { + closeFloater(false); + } + + //Conversation transcript and log path changed so reload conversations based on new location + if(mPriorInstantMessageLogPath.length()) + { + if(moveTranscriptsAndLog()) + { + //When floaters are empty but have a chat history files, reload chat history into them + LLFloaterIMSessionTab::reloadEmptyFloaters(); + } + //Couldn't move files so restore the old path and show a notification + else + { + gSavedPerAccountSettings.setString("InstantMessageLogPath", mPriorInstantMessageLogPath); + LLNotificationsUtil::add("PreferenceChatPathChanged"); + } + mPriorInstantMessageLogPath.clear(); + } + + LLUIColorTable::instance().saveUserSettings(); + gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); + + //Only save once logged in and loaded per account settings + if(mGotPersonalInfo) + { + gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE); + } + } + else + { + // Show beep, pop up dialog, etc. + LL_INFOS() << "Can't close preferences!" << LL_ENDL; + } + + LLPanelLogin::updateLocationSelectorsVisibility(); + //Need to reload the navmesh if the pathing console is up + LLHandle pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle(); + if ( !pathfindingConsoleHandle.isDead() ) + { + LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get(); + pPathfindingConsole->onRegionBoundaryCross(); + } } // static void LLFloaterPreference::onBtnCancel(const LLSD& userdata) { - if (hasFocus()) - { - LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); - if (cur_focus && cur_focus->acceptsTextInput()) - { - cur_focus->onCommit(); - } - refresh(); - } - cancel(); - - if (userdata.asString() == "closeadvanced") - { - LLFloaterReg::hideInstance("prefs_graphics_advanced"); - } - else - { - closeFloater(); - } + if (hasFocus()) + { + LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); + if (cur_focus && cur_focus->acceptsTextInput()) + { + cur_focus->onCommit(); + } + refresh(); + } + cancel(); + + if (userdata.asString() == "closeadvanced") + { + LLFloaterReg::hideInstance("prefs_graphics_advanced"); + } + else + { + closeFloater(); + } } // static void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_via_email, bool is_verified_email) { - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { instance->setPersonalInfo(visibility, im_via_email, is_verified_email); - } + } } void LLFloaterPreference::refreshEnabledGraphics() { - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->refresh(); - } + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->refresh(); + } - LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); - if (advanced) - { - advanced->refresh(); - } + LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); + if (advanced) + { + advanced->refresh(); + } } void LLFloaterPreference::onClickClearCache() { - LLNotificationsUtil::add("ConfirmClearCache", LLSD(), LLSD(), callback_clear_cache); + LLNotificationsUtil::add("ConfirmClearCache", LLSD(), LLSD(), callback_clear_cache); } void LLFloaterPreference::onClickBrowserClearCache() { - LLNotificationsUtil::add("ConfirmClearBrowserCache", LLSD(), LLSD(), callback_clear_browser_cache); + LLNotificationsUtil::add("ConfirmClearBrowserCache", LLSD(), LLSD(), callback_clear_browser_cache); } // Called when user changes language via the combobox. void LLFloaterPreference::onLanguageChange() { - // Let the user know that the change will only take effect after restart. - // Do it only once so that we're not too irritating. - if (!mLanguageChanged) - { - LLNotificationsUtil::add("ChangeLanguage"); - mLanguageChanged = true; - } + // Let the user know that the change will only take effect after restart. + // Do it only once so that we're not too irritating. + if (!mLanguageChanged) + { + LLNotificationsUtil::add("ChangeLanguage"); + mLanguageChanged = true; + } } void LLFloaterPreference::onNotificationsChange(const std::string& OptionName) { - mNotificationOptions[OptionName] = getChild(OptionName)->getSelectedItemLabel(); + mNotificationOptions[OptionName] = getChild(OptionName)->getSelectedItemLabel(); - bool show_notifications_alert = true; - for (notifications_map::iterator it_notification = mNotificationOptions.begin(); it_notification != mNotificationOptions.end(); it_notification++) - { - if(it_notification->second != "No action") - { - show_notifications_alert = false; - break; - } - } + bool show_notifications_alert = true; + for (notifications_map::iterator it_notification = mNotificationOptions.begin(); it_notification != mNotificationOptions.end(); it_notification++) + { + if(it_notification->second != "No action") + { + show_notifications_alert = false; + break; + } + } - getChild("notifications_alert")->setVisible(show_notifications_alert); + getChild("notifications_alert")->setVisible(show_notifications_alert); } void LLFloaterPreference::onNameTagOpacityChange(const LLSD& newvalue) { - LLColorSwatchCtrl* color_swatch = findChild("background"); - if (color_swatch) - { - LLColor4 new_color = color_swatch->get(); - color_swatch->set( new_color.setAlpha(newvalue.asReal()) ); - } + LLColorSwatchCtrl* color_swatch = findChild("background"); + if (color_swatch) + { + LLColor4 new_color = color_swatch->get(); + color_swatch->set( new_color.setAlpha(newvalue.asReal()) ); + } } void LLFloaterPreference::onClickSetCache() { - std::string cur_name(gSavedSettings.getString("CacheLocation")); -// std::string cur_top_folder(gDirUtilp->getBaseFileName(cur_name)); - - std::string proposed_name(cur_name); + std::string cur_name(gSavedSettings.getString("CacheLocation")); +// std::string cur_top_folder(gDirUtilp->getBaseFileName(cur_name)); + + std::string proposed_name(cur_name); - (new LLDirPickerThread(boost::bind(&LLFloaterPreference::changeCachePath, this, _1, _2), proposed_name))->getFile(); + (new LLDirPickerThread(boost::bind(&LLFloaterPreference::changeCachePath, this, _1, _2), proposed_name))->getFile(); } void LLFloaterPreference::changeCachePath(const std::vector& filenames, std::string proposed_name) { - std::string dir_name = filenames[0]; - if (!dir_name.empty() && dir_name != proposed_name) - { - std::string new_top_folder(gDirUtilp->getBaseFileName(dir_name)); - LLNotificationsUtil::add("CacheWillBeMoved"); - gSavedSettings.setString("NewCacheLocation", dir_name); - gSavedSettings.setString("NewCacheLocationTopFolder", new_top_folder); - } - else - { - std::string cache_location = gDirUtilp->getCacheDir(); - gSavedSettings.setString("CacheLocation", cache_location); - std::string top_folder(gDirUtilp->getBaseFileName(cache_location)); - gSavedSettings.setString("CacheLocationTopFolder", top_folder); - } + std::string dir_name = filenames[0]; + if (!dir_name.empty() && dir_name != proposed_name) + { + std::string new_top_folder(gDirUtilp->getBaseFileName(dir_name)); + LLNotificationsUtil::add("CacheWillBeMoved"); + gSavedSettings.setString("NewCacheLocation", dir_name); + gSavedSettings.setString("NewCacheLocationTopFolder", new_top_folder); + } + else + { + std::string cache_location = gDirUtilp->getCacheDir(); + gSavedSettings.setString("CacheLocation", cache_location); + std::string top_folder(gDirUtilp->getBaseFileName(cache_location)); + gSavedSettings.setString("CacheLocationTopFolder", top_folder); + } } void LLFloaterPreference::onClickResetCache() { - if (gDirUtilp->getCacheDir(false) == gDirUtilp->getCacheDir(true)) - { - // The cache location was already the default. - return; - } - gSavedSettings.setString("NewCacheLocation", ""); - gSavedSettings.setString("NewCacheLocationTopFolder", ""); - LLNotificationsUtil::add("CacheWillBeMoved"); - std::string cache_location = gDirUtilp->getCacheDir(false); - gSavedSettings.setString("CacheLocation", cache_location); - std::string top_folder(gDirUtilp->getBaseFileName(cache_location)); - gSavedSettings.setString("CacheLocationTopFolder", top_folder); + if (gDirUtilp->getCacheDir(false) == gDirUtilp->getCacheDir(true)) + { + // The cache location was already the default. + return; + } + gSavedSettings.setString("NewCacheLocation", ""); + gSavedSettings.setString("NewCacheLocationTopFolder", ""); + LLNotificationsUtil::add("CacheWillBeMoved"); + std::string cache_location = gDirUtilp->getCacheDir(false); + gSavedSettings.setString("CacheLocation", cache_location); + std::string top_folder(gDirUtilp->getBaseFileName(cache_location)); + gSavedSettings.setString("CacheLocationTopFolder", top_folder); } void LLFloaterPreference::onClickSkin(LLUICtrl* ctrl, const LLSD& userdata) { - gSavedSettings.setString("SkinCurrent", userdata.asString()); - ctrl->setValue(userdata.asString()); + gSavedSettings.setString("SkinCurrent", userdata.asString()); + ctrl->setValue(userdata.asString()); } void LLFloaterPreference::onSelectSkin() { - std::string skin_selection = getChild("skin_selection")->getValue().asString(); - gSavedSettings.setString("SkinCurrent", skin_selection); + std::string skin_selection = getChild("skin_selection")->getValue().asString(); + gSavedSettings.setString("SkinCurrent", skin_selection); } void LLFloaterPreference::refreshSkin(void* data) { - LLPanel*self = (LLPanel*)data; - sSkin = gSavedSettings.getString("SkinCurrent"); - self->getChild("skin_selection", true)->setValue(sSkin); + LLPanel*self = (LLPanel*)data; + sSkin = gSavedSettings.getString("SkinCurrent"); + self->getChild("skin_selection", true)->setValue(sSkin); } void LLFloaterPreference::buildPopupLists() { - LLScrollListCtrl& disabled_popups = - getChildRef("disabled_popups"); - LLScrollListCtrl& enabled_popups = - getChildRef("enabled_popups"); - - disabled_popups.deleteAllItems(); - enabled_popups.deleteAllItems(); - - for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); - iter != LLNotifications::instance().templatesEnd(); - ++iter) - { - LLNotificationTemplatePtr templatep = iter->second; - LLNotificationFormPtr formp = templatep->mForm; - - LLNotificationForm::EIgnoreType ignore = formp->getIgnoreType(); - if (ignore == LLNotificationForm::IGNORE_NO) - continue; - - LLSD row; - row["columns"][0]["value"] = formp->getIgnoreMessage(); - row["columns"][0]["font"] = "SANSSERIF_SMALL"; - row["columns"][0]["width"] = 400; - - LLScrollListItem* item = NULL; - - bool show_popup = !formp->getIgnored(); - if (!show_popup) - { - if (ignore == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE) - { - LLSD last_response = LLUI::sSettingGroups["config"]->getLLSD("Default" + templatep->mName); - if (!last_response.isUndefined()) - { - for (LLSD::map_const_iterator it = last_response.beginMap(); - it != last_response.endMap(); - ++it) - { - if (it->second.asBoolean()) - { - row["columns"][1]["value"] = formp->getElement(it->first)["ignore"].asString(); - break; - } - } - } - row["columns"][1]["font"] = "SANSSERIF_SMALL"; - row["columns"][1]["width"] = 360; - } - item = disabled_popups.addElement(row); - } - else - { - item = enabled_popups.addElement(row); - } - - if (item) - { - item->setUserdata((void*)&iter->first); - } - } + LLScrollListCtrl& disabled_popups = + getChildRef("disabled_popups"); + LLScrollListCtrl& enabled_popups = + getChildRef("enabled_popups"); + + disabled_popups.deleteAllItems(); + enabled_popups.deleteAllItems(); + + for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); + iter != LLNotifications::instance().templatesEnd(); + ++iter) + { + LLNotificationTemplatePtr templatep = iter->second; + LLNotificationFormPtr formp = templatep->mForm; + + LLNotificationForm::EIgnoreType ignore = formp->getIgnoreType(); + if (ignore == LLNotificationForm::IGNORE_NO) + continue; + + LLSD row; + row["columns"][0]["value"] = formp->getIgnoreMessage(); + row["columns"][0]["font"] = "SANSSERIF_SMALL"; + row["columns"][0]["width"] = 400; + + LLScrollListItem* item = NULL; + + bool show_popup = !formp->getIgnored(); + if (!show_popup) + { + if (ignore == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE) + { + LLSD last_response = LLUI::sSettingGroups["config"]->getLLSD("Default" + templatep->mName); + if (!last_response.isUndefined()) + { + for (LLSD::map_const_iterator it = last_response.beginMap(); + it != last_response.endMap(); + ++it) + { + if (it->second.asBoolean()) + { + row["columns"][1]["value"] = formp->getElement(it->first)["ignore"].asString(); + break; + } + } + } + row["columns"][1]["font"] = "SANSSERIF_SMALL"; + row["columns"][1]["width"] = 360; + } + item = disabled_popups.addElement(row); + } + else + { + item = enabled_popups.addElement(row); + } + + if (item) + { + item->setUserdata((void*)&iter->first); + } + } } void LLFloaterPreference::refreshEnabledState() { - LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); - LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); + LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); + LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); - // if vertex shaders off, disable all shader related products - if (!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable") || - !LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")) - { - ctrl_wind_light->setEnabled(FALSE); - ctrl_wind_light->setValue(FALSE); - } - else - { - ctrl_wind_light->setEnabled(gSavedSettings.getBOOL("VertexShaderEnable")); - } + // if vertex shaders off, disable all shader related products + if (!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable") || + !LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")) + { + ctrl_wind_light->setEnabled(FALSE); + ctrl_wind_light->setValue(FALSE); + } + else + { + ctrl_wind_light->setEnabled(gSavedSettings.getBOOL("VertexShaderEnable")); + } - //Deferred/SSAO/Shadows - BOOL bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump") && gSavedSettings.getBOOL("RenderObjectBump"); - BOOL shaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders") && gSavedSettings.getBOOL("VertexShaderEnable"); - BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && - bumpshiny && - shaders && - gGLManager.mHasFramebufferObject && - gSavedSettings.getBOOL("RenderAvatarVP") && - (ctrl_wind_light->get()) ? TRUE : FALSE; + //Deferred/SSAO/Shadows + BOOL bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump") && gSavedSettings.getBOOL("RenderObjectBump"); + BOOL shaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders") && gSavedSettings.getBOOL("VertexShaderEnable"); + BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && + bumpshiny && + shaders && + gGLManager.mHasFramebufferObject && + gSavedSettings.getBOOL("RenderAvatarVP") && + (ctrl_wind_light->get()) ? TRUE : FALSE; - ctrl_deferred->setEnabled(enabled); + ctrl_deferred->setEnabled(enabled); - // Cannot have floater active until caps have been received - getChild("default_creation_permissions")->setEnabled(LLStartUp::getStartupState() < STATE_STARTED ? false : true); + // Cannot have floater active until caps have been received + getChild("default_creation_permissions")->setEnabled(LLStartUp::getStartupState() < STATE_STARTED ? false : true); - getChildView("block_list")->setEnabled(LLLoginInstance::getInstance()->authSuccess()); + getChildView("block_list")->setEnabled(LLLoginInstance::getInstance()->authSuccess()); } void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() { - LLComboBox* ctrl_reflections = getChild("Reflections"); - LLTextBox* reflections_text = getChild("ReflectionsText"); - - // Reflections - BOOL reflections = gSavedSettings.getBOOL("VertexShaderEnable") - && gGLManager.mHasCubeMap - && LLCubeMap::sUseCubeMaps; - ctrl_reflections->setEnabled(reflections); - reflections_text->setEnabled(reflections); - - // Bump & Shiny - LLCheckBoxCtrl* bumpshiny_ctrl = getChild("BumpShiny"); - bool bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump"); - bumpshiny_ctrl->setEnabled(bumpshiny ? TRUE : FALSE); - - // Avatar Mode - // Enable Avatar Shaders - LLCheckBoxCtrl* ctrl_avatar_vp = getChild("AvatarVertexProgram"); - // Avatar Render Mode - LLCheckBoxCtrl* ctrl_avatar_cloth = getChild("AvatarCloth"); + LLComboBox* ctrl_reflections = getChild("Reflections"); + LLTextBox* reflections_text = getChild("ReflectionsText"); + + // Reflections + BOOL reflections = gSavedSettings.getBOOL("VertexShaderEnable") + && gGLManager.mHasCubeMap + && LLCubeMap::sUseCubeMaps; + ctrl_reflections->setEnabled(reflections); + reflections_text->setEnabled(reflections); + + // Bump & Shiny + LLCheckBoxCtrl* bumpshiny_ctrl = getChild("BumpShiny"); + bool bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump"); + bumpshiny_ctrl->setEnabled(bumpshiny ? TRUE : FALSE); - bool avatar_vp_enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarVP"); - if (LLViewerShaderMgr::sInitialized) - { - S32 max_avatar_shader = LLViewerShaderMgr::instance()->mMaxAvatarShaderLevel; - avatar_vp_enabled = (max_avatar_shader > 0) ? TRUE : FALSE; - } - - ctrl_avatar_vp->setEnabled(avatar_vp_enabled); - - if (gSavedSettings.getBOOL("VertexShaderEnable") == FALSE || - gSavedSettings.getBOOL("RenderAvatarVP") == FALSE) - { - ctrl_avatar_cloth->setEnabled(FALSE); - } - else - { - ctrl_avatar_cloth->setEnabled(TRUE); - } - - // Vertex Shaders - // Global Shader Enable - LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); - LLSliderCtrl* terrain_detail = getChild("TerrainDetail"); // can be linked with control var - LLTextBox* terrain_text = getChild("TerrainDetailText"); - - ctrl_shader_enable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")); - - BOOL shaders = ctrl_shader_enable->get(); - if (shaders) - { - terrain_detail->setEnabled(FALSE); - terrain_text->setEnabled(FALSE); - } - else - { - terrain_detail->setEnabled(TRUE); - terrain_text->setEnabled(TRUE); - } - - // WindLight - LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); - LLSliderCtrl* sky = getChild("SkyMeshDetail"); - LLTextBox* sky_text = getChild("SkyMeshDetailText"); - - // *HACK just checks to see if we can use shaders... - // maybe some cards that use shaders, but don't support windlight - ctrl_wind_light->setEnabled(ctrl_shader_enable->getEnabled() && shaders); - - sky->setEnabled(ctrl_wind_light->get() && shaders); - sky_text->setEnabled(ctrl_wind_light->get() && shaders); - - //Deferred/SSAO/Shadows - LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); - - BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && - ((bumpshiny_ctrl && bumpshiny_ctrl->get()) ? TRUE : FALSE) && - shaders && - gGLManager.mHasFramebufferObject && - gSavedSettings.getBOOL("RenderAvatarVP") && - (ctrl_wind_light->get()) ? TRUE : FALSE; - - ctrl_deferred->setEnabled(enabled); - - LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); - LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); - LLComboBox* ctrl_shadow = getChild("ShadowDetail"); - LLTextBox* shadow_text = getChild("RenderShadowDetailText"); - - // note, okay here to get from ctrl_deferred as it's twin, ctrl_deferred2 will alway match it - enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO") && (ctrl_deferred->get() ? TRUE : FALSE); - - ctrl_deferred->set(gSavedSettings.getBOOL("RenderDeferred")); - - ctrl_ssao->setEnabled(enabled); - ctrl_dof->setEnabled(enabled); - - enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail"); - - ctrl_shadow->setEnabled(enabled); - shadow_text->setEnabled(enabled); - - // Hardware settings - F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); - S32Megabytes min_tex_mem = LLViewerTextureList::getMinVideoRamSetting(); - S32Megabytes max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting(false, mem_multiplier); - getChild("GraphicsCardTextureMemory")->setMinValue(min_tex_mem.value()); - getChild("GraphicsCardTextureMemory")->setMaxValue(max_tex_mem.value()); - - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") || - !gGLManager.mHasVertexBufferObject) - { - getChildView("vbo")->setEnabled(FALSE); - } - - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderCompressTextures") || - !gGLManager.mHasVertexBufferObject) - { - getChildView("texture compression")->setEnabled(FALSE); - } - - // if no windlight shaders, turn off nighttime brightness, gamma, and fog distance - LLUICtrl* gamma_ctrl = getChild("gamma"); - gamma_ctrl->setEnabled(!gPipeline.canUseWindLightShaders()); - getChildView("(brightness, lower is brighter)")->setEnabled(!gPipeline.canUseWindLightShaders()); - getChildView("fog")->setEnabled(!gPipeline.canUseWindLightShaders()); - getChildView("antialiasing restart")->setVisible(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred")); - - // now turn off any features that are unavailable - disableUnavailableSettings(); + // Avatar Mode + // Enable Avatar Shaders + LLCheckBoxCtrl* ctrl_avatar_vp = getChild("AvatarVertexProgram"); + // Avatar Render Mode + LLCheckBoxCtrl* ctrl_avatar_cloth = getChild("AvatarCloth"); + + bool avatar_vp_enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarVP"); + if (LLViewerShaderMgr::sInitialized) + { + S32 max_avatar_shader = LLViewerShaderMgr::instance()->mMaxAvatarShaderLevel; + avatar_vp_enabled = (max_avatar_shader > 0) ? TRUE : FALSE; + } + + ctrl_avatar_vp->setEnabled(avatar_vp_enabled); + + if (gSavedSettings.getBOOL("VertexShaderEnable") == FALSE || + gSavedSettings.getBOOL("RenderAvatarVP") == FALSE) + { + ctrl_avatar_cloth->setEnabled(FALSE); + } + else + { + ctrl_avatar_cloth->setEnabled(TRUE); + } + + // Vertex Shaders + // Global Shader Enable + LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); + LLSliderCtrl* terrain_detail = getChild("TerrainDetail"); // can be linked with control var + LLTextBox* terrain_text = getChild("TerrainDetailText"); + + ctrl_shader_enable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")); + + BOOL shaders = ctrl_shader_enable->get(); + if (shaders) + { + terrain_detail->setEnabled(FALSE); + terrain_text->setEnabled(FALSE); + } + else + { + terrain_detail->setEnabled(TRUE); + terrain_text->setEnabled(TRUE); + } + + // WindLight + LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); + LLSliderCtrl* sky = getChild("SkyMeshDetail"); + LLTextBox* sky_text = getChild("SkyMeshDetailText"); + + // *HACK just checks to see if we can use shaders... + // maybe some cards that use shaders, but don't support windlight + ctrl_wind_light->setEnabled(ctrl_shader_enable->getEnabled() && shaders); + + sky->setEnabled(ctrl_wind_light->get() && shaders); + sky_text->setEnabled(ctrl_wind_light->get() && shaders); + + //Deferred/SSAO/Shadows + LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); + + BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && + ((bumpshiny_ctrl && bumpshiny_ctrl->get()) ? TRUE : FALSE) && + shaders && + gGLManager.mHasFramebufferObject && + gSavedSettings.getBOOL("RenderAvatarVP") && + (ctrl_wind_light->get()) ? TRUE : FALSE; + + ctrl_deferred->setEnabled(enabled); + + LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); + LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); + LLComboBox* ctrl_shadow = getChild("ShadowDetail"); + LLTextBox* shadow_text = getChild("RenderShadowDetailText"); + + // note, okay here to get from ctrl_deferred as it's twin, ctrl_deferred2 will alway match it + enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO") && (ctrl_deferred->get() ? TRUE : FALSE); + + ctrl_deferred->set(gSavedSettings.getBOOL("RenderDeferred")); + + ctrl_ssao->setEnabled(enabled); + ctrl_dof->setEnabled(enabled); + + enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail"); + + ctrl_shadow->setEnabled(enabled); + shadow_text->setEnabled(enabled); + + // Hardware settings + F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); + S32Megabytes min_tex_mem = LLViewerTextureList::getMinVideoRamSetting(); + S32Megabytes max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting(false, mem_multiplier); + getChild("GraphicsCardTextureMemory")->setMinValue(min_tex_mem.value()); + getChild("GraphicsCardTextureMemory")->setMaxValue(max_tex_mem.value()); + + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") || + !gGLManager.mHasVertexBufferObject) + { + getChildView("vbo")->setEnabled(FALSE); + } + + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderCompressTextures") || + !gGLManager.mHasVertexBufferObject) + { + getChildView("texture compression")->setEnabled(FALSE); + } + + // if no windlight shaders, turn off nighttime brightness, gamma, and fog distance + LLUICtrl* gamma_ctrl = getChild("gamma"); + gamma_ctrl->setEnabled(!gPipeline.canUseWindLightShaders()); + getChildView("(brightness, lower is brighter)")->setEnabled(!gPipeline.canUseWindLightShaders()); + getChildView("fog")->setEnabled(!gPipeline.canUseWindLightShaders()); + getChildView("antialiasing restart")->setVisible(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred")); + + // now turn off any features that are unavailable + disableUnavailableSettings(); } // static void LLAvatarComplexityControls::setIndirectControls() { - /* - * We have controls that have an indirect relationship between the control - * values and adjacent text and the underlying setting they influence. - * In each case, the control and its associated setting are named Indirect - * This method interrogates the controlled setting and establishes the - * appropriate value for the indirect control. It must be called whenever the - * underlying setting may have changed other than through the indirect control, - * such as when the 'Reset all to recommended settings' button is used... - */ - setIndirectMaxNonImpostors(); - setIndirectMaxArc(); + /* + * We have controls that have an indirect relationship between the control + * values and adjacent text and the underlying setting they influence. + * In each case, the control and its associated setting are named Indirect + * This method interrogates the controlled setting and establishes the + * appropriate value for the indirect control. It must be called whenever the + * underlying setting may have changed other than through the indirect control, + * such as when the 'Reset all to recommended settings' button is used... + */ + setIndirectMaxNonImpostors(); + setIndirectMaxArc(); } // static void LLAvatarComplexityControls::setIndirectMaxNonImpostors() { - U32 max_non_impostors = gSavedSettings.getU32("RenderAvatarMaxNonImpostors"); - // for this one, we just need to make zero, which means off, the max value of the slider - U32 indirect_max_non_impostors = (0 == max_non_impostors) ? LLVOAvatar::IMPOSTORS_OFF : max_non_impostors; - gSavedSettings.setU32("IndirectMaxNonImpostors", indirect_max_non_impostors); + U32 max_non_impostors = gSavedSettings.getU32("RenderAvatarMaxNonImpostors"); + // for this one, we just need to make zero, which means off, the max value of the slider + U32 indirect_max_non_impostors = (0 == max_non_impostors) ? LLVOAvatar::IMPOSTORS_OFF : max_non_impostors; + gSavedSettings.setU32("IndirectMaxNonImpostors", indirect_max_non_impostors); } void LLAvatarComplexityControls::setIndirectMaxArc() { - U32 max_arc = gSavedSettings.getU32("RenderAvatarMaxComplexity"); - U32 indirect_max_arc; - if (0 == max_arc) - { - // the off position is all the way to the right, so set to control max - indirect_max_arc = INDIRECT_MAX_ARC_OFF; - } - else - { - // This is the inverse of the calculation in updateMaxComplexity - indirect_max_arc = (U32)ll_round(((log(F32(max_arc)) - MIN_ARC_LOG) / ARC_LIMIT_MAP_SCALE)) + MIN_INDIRECT_ARC_LIMIT; - } - gSavedSettings.setU32("IndirectMaxComplexity", indirect_max_arc); + U32 max_arc = gSavedSettings.getU32("RenderAvatarMaxComplexity"); + U32 indirect_max_arc; + if (0 == max_arc) + { + // the off position is all the way to the right, so set to control max + indirect_max_arc = INDIRECT_MAX_ARC_OFF; + } + else + { + // This is the inverse of the calculation in updateMaxComplexity + indirect_max_arc = (U32)ll_round(((log(F32(max_arc)) - MIN_ARC_LOG) / ARC_LIMIT_MAP_SCALE)) + MIN_INDIRECT_ARC_LIMIT; + } + gSavedSettings.setU32("IndirectMaxComplexity", indirect_max_arc); } void LLFloaterPreferenceGraphicsAdvanced::disableUnavailableSettings() -{ - LLComboBox* ctrl_reflections = getChild("Reflections"); - LLTextBox* reflections_text = getChild("ReflectionsText"); - LLCheckBoxCtrl* ctrl_avatar_vp = getChild("AvatarVertexProgram"); - LLCheckBoxCtrl* ctrl_avatar_cloth = getChild("AvatarCloth"); - LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); - LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); - LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); - LLComboBox* ctrl_shadows = getChild("ShadowDetail"); - LLTextBox* shadows_text = getChild("RenderShadowDetailText"); - LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); - LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); - LLSliderCtrl* sky = getChild("SkyMeshDetail"); - LLTextBox* sky_text = getChild("SkyMeshDetailText"); - - // if vertex shaders off, disable all shader related products - if (!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")) - { - ctrl_shader_enable->setEnabled(FALSE); - ctrl_shader_enable->setValue(FALSE); - - ctrl_wind_light->setEnabled(FALSE); - ctrl_wind_light->setValue(FALSE); - - sky->setEnabled(FALSE); - sky_text->setEnabled(FALSE); - - ctrl_reflections->setEnabled(FALSE); - ctrl_reflections->setValue(0); - reflections_text->setEnabled(FALSE); - - ctrl_avatar_vp->setEnabled(FALSE); - ctrl_avatar_vp->setValue(FALSE); - - ctrl_avatar_cloth->setEnabled(FALSE); - ctrl_avatar_cloth->setValue(FALSE); - - ctrl_shadows->setEnabled(FALSE); - ctrl_shadows->setValue(0); - shadows_text->setEnabled(FALSE); - - ctrl_ssao->setEnabled(FALSE); - ctrl_ssao->setValue(FALSE); - - ctrl_dof->setEnabled(FALSE); - ctrl_dof->setValue(FALSE); - - ctrl_deferred->setEnabled(FALSE); - ctrl_deferred->setValue(FALSE); - } - - // disabled windlight - if (!LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")) - { - ctrl_wind_light->setEnabled(FALSE); - ctrl_wind_light->setValue(FALSE); - - sky->setEnabled(FALSE); - sky_text->setEnabled(FALSE); - - //deferred needs windlight, disable deferred - ctrl_shadows->setEnabled(FALSE); - ctrl_shadows->setValue(0); - shadows_text->setEnabled(FALSE); - - ctrl_ssao->setEnabled(FALSE); - ctrl_ssao->setValue(FALSE); - - ctrl_dof->setEnabled(FALSE); - ctrl_dof->setValue(FALSE); - - ctrl_deferred->setEnabled(FALSE); - ctrl_deferred->setValue(FALSE); - } - - // disabled deferred - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") || - !gGLManager.mHasFramebufferObject) - { - ctrl_shadows->setEnabled(FALSE); - ctrl_shadows->setValue(0); - shadows_text->setEnabled(FALSE); - - ctrl_ssao->setEnabled(FALSE); - ctrl_ssao->setValue(FALSE); - - ctrl_dof->setEnabled(FALSE); - ctrl_dof->setValue(FALSE); - - ctrl_deferred->setEnabled(FALSE); - ctrl_deferred->setValue(FALSE); - } - - // disabled deferred SSAO - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO")) - { - ctrl_ssao->setEnabled(FALSE); - ctrl_ssao->setValue(FALSE); - } - - // disabled deferred shadows - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail")) - { - ctrl_shadows->setEnabled(FALSE); - ctrl_shadows->setValue(0); - shadows_text->setEnabled(FALSE); - } - - // disabled reflections - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderReflectionDetail")) - { - ctrl_reflections->setEnabled(FALSE); - ctrl_reflections->setValue(FALSE); - reflections_text->setEnabled(FALSE); - } - - // disabled av - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarVP")) - { - ctrl_avatar_vp->setEnabled(FALSE); - ctrl_avatar_vp->setValue(FALSE); - - ctrl_avatar_cloth->setEnabled(FALSE); - ctrl_avatar_cloth->setValue(FALSE); - - //deferred needs AvatarVP, disable deferred - ctrl_shadows->setEnabled(FALSE); - ctrl_shadows->setValue(0); - shadows_text->setEnabled(FALSE); - - ctrl_ssao->setEnabled(FALSE); - ctrl_ssao->setValue(FALSE); - - ctrl_dof->setEnabled(FALSE); - ctrl_dof->setValue(FALSE); - - ctrl_deferred->setEnabled(FALSE); - ctrl_deferred->setValue(FALSE); - } - - // disabled cloth - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarCloth")) - { - ctrl_avatar_cloth->setEnabled(FALSE); - ctrl_avatar_cloth->setValue(FALSE); - } +{ + LLComboBox* ctrl_reflections = getChild("Reflections"); + LLTextBox* reflections_text = getChild("ReflectionsText"); + LLCheckBoxCtrl* ctrl_avatar_vp = getChild("AvatarVertexProgram"); + LLCheckBoxCtrl* ctrl_avatar_cloth = getChild("AvatarCloth"); + LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); + LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); + LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); + LLComboBox* ctrl_shadows = getChild("ShadowDetail"); + LLTextBox* shadows_text = getChild("RenderShadowDetailText"); + LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); + LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); + LLSliderCtrl* sky = getChild("SkyMeshDetail"); + LLTextBox* sky_text = getChild("SkyMeshDetailText"); + + // if vertex shaders off, disable all shader related products + if (!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")) + { + ctrl_shader_enable->setEnabled(FALSE); + ctrl_shader_enable->setValue(FALSE); + + ctrl_wind_light->setEnabled(FALSE); + ctrl_wind_light->setValue(FALSE); + + sky->setEnabled(FALSE); + sky_text->setEnabled(FALSE); + + ctrl_reflections->setEnabled(FALSE); + ctrl_reflections->setValue(0); + reflections_text->setEnabled(FALSE); + + ctrl_avatar_vp->setEnabled(FALSE); + ctrl_avatar_vp->setValue(FALSE); + + ctrl_avatar_cloth->setEnabled(FALSE); + ctrl_avatar_cloth->setValue(FALSE); + + ctrl_shadows->setEnabled(FALSE); + ctrl_shadows->setValue(0); + shadows_text->setEnabled(FALSE); + + ctrl_ssao->setEnabled(FALSE); + ctrl_ssao->setValue(FALSE); + + ctrl_dof->setEnabled(FALSE); + ctrl_dof->setValue(FALSE); + + ctrl_deferred->setEnabled(FALSE); + ctrl_deferred->setValue(FALSE); + } + + // disabled windlight + if (!LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")) + { + ctrl_wind_light->setEnabled(FALSE); + ctrl_wind_light->setValue(FALSE); + + sky->setEnabled(FALSE); + sky_text->setEnabled(FALSE); + + //deferred needs windlight, disable deferred + ctrl_shadows->setEnabled(FALSE); + ctrl_shadows->setValue(0); + shadows_text->setEnabled(FALSE); + + ctrl_ssao->setEnabled(FALSE); + ctrl_ssao->setValue(FALSE); + + ctrl_dof->setEnabled(FALSE); + ctrl_dof->setValue(FALSE); + + ctrl_deferred->setEnabled(FALSE); + ctrl_deferred->setValue(FALSE); + } + + // disabled deferred + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") || + !gGLManager.mHasFramebufferObject) + { + ctrl_shadows->setEnabled(FALSE); + ctrl_shadows->setValue(0); + shadows_text->setEnabled(FALSE); + + ctrl_ssao->setEnabled(FALSE); + ctrl_ssao->setValue(FALSE); + + ctrl_dof->setEnabled(FALSE); + ctrl_dof->setValue(FALSE); + + ctrl_deferred->setEnabled(FALSE); + ctrl_deferred->setValue(FALSE); + } + + // disabled deferred SSAO + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO")) + { + ctrl_ssao->setEnabled(FALSE); + ctrl_ssao->setValue(FALSE); + } + + // disabled deferred shadows + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail")) + { + ctrl_shadows->setEnabled(FALSE); + ctrl_shadows->setValue(0); + shadows_text->setEnabled(FALSE); + } + + // disabled reflections + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderReflectionDetail")) + { + ctrl_reflections->setEnabled(FALSE); + ctrl_reflections->setValue(FALSE); + reflections_text->setEnabled(FALSE); + } + + // disabled av + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarVP")) + { + ctrl_avatar_vp->setEnabled(FALSE); + ctrl_avatar_vp->setValue(FALSE); + + ctrl_avatar_cloth->setEnabled(FALSE); + ctrl_avatar_cloth->setValue(FALSE); + + //deferred needs AvatarVP, disable deferred + ctrl_shadows->setEnabled(FALSE); + ctrl_shadows->setValue(0); + shadows_text->setEnabled(FALSE); + + ctrl_ssao->setEnabled(FALSE); + ctrl_ssao->setValue(FALSE); + + ctrl_dof->setEnabled(FALSE); + ctrl_dof->setValue(FALSE); + + ctrl_deferred->setEnabled(FALSE); + ctrl_deferred->setValue(FALSE); + } + + // disabled cloth + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarCloth")) + { + ctrl_avatar_cloth->setEnabled(FALSE); + ctrl_avatar_cloth->setValue(FALSE); + } } void LLFloaterPreference::refresh() { - LLPanel::refresh(); + LLPanel::refresh(); LLAvatarComplexityControls::setText( gSavedSettings.getU32("RenderAvatarMaxComplexity"), getChild("IndirectMaxComplexityText", true)); - refreshEnabledState(); - LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); - if (advanced) - { - advanced->refresh(); - } + refreshEnabledState(); + LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); + if (advanced) + { + advanced->refresh(); + } } void LLFloaterPreferenceGraphicsAdvanced::refresh() { - getChild("fsaa")->setValue((LLSD::Integer) gSavedSettings.getU32("RenderFSAASamples")); - - // sliders and their text boxes - // mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow"); - // slider text boxes - updateSliderText(getChild("ObjectMeshDetail", true), getChild("ObjectMeshDetailText", true)); - updateSliderText(getChild("FlexibleMeshDetail", true), getChild("FlexibleMeshDetailText", true)); - updateSliderText(getChild("TreeMeshDetail", true), getChild("TreeMeshDetailText", true)); - updateSliderText(getChild("AvatarMeshDetail", true), getChild("AvatarMeshDetailText", true)); - updateSliderText(getChild("AvatarPhysicsDetail", true), getChild("AvatarPhysicsDetailText", true)); - updateSliderText(getChild("TerrainMeshDetail", true), getChild("TerrainMeshDetailText", true)); - updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true)); - updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); - updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true)); + getChild("fsaa")->setValue((LLSD::Integer) gSavedSettings.getU32("RenderFSAASamples")); + + // sliders and their text boxes + // mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow"); + // slider text boxes + updateSliderText(getChild("ObjectMeshDetail", true), getChild("ObjectMeshDetailText", true)); + updateSliderText(getChild("FlexibleMeshDetail", true), getChild("FlexibleMeshDetailText", true)); + updateSliderText(getChild("TreeMeshDetail", true), getChild("TreeMeshDetailText", true)); + updateSliderText(getChild("AvatarMeshDetail", true), getChild("AvatarMeshDetailText", true)); + updateSliderText(getChild("AvatarPhysicsDetail", true), getChild("AvatarPhysicsDetailText", true)); + updateSliderText(getChild("TerrainMeshDetail", true), getChild("TerrainMeshDetailText", true)); + updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true)); + updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); + updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true)); LLAvatarComplexityControls::setIndirectControls(); - setMaxNonImpostorsText( + setMaxNonImpostorsText( gSavedSettings.getU32("RenderAvatarMaxNonImpostors"), getChild("IndirectMaxNonImpostorsText", true)); LLAvatarComplexityControls::setText( gSavedSettings.getU32("RenderAvatarMaxComplexity"), getChild("IndirectMaxComplexityText", true)); - refreshEnabledState(); + refreshEnabledState(); } void LLFloaterPreference::onCommitWindowedMode() { - refresh(); + refresh(); } void LLFloaterPreference::onChangeQuality(const LLSD& data) { - U32 level = (U32)(data.asReal()); - LLFeatureManager::getInstance()->setGraphicsLevel(level, true); - refreshEnabledGraphics(); - refresh(); + U32 level = (U32)(data.asReal()); + LLFeatureManager::getInstance()->setGraphicsLevel(level, true); + refreshEnabledGraphics(); + refresh(); } void LLFloaterPreference::onClickSetKey() { - LLVoiceSetKeyDialog* dialog = LLFloaterReg::showTypedInstance("voice_set_key", LLSD(), TRUE); - if (dialog) - { - dialog->setParent(this); - } + LLVoiceSetKeyDialog* dialog = LLFloaterReg::showTypedInstance("voice_set_key", LLSD(), TRUE); + if (dialog) + { + dialog->setParent(this); + } } void LLFloaterPreference::setKey(KEY key) { - getChild("modifier_combo")->setValue(LLKeyboard::stringFromKey(key)); - // update the control right away since we no longer wait for apply - getChild("modifier_combo")->onCommit(); + getChild("modifier_combo")->setValue(LLKeyboard::stringFromKey(key)); + // update the control right away since we no longer wait for apply + getChild("modifier_combo")->onCommit(); } void LLFloaterPreference::onClickSetMiddleMouse() { - LLUICtrl* p2t_line_editor = getChild("modifier_combo"); + LLUICtrl* p2t_line_editor = getChild("modifier_combo"); - // update the control right away since we no longer wait for apply - p2t_line_editor->setControlValue(MIDDLE_MOUSE_CV); + // update the control right away since we no longer wait for apply + p2t_line_editor->setControlValue(MIDDLE_MOUSE_CV); - //push2talk button "middle mouse" control value is in English, need to localize it for presentation - LLPanel* advanced_preferences = dynamic_cast(p2t_line_editor->getParent()); - if (advanced_preferences) - { - p2t_line_editor->setValue(advanced_preferences->getString("middle_mouse")); - } + //push2talk button "middle mouse" control value is in English, need to localize it for presentation + LLPanel* advanced_preferences = dynamic_cast(p2t_line_editor->getParent()); + if (advanced_preferences) + { + p2t_line_editor->setValue(advanced_preferences->getString("middle_mouse")); + } } void LLFloaterPreference::onClickSetSounds() { - // Disable Enable gesture sounds checkbox if the master sound is disabled - // or if sound effects are disabled. - getChild("gesture_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds")); + // Disable Enable gesture sounds checkbox if the master sound is disabled + // or if sound effects are disabled. + getChild("gesture_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds")); } /* void LLFloaterPreference::onClickSkipDialogs() { - LLNotificationsUtil::add("SkipShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_skip_dialogs, _1, _2, this)); + LLNotificationsUtil::add("SkipShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_skip_dialogs, _1, _2, this)); } void LLFloaterPreference::onClickResetDialogs() { - LLNotificationsUtil::add("ResetShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_reset_dialogs, _1, _2, this)); + LLNotificationsUtil::add("ResetShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_reset_dialogs, _1, _2, this)); } */ void LLFloaterPreference::onClickEnablePopup() -{ - LLScrollListCtrl& disabled_popups = getChildRef("disabled_popups"); - - std::vector items = disabled_popups.getAllSelected(); - std::vector::iterator itor; - for (itor = items.begin(); itor != items.end(); ++itor) - { - LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata())); - //gSavedSettings.setWarning(templatep->mName, TRUE); - std::string notification_name = templatep->mName; - LLUI::sSettingGroups["ignores"]->setBOOL(notification_name, TRUE); - } - - buildPopupLists(); +{ + LLScrollListCtrl& disabled_popups = getChildRef("disabled_popups"); + + std::vector items = disabled_popups.getAllSelected(); + std::vector::iterator itor; + for (itor = items.begin(); itor != items.end(); ++itor) + { + LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata())); + //gSavedSettings.setWarning(templatep->mName, TRUE); + std::string notification_name = templatep->mName; + LLUI::sSettingGroups["ignores"]->setBOOL(notification_name, TRUE); + } + + buildPopupLists(); } void LLFloaterPreference::onClickDisablePopup() -{ - LLScrollListCtrl& enabled_popups = getChildRef("enabled_popups"); - - std::vector items = enabled_popups.getAllSelected(); - std::vector::iterator itor; - for (itor = items.begin(); itor != items.end(); ++itor) - { - LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata())); - templatep->mForm->setIgnored(true); - } - - buildPopupLists(); +{ + LLScrollListCtrl& enabled_popups = getChildRef("enabled_popups"); + + std::vector items = enabled_popups.getAllSelected(); + std::vector::iterator itor; + for (itor = items.begin(); itor != items.end(); ++itor) + { + LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata())); + templatep->mForm->setIgnored(true); + } + + buildPopupLists(); } void LLFloaterPreference::resetAllIgnored() { - for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); - iter != LLNotifications::instance().templatesEnd(); - ++iter) - { - if (iter->second->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) - { - iter->second->mForm->setIgnored(false); - } - } + for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); + iter != LLNotifications::instance().templatesEnd(); + ++iter) + { + if (iter->second->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) + { + iter->second->mForm->setIgnored(false); + } + } } void LLFloaterPreference::setAllIgnored() { - for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); - iter != LLNotifications::instance().templatesEnd(); - ++iter) - { - if (iter->second->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) - { - iter->second->mForm->setIgnored(true); - } - } + for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); + iter != LLNotifications::instance().templatesEnd(); + ++iter) + { + if (iter->second->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) + { + iter->second->mForm->setIgnored(true); + } + } } void LLFloaterPreference::onClickLogPath() { - std::string proposed_name(gSavedPerAccountSettings.getString("InstantMessageLogPath")); - mPriorInstantMessageLogPath.clear(); - + std::string proposed_name(gSavedPerAccountSettings.getString("InstantMessageLogPath")); + mPriorInstantMessageLogPath.clear(); + - (new LLDirPickerThread(boost::bind(&LLFloaterPreference::changeLogPath, this, _1, _2), proposed_name))->getFile(); + (new LLDirPickerThread(boost::bind(&LLFloaterPreference::changeLogPath, this, _1, _2), proposed_name))->getFile(); } void LLFloaterPreference::changeLogPath(const std::vector& filenames, std::string proposed_name) { - //Path changed - if (proposed_name != filenames[0]) - { - gSavedPerAccountSettings.setString("InstantMessageLogPath", filenames[0]); - mPriorInstantMessageLogPath = proposed_name; + //Path changed + if (proposed_name != filenames[0]) + { + gSavedPerAccountSettings.setString("InstantMessageLogPath", filenames[0]); + mPriorInstantMessageLogPath = proposed_name; - // enable/disable 'Delete transcripts button - updateDeleteTranscriptsButton(); - } + // enable/disable 'Delete transcripts button + updateDeleteTranscriptsButton(); + } } bool LLFloaterPreference::moveTranscriptsAndLog() { - std::string instantMessageLogPath(gSavedPerAccountSettings.getString("InstantMessageLogPath")); - std::string chatLogPath = gDirUtilp->add(instantMessageLogPath, gDirUtilp->getUserName()); - - bool madeDirectory = false; - - //Does the directory really exist, if not then make it - if(!LLFile::isdir(chatLogPath)) - { - //mkdir success is defined as zero - if(LLFile::mkdir(chatLogPath) != 0) - { - return false; - } - madeDirectory = true; - } - - std::string originalConversationLogDir = LLConversationLog::instance().getFileName(); - std::string targetConversationLogDir = gDirUtilp->add(chatLogPath, "conversation.log"); - //Try to move the conversation log - if(!LLConversationLog::instance().moveLog(originalConversationLogDir, targetConversationLogDir)) - { - //Couldn't move the log and created a new directory so remove the new directory - if(madeDirectory) - { - LLFile::rmdir(chatLogPath); - } - return false; - } - - //Attempt to move transcripts - std::vector listOfTranscripts; - std::vector listOfFilesMoved; - - LLLogChat::getListOfTranscriptFiles(listOfTranscripts); - - if(!LLLogChat::moveTranscripts(gDirUtilp->getChatLogsDir(), - instantMessageLogPath, - listOfTranscripts, - listOfFilesMoved)) - { - //Couldn't move all the transcripts so restore those that moved back to their old location - LLLogChat::moveTranscripts(instantMessageLogPath, - gDirUtilp->getChatLogsDir(), - listOfFilesMoved); - - //Move the conversation log back - LLConversationLog::instance().moveLog(targetConversationLogDir, originalConversationLogDir); - - if(madeDirectory) - { - LLFile::rmdir(chatLogPath); - } - - return false; - } - - gDirUtilp->setChatLogsDir(instantMessageLogPath); - gDirUtilp->updatePerAccountChatLogsDir(); - - return true; + std::string instantMessageLogPath(gSavedPerAccountSettings.getString("InstantMessageLogPath")); + std::string chatLogPath = gDirUtilp->add(instantMessageLogPath, gDirUtilp->getUserName()); + + bool madeDirectory = false; + + //Does the directory really exist, if not then make it + if(!LLFile::isdir(chatLogPath)) + { + //mkdir success is defined as zero + if(LLFile::mkdir(chatLogPath) != 0) + { + return false; + } + madeDirectory = true; + } + + std::string originalConversationLogDir = LLConversationLog::instance().getFileName(); + std::string targetConversationLogDir = gDirUtilp->add(chatLogPath, "conversation.log"); + //Try to move the conversation log + if(!LLConversationLog::instance().moveLog(originalConversationLogDir, targetConversationLogDir)) + { + //Couldn't move the log and created a new directory so remove the new directory + if(madeDirectory) + { + LLFile::rmdir(chatLogPath); + } + return false; + } + + //Attempt to move transcripts + std::vector listOfTranscripts; + std::vector listOfFilesMoved; + + LLLogChat::getListOfTranscriptFiles(listOfTranscripts); + + if(!LLLogChat::moveTranscripts(gDirUtilp->getChatLogsDir(), + instantMessageLogPath, + listOfTranscripts, + listOfFilesMoved)) + { + //Couldn't move all the transcripts so restore those that moved back to their old location + LLLogChat::moveTranscripts(instantMessageLogPath, + gDirUtilp->getChatLogsDir(), + listOfFilesMoved); + + //Move the conversation log back + LLConversationLog::instance().moveLog(targetConversationLogDir, originalConversationLogDir); + + if(madeDirectory) + { + LLFile::rmdir(chatLogPath); + } + + return false; + } + + gDirUtilp->setChatLogsDir(instantMessageLogPath); + gDirUtilp->updatePerAccountChatLogsDir(); + + return true; } void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im_via_email, bool is_verified_email) { - mGotPersonalInfo = true; - mOriginalIMViaEmail = im_via_email; - mDirectoryVisibility = visibility; - - if (visibility == VISIBILITY_DEFAULT) - { - mOriginalHideOnlineStatus = false; - getChildView("online_visibility")->setEnabled(TRUE); - } - else if (visibility == VISIBILITY_HIDDEN) - { - mOriginalHideOnlineStatus = true; - getChildView("online_visibility")->setEnabled(TRUE); - } - else - { - mOriginalHideOnlineStatus = true; - } - - getChild("online_searchresults")->setEnabled(TRUE); - getChildView("friends_online_notify_checkbox")->setEnabled(TRUE); - getChild("online_visibility")->setValue(mOriginalHideOnlineStatus); - getChild("online_visibility")->setLabelArg("[DIR_VIS]", mDirectoryVisibility); - getChildView("send_im_to_email")->setEnabled(is_verified_email); + mGotPersonalInfo = true; + mOriginalIMViaEmail = im_via_email; + mDirectoryVisibility = visibility; + + if (visibility == VISIBILITY_DEFAULT) + { + mOriginalHideOnlineStatus = false; + getChildView("online_visibility")->setEnabled(TRUE); + } + else if (visibility == VISIBILITY_HIDDEN) + { + mOriginalHideOnlineStatus = true; + getChildView("online_visibility")->setEnabled(TRUE); + } + else + { + mOriginalHideOnlineStatus = true; + } + + getChild("online_searchresults")->setEnabled(TRUE); + getChildView("friends_online_notify_checkbox")->setEnabled(TRUE); + getChild("online_visibility")->setValue(mOriginalHideOnlineStatus); + getChild("online_visibility")->setLabelArg("[DIR_VIS]", mDirectoryVisibility); + getChildView("send_im_to_email")->setEnabled(is_verified_email); std::string tooltip; if (!is_verified_email) @@ -1867,115 +1867,115 @@ void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im // *TODO: Show or hide verify email text here based on is_verified_email getChild("send_im_to_email")->setValue(im_via_email); - getChildView("favorites_on_login_check")->setEnabled(TRUE); - getChildView("log_path_button")->setEnabled(TRUE); - getChildView("chat_font_size")->setEnabled(TRUE); - getChildView("conversation_log_combo")->setEnabled(TRUE); + getChildView("favorites_on_login_check")->setEnabled(TRUE); + getChildView("log_path_button")->setEnabled(TRUE); + getChildView("chat_font_size")->setEnabled(TRUE); + getChildView("conversation_log_combo")->setEnabled(TRUE); } void LLFloaterPreference::refreshUI() { - refresh(); + refresh(); } void LLFloaterPreferenceGraphicsAdvanced::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box) { - if (text_box == NULL || ctrl== NULL) - return; - - // get range and points when text should change - F32 value = (F32)ctrl->getValue().asReal(); - F32 min = ctrl->getMinValue(); - F32 max = ctrl->getMaxValue(); - F32 range = max - min; - llassert(range > 0); - F32 midPoint = min + range / 3.0f; - F32 highPoint = min + (2.0f * range / 3.0f); - - // choose the right text - if (value < midPoint) - { - text_box->setText(LLTrans::getString("GraphicsQualityLow")); - } - else if (value < highPoint) - { - text_box->setText(LLTrans::getString("GraphicsQualityMid")); - } - else - { - text_box->setText(LLTrans::getString("GraphicsQualityHigh")); - } + if (text_box == NULL || ctrl== NULL) + return; + + // get range and points when text should change + F32 value = (F32)ctrl->getValue().asReal(); + F32 min = ctrl->getMinValue(); + F32 max = ctrl->getMaxValue(); + F32 range = max - min; + llassert(range > 0); + F32 midPoint = min + range / 3.0f; + F32 highPoint = min + (2.0f * range / 3.0f); + + // choose the right text + if (value < midPoint) + { + text_box->setText(LLTrans::getString("GraphicsQualityLow")); + } + else if (value < highPoint) + { + text_box->setText(LLTrans::getString("GraphicsQualityMid")); + } + else + { + text_box->setText(LLTrans::getString("GraphicsQualityHigh")); + } } void LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors() { - // Called when the IndirectMaxNonImpostors control changes - // Responsible for fixing the slider label (IndirectMaxNonImpostorsText) and setting RenderAvatarMaxNonImpostors - LLSliderCtrl* ctrl = getChild("IndirectMaxNonImpostors",true); - U32 value = ctrl->getValue().asInteger(); + // Called when the IndirectMaxNonImpostors control changes + // Responsible for fixing the slider label (IndirectMaxNonImpostorsText) and setting RenderAvatarMaxNonImpostors + LLSliderCtrl* ctrl = getChild("IndirectMaxNonImpostors",true); + U32 value = ctrl->getValue().asInteger(); - if (0 == value || LLVOAvatar::IMPOSTORS_OFF <= value) - { - value=0; - } - gSavedSettings.setU32("RenderAvatarMaxNonImpostors", value); - LLVOAvatar::updateImpostorRendering(value); // make it effective immediately - setMaxNonImpostorsText(value, getChild("IndirectMaxNonImpostorsText")); + if (0 == value || LLVOAvatar::IMPOSTORS_OFF <= value) + { + value=0; + } + gSavedSettings.setU32("RenderAvatarMaxNonImpostors", value); + LLVOAvatar::updateImpostorRendering(value); // make it effective immediately + setMaxNonImpostorsText(value, getChild("IndirectMaxNonImpostorsText")); } void LLFloaterPreferenceGraphicsAdvanced::setMaxNonImpostorsText(U32 value, LLTextBox* text_box) { - if (0 == value) - { - text_box->setText(LLTrans::getString("no_limit")); - } - else - { - text_box->setText(llformat("%d", value)); - } + if (0 == value) + { + text_box->setText(LLTrans::getString("no_limit")); + } + else + { + text_box->setText(llformat("%d", value)); + } } void LLAvatarComplexityControls::updateMax(LLSliderCtrl* slider, LLTextBox* value_label) { - // Called when the IndirectMaxComplexity control changes - // Responsible for fixing the slider label (IndirectMaxComplexityText) and setting RenderAvatarMaxComplexity - U32 indirect_value = slider->getValue().asInteger(); - U32 max_arc; - - if (INDIRECT_MAX_ARC_OFF == indirect_value) - { - // The 'off' position is when the slider is all the way to the right, - // which is a value of INDIRECT_MAX_ARC_OFF, - // so it is necessary to set max_arc to 0 disable muted avatars. - max_arc = 0; - } - else - { - // if this is changed, the inverse calculation in setIndirectMaxArc - // must be changed to match - max_arc = (U32)ll_round(exp(MIN_ARC_LOG + (ARC_LIMIT_MAP_SCALE * (indirect_value - MIN_INDIRECT_ARC_LIMIT)))); - } - - gSavedSettings.setU32("RenderAvatarMaxComplexity", (U32)max_arc); - setText(max_arc, value_label); + // Called when the IndirectMaxComplexity control changes + // Responsible for fixing the slider label (IndirectMaxComplexityText) and setting RenderAvatarMaxComplexity + U32 indirect_value = slider->getValue().asInteger(); + U32 max_arc; + + if (INDIRECT_MAX_ARC_OFF == indirect_value) + { + // The 'off' position is when the slider is all the way to the right, + // which is a value of INDIRECT_MAX_ARC_OFF, + // so it is necessary to set max_arc to 0 disable muted avatars. + max_arc = 0; + } + else + { + // if this is changed, the inverse calculation in setIndirectMaxArc + // must be changed to match + max_arc = (U32)ll_round(exp(MIN_ARC_LOG + (ARC_LIMIT_MAP_SCALE * (indirect_value - MIN_INDIRECT_ARC_LIMIT)))); + } + + gSavedSettings.setU32("RenderAvatarMaxComplexity", (U32)max_arc); + setText(max_arc, value_label); } void LLAvatarComplexityControls::setText(U32 value, LLTextBox* text_box) { - if (0 == value) - { - text_box->setText(LLTrans::getString("no_limit")); - } - else - { - text_box->setText(llformat("%d", value)); - } + if (0 == value) + { + text_box->setText(LLTrans::getString("no_limit")); + } + else + { + text_box->setText(llformat("%d", value)); + } } void LLFloaterPreference::updateMaxComplexity() { - // Called when the IndirectMaxComplexity control changes + // Called when the IndirectMaxComplexity control changes LLAvatarComplexityControls::updateMax( getChild("IndirectMaxComplexity"), getChild("IndirectMaxComplexityText")); @@ -1983,7 +1983,7 @@ void LLFloaterPreference::updateMaxComplexity() void LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity() { - // Called when the IndirectMaxComplexity control changes + // Called when the IndirectMaxComplexity control changes LLAvatarComplexityControls::updateMax( getChild("IndirectMaxComplexity"), getChild("IndirectMaxComplexityText")); @@ -1991,16 +1991,16 @@ void LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity() void LLFloaterPreference::onChangeMaturity() { - U8 sim_access = gSavedSettings.getU32("PreferredMaturity"); + U8 sim_access = gSavedSettings.getU32("PreferredMaturity"); - getChild("rating_icon_general")->setVisible(sim_access == SIM_ACCESS_PG - || sim_access == SIM_ACCESS_MATURE - || sim_access == SIM_ACCESS_ADULT); + getChild("rating_icon_general")->setVisible(sim_access == SIM_ACCESS_PG + || sim_access == SIM_ACCESS_MATURE + || sim_access == SIM_ACCESS_ADULT); - getChild("rating_icon_moderate")->setVisible(sim_access == SIM_ACCESS_MATURE - || sim_access == SIM_ACCESS_ADULT); + getChild("rating_icon_moderate")->setVisible(sim_access == SIM_ACCESS_MATURE + || sim_access == SIM_ACCESS_ADULT); - getChild("rating_icon_adult")->setVisible(sim_access == SIM_ACCESS_ADULT); + getChild("rating_icon_adult")->setVisible(sim_access == SIM_ACCESS_ADULT); } std::string get_category_path(LLUUID cat_id) @@ -2064,23 +2064,23 @@ void LLFloaterPreference::onChangeAnimationFolder() // but the UI for this will still be enabled void LLFloaterPreference::onClickBlockList() { - LLFloaterSidePanelContainer::showPanel("people", "panel_people", - LLSD().with("people_panel_tab_name", "blocked_panel")); + LLFloaterSidePanelContainer::showPanel("people", "panel_people", + LLSD().with("people_panel_tab_name", "blocked_panel")); } void LLFloaterPreference::onClickProxySettings() { - LLFloaterReg::showInstance("prefs_proxy"); + LLFloaterReg::showInstance("prefs_proxy"); } void LLFloaterPreference::onClickTranslationSettings() { - LLFloaterReg::showInstance("prefs_translation"); + LLFloaterReg::showInstance("prefs_translation"); } void LLFloaterPreference::onClickAutoReplace() { - LLFloaterReg::showInstance("prefs_autoreplace"); + LLFloaterReg::showInstance("prefs_autoreplace"); } void LLFloaterPreference::onClickSpellChecker() @@ -2095,141 +2095,141 @@ void LLFloaterPreference::onClickRenderExceptions() void LLFloaterPreference::onClickAdvanced() { - LLFloaterReg::showInstance("prefs_graphics_advanced"); + LLFloaterReg::showInstance("prefs_graphics_advanced"); - LLTabContainer* tabcontainer = getChild("pref core"); - for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); - iter != tabcontainer->getChildList()->end(); ++iter) - { - LLView* view = *iter; - LLPanelPreferenceGraphics* panel = dynamic_cast(view); - if (panel) - { - panel->resetDirtyChilds(); - } - } + LLTabContainer* tabcontainer = getChild("pref core"); + for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); + iter != tabcontainer->getChildList()->end(); ++iter) + { + LLView* view = *iter; + LLPanelPreferenceGraphics* panel = dynamic_cast(view); + if (panel) + { + panel->resetDirtyChilds(); + } + } } void LLFloaterPreference::onClickActionChange() { - mClickActionDirty = true; + mClickActionDirty = true; } void LLFloaterPreference::onClickPermsDefault() { - LLFloaterReg::showInstance("perms_default"); + LLFloaterReg::showInstance("perms_default"); } void LLFloaterPreference::onDeleteTranscripts() { - LLSD args; - args["FOLDER"] = gDirUtilp->getUserName(); + LLSD args; + args["FOLDER"] = gDirUtilp->getUserName(); - LLNotificationsUtil::add("PreferenceChatDeleteTranscripts", args, LLSD(), boost::bind(&LLFloaterPreference::onDeleteTranscriptsResponse, this, _1, _2)); + LLNotificationsUtil::add("PreferenceChatDeleteTranscripts", args, LLSD(), boost::bind(&LLFloaterPreference::onDeleteTranscriptsResponse, this, _1, _2)); } void LLFloaterPreference::onDeleteTranscriptsResponse(const LLSD& notification, const LLSD& response) { - if (0 == LLNotificationsUtil::getSelectedOption(notification, response)) - { - LLLogChat::deleteTranscripts(); - updateDeleteTranscriptsButton(); - } + if (0 == LLNotificationsUtil::getSelectedOption(notification, response)) + { + LLLogChat::deleteTranscripts(); + updateDeleteTranscriptsButton(); + } } void LLFloaterPreference::onLogChatHistorySaved() { - LLButton * delete_transcripts_buttonp = getChild("delete_transcripts"); + LLButton * delete_transcripts_buttonp = getChild("delete_transcripts"); - if (!delete_transcripts_buttonp->getEnabled()) - { - delete_transcripts_buttonp->setEnabled(true); - } + if (!delete_transcripts_buttonp->getEnabled()) + { + delete_transcripts_buttonp->setEnabled(true); + } } void LLFloaterPreference::updateClickActionSettings() { - const int single_clk_action = getChild("single_click_action_combo")->getValue().asInteger(); - const int double_clk_action = getChild("double_click_action_combo")->getValue().asInteger(); + const int single_clk_action = getChild("single_click_action_combo")->getValue().asInteger(); + const int double_clk_action = getChild("double_click_action_combo")->getValue().asInteger(); - gSavedSettings.setBOOL("ClickToWalk", single_clk_action == 1); - gSavedSettings.setBOOL("DoubleClickAutoPilot", double_clk_action == 1); - gSavedSettings.setBOOL("DoubleClickTeleport", double_clk_action == 2); + gSavedSettings.setBOOL("ClickToWalk", single_clk_action == 1); + gSavedSettings.setBOOL("DoubleClickAutoPilot", double_clk_action == 1); + gSavedSettings.setBOOL("DoubleClickTeleport", double_clk_action == 2); } void LLFloaterPreference::updateClickActionControls() { - const bool click_to_walk = gSavedSettings.getBOOL("ClickToWalk"); - const bool dbl_click_to_walk = gSavedSettings.getBOOL("DoubleClickAutoPilot"); - const bool dbl_click_to_teleport = gSavedSettings.getBOOL("DoubleClickTeleport"); + const bool click_to_walk = gSavedSettings.getBOOL("ClickToWalk"); + const bool dbl_click_to_walk = gSavedSettings.getBOOL("DoubleClickAutoPilot"); + const bool dbl_click_to_teleport = gSavedSettings.getBOOL("DoubleClickTeleport"); - getChild("single_click_action_combo")->setValue((int)click_to_walk); - getChild("double_click_action_combo")->setValue(dbl_click_to_teleport ? 2 : (int)dbl_click_to_walk); + getChild("single_click_action_combo")->setValue((int)click_to_walk); + getChild("double_click_action_combo")->setValue(dbl_click_to_teleport ? 2 : (int)dbl_click_to_walk); } void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param) { - LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue())); + LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue())); } void LLFloaterPreference::getUIColor(LLUICtrl* ctrl, const LLSD& param) { - LLColorSwatchCtrl* color_swatch = (LLColorSwatchCtrl*) ctrl; - color_swatch->setOriginal(LLUIColorTable::instance().getColor(param.asString())); + LLColorSwatchCtrl* color_swatch = (LLColorSwatchCtrl*) ctrl; + color_swatch->setOriginal(LLUIColorTable::instance().getColor(param.asString())); } void LLFloaterPreference::setCacheLocation(const LLStringExplicit& location) { - LLUICtrl* cache_location_editor = getChild("cache_location"); - cache_location_editor->setValue(location); - cache_location_editor->setToolTip(location); + LLUICtrl* cache_location_editor = getChild("cache_location"); + cache_location_editor->setValue(location); + cache_location_editor->setToolTip(location); } void LLFloaterPreference::selectPanel(const LLSD& name) { - LLTabContainer * tab_containerp = getChild("pref core"); - LLPanel * panel = tab_containerp->getPanelByName(name); - if (NULL != panel) - { - tab_containerp->selectTabPanel(panel); - } + LLTabContainer * tab_containerp = getChild("pref core"); + LLPanel * panel = tab_containerp->getPanelByName(name); + if (NULL != panel) + { + tab_containerp->selectTabPanel(panel); + } } void LLFloaterPreference::selectPrivacyPanel() { - selectPanel("im"); + selectPanel("im"); } void LLFloaterPreference::selectChatPanel() { - selectPanel("chat"); + selectPanel("chat"); } void LLFloaterPreference::changed() { - getChild("clear_log")->setEnabled(LLConversationLog::instance().getConversations().size() > 0); + getChild("clear_log")->setEnabled(LLConversationLog::instance().getConversations().size() > 0); - // set 'enable' property for 'Delete transcripts...' button - updateDeleteTranscriptsButton(); + // set 'enable' property for 'Delete transcripts...' button + updateDeleteTranscriptsButton(); } void LLFloaterPreference::saveCameraPreset(std::string& preset) { - mSavedCameraPreset = preset; + mSavedCameraPreset = preset; } void LLFloaterPreference::saveGraphicsPreset(std::string& preset) { - mSavedGraphicsPreset = preset; + mSavedGraphicsPreset = preset; } //------------------------------Updater--------------------------------------- static bool handleBandwidthChanged(const LLSD& newvalue) { - gViewerThrottle.setMaxBandwidth((F32) newvalue.asReal()); - return true; + gViewerThrottle.setMaxBandwidth((F32) newvalue.asReal()); + return true; } class LLPanelPreference::Updater : public LLEventTimer @@ -2237,37 +2237,37 @@ class LLPanelPreference::Updater : public LLEventTimer public: - typedef boost::function callback_t; + typedef boost::function callback_t; - Updater(callback_t cb, F32 period) - :LLEventTimer(period), - mCallback(cb) - { - mEventTimer.stop(); - } + Updater(callback_t cb, F32 period) + :LLEventTimer(period), + mCallback(cb) + { + mEventTimer.stop(); + } - virtual ~Updater(){} + virtual ~Updater(){} - void update(const LLSD& new_value) - { - mNewValue = new_value; - mEventTimer.start(); - } + void update(const LLSD& new_value) + { + mNewValue = new_value; + mEventTimer.start(); + } protected: - BOOL tick() - { - mCallback(mNewValue); - mEventTimer.stop(); + BOOL tick() + { + mCallback(mNewValue); + mEventTimer.stop(); - return FALSE; - } + return FALSE; + } private: - LLSD mNewValue; - callback_t mCallback; + LLSD mNewValue; + callback_t mCallback; }; //---------------------------------------------------------------------------- static LLPanelInjector t_places("panel_preference"); @@ -2275,169 +2275,169 @@ LLPanelPreference::LLPanelPreference() : LLPanel(), mBandWidthUpdater(NULL) { - mCommitCallbackRegistrar.add("Pref.setControlFalse", boost::bind(&LLPanelPreference::setControlFalse,this, _2)); - mCommitCallbackRegistrar.add("Pref.updateMediaAutoPlayCheckbox", boost::bind(&LLPanelPreference::updateMediaAutoPlayCheckbox, this, _1)); - mCommitCallbackRegistrar.add("Pref.PrefDelete", boost::bind(&LLPanelPreference::deletePreset, this, _2)); - mCommitCallbackRegistrar.add("Pref.PrefSave", boost::bind(&LLPanelPreference::savePreset, this, _2)); - mCommitCallbackRegistrar.add("Pref.PrefLoad", boost::bind(&LLPanelPreference::loadPreset, this, _2)); + mCommitCallbackRegistrar.add("Pref.setControlFalse", boost::bind(&LLPanelPreference::setControlFalse,this, _2)); + mCommitCallbackRegistrar.add("Pref.updateMediaAutoPlayCheckbox", boost::bind(&LLPanelPreference::updateMediaAutoPlayCheckbox, this, _1)); + mCommitCallbackRegistrar.add("Pref.PrefDelete", boost::bind(&LLPanelPreference::deletePreset, this, _2)); + mCommitCallbackRegistrar.add("Pref.PrefSave", boost::bind(&LLPanelPreference::savePreset, this, _2)); + mCommitCallbackRegistrar.add("Pref.PrefLoad", boost::bind(&LLPanelPreference::loadPreset, this, _2)); } //virtual BOOL LLPanelPreference::postBuild() { - ////////////////////// PanelGeneral /////////////////// - if (hasChild("display_names_check", TRUE)) - { - BOOL use_people_api = gSavedSettings.getBOOL("UsePeopleAPI"); - LLCheckBoxCtrl* ctrl_display_name = getChild("display_names_check"); - ctrl_display_name->setEnabled(use_people_api); - if (!use_people_api) - { - ctrl_display_name->setValue(FALSE); - } - } - - ////////////////////// PanelVoice /////////////////// - if (hasChild("voice_unavailable", TRUE)) - { - BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice"); - getChildView("voice_unavailable")->setVisible( voice_disabled); - getChildView("enable_voice_check")->setVisible( !voice_disabled); - } - - //////////////////////PanelSkins /////////////////// - - if (hasChild("skin_selection", TRUE)) - { - LLFloaterPreference::refreshSkin(this); - - // if skin is set to a skin that no longer exists (silver) set back to default - if (getChild("skin_selection")->getSelectedIndex() < 0) - { - gSavedSettings.setString("SkinCurrent", "default"); - LLFloaterPreference::refreshSkin(this); - } - - } - - //////////////////////PanelPrivacy /////////////////// - if (hasChild("media_enabled", TRUE)) - { - bool media_enabled = gSavedSettings.getBOOL("AudioStreamingMedia"); - - getChild("media_enabled")->set(media_enabled); - getChild("autoplay_enabled")->setEnabled(media_enabled); - } - if (hasChild("music_enabled", TRUE)) - { - getChild("music_enabled")->set(gSavedSettings.getBOOL("AudioStreamingMusic")); - } - if (hasChild("voice_call_friends_only_check", TRUE)) - { - getChild("voice_call_friends_only_check")->setCommitCallback(boost::bind(&showFriendsOnlyWarning, _1, _2)); - } - if (hasChild("allow_multiple_viewer_check", TRUE)) - { - getChild("allow_multiple_viewer_check")->setCommitCallback(boost::bind(&showMultipleViewersWarning, _1, _2)); - } - if (hasChild("favorites_on_login_check", TRUE)) - { - getChild("favorites_on_login_check")->setCommitCallback(boost::bind(&handleFavoritesOnLoginChanged, _1, _2)); - bool show_favorites_at_login = LLPanelLogin::getShowFavorites(); - getChild("favorites_on_login_check")->setValue(show_favorites_at_login); - } - if (hasChild("mute_chb_label", TRUE)) - { - getChild("mute_chb_label")->setShowCursorHand(false); - getChild("mute_chb_label")->setClickedCallback(boost::bind(&toggleMuteWhenMinimized)); - } - - //////////////////////PanelAdvanced /////////////////// - if (hasChild("modifier_combo", TRUE)) - { - //localizing if push2talk button is set to middle mouse - if (MIDDLE_MOUSE_CV == getChild("modifier_combo")->getValue().asString()) - { - getChild("modifier_combo")->setValue(getString("middle_mouse")); - } - } - - //////////////////////PanelSetup /////////////////// - if (hasChild("max_bandwidth"), TRUE) - { - mBandWidthUpdater = new LLPanelPreference::Updater(boost::bind(&handleBandwidthChanged, _1), BANDWIDTH_UPDATER_TIMEOUT); - gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&LLPanelPreference::Updater::update, mBandWidthUpdater, _2)); - } + ////////////////////// PanelGeneral /////////////////// + if (hasChild("display_names_check", TRUE)) + { + BOOL use_people_api = gSavedSettings.getBOOL("UsePeopleAPI"); + LLCheckBoxCtrl* ctrl_display_name = getChild("display_names_check"); + ctrl_display_name->setEnabled(use_people_api); + if (!use_people_api) + { + ctrl_display_name->setValue(FALSE); + } + } + + ////////////////////// PanelVoice /////////////////// + if (hasChild("voice_unavailable", TRUE)) + { + BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice"); + getChildView("voice_unavailable")->setVisible( voice_disabled); + getChildView("enable_voice_check")->setVisible( !voice_disabled); + } + + //////////////////////PanelSkins /////////////////// + + if (hasChild("skin_selection", TRUE)) + { + LLFloaterPreference::refreshSkin(this); + + // if skin is set to a skin that no longer exists (silver) set back to default + if (getChild("skin_selection")->getSelectedIndex() < 0) + { + gSavedSettings.setString("SkinCurrent", "default"); + LLFloaterPreference::refreshSkin(this); + } + + } + + //////////////////////PanelPrivacy /////////////////// + if (hasChild("media_enabled", TRUE)) + { + bool media_enabled = gSavedSettings.getBOOL("AudioStreamingMedia"); + + getChild("media_enabled")->set(media_enabled); + getChild("autoplay_enabled")->setEnabled(media_enabled); + } + if (hasChild("music_enabled", TRUE)) + { + getChild("music_enabled")->set(gSavedSettings.getBOOL("AudioStreamingMusic")); + } + if (hasChild("voice_call_friends_only_check", TRUE)) + { + getChild("voice_call_friends_only_check")->setCommitCallback(boost::bind(&showFriendsOnlyWarning, _1, _2)); + } + if (hasChild("allow_multiple_viewer_check", TRUE)) + { + getChild("allow_multiple_viewer_check")->setCommitCallback(boost::bind(&showMultipleViewersWarning, _1, _2)); + } + if (hasChild("favorites_on_login_check", TRUE)) + { + getChild("favorites_on_login_check")->setCommitCallback(boost::bind(&handleFavoritesOnLoginChanged, _1, _2)); + bool show_favorites_at_login = LLPanelLogin::getShowFavorites(); + getChild("favorites_on_login_check")->setValue(show_favorites_at_login); + } + if (hasChild("mute_chb_label", TRUE)) + { + getChild("mute_chb_label")->setShowCursorHand(false); + getChild("mute_chb_label")->setClickedCallback(boost::bind(&toggleMuteWhenMinimized)); + } + + //////////////////////PanelAdvanced /////////////////// + if (hasChild("modifier_combo", TRUE)) + { + //localizing if push2talk button is set to middle mouse + if (MIDDLE_MOUSE_CV == getChild("modifier_combo")->getValue().asString()) + { + getChild("modifier_combo")->setValue(getString("middle_mouse")); + } + } + + //////////////////////PanelSetup /////////////////// + if (hasChild("max_bandwidth"), TRUE) + { + mBandWidthUpdater = new LLPanelPreference::Updater(boost::bind(&handleBandwidthChanged, _1), BANDWIDTH_UPDATER_TIMEOUT); + gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&LLPanelPreference::Updater::update, mBandWidthUpdater, _2)); + } #ifdef EXTERNAL_TOS - LLRadioGroup* ext_browser_settings = getChild("preferred_browser_behavior"); - if (ext_browser_settings) - { - // turn off ability to set external/internal browser - ext_browser_settings->setSelectedByValue(LLWeb::BROWSER_EXTERNAL_ONLY, true); - ext_browser_settings->setEnabled(false); - } + LLRadioGroup* ext_browser_settings = getChild("preferred_browser_behavior"); + if (ext_browser_settings) + { + // turn off ability to set external/internal browser + ext_browser_settings->setSelectedByValue(LLWeb::BROWSER_EXTERNAL_ONLY, true); + ext_browser_settings->setEnabled(false); + } #endif - apply(); - return true; + apply(); + return true; } LLPanelPreference::~LLPanelPreference() { - if (mBandWidthUpdater) - { - delete mBandWidthUpdater; - } + if (mBandWidthUpdater) + { + delete mBandWidthUpdater; + } } void LLPanelPreference::apply() { - // no-op + // no-op } void LLPanelPreference::saveSettings() { - LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); - - // Save the value of all controls in the hierarchy - mSavedValues.clear(); - std::list view_stack; - view_stack.push_back(this); - if (advanced) - { - view_stack.push_back(advanced); - } - while(!view_stack.empty()) - { - // Process view on top of the stack - LLView* curview = view_stack.front(); - view_stack.pop_front(); - - LLColorSwatchCtrl* color_swatch = dynamic_cast(curview); - if (color_swatch) - { - mSavedColors[color_swatch->getName()] = color_swatch->get(); - } - else - { - LLUICtrl* ctrl = dynamic_cast(curview); - if (ctrl) - { - LLControlVariable* control = ctrl->getControlVariable(); - if (control) - { - mSavedValues[control] = control->getValue(); - } - } - } - - // Push children onto the end of the work stack - for (child_list_t::const_iterator iter = curview->getChildList()->begin(); - iter != curview->getChildList()->end(); ++iter) - { - view_stack.push_back(*iter); - } - } + LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); + + // Save the value of all controls in the hierarchy + mSavedValues.clear(); + std::list view_stack; + view_stack.push_back(this); + if (advanced) + { + view_stack.push_back(advanced); + } + while(!view_stack.empty()) + { + // Process view on top of the stack + LLView* curview = view_stack.front(); + view_stack.pop_front(); + + LLColorSwatchCtrl* color_swatch = dynamic_cast(curview); + if (color_swatch) + { + mSavedColors[color_swatch->getName()] = color_swatch->get(); + } + else + { + LLUICtrl* ctrl = dynamic_cast(curview); + if (ctrl) + { + LLControlVariable* control = ctrl->getControlVariable(); + if (control) + { + mSavedValues[control] = control->getValue(); + } + } + } + + // Push children onto the end of the work stack + for (child_list_t::const_iterator iter = curview->getChildList()->begin(); + iter != curview->getChildList()->end(); ++iter) + { + view_stack.push_back(*iter); + } + } } void LLPanelPreference::showMultipleViewersWarning(LLUICtrl* checkbox, const LLSD& value) @@ -2450,104 +2450,104 @@ void LLPanelPreference::showMultipleViewersWarning(LLUICtrl* checkbox, const LLS void LLPanelPreference::showFriendsOnlyWarning(LLUICtrl* checkbox, const LLSD& value) { - if (checkbox && checkbox->getValue()) - { - LLNotificationsUtil::add("FriendsAndGroupsOnly"); - } + if (checkbox && checkbox->getValue()) + { + LLNotificationsUtil::add("FriendsAndGroupsOnly"); + } } void LLPanelPreference::handleFavoritesOnLoginChanged(LLUICtrl* checkbox, const LLSD& value) { - if (checkbox) - { - LLFavoritesOrderStorage::instance().showFavoritesOnLoginChanged(checkbox->getValue().asBoolean()); - if(checkbox->getValue()) - { - LLNotificationsUtil::add("FavoritesOnLogin"); - } - } + if (checkbox) + { + LLFavoritesOrderStorage::instance().showFavoritesOnLoginChanged(checkbox->getValue().asBoolean()); + if(checkbox->getValue()) + { + LLNotificationsUtil::add("FavoritesOnLogin"); + } + } } void LLPanelPreference::toggleMuteWhenMinimized() { - std::string mute("MuteWhenMinimized"); - gSavedSettings.setBOOL(mute, !gSavedSettings.getBOOL(mute)); + std::string mute("MuteWhenMinimized"); + gSavedSettings.setBOOL(mute, !gSavedSettings.getBOOL(mute)); } void LLPanelPreference::cancel() { - for (control_values_map_t::iterator iter = mSavedValues.begin(); - iter != mSavedValues.end(); ++iter) - { - LLControlVariable* control = iter->first; - LLSD ctrl_value = iter->second; + for (control_values_map_t::iterator iter = mSavedValues.begin(); + iter != mSavedValues.end(); ++iter) + { + LLControlVariable* control = iter->first; + LLSD ctrl_value = iter->second; - if((control->getName() == "InstantMessageLogPath") && (ctrl_value.asString() == "")) - { - continue; - } + if((control->getName() == "InstantMessageLogPath") && (ctrl_value.asString() == "")) + { + continue; + } - control->set(ctrl_value); - } + control->set(ctrl_value); + } - for (string_color_map_t::iterator iter = mSavedColors.begin(); - iter != mSavedColors.end(); ++iter) - { - LLColorSwatchCtrl* color_swatch = findChild(iter->first); - if (color_swatch) - { - color_swatch->set(iter->second); - color_swatch->onCommit(); - } - } + for (string_color_map_t::iterator iter = mSavedColors.begin(); + iter != mSavedColors.end(); ++iter) + { + LLColorSwatchCtrl* color_swatch = findChild(iter->first); + if (color_swatch) + { + color_swatch->set(iter->second); + color_swatch->onCommit(); + } + } } void LLPanelPreference::setControlFalse(const LLSD& user_data) { - std::string control_name = user_data.asString(); - LLControlVariable* control = findControl(control_name); - - if (control) - control->set(LLSD(FALSE)); + std::string control_name = user_data.asString(); + LLControlVariable* control = findControl(control_name); + + if (control) + control->set(LLSD(FALSE)); } void LLPanelPreference::updateMediaAutoPlayCheckbox(LLUICtrl* ctrl) { - std::string name = ctrl->getName(); + std::string name = ctrl->getName(); - // Disable "Allow Media to auto play" only when both - // "Streaming Music" and "Media" are unchecked. STORM-513. - if ((name == "enable_music") || (name == "enable_media")) - { - bool music_enabled = getChild("enable_music")->get(); - bool media_enabled = getChild("enable_media")->get(); + // Disable "Allow Media to auto play" only when both + // "Streaming Music" and "Media" are unchecked. STORM-513. + if ((name == "enable_music") || (name == "enable_media")) + { + bool music_enabled = getChild("enable_music")->get(); + bool media_enabled = getChild("enable_media")->get(); - getChild("media_auto_play_btn")->setEnabled(music_enabled || media_enabled); - } + getChild("media_auto_play_btn")->setEnabled(music_enabled || media_enabled); + } } void LLPanelPreference::deletePreset(const LLSD& user_data) { - std::string subdirectory = user_data.asString(); - LLFloaterReg::hideInstance("load_pref_preset", subdirectory); - LLFloaterReg::hideInstance("save_pref_preset", subdirectory); - LLFloaterReg::showInstance("delete_pref_preset", subdirectory); + std::string subdirectory = user_data.asString(); + LLFloaterReg::hideInstance("load_pref_preset", subdirectory); + LLFloaterReg::hideInstance("save_pref_preset", subdirectory); + LLFloaterReg::showInstance("delete_pref_preset", subdirectory); } void LLPanelPreference::savePreset(const LLSD& user_data) { - std::string subdirectory = user_data.asString(); - LLFloaterReg::hideInstance("delete_pref_preset", subdirectory); - LLFloaterReg::hideInstance("load_pref_preset", subdirectory); - LLFloaterReg::showInstance("save_pref_preset", subdirectory); + std::string subdirectory = user_data.asString(); + LLFloaterReg::hideInstance("delete_pref_preset", subdirectory); + LLFloaterReg::hideInstance("load_pref_preset", subdirectory); + LLFloaterReg::showInstance("save_pref_preset", subdirectory); } void LLPanelPreference::loadPreset(const LLSD& user_data) { - std::string subdirectory = user_data.asString(); - LLFloaterReg::hideInstance("delete_pref_preset", subdirectory); - LLFloaterReg::hideInstance("save_pref_preset", subdirectory); - LLFloaterReg::showInstance("load_pref_preset", subdirectory); + std::string subdirectory = user_data.asString(); + LLFloaterReg::hideInstance("delete_pref_preset", subdirectory); + LLFloaterReg::hideInstance("save_pref_preset", subdirectory); + LLFloaterReg::showInstance("load_pref_preset", subdirectory); } void LLPanelPreference::setHardwareDefaults() @@ -2557,39 +2557,39 @@ void LLPanelPreference::setHardwareDefaults() class LLPanelPreferencePrivacy : public LLPanelPreference { public: - LLPanelPreferencePrivacy() - { - mAccountIndependentSettings.push_back("VoiceCallsFriendsOnly"); - mAccountIndependentSettings.push_back("AutoDisengageMic"); - } - - /*virtual*/ void saveSettings() - { - LLPanelPreference::saveSettings(); - - // Don't save (=erase from the saved values map) per-account privacy settings - // if we're not logged in, otherwise they will be reset to defaults on log off. - if (LLStartUp::getStartupState() != STATE_STARTED) - { - // Erase only common settings, assuming there are no color settings on Privacy page. - for (control_values_map_t::iterator it = mSavedValues.begin(); it != mSavedValues.end(); ) - { - const std::string setting = it->first->getName(); - if (find(mAccountIndependentSettings.begin(), - mAccountIndependentSettings.end(), setting) == mAccountIndependentSettings.end()) - { - mSavedValues.erase(it++); - } - else - { - ++it; - } - } - } - } + LLPanelPreferencePrivacy() + { + mAccountIndependentSettings.push_back("VoiceCallsFriendsOnly"); + mAccountIndependentSettings.push_back("AutoDisengageMic"); + } + + /*virtual*/ void saveSettings() + { + LLPanelPreference::saveSettings(); + + // Don't save (=erase from the saved values map) per-account privacy settings + // if we're not logged in, otherwise they will be reset to defaults on log off. + if (LLStartUp::getStartupState() != STATE_STARTED) + { + // Erase only common settings, assuming there are no color settings on Privacy page. + for (control_values_map_t::iterator it = mSavedValues.begin(); it != mSavedValues.end(); ) + { + const std::string setting = it->first->getName(); + if (find(mAccountIndependentSettings.begin(), + mAccountIndependentSettings.end(), setting) == mAccountIndependentSettings.end()) + { + mSavedValues.erase(it++); + } + else + { + ++it; + } + } + } + } private: - std::list mAccountIndependentSettings; + std::list mAccountIndependentSettings; }; static LLPanelInjector t_pref_graph("panel_preference_graphics"); @@ -2598,253 +2598,253 @@ static LLPanelInjector t_pref_view("panel_preference_view BOOL LLPanelPreferenceView::postBuild() { - setPresetText(); + 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 - } + 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(); + return LLPanelPreference::postBuild(); } void LLPanelPreferenceView::onPresetsListChangeCamera() { - LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); - if (presetsMgr) - { - presetsMgr->setCameraDirty(false); - } + LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); + if (presetsMgr) + { + presetsMgr->setCameraDirty(false); + } - setPresetText(); + setPresetText(); - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance && !gSavedSettings.getString("PresetCameraActive").empty()) - { - instance->saveSettings(); //make cancel work correctly after changing the preset - } + 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(); + 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()) - { - preset_camera_active.clear(); - } - } - - 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")); - } + 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()) + { + preset_camera_active.clear(); + } + } + + 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() { - LLFloaterReg::showInstance("prefs_graphics_advanced"); - LLFloaterReg::hideInstance("prefs_graphics_advanced"); + LLFloaterReg::showInstance("prefs_graphics_advanced"); + LLFloaterReg::hideInstance("prefs_graphics_advanced"); - resetDirtyChilds(); - setPresetText(); + resetDirtyChilds(); + setPresetText(); - LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); + LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); presetsMgr->setPresetListChangeCallback(boost::bind(&LLPanelPreferenceGraphics::onPresetsListChange, this)); presetsMgr->createMissingDefault(PRESETS_GRAPHIC); // a no-op after the first time, but that's ok - return LLPanelPreference::postBuild(); + return LLPanelPreference::postBuild(); } void LLPanelPreferenceGraphics::draw() { - setPresetText(); - LLPanelPreference::draw(); + setPresetText(); + LLPanelPreference::draw(); } void LLPanelPreferenceGraphics::onPresetsListChange() { - resetDirtyChilds(); - setPresetText(); + resetDirtyChilds(); + setPresetText(); - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance && !gSavedSettings.getString("PresetGraphicActive").empty()) - { - instance->saveSettings(); //make cancel work correctly after changing the preset - } + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance && !gSavedSettings.getString("PresetGraphicActive").empty()) + { + instance->saveSettings(); //make cancel work correctly after changing the preset + } } void LLPanelPreferenceGraphics::setPresetText() { - LLTextBox* preset_text = getChild("preset_text"); - - std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); - - if (!preset_graphic_active.empty() && preset_graphic_active != preset_text->getText()) - { - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->saveGraphicsPreset(preset_graphic_active); - } - } - - if (hasDirtyChilds() && !preset_graphic_active.empty()) - { - gSavedSettings.setString("PresetGraphicActive", ""); - preset_graphic_active.clear(); - // This doesn't seem to cause an infinite recursion. This trigger is needed to cause the pulldown - // panel to update. - LLPresetsManager::getInstance()->triggerChangeSignal(); - } - - if (!preset_graphic_active.empty()) - { - if (preset_graphic_active == PRESETS_DEFAULT) - { - preset_graphic_active = LLTrans::getString(PRESETS_DEFAULT); - } - preset_text->setText(preset_graphic_active); - } - else - { - preset_text->setText(LLTrans::getString("none_paren_cap")); - } - - preset_text->resetDirty(); + LLTextBox* preset_text = getChild("preset_text"); + + std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); + + if (!preset_graphic_active.empty() && preset_graphic_active != preset_text->getText()) + { + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->saveGraphicsPreset(preset_graphic_active); + } + } + + if (hasDirtyChilds() && !preset_graphic_active.empty()) + { + gSavedSettings.setString("PresetGraphicActive", ""); + preset_graphic_active.clear(); + // This doesn't seem to cause an infinite recursion. This trigger is needed to cause the pulldown + // panel to update. + LLPresetsManager::getInstance()->triggerChangeSignal(); + } + + if (!preset_graphic_active.empty()) + { + if (preset_graphic_active == PRESETS_DEFAULT) + { + preset_graphic_active = LLTrans::getString(PRESETS_DEFAULT); + } + preset_text->setText(preset_graphic_active); + } + else + { + preset_text->setText(LLTrans::getString("none_paren_cap")); + } + + preset_text->resetDirty(); } bool LLPanelPreferenceGraphics::hasDirtyChilds() { - LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); - std::list view_stack; - view_stack.push_back(this); - if (advanced) - { - view_stack.push_back(advanced); - } - while(!view_stack.empty()) - { - // Process view on top of the stack - LLView* curview = view_stack.front(); - view_stack.pop_front(); - - LLUICtrl* ctrl = dynamic_cast(curview); - if (ctrl) - { - if (ctrl->isDirty()) - { - LLControlVariable* control = ctrl->getControlVariable(); - if (control) - { - std::string control_name = control->getName(); - if (!control_name.empty()) - { - return true; - } - } - } - } - // Push children onto the end of the work stack - for (child_list_t::const_iterator iter = curview->getChildList()->begin(); - iter != curview->getChildList()->end(); ++iter) - { - view_stack.push_back(*iter); - } - } - - return false; + LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); + std::list view_stack; + view_stack.push_back(this); + if (advanced) + { + view_stack.push_back(advanced); + } + while(!view_stack.empty()) + { + // Process view on top of the stack + LLView* curview = view_stack.front(); + view_stack.pop_front(); + + LLUICtrl* ctrl = dynamic_cast(curview); + if (ctrl) + { + if (ctrl->isDirty()) + { + LLControlVariable* control = ctrl->getControlVariable(); + if (control) + { + std::string control_name = control->getName(); + if (!control_name.empty()) + { + return true; + } + } + } + } + // Push children onto the end of the work stack + for (child_list_t::const_iterator iter = curview->getChildList()->begin(); + iter != curview->getChildList()->end(); ++iter) + { + view_stack.push_back(*iter); + } + } + + return false; } void LLPanelPreferenceGraphics::resetDirtyChilds() { - LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); - std::list view_stack; - view_stack.push_back(this); - if (advanced) - { - view_stack.push_back(advanced); - } - while(!view_stack.empty()) - { - // Process view on top of the stack - LLView* curview = view_stack.front(); - view_stack.pop_front(); - - LLUICtrl* ctrl = dynamic_cast(curview); - if (ctrl) - { - ctrl->resetDirty(); - } - // Push children onto the end of the work stack - for (child_list_t::const_iterator iter = curview->getChildList()->begin(); - iter != curview->getChildList()->end(); ++iter) - { - view_stack.push_back(*iter); - } - } + LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); + std::list view_stack; + view_stack.push_back(this); + if (advanced) + { + view_stack.push_back(advanced); + } + while(!view_stack.empty()) + { + // Process view on top of the stack + LLView* curview = view_stack.front(); + view_stack.pop_front(); + + LLUICtrl* ctrl = dynamic_cast(curview); + if (ctrl) + { + ctrl->resetDirty(); + } + // Push children onto the end of the work stack + for (child_list_t::const_iterator iter = curview->getChildList()->begin(); + iter != curview->getChildList()->end(); ++iter) + { + view_stack.push_back(*iter); + } + } } void LLPanelPreferenceGraphics::cancel() { - LLPanelPreference::cancel(); + LLPanelPreference::cancel(); } void LLPanelPreferenceGraphics::saveSettings() { - resetDirtyChilds(); - std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); - if (preset_graphic_active.empty()) - { - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - //don't restore previous preset after closing Preferences - instance->saveGraphicsPreset(preset_graphic_active); - } - } - LLPanelPreference::saveSettings(); + resetDirtyChilds(); + std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); + if (preset_graphic_active.empty()) + { + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + //don't restore previous preset after closing Preferences + instance->saveGraphicsPreset(preset_graphic_active); + } + } + LLPanelPreference::saveSettings(); } void LLPanelPreferenceGraphics::setHardwareDefaults() { - resetDirtyChilds(); + resetDirtyChilds(); } LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const LLSD& key) - : LLFloater(key) + : LLFloater(key) { - mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onVertexShaderEnable, this)); - mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxNonImpostors", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors,this)); - mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity,this)); + mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onVertexShaderEnable, this)); + mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxNonImpostors", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors,this)); + mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity,this)); } LLFloaterPreferenceGraphicsAdvanced::~LLFloaterPreferenceGraphicsAdvanced() @@ -2852,12 +2852,12 @@ LLFloaterPreferenceGraphicsAdvanced::~LLFloaterPreferenceGraphicsAdvanced() } LLFloaterPreferenceProxy::LLFloaterPreferenceProxy(const LLSD& key) - : LLFloater(key), - mSocksSettingsDirty(false) + : LLFloater(key), + mSocksSettingsDirty(false) { - mCommitCallbackRegistrar.add("Proxy.OK", boost::bind(&LLFloaterPreferenceProxy::onBtnOk, this)); - mCommitCallbackRegistrar.add("Proxy.Cancel", boost::bind(&LLFloaterPreferenceProxy::onBtnCancel, this)); - mCommitCallbackRegistrar.add("Proxy.Change", boost::bind(&LLFloaterPreferenceProxy::onChangeSocksSettings, this)); + mCommitCallbackRegistrar.add("Proxy.OK", boost::bind(&LLFloaterPreferenceProxy::onBtnOk, this)); + mCommitCallbackRegistrar.add("Proxy.Cancel", boost::bind(&LLFloaterPreferenceProxy::onBtnCancel, this)); + mCommitCallbackRegistrar.add("Proxy.Change", boost::bind(&LLFloaterPreferenceProxy::onChangeSocksSettings, this)); } BOOL LLFloaterPreferenceGraphicsAdvanced::postBuild() @@ -2884,11 +2884,11 @@ void LLFloaterPreferenceGraphicsAdvanced::onOpen(const LLSD& key) void LLFloaterPreferenceGraphicsAdvanced::onClickCloseBtn(bool app_quitting) { - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->cancel(); - } + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->cancel(); + } } LLFloaterPreferenceProxy::~LLFloaterPreferenceProxy() @@ -2897,182 +2897,182 @@ LLFloaterPreferenceProxy::~LLFloaterPreferenceProxy() BOOL LLFloaterPreferenceProxy::postBuild() { - LLRadioGroup* socksAuth = getChild("socks5_auth_type"); - if (!socksAuth) - { - return FALSE; - } - if (socksAuth->getSelectedValue().asString() == "None") - { - getChild("socks5_username")->setEnabled(false); - getChild("socks5_password")->setEnabled(false); - } - else - { - // Populate the SOCKS 5 credential fields with protected values. - LLPointer socks_cred = gSecAPIHandler->loadCredential("SOCKS5"); - getChild("socks5_username")->setValue(socks_cred->getIdentifier()["username"].asString()); - getChild("socks5_password")->setValue(socks_cred->getAuthenticator()["creds"].asString()); - } - - return TRUE; + LLRadioGroup* socksAuth = getChild("socks5_auth_type"); + if (!socksAuth) + { + return FALSE; + } + if (socksAuth->getSelectedValue().asString() == "None") + { + getChild("socks5_username")->setEnabled(false); + getChild("socks5_password")->setEnabled(false); + } + else + { + // Populate the SOCKS 5 credential fields with protected values. + LLPointer socks_cred = gSecAPIHandler->loadCredential("SOCKS5"); + getChild("socks5_username")->setValue(socks_cred->getIdentifier()["username"].asString()); + getChild("socks5_password")->setValue(socks_cred->getAuthenticator()["creds"].asString()); + } + + return TRUE; } void LLFloaterPreferenceProxy::onOpen(const LLSD& key) { - saveSettings(); + saveSettings(); } void LLFloaterPreferenceProxy::onClose(bool app_quitting) { - if(app_quitting) - { - cancel(); - } + if(app_quitting) + { + cancel(); + } - if (mSocksSettingsDirty) - { + if (mSocksSettingsDirty) + { - // If the user plays with the Socks proxy settings after login, it's only fair we let them know - // it will not be updated until next restart. - if (LLStartUp::getStartupState()>STATE_LOGIN_WAIT) - { - LLNotifications::instance().add("ChangeProxySettings", LLSD(), LLSD()); - mSocksSettingsDirty = false; // we have notified the user now be quiet again - } - } + // If the user plays with the Socks proxy settings after login, it's only fair we let them know + // it will not be updated until next restart. + if (LLStartUp::getStartupState()>STATE_LOGIN_WAIT) + { + LLNotifications::instance().add("ChangeProxySettings", LLSD(), LLSD()); + mSocksSettingsDirty = false; // we have notified the user now be quiet again + } + } } void LLFloaterPreferenceProxy::saveSettings() { - // Save the value of all controls in the hierarchy - mSavedValues.clear(); - std::list view_stack; - view_stack.push_back(this); - while(!view_stack.empty()) - { - // Process view on top of the stack - LLView* curview = view_stack.front(); - view_stack.pop_front(); - - LLUICtrl* ctrl = dynamic_cast(curview); - if (ctrl) - { - LLControlVariable* control = ctrl->getControlVariable(); - if (control) - { - mSavedValues[control] = control->getValue(); - } - } - - // Push children onto the end of the work stack - for (child_list_t::const_iterator iter = curview->getChildList()->begin(); - iter != curview->getChildList()->end(); ++iter) - { - view_stack.push_back(*iter); - } - } + // Save the value of all controls in the hierarchy + mSavedValues.clear(); + std::list view_stack; + view_stack.push_back(this); + while(!view_stack.empty()) + { + // Process view on top of the stack + LLView* curview = view_stack.front(); + view_stack.pop_front(); + + LLUICtrl* ctrl = dynamic_cast(curview); + if (ctrl) + { + LLControlVariable* control = ctrl->getControlVariable(); + if (control) + { + mSavedValues[control] = control->getValue(); + } + } + + // Push children onto the end of the work stack + for (child_list_t::const_iterator iter = curview->getChildList()->begin(); + iter != curview->getChildList()->end(); ++iter) + { + view_stack.push_back(*iter); + } + } } void LLFloaterPreferenceProxy::onBtnOk() { - // commit any outstanding text entry - if (hasFocus()) - { - LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); - if (cur_focus && cur_focus->acceptsTextInput()) - { - cur_focus->onCommit(); - } - } - - // Save SOCKS proxy credentials securely if password auth is enabled - LLRadioGroup* socksAuth = getChild("socks5_auth_type"); - if (socksAuth->getSelectedValue().asString() == "UserPass") - { - LLSD socks_id = LLSD::emptyMap(); - socks_id["type"] = "SOCKS5"; - socks_id["username"] = getChild("socks5_username")->getValue().asString(); - - LLSD socks_authenticator = LLSD::emptyMap(); - socks_authenticator["type"] = "SOCKS5"; - socks_authenticator["creds"] = getChild("socks5_password")->getValue().asString(); - - // Using "SOCKS5" as the "grid" argument since the same proxy - // settings will be used for all grids and because there is no - // way to specify the type of credential. - LLPointer socks_cred = gSecAPIHandler->createCredential("SOCKS5", socks_id, socks_authenticator); - gSecAPIHandler->saveCredential(socks_cred, true); - } - else - { - // Clear SOCKS5 credentials since they are no longer needed. - LLPointer socks_cred = new LLCredential("SOCKS5"); - gSecAPIHandler->deleteCredential(socks_cred); - } - - closeFloater(false); + // commit any outstanding text entry + if (hasFocus()) + { + LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); + if (cur_focus && cur_focus->acceptsTextInput()) + { + cur_focus->onCommit(); + } + } + + // Save SOCKS proxy credentials securely if password auth is enabled + LLRadioGroup* socksAuth = getChild("socks5_auth_type"); + if (socksAuth->getSelectedValue().asString() == "UserPass") + { + LLSD socks_id = LLSD::emptyMap(); + socks_id["type"] = "SOCKS5"; + socks_id["username"] = getChild("socks5_username")->getValue().asString(); + + LLSD socks_authenticator = LLSD::emptyMap(); + socks_authenticator["type"] = "SOCKS5"; + socks_authenticator["creds"] = getChild("socks5_password")->getValue().asString(); + + // Using "SOCKS5" as the "grid" argument since the same proxy + // settings will be used for all grids and because there is no + // way to specify the type of credential. + LLPointer socks_cred = gSecAPIHandler->createCredential("SOCKS5", socks_id, socks_authenticator); + gSecAPIHandler->saveCredential(socks_cred, true); + } + else + { + // Clear SOCKS5 credentials since they are no longer needed. + LLPointer socks_cred = new LLCredential("SOCKS5"); + gSecAPIHandler->deleteCredential(socks_cred); + } + + closeFloater(false); } void LLFloaterPreferenceProxy::onBtnCancel() { - if (hasFocus()) - { - LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); - if (cur_focus && cur_focus->acceptsTextInput()) - { - cur_focus->onCommit(); - } - refresh(); - } + if (hasFocus()) + { + LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); + if (cur_focus && cur_focus->acceptsTextInput()) + { + cur_focus->onCommit(); + } + refresh(); + } - cancel(); + cancel(); } void LLFloaterPreferenceProxy::onClickCloseBtn(bool app_quitting) { - cancel(); + cancel(); } void LLFloaterPreferenceProxy::cancel() { - for (control_values_map_t::iterator iter = mSavedValues.begin(); - iter != mSavedValues.end(); ++iter) - { - LLControlVariable* control = iter->first; - LLSD ctrl_value = iter->second; - control->set(ctrl_value); - } - mSocksSettingsDirty = false; - closeFloater(); + for (control_values_map_t::iterator iter = mSavedValues.begin(); + iter != mSavedValues.end(); ++iter) + { + LLControlVariable* control = iter->first; + LLSD ctrl_value = iter->second; + control->set(ctrl_value); + } + mSocksSettingsDirty = false; + closeFloater(); } void LLFloaterPreferenceProxy::onChangeSocksSettings() { - mSocksSettingsDirty = true; - - LLRadioGroup* socksAuth = getChild("socks5_auth_type"); - if (socksAuth->getSelectedValue().asString() == "None") - { - getChild("socks5_username")->setEnabled(false); - getChild("socks5_password")->setEnabled(false); - } - else - { - getChild("socks5_username")->setEnabled(true); - getChild("socks5_password")->setEnabled(true); - } - - // Check for invalid states for the other HTTP proxy radio - LLRadioGroup* otherHttpProxy = getChild("other_http_proxy_type"); - if ((otherHttpProxy->getSelectedValue().asString() == "Socks" && - getChild("socks_proxy_enabled")->get() == FALSE )||( - otherHttpProxy->getSelectedValue().asString() == "Web" && - getChild("web_proxy_enabled")->get() == FALSE ) ) - { - otherHttpProxy->selectFirstItem(); - } + mSocksSettingsDirty = true; + + LLRadioGroup* socksAuth = getChild("socks5_auth_type"); + if (socksAuth->getSelectedValue().asString() == "None") + { + getChild("socks5_username")->setEnabled(false); + getChild("socks5_password")->setEnabled(false); + } + else + { + getChild("socks5_username")->setEnabled(true); + getChild("socks5_password")->setEnabled(true); + } + + // Check for invalid states for the other HTTP proxy radio + LLRadioGroup* otherHttpProxy = getChild("other_http_proxy_type"); + if ((otherHttpProxy->getSelectedValue().asString() == "Socks" && + getChild("socks_proxy_enabled")->get() == FALSE )||( + otherHttpProxy->getSelectedValue().asString() == "Web" && + getChild("web_proxy_enabled")->get() == FALSE ) ) + { + otherHttpProxy->selectFirstItem(); + } } diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 0d383c1da0..da96e68f5e 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -50,308 +50,308 @@ class LLTextBox; typedef std::map notifications_map; typedef enum - { - GS_LOW_GRAPHICS, - GS_MID_GRAPHICS, - GS_HIGH_GRAPHICS, - GS_ULTRA_GRAPHICS - - } EGraphicsSettings; + { + GS_LOW_GRAPHICS, + GS_MID_GRAPHICS, + GS_HIGH_GRAPHICS, + GS_ULTRA_GRAPHICS + + } EGraphicsSettings; // Floater to control preferences (display, audio, bandwidth, general. class LLFloaterPreference : public LLFloater, public LLAvatarPropertiesObserver, public LLConversationLogObserver { public: - LLFloaterPreference(const LLSD& key); - ~LLFloaterPreference(); - - void apply(); - void cancel(); - /*virtual*/ void draw(); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); - /*virtual*/ void changed(); - /*virtual*/ void changed(const LLUUID& session_id, U32 mask) {}; - - // static data update, called from message handler - static void updateUserInfo(const std::string& visibility, bool im_via_email, bool is_verified_email); - - // refresh all the graphics preferences menus - static void refreshEnabledGraphics(); - - // translate user's do not disturb response message according to current locale if message is default, otherwise do nothing - static void initDoNotDisturbResponse(); - - // update Show Favorites checkbox - static void updateShowFavoritesCheckbox(bool val); - - void processProperties( void* pData, EAvatarProcessorType type ); - void processProfileProperties(const LLAvatarData* pAvatarData ); - void storeAvatarProperties( const LLAvatarData* pAvatarData ); - void saveAvatarProperties( void ); - void selectPrivacyPanel(); - void selectChatPanel(); - void getControlNames(std::vector& names); - -protected: - void onBtnOK(const LLSD& userdata); - void onBtnCancel(const LLSD& userdata); - - void onClickClearCache(); // Clear viewer texture cache, vfs, and VO cache on next startup - void onClickBrowserClearCache(); // Clear web history and caches as well as viewer caches above - void onLanguageChange(); - void onNotificationsChange(const std::string& OptionName); - void onNameTagOpacityChange(const LLSD& newvalue); - - // set value of "DoNotDisturbResponseChanged" in account settings depending on whether do not disturb response - // string differs from default after user changes. - void onDoNotDisturbResponseChanged(); - // if the custom settings box is clicked - void onChangeCustom(); - void updateMeterText(LLUICtrl* ctrl); - // callback for defaults - void setHardwareDefaults(); - void setRecommended(); - // callback for when client turns on shaders - void onVertexShaderEnable(); - // callback for when client turns on impostors - void onAvatarImpostorsEnable(); - - // callback for commit in the "Single click on land" and "Double click on land" comboboxes. - void onClickActionChange(); - // updates click/double-click action settings depending on controls values - void updateClickActionSettings(); - // updates click/double-click action controls depending on values from settings.xml - void updateClickActionControls(); + LLFloaterPreference(const LLSD& key); + ~LLFloaterPreference(); + + void apply(); + void cancel(); + /*virtual*/ void draw(); + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void onClose(bool app_quitting); + /*virtual*/ void changed(); + /*virtual*/ void changed(const LLUUID& session_id, U32 mask) {}; + + // static data update, called from message handler + static void updateUserInfo(const std::string& visibility, bool im_via_email, bool is_verified_email); + + // refresh all the graphics preferences menus + static void refreshEnabledGraphics(); + + // translate user's do not disturb response message according to current locale if message is default, otherwise do nothing + static void initDoNotDisturbResponse(); + + // update Show Favorites checkbox + static void updateShowFavoritesCheckbox(bool val); + + void processProperties( void* pData, EAvatarProcessorType type ); + void processProfileProperties(const LLAvatarData* pAvatarData ); + void storeAvatarProperties( const LLAvatarData* pAvatarData ); + void saveAvatarProperties( void ); + void selectPrivacyPanel(); + void selectChatPanel(); + void getControlNames(std::vector& names); + +protected: + void onBtnOK(const LLSD& userdata); + void onBtnCancel(const LLSD& userdata); + + void onClickClearCache(); // Clear viewer texture cache, vfs, and VO cache on next startup + void onClickBrowserClearCache(); // Clear web history and caches as well as viewer caches above + void onLanguageChange(); + void onNotificationsChange(const std::string& OptionName); + void onNameTagOpacityChange(const LLSD& newvalue); + + // set value of "DoNotDisturbResponseChanged" in account settings depending on whether do not disturb response + // string differs from default after user changes. + void onDoNotDisturbResponseChanged(); + // if the custom settings box is clicked + void onChangeCustom(); + void updateMeterText(LLUICtrl* ctrl); + // callback for defaults + void setHardwareDefaults(); + void setRecommended(); + // callback for when client turns on shaders + void onVertexShaderEnable(); + // callback for when client turns on impostors + void onAvatarImpostorsEnable(); + + // callback for commit in the "Single click on land" and "Double click on land" comboboxes. + void onClickActionChange(); + // updates click/double-click action settings depending on controls values + void updateClickActionSettings(); + // updates click/double-click action controls depending on values from settings.xml + void updateClickActionControls(); public: - // This function squirrels away the current values of the controls so that - // cancel() can restore them. - void saveSettings(); - - void setCacheLocation(const LLStringExplicit& location); - - void onClickSetCache(); - void changeCachePath(const std::vector& filenames, std::string proposed_name); - void onClickResetCache(); - void onClickSkin(LLUICtrl* ctrl,const LLSD& userdata); - void onSelectSkin(); - void onClickSetKey(); - void setKey(KEY key); - void onClickSetMiddleMouse(); - void onClickSetSounds(); - void onClickEnablePopup(); - void onClickDisablePopup(); - void resetAllIgnored(); - void setAllIgnored(); - void onClickLogPath(); - void changeLogPath(const std::vector& filenames, std::string proposed_name); - bool moveTranscriptsAndLog(); - void enableHistory(); - void setPersonalInfo(const std::string& visibility, bool im_via_email, bool is_verified_email); - void refreshEnabledState(); - void onCommitWindowedMode(); - void refresh(); // Refresh enable/disable - // if the quality radio buttons are changed - void onChangeQuality(const LLSD& data); - - void refreshUI(); - - void onCommitParcelMediaAutoPlayEnable(); - void onCommitMediaEnabled(); - void onCommitMusicEnabled(); - void applyResolution(); - void onChangeMaturity(); - void onChangeModelFolder(); - void onChangeTextureFolder(); - void onChangeSoundFolder(); - void onChangeAnimationFolder(); - void onClickBlockList(); - void onClickProxySettings(); - void onClickTranslationSettings(); - void onClickPermsDefault(); - void onClickAutoReplace(); - void onClickSpellChecker(); - void onClickRenderExceptions(); - void onClickAdvanced(); - void applyUIColor(LLUICtrl* ctrl, const LLSD& param); - void getUIColor(LLUICtrl* ctrl, const LLSD& param); - void onLogChatHistorySaved(); - void buildPopupLists(); - static void refreshSkin(void* data); - void selectPanel(const LLSD& name); - void saveCameraPreset(std::string& preset); - void saveGraphicsPreset(std::string& preset); + // This function squirrels away the current values of the controls so that + // cancel() can restore them. + void saveSettings(); + + void setCacheLocation(const LLStringExplicit& location); + + void onClickSetCache(); + void changeCachePath(const std::vector& filenames, std::string proposed_name); + void onClickResetCache(); + void onClickSkin(LLUICtrl* ctrl,const LLSD& userdata); + void onSelectSkin(); + void onClickSetKey(); + void setKey(KEY key); + void onClickSetMiddleMouse(); + void onClickSetSounds(); + void onClickEnablePopup(); + void onClickDisablePopup(); + void resetAllIgnored(); + void setAllIgnored(); + void onClickLogPath(); + void changeLogPath(const std::vector& filenames, std::string proposed_name); + bool moveTranscriptsAndLog(); + void enableHistory(); + void setPersonalInfo(const std::string& visibility, bool im_via_email, bool is_verified_email); + void refreshEnabledState(); + void onCommitWindowedMode(); + void refresh(); // Refresh enable/disable + // if the quality radio buttons are changed + void onChangeQuality(const LLSD& data); + + void refreshUI(); + + void onCommitParcelMediaAutoPlayEnable(); + void onCommitMediaEnabled(); + void onCommitMusicEnabled(); + void applyResolution(); + void onChangeMaturity(); + void onChangeModelFolder(); + void onChangeTextureFolder(); + void onChangeSoundFolder(); + void onChangeAnimationFolder(); + void onClickBlockList(); + void onClickProxySettings(); + void onClickTranslationSettings(); + void onClickPermsDefault(); + void onClickAutoReplace(); + void onClickSpellChecker(); + void onClickRenderExceptions(); + void onClickAdvanced(); + void applyUIColor(LLUICtrl* ctrl, const LLSD& param); + void getUIColor(LLUICtrl* ctrl, const LLSD& param); + void onLogChatHistorySaved(); + void buildPopupLists(); + static void refreshSkin(void* data); + void selectPanel(const LLSD& name); + void saveCameraPreset(std::string& preset); + void saveGraphicsPreset(std::string& preset); private: - void onDeleteTranscripts(); - void onDeleteTranscriptsResponse(const LLSD& notification, const LLSD& response); - void updateDeleteTranscriptsButton(); - void updateMaxComplexity(); - - static std::string sSkin; - notifications_map mNotificationOptions; - bool mClickActionDirty; ///< Set to true when the click/double-click options get changed by user. - bool mGotPersonalInfo; - bool mOriginalIMViaEmail; - bool mLanguageChanged; - bool mAvatarDataInitialized; - std::string mPriorInstantMessageLogPath; - - bool mOriginalHideOnlineStatus; - std::string mDirectoryVisibility; - - LLAvatarData mAvatarProperties; - std::string mSavedCameraPreset; - std::string mSavedGraphicsPreset; - LOG_CLASS(LLFloaterPreference); + void onDeleteTranscripts(); + void onDeleteTranscriptsResponse(const LLSD& notification, const LLSD& response); + void updateDeleteTranscriptsButton(); + void updateMaxComplexity(); + + static std::string sSkin; + notifications_map mNotificationOptions; + bool mClickActionDirty; ///< Set to true when the click/double-click options get changed by user. + bool mGotPersonalInfo; + bool mOriginalIMViaEmail; + bool mLanguageChanged; + bool mAvatarDataInitialized; + std::string mPriorInstantMessageLogPath; + + bool mOriginalHideOnlineStatus; + std::string mDirectoryVisibility; + + LLAvatarData mAvatarProperties; + std::string mSavedCameraPreset; + std::string mSavedGraphicsPreset; + LOG_CLASS(LLFloaterPreference); }; class LLPanelPreference : public LLPanel { public: - LLPanelPreference(); - /*virtual*/ BOOL postBuild(); - - virtual ~LLPanelPreference(); + LLPanelPreference(); + /*virtual*/ BOOL postBuild(); + + virtual ~LLPanelPreference(); - virtual void apply(); - virtual void cancel(); - void setControlFalse(const LLSD& user_data); - virtual void setHardwareDefaults(); + virtual void apply(); + virtual void cancel(); + void setControlFalse(const LLSD& user_data); + virtual void setHardwareDefaults(); - // Disables "Allow Media to auto play" check box only when both - // "Streaming Music" and "Media" are unchecked. Otherwise enables it. - void updateMediaAutoPlayCheckbox(LLUICtrl* ctrl); + // Disables "Allow Media to auto play" check box only when both + // "Streaming Music" and "Media" are unchecked. Otherwise enables it. + void updateMediaAutoPlayCheckbox(LLUICtrl* ctrl); - // This function squirrels away the current values of the controls so that - // cancel() can restore them. - virtual void saveSettings(); + // This function squirrels away the current values of the controls so that + // cancel() can restore them. + virtual void saveSettings(); - void deletePreset(const LLSD& user_data); - void savePreset(const LLSD& user_data); - void loadPreset(const LLSD& user_data); + void deletePreset(const LLSD& user_data); + void savePreset(const LLSD& user_data); + void loadPreset(const LLSD& user_data); - class Updater; + class Updater; protected: - typedef std::map control_values_map_t; - control_values_map_t mSavedValues; + typedef std::map control_values_map_t; + control_values_map_t mSavedValues; private: - //for "Only friends and groups can call or IM me" - static void showFriendsOnlyWarning(LLUICtrl*, const LLSD&); + //for "Only friends and groups can call or IM me" + static void showFriendsOnlyWarning(LLUICtrl*, const LLSD&); //for "Allow Multiple Viewers" static void showMultipleViewersWarning(LLUICtrl*, const LLSD&); - //for "Show my Favorite Landmarks at Login" - static void handleFavoritesOnLoginChanged(LLUICtrl* checkbox, const LLSD& value); + //for "Show my Favorite Landmarks at Login" + static void handleFavoritesOnLoginChanged(LLUICtrl* checkbox, const LLSD& value); - static void toggleMuteWhenMinimized(); - typedef std::map string_color_map_t; - string_color_map_t mSavedColors; + static void toggleMuteWhenMinimized(); + typedef std::map string_color_map_t; + string_color_map_t mSavedColors; - Updater* mBandWidthUpdater; - LOG_CLASS(LLPanelPreference); + Updater* mBandWidthUpdater; + LOG_CLASS(LLPanelPreference); }; class LLPanelPreferenceView : public LLPanelPreference { public: - BOOL postBuild(); - void draw(); - void setPresetText(); + BOOL postBuild(); + void draw(); + void setPresetText(); private: - void onPresetsListChangeCamera(); - LOG_CLASS(LLPanelPreferenceView); + void onPresetsListChangeCamera(); + LOG_CLASS(LLPanelPreferenceView); }; class LLPanelPreferenceGraphics : public LLPanelPreference { public: - BOOL postBuild(); - void draw(); - void cancel(); - void saveSettings(); - void resetDirtyChilds(); - void setHardwareDefaults(); - void setPresetText(); + BOOL postBuild(); + void draw(); + void cancel(); + void saveSettings(); + void resetDirtyChilds(); + void setHardwareDefaults(); + void setPresetText(); - static const std::string getPresetsPath(); + static const std::string getPresetsPath(); protected: - bool hasDirtyChilds(); + bool hasDirtyChilds(); private: - void onPresetsListChange(); - LOG_CLASS(LLPanelPreferenceGraphics); + void onPresetsListChange(); + LOG_CLASS(LLPanelPreferenceGraphics); }; class LLFloaterPreferenceGraphicsAdvanced : public LLFloater { public: - LLFloaterPreferenceGraphicsAdvanced(const LLSD& key); - ~LLFloaterPreferenceGraphicsAdvanced(); - /*virtual*/ BOOL postBuild(); - void onOpen(const LLSD& key); - void onClickCloseBtn(bool app_quitting); - void disableUnavailableSettings(); - void refreshEnabledGraphics(); - void refreshEnabledState(); - void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box); - void updateMaxNonImpostors(); - void setMaxNonImpostorsText(U32 value, LLTextBox* text_box); - void updateMaxComplexity(); - void setMaxComplexityText(U32 value, LLTextBox* text_box); - static void setIndirectControls(); - static void setIndirectMaxNonImpostors(); - static void setIndirectMaxArc(); - void refresh(); - // callback for when client turns on shaders - void onVertexShaderEnable(); - LOG_CLASS(LLFloaterPreferenceGraphicsAdvanced); + LLFloaterPreferenceGraphicsAdvanced(const LLSD& key); + ~LLFloaterPreferenceGraphicsAdvanced(); + /*virtual*/ BOOL postBuild(); + void onOpen(const LLSD& key); + void onClickCloseBtn(bool app_quitting); + void disableUnavailableSettings(); + void refreshEnabledGraphics(); + void refreshEnabledState(); + void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box); + void updateMaxNonImpostors(); + void setMaxNonImpostorsText(U32 value, LLTextBox* text_box); + void updateMaxComplexity(); + void setMaxComplexityText(U32 value, LLTextBox* text_box); + static void setIndirectControls(); + static void setIndirectMaxNonImpostors(); + static void setIndirectMaxArc(); + void refresh(); + // callback for when client turns on shaders + void onVertexShaderEnable(); + LOG_CLASS(LLFloaterPreferenceGraphicsAdvanced); }; class LLAvatarComplexityControls { public: - static void updateMax(LLSliderCtrl* slider, LLTextBox* value_label); - static void setText(U32 value, LLTextBox* text_box); - static void setIndirectControls(); - static void setIndirectMaxNonImpostors(); - static void setIndirectMaxArc(); - LOG_CLASS(LLAvatarComplexityControls); + static void updateMax(LLSliderCtrl* slider, LLTextBox* value_label); + static void setText(U32 value, LLTextBox* text_box); + static void setIndirectControls(); + static void setIndirectMaxNonImpostors(); + static void setIndirectMaxArc(); + LOG_CLASS(LLAvatarComplexityControls); }; class LLFloaterPreferenceProxy : public LLFloater { public: - LLFloaterPreferenceProxy(const LLSD& key); - ~LLFloaterPreferenceProxy(); + LLFloaterPreferenceProxy(const LLSD& key); + ~LLFloaterPreferenceProxy(); - /// show off our menu - static void show(); - void cancel(); - + /// show off our menu + static void show(); + void cancel(); + protected: - BOOL postBuild(); - void onOpen(const LLSD& key); - void onClose(bool app_quitting); - void saveSettings(); - void onBtnOk(); - void onBtnCancel(); - void onClickCloseBtn(bool app_quitting = false); + BOOL postBuild(); + void onOpen(const LLSD& key); + void onClose(bool app_quitting); + void saveSettings(); + void onBtnOk(); + void onBtnCancel(); + void onClickCloseBtn(bool app_quitting = false); - void onChangeSocksSettings(); + void onChangeSocksSettings(); private: - - bool mSocksSettingsDirty; - typedef std::map control_values_map_t; - control_values_map_t mSavedValues; - LOG_CLASS(LLFloaterPreferenceProxy); + + bool mSocksSettingsDirty; + typedef std::map control_values_map_t; + control_values_map_t mSavedValues; + LOG_CLASS(LLFloaterPreferenceProxy); }; diff --git a/indra/newview/llfloaterpreferenceviewadvanced.cpp b/indra/newview/llfloaterpreferenceviewadvanced.cpp index e740a3a9cf..791ff79d87 100644 --- a/indra/newview/llfloaterpreferenceviewadvanced.cpp +++ b/indra/newview/llfloaterpreferenceviewadvanced.cpp @@ -34,11 +34,11 @@ LLFloaterPreferenceViewAdvanced::LLFloaterPreferenceViewAdvanced(const LLSD& key) -: LLFloater(key) +: LLFloater(key) { - mCommitCallbackRegistrar.add("Cancel", boost::bind(&LLFloaterPreferenceViewAdvanced::onClickCancel, this)); - mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterPreferenceViewAdvanced::onCommitSettings, this)); - mCommitCallbackRegistrar.add("Ok", boost::bind(&LLFloaterPreferenceViewAdvanced::onClickOk, this)); + mCommitCallbackRegistrar.add("Cancel", boost::bind(&LLFloaterPreferenceViewAdvanced::onClickCancel, this)); + mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterPreferenceViewAdvanced::onCommitSettings, this)); + mCommitCallbackRegistrar.add("Ok", boost::bind(&LLFloaterPreferenceViewAdvanced::onClickOk, this)); } @@ -47,66 +47,66 @@ LLFloaterPreferenceViewAdvanced::~LLFloaterPreferenceViewAdvanced() void LLFloaterPreferenceViewAdvanced::onClickOk() { - closeFloater(); + closeFloater(); } void LLFloaterPreferenceViewAdvanced::onClickCancel() { - gSavedSettings.setVector3("CameraOffsetRearView", mCameraSaved); - gSavedSettings.setVector3d("FocusOffsetRearView", mFocusSaved); + gSavedSettings.setVector3("CameraOffsetRearView", mCameraSaved); + gSavedSettings.setVector3d("FocusOffsetRearView", mFocusSaved); - updateCameraControl(mCameraSaved); - updateFocusControl(mFocusSaved); + updateCameraControl(mCameraSaved); + updateFocusControl(mFocusSaved); } BOOL LLFloaterPreferenceViewAdvanced::postBuild() { - mCameraSaved = gSavedSettings.getVector3("CameraOffsetRearView"); - mFocusSaved = gSavedSettings.getVector3d("FocusOffsetRearView"); + mCameraSaved = gSavedSettings.getVector3("CameraOffsetRearView"); + mFocusSaved = gSavedSettings.getVector3d("FocusOffsetRearView"); - updateCameraControl(mCameraSaved); - updateFocusControl(mFocusSaved); + updateCameraControl(mCameraSaved); + updateFocusControl(mFocusSaved); - return TRUE; + return TRUE; } void LLFloaterPreferenceViewAdvanced::updateCameraControl(const LLVector3& vector) { - getChild("camera_x")->setValue(vector[VX]); - getChild("camera_y")->setValue(vector[VY]); - getChild("camera_z")->setValue(vector[VZ]); + getChild("camera_x")->setValue(vector[VX]); + getChild("camera_y")->setValue(vector[VY]); + getChild("camera_z")->setValue(vector[VZ]); } void LLFloaterPreferenceViewAdvanced::updateFocusControl(const LLVector3d& vector3d) { - getChild("focus_x")->setValue(vector3d[VX]); - getChild("focus_y")->setValue(vector3d[VY]); - getChild("focus_z")->setValue(vector3d[VZ]); + getChild("focus_x")->setValue(vector3d[VX]); + getChild("focus_y")->setValue(vector3d[VY]); + getChild("focus_z")->setValue(vector3d[VZ]); } void LLFloaterPreferenceViewAdvanced::draw() { - static LLCachedControl camera(gSavedSettings, "CameraOffsetRearView"); - static LLCachedControl focus(gSavedSettings, "FocusOffsetRearView"); + static LLCachedControl camera(gSavedSettings, "CameraOffsetRearView"); + static LLCachedControl focus(gSavedSettings, "FocusOffsetRearView"); - updateCameraControl(camera); - updateFocusControl(focus); + updateCameraControl(camera); + updateFocusControl(focus); - LLFloater::draw(); + LLFloater::draw(); } void LLFloaterPreferenceViewAdvanced::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); + 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/llfloaterpreferenceviewadvanced.h b/indra/newview/llfloaterpreferenceviewadvanced.h index 9113949273..8f4b594605 100644 --- a/indra/newview/llfloaterpreferenceviewadvanced.h +++ b/indra/newview/llfloaterpreferenceviewadvanced.h @@ -31,27 +31,27 @@ #include "llfloater.h" class LLFloaterPreferenceViewAdvanced -: public LLFloater +: public LLFloater { - friend class LLFloaterReg; + friend class LLFloaterReg; public: - LLFloaterPreferenceViewAdvanced(const LLSD& key); - virtual BOOL postBuild(); - virtual void draw(); + LLFloaterPreferenceViewAdvanced(const LLSD& key); + virtual BOOL postBuild(); + virtual void draw(); - void onCommitSettings(); - void onClickCancel(); - void onClickOk(); - void updateCameraControl(const LLVector3& vector); - void updateFocusControl(const LLVector3d& vector3d); + void onCommitSettings(); + void onClickCancel(); + void onClickOk(); + void updateCameraControl(const LLVector3& vector); + void updateFocusControl(const LLVector3d& vector3d); private: - virtual ~LLFloaterPreferenceViewAdvanced(); + virtual ~LLFloaterPreferenceViewAdvanced(); - LLVector3 mCameraSaved; - LLVector3d mFocusSaved; - + LLVector3 mCameraSaved; + LLVector3d mFocusSaved; + }; #endif //LLFLOATERPREFERENCEVIEWADVANCED_H diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index 149451c8c4..bae7602566 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -37,78 +37,78 @@ #include "lltrans.h" LLFloaterSavePrefPreset::LLFloaterSavePrefPreset(const LLSD &key) -: LLFloater(key) +: LLFloater(key) { } // virtual BOOL LLFloaterSavePrefPreset::postBuild() { - LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance("preferences"); - if (preferences) - { - preferences->addDependentFloater(this); - } - getChild("preset_combo")->setTextEntryCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); - getChild("preset_combo")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); - getChild("save")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnSave, this)); - getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnCancel, this)); - - LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetsListChange, this)); - - mSaveButton = getChild("save"); - mPresetCombo = getChild("preset_combo"); - - return TRUE; + LLFloaterPreference* preferences = LLFloaterReg::getTypedInstance("preferences"); + if (preferences) + { + preferences->addDependentFloater(this); + } + getChild("preset_combo")->setTextEntryCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); + getChild("preset_combo")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); + getChild("save")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnSave, this)); + getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnCancel, this)); + + LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetsListChange, this)); + + mSaveButton = getChild("save"); + mPresetCombo = getChild("preset_combo"); + + return TRUE; } void LLFloaterSavePrefPreset::onPresetNameEdited() { - // Disable saving a preset having empty name. - std::string name = mPresetCombo->getSimple(); + // Disable saving a preset having empty name. + std::string name = mPresetCombo->getSimple(); - mSaveButton->setEnabled(!name.empty()); + mSaveButton->setEnabled(!name.empty()); } void LLFloaterSavePrefPreset::onOpen(const LLSD& key) { - mSubdirectory = key.asString(); + mSubdirectory = key.asString(); - std::string floater_title = getString(std::string("title_") + mSubdirectory); + std::string floater_title = getString(std::string("title_") + mSubdirectory); - setTitle(floater_title); + setTitle(floater_title); - EDefaultOptions option = DEFAULT_HIDE; - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); + EDefaultOptions option = DEFAULT_HIDE; + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); - onPresetNameEdited(); + onPresetNameEdited(); } void LLFloaterSavePrefPreset::onBtnSave() { - std::string name = mPresetCombo->getSimple(); - - if ((name == LLTrans::getString(PRESETS_DEFAULT)) || (name == PRESETS_DEFAULT)) - { - LLNotificationsUtil::add("DefaultPresetNotSaved"); - } - else if (!LLPresetsManager::getInstance()->savePreset(mSubdirectory, name)) - { - LLSD args; - args["NAME"] = name; - LLNotificationsUtil::add("PresetNotSaved", args); - } - - closeFloater(); + std::string name = mPresetCombo->getSimple(); + + if ((name == LLTrans::getString(PRESETS_DEFAULT)) || (name == PRESETS_DEFAULT)) + { + LLNotificationsUtil::add("DefaultPresetNotSaved"); + } + else if (!LLPresetsManager::getInstance()->savePreset(mSubdirectory, name)) + { + LLSD args; + args["NAME"] = name; + LLNotificationsUtil::add("PresetNotSaved", args); + } + + closeFloater(); } void LLFloaterSavePrefPreset::onPresetsListChange() { - EDefaultOptions option = DEFAULT_HIDE; - LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); + EDefaultOptions option = DEFAULT_HIDE; + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); } void LLFloaterSavePrefPreset::onBtnCancel() { - closeFloater(); + closeFloater(); } diff --git a/indra/newview/llnavigationbar.h b/indra/newview/llnavigationbar.h index a9d0f1a82e..a44c6dd699 100755 --- a/indra/newview/llnavigationbar.h +++ b/indra/newview/llnavigationbar.h @@ -47,113 +47,113 @@ class LLSearchComboBox; class LLPullButton: public LLButton { - LOG_CLASS(LLPullButton); + LOG_CLASS(LLPullButton); public: - struct Params: public LLInitParam::Block - { - Optional direction; // left, right, down, up + struct Params: public LLInitParam::Block + { + Optional direction; // left, right, down, up - Params() - : direction("direction", "down") - { - } - }; - - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + Params() + : direction("direction", "down") + { + } + }; + + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); + /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); - boost::signals2::connection setClickDraggingCallback(const commit_signal_t::slot_type& cb); + boost::signals2::connection setClickDraggingCallback(const commit_signal_t::slot_type& cb); protected: - friend class LLUICtrlFactory; - // convert string name into direction vector - void setDirectionFromName(const std::string& name); - LLPullButton(const LLPullButton::Params& params); - - commit_signal_t mClickDraggingSignal; - LLVector2 mLastMouseDown; - LLVector2 mDraggingDirection; + friend class LLUICtrlFactory; + // convert string name into direction vector + void setDirectionFromName(const std::string& name); + LLPullButton(const LLPullButton::Params& params); + + commit_signal_t mClickDraggingSignal; + LLVector2 mLastMouseDown; + LLVector2 mDraggingDirection; }; /** * Web browser-like navigation bar. */ class LLNavigationBar - : public LLPanel, public LLSingleton, private LLDestroyClass + : public LLPanel, public LLSingleton, private LLDestroyClass { - LLSINGLETON(LLNavigationBar); - virtual ~LLNavigationBar(); - LOG_CLASS(LLNavigationBar); - friend class LLDestroyClass; + LLSINGLETON(LLNavigationBar); + virtual ~LLNavigationBar(); + LOG_CLASS(LLNavigationBar); + friend class LLDestroyClass; public: - - /*virtual*/ void draw(); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void setVisible(BOOL visible); - - void handleLoginComplete(); - void clearHistoryCache(); - - int getDefNavBarHeight(); - int getDefFavBarHeight(); - + + /*virtual*/ void draw(); + /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL postBuild(); + /*virtual*/ void setVisible(BOOL visible); + + void handleLoginComplete(); + void clearHistoryCache(); + + int getDefNavBarHeight(); + int getDefFavBarHeight(); + private: - // the distance between navigation panel and favorites panel in pixels - const static S32 FAVBAR_TOP_PADDING = 10; - - void rebuildTeleportHistoryMenu(); - void showTeleportHistoryMenu(LLUICtrl* btn_ctrl); - void invokeSearch(std::string search_text); - void resizeLayoutPanel(); - // callbacks - void onTeleportHistoryMenuItemClicked(const LLSD& userdata); - void onTeleportHistoryChanged(); - void onBackButtonClicked(); - void onBackOrForwardButtonHeldDown(LLUICtrl* ctrl, const LLSD& param); - void onNavigationButtonHeldUp(LLButton* nav_button); - void onForwardButtonClicked(); - void onHomeButtonClicked(); - void onLocationSelection(); - void onLocationPrearrange(const LLSD& data); - void onTeleportFinished(const LLVector3d& global_agent_pos); - void onTeleportFailed(); - void onNavbarResized(); - void onRegionNameResponse( - std::string typed_location, - std::string region_name, - LLVector3 local_coords, - U64 region_handle, const std::string& url, - const LLUUID& snapshot_id, bool teleport); - - static void destroyClass() - { - if (LLNavigationBar::instanceExists()) - { - LLNavigationBar::getInstance()->setEnabled(FALSE); - } - } - - S32 mNavPanWidth; - LLMenuGL* mTeleportHistoryMenu; - LLPullButton* mBtnBack; - LLPullButton* mBtnForward; - LLButton* mBtnHome; - LLLocationInputCtrl* mCmbLocation; - LLRect mDefaultNbRect; - LLRect mDefaultFpRect; - LLLayoutPanel* mNavigationPanel; - LLLayoutPanel* mFavoritePanel; - boost::signals2::connection mTeleportFailedConnection; - boost::signals2::connection mTeleportFinishConnection; - boost::signals2::connection mHistoryMenuConnection; - // if true, save location to location history when teleport finishes - bool mSaveToLocationHistory; + // the distance between navigation panel and favorites panel in pixels + const static S32 FAVBAR_TOP_PADDING = 10; + + void rebuildTeleportHistoryMenu(); + void showTeleportHistoryMenu(LLUICtrl* btn_ctrl); + void invokeSearch(std::string search_text); + void resizeLayoutPanel(); + // callbacks + void onTeleportHistoryMenuItemClicked(const LLSD& userdata); + void onTeleportHistoryChanged(); + void onBackButtonClicked(); + void onBackOrForwardButtonHeldDown(LLUICtrl* ctrl, const LLSD& param); + void onNavigationButtonHeldUp(LLButton* nav_button); + void onForwardButtonClicked(); + void onHomeButtonClicked(); + void onLocationSelection(); + void onLocationPrearrange(const LLSD& data); + void onTeleportFinished(const LLVector3d& global_agent_pos); + void onTeleportFailed(); + void onNavbarResized(); + void onRegionNameResponse( + std::string typed_location, + std::string region_name, + LLVector3 local_coords, + U64 region_handle, const std::string& url, + const LLUUID& snapshot_id, bool teleport); + + static void destroyClass() + { + if (LLNavigationBar::instanceExists()) + { + LLNavigationBar::getInstance()->setEnabled(FALSE); + } + } + + S32 mNavPanWidth; + LLMenuGL* mTeleportHistoryMenu; + LLPullButton* mBtnBack; + LLPullButton* mBtnForward; + LLButton* mBtnHome; + LLLocationInputCtrl* mCmbLocation; + LLRect mDefaultNbRect; + LLRect mDefaultFpRect; + LLLayoutPanel* mNavigationPanel; + LLLayoutPanel* mFavoritePanel; + boost::signals2::connection mTeleportFailedConnection; + boost::signals2::connection mTeleportFinishConnection; + boost::signals2::connection mHistoryMenuConnection; + // if true, save location to location history when teleport finishes + bool mSaveToLocationHistory; }; #endif diff --git a/indra/newview/llpanelpresetscamerapulldown.cpp b/indra/newview/llpanelpresetscamerapulldown.cpp index 7cdb91388a..7612c428d9 100644 --- a/indra/newview/llpanelpresetscamerapulldown.cpp +++ b/indra/newview/llpanelpresetscamerapulldown.cpp @@ -50,85 +50,85 @@ // Default constructor LLPanelPresetsCameraPulldown::LLPanelPresetsCameraPulldown() { - mHoverTimer.stop(); + mHoverTimer.stop(); - mCommitCallbackRegistrar.add("Presets.GoViewPrefs", boost::bind(&LLPanelPresetsCameraPulldown::onViewButtonClick, this, _2)); - mCommitCallbackRegistrar.add("PresetsCamera.RowClick", boost::bind(&LLPanelPresetsCameraPulldown::onRowClick, this, _2)); + 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"); + buildFromFile( "panel_presets_camera_pulldown.xml"); } BOOL LLPanelPresetsCameraPulldown::postBuild() { - LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); - if (presetsMgr) - { - // Make sure there is a default preference file - presetsMgr->createMissingDefault(PRESETS_CAMERA); + LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); + if (presetsMgr) + { + // Make sure there is a default preference file + presetsMgr->createMissingDefault(PRESETS_CAMERA); - presetsMgr->startWatching(PRESETS_CAMERA); + presetsMgr->startWatching(PRESETS_CAMERA); - presetsMgr->setPresetListChangeCameraCallback(boost::bind(&LLPanelPresetsCameraPulldown::populatePanel, this)); - } + presetsMgr->setPresetListChangeCameraCallback(boost::bind(&LLPanelPresetsCameraPulldown::populatePanel, this)); + } - populatePanel(); + populatePanel(); - return LLPanel::postBuild(); + return LLPanel::postBuild(); } void LLPanelPresetsCameraPulldown::populatePanel() { - std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_CAMERA); - LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_TOP); + std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_CAMERA); + LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_TOP); - LLScrollListCtrl* scroll = getChild("preset_camera_list"); + LLScrollListCtrl* scroll = getChild("preset_camera_list"); - if (scroll && mPresetNames.begin() != mPresetNames.end()) - { - scroll->clearRows(); + 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); - } + 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; + 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); - } - } + 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); + mHoverTimer.stop(); + LLPanel::onMouseEnter(x,y,mask); } /*virtual*/ void LLPanelPresetsCameraPulldown::onTopLost() { - setVisible(FALSE); + setVisible(FALSE); } /*virtual*/ @@ -155,45 +155,45 @@ BOOL LLPanelPresetsCameraPulldown::handleDoubleClick(S32 x, S32 y, MASK mask) /*virtual*/ void LLPanelPresetsCameraPulldown::onMouseLeave(S32 x, S32 y, MASK mask) { - mHoverTimer.start(); - LLPanel::onMouseLeave(x,y,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(); - - } + 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"); + LLScrollListCtrl* scroll = getChild("preset_camera_list"); - if (scroll) - { - LLScrollListItem* item = scroll->getFirstSelected(); - if (item) - { - std::string name = item->getColumn(1)->getValue().asString(); + 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); + LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, name); - setVisible(FALSE); - } + setVisible(FALSE); + } else { LL_DEBUGS() << "none selected" << LL_ENDL; } - } + } else { LL_DEBUGS() << "no scroll" << LL_ENDL; @@ -202,36 +202,36 @@ void LLPanelPresetsCameraPulldown::onRowClick(const LLSD& user_data) 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("view"); - if (tabcontainer && graphicspanel) - { - tabcontainer->selectTabPanel(graphicspanel); - } - } + // 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("view"); + 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); + F32 alpha = mHoverTimer.getStarted() + ? clamp_rescale(mHoverTimer.getElapsedTimeF32(), sAutoCloseFadeStartTimeSec, sAutoCloseTotalTimeSec, 1.f, 0.f) + : 1.0f; + LLViewDrawContext context(alpha); - LLPanel::draw(); + LLPanel::draw(); - if (alpha == 0.f) - { - setVisible(FALSE); - } + if (alpha == 0.f) + { + setVisible(FALSE); + } } diff --git a/indra/newview/llpanelpresetscamerapulldown.h b/indra/newview/llpanelpresetscamerapulldown.h index 069d587086..12d9bc26ec 100644 --- a/indra/newview/llpanelpresetscamerapulldown.h +++ b/indra/newview/llpanelpresetscamerapulldown.h @@ -36,26 +36,26 @@ 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); + 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(); - + /*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); + 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; + std::list mPresetNames; + LLFrameTimer mHoverTimer; + static const F32 sAutoCloseFadeStartTimeSec; + static const F32 sAutoCloseTotalTimeSec; LOG_CLASS(LLPanelPresetsCameraPulldown); }; diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index fb36c5875d..c1702b4132 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -48,35 +48,35 @@ LLPresetsManager::LLPresetsManager() LLPresetsManager::~LLPresetsManager() { - mCameraChangedSignal.disconnect(); + mCameraChangedSignal.disconnect(); } void LLPresetsManager::triggerChangeCameraSignal() { - mPresetListChangeCameraSignal(); + mPresetListChangeCameraSignal(); } void LLPresetsManager::triggerChangeSignal() { - mPresetListChangeSignal(); + mPresetListChangeSignal(); } void LLPresetsManager::createMissingDefault(const std::string& subdirectory) { - if(gDirUtilp->getLindenUserDir().empty()) - { - return; - } - - 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 settings as the default + if(gDirUtilp->getLindenUserDir().empty()) + { + return; + } + + 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 settings as the default savePreset(subdirectory, PRESETS_DEFAULT, true); - } + } else { LL_DEBUGS() << "default preset exists; no-op" << LL_ENDL; @@ -85,330 +85,330 @@ void LLPresetsManager::createMissingDefault(const std::string& subdirectory) 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; - 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)); - } - } - } - } + 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; + 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); - - LLFile::mkdir(presets_path); - - std::string dest_path = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, subdirectory); - if (!gDirUtilp->fileExists(dest_path)) - LLFile::mkdir(dest_path); - - if (PRESETS_CAMERA == subdirectory) - { - std::string source_dir = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA); - LLDirIterator dir_iter(source_dir, "*.xml"); - bool found = true; - while (found) - { - std::string file; - found = dir_iter.next(file); - - if (found) - { - std::string source = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA, file); - file = LLURI::escape(file); - std::string dest = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, PRESETS_CAMERA, file); - LLFile::copy(source, dest); - } - } - } - - return dest_path; + std::string presets_path = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR); + + LLFile::mkdir(presets_path); + + std::string dest_path = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, subdirectory); + if (!gDirUtilp->fileExists(dest_path)) + LLFile::mkdir(dest_path); + + if (PRESETS_CAMERA == subdirectory) + { + std::string source_dir = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA); + LLDirIterator dir_iter(source_dir, "*.xml"); + bool found = true; + while (found) + { + std::string file; + found = dir_iter.next(file); + + if (found) + { + std::string source = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA, file); + file = LLURI::escape(file); + std::string dest = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, PRESETS_CAMERA, file); + LLFile::copy(source, dest); + } + } + } + + return dest_path; } void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets, EDefaultOptions default_option) { - LL_INFOS("AppInit") << "Loading list of preset names from " << dir << LL_ENDL; + LL_INFOS("AppInit") << "Loading list of preset names from " << dir << LL_ENDL; - mPresetNames.clear(); + mPresetNames.clear(); - LLDirIterator dir_iter(dir, "*.xml"); - bool found = true; - while (found) - { - std::string file; - found = dir_iter.next(file); + LLDirIterator dir_iter(dir, "*.xml"); + bool found = true; + while (found) + { + std::string file; + found = dir_iter.next(file); - if (found) - { - std::string path = gDirUtilp->add(dir, file); - std::string name = LLURI::unescape(gDirUtilp->getBaseFileName(path, /*strip_exten = */ true)); + if (found) + { + std::string path = gDirUtilp->add(dir, file); + std::string name = LLURI::unescape(gDirUtilp->getBaseFileName(path, /*strip_exten = */ true)); LL_DEBUGS() << " Found preset '" << name << "'" << LL_ENDL; - if (PRESETS_DEFAULT != name) - { - mPresetNames.push_back(name); - } - else - { - switch (default_option) - { - case DEFAULT_SHOW: - mPresetNames.push_back(LLTrans::getString(PRESETS_DEFAULT)); - break; - - case DEFAULT_TOP: - mPresetNames.push_front(LLTrans::getString(PRESETS_DEFAULT)); - break; - - case DEFAULT_HIDE: - default: - break; - } - } - } - } - - presets = mPresetNames; + if (PRESETS_DEFAULT != name) + { + mPresetNames.push_back(name); + } + else + { + switch (default_option) + { + case DEFAULT_SHOW: + mPresetNames.push_back(LLTrans::getString(PRESETS_DEFAULT)); + break; + + case DEFAULT_TOP: + mPresetNames.push_front(LLTrans::getString(PRESETS_DEFAULT)); + break; + + case DEFAULT_HIDE: + default: + break; + } + } + } + } + + presets = mPresetNames; } bool LLPresetsManager::mCameraDirty = false; void LLPresetsManager::setCameraDirty(bool dirty) { - mCameraDirty = dirty; + mCameraDirty = dirty; } bool LLPresetsManager::isCameraDirty() { - return mCameraDirty; + return mCameraDirty; } void LLPresetsManager::settingChanged() { - setCameraDirty(true); + setCameraDirty(true); - gSavedSettings.setString("PresetCameraActive", ""); + gSavedSettings.setString("PresetCameraActive", ""); // Hack call because this is a static routine - LLPresetsManager::getInstance()->triggerChangeCameraSignal(); + LLPresetsManager::getInstance()->triggerChangeCameraSignal(); } void LLPresetsManager::getControlNames(std::vector& names) { - const std::vector camera_controls = boost::assign::list_of - // From panel_preferences_move.xml - ("CameraAngle") - ("CameraOffsetScale") - ("EditCameraMovement") - ("AppearanceCameraMovement") - // From llagentcamera.cpp - ("CameraOffsetBuild") - ("CameraOffsetRearView") - ("FocusOffsetRearView") - ("CameraOffsetScale") - ("TrackFocusObject") + const std::vector camera_controls = boost::assign::list_of + // From panel_preferences_move.xml + ("CameraAngle") + ("CameraOffsetScale") + ("EditCameraMovement") + ("AppearanceCameraMovement") + // From llagentcamera.cpp + ("CameraOffsetBuild") + ("CameraOffsetRearView") + ("FocusOffsetRearView") + ("CameraOffsetScale") + ("TrackFocusObject") ; names = camera_controls; } bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string name, bool createDefault) { - if (LLTrans::getString(PRESETS_DEFAULT) == name) - { - name = PRESETS_DEFAULT; - } - if (!createDefault && name == PRESETS_DEFAULT) - { - LL_WARNS() << "Should not overwrite default" << LL_ENDL; - return false; - } - - bool saved = false; - std::vector name_list; - - if(PRESETS_GRAPHIC == subdirectory) - { - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance && !createDefault) - { - gSavedSettings.setString("PresetGraphicActive", name); - instance->getControlNames(name_list); - LL_DEBUGS() << "saving preset '" << name << "'; " << name_list.size() << " names" << LL_ENDL; - name_list.push_back("PresetGraphicActive"); - } - else + if (LLTrans::getString(PRESETS_DEFAULT) == name) + { + name = PRESETS_DEFAULT; + } + if (!createDefault && name == PRESETS_DEFAULT) + { + LL_WARNS() << "Should not overwrite default" << LL_ENDL; + return false; + } + + bool saved = false; + std::vector name_list; + + if(PRESETS_GRAPHIC == subdirectory) + { + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance && !createDefault) + { + gSavedSettings.setString("PresetGraphicActive", name); + instance->getControlNames(name_list); + LL_DEBUGS() << "saving preset '" << name << "'; " << name_list.size() << " names" << LL_ENDL; + name_list.push_back("PresetGraphicActive"); + } + else { - LL_WARNS("Presets") << "preferences floater instance not found" << LL_ENDL; - } - } - else if(PRESETS_CAMERA == subdirectory) - { - gSavedSettings.setString("PresetGraphicActive", name); - - name_list.clear(); - getControlNames(name_list); - name_list.push_back("PresetCameraActive"); - } - else - { - LL_ERRS() << "Invalid presets directory '" << subdirectory << "'" << LL_ENDL; - } + LL_WARNS("Presets") << "preferences floater instance not found" << LL_ENDL; + } + } + else if(PRESETS_CAMERA == subdirectory) + { + gSavedSettings.setString("PresetGraphicActive", name); + + name_list.clear(); + getControlNames(name_list); + name_list.push_back("PresetCameraActive"); + } + else + { + LL_ERRS() << "Invalid presets directory '" << subdirectory << "'" << LL_ENDL; + } - // make an empty llsd - LLSD paramsData(LLSD::emptyMap()); - - // 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"); + // make an empty llsd + LLSD paramsData(LLSD::emptyMap()); + + // 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; + 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 (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; - } - } + 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 available to be saved" << LL_ENDL; - } + { + LL_INFOS() << "No settings available to be saved" << LL_ENDL; + } - return saved; + return saved; } bool LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option) { - bool sts = true; - - combo->clearRows(); - - std::string presets_dir = getPresetsDir(subdirectory); - - if (!presets_dir.empty()) - { - std::list preset_names; - loadPresetNamesFromDir(presets_dir, preset_names, default_option); - - std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); - - if (preset_names.begin() != preset_names.end()) - { - for (std::list::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it) - { - const std::string& name = *it; - combo->add(name, LLSD().with(0, name)); - } - } - else - { - combo->setLabel(LLTrans::getString("preset_combo_label")); - sts = false; - } - } - return sts; + bool sts = true; + + combo->clearRows(); + + std::string presets_dir = getPresetsDir(subdirectory); + + if (!presets_dir.empty()) + { + std::list preset_names; + loadPresetNamesFromDir(presets_dir, preset_names, default_option); + + std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); + + if (preset_names.begin() != preset_names.end()) + { + for (std::list::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it) + { + const std::string& name = *it; + combo->add(name, LLSD().with(0, name)); + } + } + else + { + combo->setLabel(LLTrans::getString("preset_combo_label")); + sts = false; + } + } + return sts; } void LLPresetsManager::loadPreset(const std::string& subdirectory, std::string name) { - if (LLTrans::getString(PRESETS_DEFAULT) == name) - { - name = PRESETS_DEFAULT; - } + if (LLTrans::getString(PRESETS_DEFAULT) == name) + { + name = PRESETS_DEFAULT; + } - std::string full_path(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); + std::string full_path(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); LL_DEBUGS() << "attempting to load preset '"< 0) - { - if(PRESETS_GRAPHIC == subdirectory) - { - gSavedSettings.setString("PresetGraphicActive", name); - - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->refreshEnabledGraphics(); - } - triggerChangeSignal(); - } - if(PRESETS_CAMERA == subdirectory) - { - gSavedSettings.setString("PresetCameraActive", name); - triggerChangeCameraSignal(); - } - } + if(gSavedSettings.loadFromFile(full_path, false, true) > 0) + { + if(PRESETS_GRAPHIC == subdirectory) + { + gSavedSettings.setString("PresetGraphicActive", name); + + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->refreshEnabledGraphics(); + } + triggerChangeSignal(); + } + if(PRESETS_CAMERA == subdirectory) + { + gSavedSettings.setString("PresetCameraActive", name); + triggerChangeCameraSignal(); + } + } else { LL_WARNS("Presets") << "failed to load preset '"<deleteFilesInDir(getPresetsDir(subdirectory), LLURI::escape(name) + ".xml") < 1) - { - LL_WARNS("Presets") << "Error removing preset " << name << " from disk" << LL_ENDL; - sts = false; - } - - // If you delete the preset that is currently marked as loaded then also indicate that no preset is loaded. - if(PRESETS_GRAPHIC == subdirectory) - { - if (gSavedSettings.getString("PresetGraphicActive") == name) - { - gSavedSettings.setString("PresetGraphicActive", ""); - } - // signal interested parties - triggerChangeSignal(); - } - - if(PRESETS_CAMERA == subdirectory) - { - if (gSavedSettings.getString("PresetCameraActive") == name) - { - gSavedSettings.setString("PresetCameraActive", ""); - } - // signal interested parties - triggerChangeCameraSignal(); - } - - return sts; + if (LLTrans::getString(PRESETS_DEFAULT) == name) + { + name = PRESETS_DEFAULT; + } + + bool sts = true; + + if (PRESETS_DEFAULT == name) + { + // This code should never execute + LL_WARNS("Presets") << "You are not allowed to delete the default preset." << LL_ENDL; + sts = false; + } + + if (gDirUtilp->deleteFilesInDir(getPresetsDir(subdirectory), LLURI::escape(name) + ".xml") < 1) + { + LL_WARNS("Presets") << "Error removing preset " << name << " from disk" << LL_ENDL; + sts = false; + } + + // If you delete the preset that is currently marked as loaded then also indicate that no preset is loaded. + if(PRESETS_GRAPHIC == subdirectory) + { + if (gSavedSettings.getString("PresetGraphicActive") == name) + { + gSavedSettings.setString("PresetGraphicActive", ""); + } + // 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); + return mPresetListChangeCameraSignal.connect(cb); } boost::signals2::connection LLPresetsManager::setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb) { - return mPresetListChangeSignal.connect(cb); + return mPresetListChangeSignal.connect(cb); } diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index c3a6c0795c..7370e0a3b1 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -39,54 +39,54 @@ static const std::string PRESETS_CAMERA = "camera"; enum EDefaultOptions { - DEFAULT_SHOW, - DEFAULT_TOP, - DEFAULT_HIDE // Do not display "Default" in a list + DEFAULT_SHOW, + DEFAULT_TOP, + DEFAULT_HIDE // Do not display "Default" in a list }; class LLPresetsManager : public LLSingleton { - LLSINGLETON(LLPresetsManager); - ~LLPresetsManager(); + LLSINGLETON(LLPresetsManager); + ~LLPresetsManager(); public: - typedef std::list preset_name_list_t; - typedef boost::signals2::signal preset_list_signal_t; + typedef std::list preset_name_list_t; + typedef boost::signals2::signal preset_list_signal_t; - void createMissingDefault(const std::string& subdirectory); - void startWatching(const std::string& subdirectory); - void triggerChangeCameraSignal(); - void triggerChangeSignal(); - static std::string getPresetsDir(const std::string& subdirectory); - 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); + void createMissingDefault(const std::string& subdirectory); + void startWatching(const std::string& subdirectory); + void triggerChangeCameraSignal(); + void triggerChangeSignal(); + static std::string getPresetsDir(const std::string& subdirectory); + 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, 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. + // Emitted when a preset gets loaded or saved. - preset_name_list_t mPresetNames; + preset_name_list_t mPresetNames; - preset_list_signal_t mPresetListChangeCameraSignal; - preset_list_signal_t mPresetListChangeSignal; + preset_list_signal_t mPresetListChangeCameraSignal; + preset_list_signal_t mPresetListChangeSignal; private: - LOG_CLASS(LLPresetsManager); + LOG_CLASS(LLPresetsManager); - void getControlNames(std::vector& names); - static void settingChanged(); + void getControlNames(std::vector& names); + static void settingChanged(); - boost::signals2::connection mCameraChangedSignal; + boost::signals2::connection mCameraChangedSignal; - static bool mCameraDirty; + static bool mCameraDirty; }; #endif // LL_PRESETSMANAGER_H diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index da495cbf21..398ec953d7 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -63,7 +63,7 @@ #include "llworld.h" #include "llstatgraph.h" #include "llviewermedia.h" -#include "llviewermenu.h" // for gMenuBarView +#include "llviewermenu.h" // for gMenuBarView #include "llviewerparcelmgr.h" #include "llviewerthrottle.h" #include "lluictrlfactory.h" @@ -100,42 +100,42 @@ const S32 SIM_STAT_WIDTH = 8; const LLColor4 SIM_OK_COLOR(0.f, 1.f, 0.f, 1.f); const LLColor4 SIM_WARN_COLOR(1.f, 1.f, 0.f, 1.f); const LLColor4 SIM_FULL_COLOR(1.f, 0.f, 0.f, 1.f); -const F32 ICON_TIMER_EXPIRY = 3.f; // How long the balance and health icons should flash after a change. +const F32 ICON_TIMER_EXPIRY = 3.f; // How long the balance and health icons should flash after a change. static void onClickVolume(void*); LLStatusBar::LLStatusBar(const LLRect& rect) -: LLPanel(), - mTextTime(NULL), - mSGBandwidth(NULL), - mSGPacketLoss(NULL), - mBtnVolume(NULL), - mBoxBalance(NULL), - mBalance(0), - mHealth(100), - mSquareMetersCredit(0), - mSquareMetersCommitted(0) +: LLPanel(), + mTextTime(NULL), + mSGBandwidth(NULL), + mSGPacketLoss(NULL), + mBtnVolume(NULL), + mBoxBalance(NULL), + mBalance(0), + mHealth(100), + mSquareMetersCredit(0), + mSquareMetersCommitted(0) { - setRect(rect); - - // status bar can possible overlay menus? - setMouseOpaque(FALSE); + setRect(rect); + + // status bar can possible overlay menus? + setMouseOpaque(FALSE); - mBalanceTimer = new LLFrameTimer(); - mHealthTimer = new LLFrameTimer(); + mBalanceTimer = new LLFrameTimer(); + mHealthTimer = new LLFrameTimer(); - buildFromFile("panel_status_bar.xml"); + buildFromFile("panel_status_bar.xml"); } LLStatusBar::~LLStatusBar() { - delete mBalanceTimer; - mBalanceTimer = NULL; + delete mBalanceTimer; + mBalanceTimer = NULL; - delete mHealthTimer; - mHealthTimer = NULL; + delete mHealthTimer; + mHealthTimer = NULL; - // LLView destructor cleans up children + // LLView destructor cleans up children } //----------------------------------------------------------------------- @@ -145,465 +145,465 @@ LLStatusBar::~LLStatusBar() // virtual void LLStatusBar::draw() { - refresh(); - LLPanel::draw(); + refresh(); + LLPanel::draw(); } BOOL LLStatusBar::handleRightMouseDown(S32 x, S32 y, MASK mask) { - show_navbar_context_menu(this,x,y); - return TRUE; + show_navbar_context_menu(this,x,y); + return TRUE; } BOOL LLStatusBar::postBuild() { - gMenuBarView->setRightMouseDownCallback(boost::bind(&show_navbar_context_menu, _1, _2, _3)); + gMenuBarView->setRightMouseDownCallback(boost::bind(&show_navbar_context_menu, _1, _2, _3)); - mTextTime = getChild("TimeText" ); - - getChild("buyL")->setCommitCallback( - boost::bind(&LLStatusBar::onClickBuyCurrency, this)); + mTextTime = getChild("TimeText" ); + + getChild("buyL")->setCommitCallback( + boost::bind(&LLStatusBar::onClickBuyCurrency, this)); getChild("goShop")->setCommitCallback(boost::bind(&LLWeb::loadURL, gSavedSettings.getString("MarketplaceURL"), LLStringUtil::null, LLStringUtil::null)); - mBoxBalance = getChild("balance"); - mBoxBalance->setClickedCallback( &LLStatusBar::onClickBalance, 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 ); - mBtnVolume->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterVolume, this)); - - mMediaToggle = getChild("media_toggle_btn"); - mMediaToggle->setClickedCallback( &LLStatusBar::onClickMediaToggle, this ); - mMediaToggle->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterNearbyMedia, this)); - - LLHints::registerHintTarget("linden_balance", getChild("balance_bg")->getHandle()); - - gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&LLStatusBar::onVolumeChanged, this, _2)); - - // Adding Net Stat Graph - S32 x = getRect().getWidth() - 2; - S32 y = 0; - LLRect r; - r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); - LLStatGraph::Params sgp; - sgp.name("BandwidthGraph"); - sgp.rect(r); - sgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); - sgp.mouse_opaque(false); - sgp.stat.count_stat_float(&LLStatViewer::ACTIVE_MESSAGE_DATA_RECEIVED); - sgp.units("Kbps"); - sgp.precision(0); - sgp.per_sec(true); - mSGBandwidth = LLUICtrlFactory::create(sgp); - addChild(mSGBandwidth); - x -= SIM_STAT_WIDTH + 2; - - r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); - //these don't seem to like being reused - LLStatGraph::Params pgp; - pgp.name("PacketLossPercent"); - pgp.rect(r); - pgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); - pgp.mouse_opaque(false); - pgp.stat.sample_stat_float(&LLStatViewer::PACKETS_LOST_PERCENT); - pgp.units("%"); - pgp.min(0.f); - pgp.max(5.f); - pgp.precision(1); - pgp.per_sec(false); - LLStatGraph::Thresholds thresholds; - thresholds.threshold.add(LLStatGraph::ThresholdParams().value(0.1).color(LLColor4::green)) - .add(LLStatGraph::ThresholdParams().value(0.25f).color(LLColor4::yellow)) - .add(LLStatGraph::ThresholdParams().value(0.6f).color(LLColor4::red)); - - pgp.thresholds(thresholds); - - 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); - mPanelPresetsPulldown->setVisible(FALSE); - - mPanelVolumePulldown = new LLPanelVolumePulldown(); - addChild(mPanelVolumePulldown); - mPanelVolumePulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); - mPanelVolumePulldown->setVisible(FALSE); - - mPanelNearByMedia = new LLPanelNearByMedia(); - addChild(mPanelNearByMedia); - mPanelNearByMedia->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); - mPanelNearByMedia->setVisible(FALSE); - - return TRUE; + mBoxBalance = getChild("balance"); + mBoxBalance->setClickedCallback( &LLStatusBar::onClickBalance, 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 ); + mBtnVolume->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterVolume, this)); + + mMediaToggle = getChild("media_toggle_btn"); + mMediaToggle->setClickedCallback( &LLStatusBar::onClickMediaToggle, this ); + mMediaToggle->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterNearbyMedia, this)); + + LLHints::registerHintTarget("linden_balance", getChild("balance_bg")->getHandle()); + + gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&LLStatusBar::onVolumeChanged, this, _2)); + + // Adding Net Stat Graph + S32 x = getRect().getWidth() - 2; + S32 y = 0; + LLRect r; + r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); + LLStatGraph::Params sgp; + sgp.name("BandwidthGraph"); + sgp.rect(r); + sgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); + sgp.mouse_opaque(false); + sgp.stat.count_stat_float(&LLStatViewer::ACTIVE_MESSAGE_DATA_RECEIVED); + sgp.units("Kbps"); + sgp.precision(0); + sgp.per_sec(true); + mSGBandwidth = LLUICtrlFactory::create(sgp); + addChild(mSGBandwidth); + x -= SIM_STAT_WIDTH + 2; + + r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); + //these don't seem to like being reused + LLStatGraph::Params pgp; + pgp.name("PacketLossPercent"); + pgp.rect(r); + pgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); + pgp.mouse_opaque(false); + pgp.stat.sample_stat_float(&LLStatViewer::PACKETS_LOST_PERCENT); + pgp.units("%"); + pgp.min(0.f); + pgp.max(5.f); + pgp.precision(1); + pgp.per_sec(false); + LLStatGraph::Thresholds thresholds; + thresholds.threshold.add(LLStatGraph::ThresholdParams().value(0.1).color(LLColor4::green)) + .add(LLStatGraph::ThresholdParams().value(0.25f).color(LLColor4::yellow)) + .add(LLStatGraph::ThresholdParams().value(0.6f).color(LLColor4::red)); + + pgp.thresholds(thresholds); + + 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); + mPanelPresetsPulldown->setVisible(FALSE); + + mPanelVolumePulldown = new LLPanelVolumePulldown(); + addChild(mPanelVolumePulldown); + mPanelVolumePulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); + mPanelVolumePulldown->setVisible(FALSE); + + mPanelNearByMedia = new LLPanelNearByMedia(); + addChild(mPanelNearByMedia); + mPanelNearByMedia->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); + mPanelNearByMedia->setVisible(FALSE); + + return TRUE; } // Per-frame updates of visibility void LLStatusBar::refresh() { - static LLCachedControl show_net_stats(gSavedSettings, "ShowNetStats", false); - bool net_stats_visible = show_net_stats; - - if (net_stats_visible) - { - // Adding Net Stat Meter back in - F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f; - mSGBandwidth->setMin(0.f); - mSGBandwidth->setMax(bwtotal*1.25f); - //mSGBandwidth->setThreshold(0, bwtotal*0.75f); - //mSGBandwidth->setThreshold(1, bwtotal); - //mSGBandwidth->setThreshold(2, bwtotal); - } - - // update clock every 10 seconds - if(mClockUpdateTimer.getElapsedTimeF32() > 10.f) - { - mClockUpdateTimer.reset(); - - // Get current UTC time, adjusted for the user's clock - // being off. - time_t utc_time; - utc_time = time_corrected(); - - std::string timeStr = getString("time"); - LLSD substitution; - substitution["datetime"] = (S32) utc_time; - LLStringUtil::format (timeStr, substitution); - mTextTime->setText(timeStr); - - // set the tooltip to have the date - std::string dtStr = getString("timeTooltip"); - LLStringUtil::format (dtStr, substitution); - mTextTime->setToolTip (dtStr); - } - - LLRect r; - const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge(); - - // reshape menu bar to its content's width - if (MENU_RIGHT != gMenuBarView->getRect().getWidth()) - { - gMenuBarView->reshape(MENU_RIGHT, gMenuBarView->getRect().getHeight()); - } - - mSGBandwidth->setVisible(net_stats_visible); - mSGPacketLoss->setVisible(net_stats_visible); - - // update the master volume button state - bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute(); - mBtnVolume->setToggleState(mute_audio); - - // Disable media toggle if there's no media, parcel media, and no parcel audio - // (or if media is disabled) - bool button_enabled = (gSavedSettings.getBOOL("AudioStreamingMusic")||gSavedSettings.getBOOL("AudioStreamingMedia")) && - (LLViewerMedia::hasInWorldMedia() || LLViewerMedia::hasParcelMedia() || LLViewerMedia::hasParcelAudio()); - mMediaToggle->setEnabled(button_enabled); - // Note the "sense" of the toggle is opposite whether media is playing or not - bool any_media_playing = (LLViewerMedia::isAnyMediaPlaying() || - LLViewerMedia::isParcelMediaPlaying() || - LLViewerMedia::isParcelAudioPlaying()); - mMediaToggle->setValue(!any_media_playing); + static LLCachedControl show_net_stats(gSavedSettings, "ShowNetStats", false); + bool net_stats_visible = show_net_stats; + + if (net_stats_visible) + { + // Adding Net Stat Meter back in + F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f; + mSGBandwidth->setMin(0.f); + mSGBandwidth->setMax(bwtotal*1.25f); + //mSGBandwidth->setThreshold(0, bwtotal*0.75f); + //mSGBandwidth->setThreshold(1, bwtotal); + //mSGBandwidth->setThreshold(2, bwtotal); + } + + // update clock every 10 seconds + if(mClockUpdateTimer.getElapsedTimeF32() > 10.f) + { + mClockUpdateTimer.reset(); + + // Get current UTC time, adjusted for the user's clock + // being off. + time_t utc_time; + utc_time = time_corrected(); + + std::string timeStr = getString("time"); + LLSD substitution; + substitution["datetime"] = (S32) utc_time; + LLStringUtil::format (timeStr, substitution); + mTextTime->setText(timeStr); + + // set the tooltip to have the date + std::string dtStr = getString("timeTooltip"); + LLStringUtil::format (dtStr, substitution); + mTextTime->setToolTip (dtStr); + } + + LLRect r; + const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge(); + + // reshape menu bar to its content's width + if (MENU_RIGHT != gMenuBarView->getRect().getWidth()) + { + gMenuBarView->reshape(MENU_RIGHT, gMenuBarView->getRect().getHeight()); + } + + mSGBandwidth->setVisible(net_stats_visible); + mSGPacketLoss->setVisible(net_stats_visible); + + // update the master volume button state + bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute(); + mBtnVolume->setToggleState(mute_audio); + + // Disable media toggle if there's no media, parcel media, and no parcel audio + // (or if media is disabled) + bool button_enabled = (gSavedSettings.getBOOL("AudioStreamingMusic")||gSavedSettings.getBOOL("AudioStreamingMedia")) && + (LLViewerMedia::hasInWorldMedia() || LLViewerMedia::hasParcelMedia() || LLViewerMedia::hasParcelAudio()); + mMediaToggle->setEnabled(button_enabled); + // Note the "sense" of the toggle is opposite whether media is playing or not + bool any_media_playing = (LLViewerMedia::isAnyMediaPlaying() || + LLViewerMedia::isParcelMediaPlaying() || + LLViewerMedia::isParcelAudioPlaying()); + mMediaToggle->setValue(!any_media_playing); } void LLStatusBar::setVisibleForMouselook(bool visible) { - mTextTime->setVisible(visible); - getChild("balance_bg")->setVisible(visible); - mBoxBalance->setVisible(visible); - mBtnVolume->setVisible(visible); - mMediaToggle->setVisible(visible); - mSGBandwidth->setVisible(visible); - mSGPacketLoss->setVisible(visible); - setBackgroundVisible(visible); - mIconPresetsCamera->setVisible(visible); - mIconPresetsGraphic->setVisible(visible); + mTextTime->setVisible(visible); + getChild("balance_bg")->setVisible(visible); + mBoxBalance->setVisible(visible); + mBtnVolume->setVisible(visible); + mMediaToggle->setVisible(visible); + mSGBandwidth->setVisible(visible); + mSGPacketLoss->setVisible(visible); + setBackgroundVisible(visible); + mIconPresetsCamera->setVisible(visible); + mIconPresetsGraphic->setVisible(visible); } void LLStatusBar::debitBalance(S32 debit) { - setBalance(getBalance() - debit); + setBalance(getBalance() - debit); } void LLStatusBar::creditBalance(S32 credit) { - setBalance(getBalance() + credit); + setBalance(getBalance() + credit); } void LLStatusBar::setBalance(S32 balance) { - if (balance > getBalance() && getBalance() != 0) - { - LLFirstUse::receiveLindens(); - } - - std::string money_str = LLResMgr::getInstance()->getMonetaryString( balance ); - - LLStringUtil::format_map_t string_args; - string_args["[AMT]"] = llformat("%s", money_str.c_str()); - std::string label_str = getString("buycurrencylabel", string_args); - mBoxBalance->setValue(label_str); - - // Resize the L$ balance background to be wide enough for your balance plus the buy button - { - const S32 HPAD = 24; - LLRect balance_rect = mBoxBalance->getTextBoundingRect(); - LLRect buy_rect = getChildView("buyL")->getRect(); - LLRect shop_rect = getChildView("goShop")->getRect(); - LLView* balance_bg_view = getChildView("balance_bg"); - LLRect balance_bg_rect = balance_bg_view->getRect(); - balance_bg_rect.mLeft = balance_bg_rect.mRight - (buy_rect.getWidth() + shop_rect.getWidth() + balance_rect.getWidth() + HPAD); - balance_bg_view->setShape(balance_bg_rect); - } - - if (mBalance && (fabs((F32)(mBalance - balance)) > gSavedSettings.getF32("UISndMoneyChangeThreshold"))) - { - if (mBalance > balance) - make_ui_sound("UISndMoneyChangeDown"); - else - make_ui_sound("UISndMoneyChangeUp"); - } - - if( balance != mBalance ) - { - mBalanceTimer->reset(); - mBalanceTimer->setTimerExpirySec( ICON_TIMER_EXPIRY ); - mBalance = balance; - } + if (balance > getBalance() && getBalance() != 0) + { + LLFirstUse::receiveLindens(); + } + + std::string money_str = LLResMgr::getInstance()->getMonetaryString( balance ); + + LLStringUtil::format_map_t string_args; + string_args["[AMT]"] = llformat("%s", money_str.c_str()); + std::string label_str = getString("buycurrencylabel", string_args); + mBoxBalance->setValue(label_str); + + // Resize the L$ balance background to be wide enough for your balance plus the buy button + { + const S32 HPAD = 24; + LLRect balance_rect = mBoxBalance->getTextBoundingRect(); + LLRect buy_rect = getChildView("buyL")->getRect(); + LLRect shop_rect = getChildView("goShop")->getRect(); + LLView* balance_bg_view = getChildView("balance_bg"); + LLRect balance_bg_rect = balance_bg_view->getRect(); + balance_bg_rect.mLeft = balance_bg_rect.mRight - (buy_rect.getWidth() + shop_rect.getWidth() + balance_rect.getWidth() + HPAD); + balance_bg_view->setShape(balance_bg_rect); + } + + if (mBalance && (fabs((F32)(mBalance - balance)) > gSavedSettings.getF32("UISndMoneyChangeThreshold"))) + { + if (mBalance > balance) + make_ui_sound("UISndMoneyChangeDown"); + else + make_ui_sound("UISndMoneyChangeUp"); + } + + if( balance != mBalance ) + { + mBalanceTimer->reset(); + mBalanceTimer->setTimerExpirySec( ICON_TIMER_EXPIRY ); + mBalance = balance; + } } // static void LLStatusBar::sendMoneyBalanceRequest() { - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_MoneyBalanceRequest); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_MoneyData); - msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null ); - gAgent.sendReliableMessage(); + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_MoneyBalanceRequest); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_MoneyData); + msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null ); + gAgent.sendReliableMessage(); } void LLStatusBar::setHealth(S32 health) { - //LL_INFOS() << "Setting health to: " << buffer << LL_ENDL; - if( mHealth > health ) - { - if (mHealth > (health + gSavedSettings.getF32("UISndHealthReductionThreshold"))) - { - if (isAgentAvatarValid()) - { - if (gAgentAvatarp->getSex() == SEX_FEMALE) - { - make_ui_sound("UISndHealthReductionF"); - } - else - { - make_ui_sound("UISndHealthReductionM"); - } - } - } - - mHealthTimer->reset(); - mHealthTimer->setTimerExpirySec( ICON_TIMER_EXPIRY ); - } - - mHealth = health; + //LL_INFOS() << "Setting health to: " << buffer << LL_ENDL; + if( mHealth > health ) + { + if (mHealth > (health + gSavedSettings.getF32("UISndHealthReductionThreshold"))) + { + if (isAgentAvatarValid()) + { + if (gAgentAvatarp->getSex() == SEX_FEMALE) + { + make_ui_sound("UISndHealthReductionF"); + } + else + { + make_ui_sound("UISndHealthReductionM"); + } + } + } + + mHealthTimer->reset(); + mHealthTimer->setTimerExpirySec( ICON_TIMER_EXPIRY ); + } + + mHealth = health; } S32 LLStatusBar::getBalance() const { - return mBalance; + return mBalance; } S32 LLStatusBar::getHealth() const { - return mHealth; + return mHealth; } void LLStatusBar::setLandCredit(S32 credit) { - mSquareMetersCredit = credit; + mSquareMetersCredit = credit; } void LLStatusBar::setLandCommitted(S32 committed) { - mSquareMetersCommitted = committed; + mSquareMetersCommitted = committed; } BOOL LLStatusBar::isUserTiered() const { - return (mSquareMetersCredit > 0); + return (mSquareMetersCredit > 0); } S32 LLStatusBar::getSquareMetersCredit() const { - return mSquareMetersCredit; + return mSquareMetersCredit; } S32 LLStatusBar::getSquareMetersCommitted() const { - return mSquareMetersCommitted; + return mSquareMetersCommitted; } S32 LLStatusBar::getSquareMetersLeft() const { - return mSquareMetersCredit - mSquareMetersCommitted; + return mSquareMetersCredit - mSquareMetersCommitted; } void LLStatusBar::onClickBuyCurrency() { - // open a currency floater - actual one open depends on - // value specified in settings.xml - LLBuyCurrencyHTML::openCurrencyFloater(); - LLFirstUse::receiveLindens(false); + // open a currency floater - actual one open depends on + // value specified in settings.xml + LLBuyCurrencyHTML::openCurrencyFloater(); + 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); + 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_graphic" ); - LLRect icon_rect = icon->getRect(); - LLRect pulldown_rect = mPanelPresetsPulldown->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); - mPanelPresetsPulldown->setShape(pulldown_rect); - - // show the master presets pull-down - LLUI::clearPopups(); - LLUI::addPopup(mPanelPresetsPulldown); - mPanelNearByMedia->setVisible(FALSE); - mPanelVolumePulldown->setVisible(FALSE); - mPanelPresetsPulldown->setVisible(TRUE); + LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); + LLIconCtrl* icon = getChild( "presets_icon_graphic" ); + LLRect icon_rect = icon->getRect(); + LLRect pulldown_rect = mPanelPresetsPulldown->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); + mPanelPresetsPulldown->setShape(pulldown_rect); + + // show the master presets pull-down + LLUI::clearPopups(); + LLUI::addPopup(mPanelPresetsPulldown); + mPanelNearByMedia->setVisible(FALSE); + mPanelVolumePulldown->setVisible(FALSE); + mPanelPresetsPulldown->setVisible(TRUE); } void LLStatusBar::onMouseEnterVolume() { - LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); - LLButton* volbtn = getChild( "volume_btn" ); - LLRect vol_btn_rect = volbtn->getRect(); - LLRect volume_pulldown_rect = mPanelVolumePulldown->getRect(); - volume_pulldown_rect.setLeftTopAndSize(vol_btn_rect.mLeft - - (volume_pulldown_rect.getWidth() - vol_btn_rect.getWidth()), - vol_btn_rect.mBottom, - volume_pulldown_rect.getWidth(), - volume_pulldown_rect.getHeight()); - - volume_pulldown_rect.translate(popup_holder->getRect().getWidth() - volume_pulldown_rect.mRight, 0); - mPanelVolumePulldown->setShape(volume_pulldown_rect); - - - // show the master volume pull-down - LLUI::clearPopups(); - LLUI::addPopup(mPanelVolumePulldown); - mPanelPresetsCameraPulldown->setVisible(FALSE); - mPanelPresetsPulldown->setVisible(FALSE); - mPanelNearByMedia->setVisible(FALSE); - mPanelVolumePulldown->setVisible(TRUE); + LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); + LLButton* volbtn = getChild( "volume_btn" ); + LLRect vol_btn_rect = volbtn->getRect(); + LLRect volume_pulldown_rect = mPanelVolumePulldown->getRect(); + volume_pulldown_rect.setLeftTopAndSize(vol_btn_rect.mLeft - + (volume_pulldown_rect.getWidth() - vol_btn_rect.getWidth()), + vol_btn_rect.mBottom, + volume_pulldown_rect.getWidth(), + volume_pulldown_rect.getHeight()); + + volume_pulldown_rect.translate(popup_holder->getRect().getWidth() - volume_pulldown_rect.mRight, 0); + mPanelVolumePulldown->setShape(volume_pulldown_rect); + + + // show the master volume pull-down + LLUI::clearPopups(); + LLUI::addPopup(mPanelVolumePulldown); + mPanelPresetsCameraPulldown->setVisible(FALSE); + mPanelPresetsPulldown->setVisible(FALSE); + mPanelNearByMedia->setVisible(FALSE); + mPanelVolumePulldown->setVisible(TRUE); } void LLStatusBar::onMouseEnterNearbyMedia() { - LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); - LLRect nearby_media_rect = mPanelNearByMedia->getRect(); - LLButton* nearby_media_btn = getChild( "media_toggle_btn" ); - LLRect nearby_media_btn_rect = nearby_media_btn->getRect(); - nearby_media_rect.setLeftTopAndSize(nearby_media_btn_rect.mLeft - - (nearby_media_rect.getWidth() - nearby_media_btn_rect.getWidth())/2, - nearby_media_btn_rect.mBottom, - nearby_media_rect.getWidth(), - nearby_media_rect.getHeight()); - // force onscreen - nearby_media_rect.translate(popup_holder->getRect().getWidth() - nearby_media_rect.mRight, 0); - - // show the master volume pull-down - mPanelNearByMedia->setShape(nearby_media_rect); - LLUI::clearPopups(); - LLUI::addPopup(mPanelNearByMedia); - - mPanelPresetsCameraPulldown->setVisible(FALSE); - mPanelPresetsPulldown->setVisible(FALSE); - mPanelVolumePulldown->setVisible(FALSE); - mPanelNearByMedia->setVisible(TRUE); + LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); + LLRect nearby_media_rect = mPanelNearByMedia->getRect(); + LLButton* nearby_media_btn = getChild( "media_toggle_btn" ); + LLRect nearby_media_btn_rect = nearby_media_btn->getRect(); + nearby_media_rect.setLeftTopAndSize(nearby_media_btn_rect.mLeft - + (nearby_media_rect.getWidth() - nearby_media_btn_rect.getWidth())/2, + nearby_media_btn_rect.mBottom, + nearby_media_rect.getWidth(), + nearby_media_rect.getHeight()); + // force onscreen + nearby_media_rect.translate(popup_holder->getRect().getWidth() - nearby_media_rect.mRight, 0); + + // show the master volume pull-down + mPanelNearByMedia->setShape(nearby_media_rect); + LLUI::clearPopups(); + LLUI::addPopup(mPanelNearByMedia); + + mPanelPresetsCameraPulldown->setVisible(FALSE); + mPanelPresetsPulldown->setVisible(FALSE); + mPanelVolumePulldown->setVisible(FALSE); + mPanelNearByMedia->setVisible(TRUE); } static void onClickVolume(void* data) { - // toggle the master mute setting - bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute(); - LLAppViewer::instance()->setMasterSystemAudioMute(!mute_audio); + // toggle the master mute setting + bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute(); + LLAppViewer::instance()->setMasterSystemAudioMute(!mute_audio); } //static void LLStatusBar::onClickBalance(void* ) { - // Force a balance request message: - LLStatusBar::sendMoneyBalanceRequest(); - // The refresh of the display (call to setBalance()) will be done by process_money_balance_reply() + // Force a balance request message: + LLStatusBar::sendMoneyBalanceRequest(); + // The refresh of the display (call to setBalance()) will be done by process_money_balance_reply() } //static void LLStatusBar::onClickMediaToggle(void* data) { - LLStatusBar *status_bar = (LLStatusBar*)data; - // "Selected" means it was showing the "play" icon (so media was playing), and now it shows "pause", so turn off media - bool pause = status_bar->mMediaToggle->getValue(); - LLViewerMedia::setAllMediaPaused(pause); + LLStatusBar *status_bar = (LLStatusBar*)data; + // "Selected" means it was showing the "play" icon (so media was playing), and now it shows "pause", so turn off media + bool pause = status_bar->mMediaToggle->getValue(); + LLViewerMedia::setAllMediaPaused(pause); } BOOL can_afford_transaction(S32 cost) { - return((cost <= 0)||((gStatusBar) && (gStatusBar->getBalance() >=cost))); + return((cost <= 0)||((gStatusBar) && (gStatusBar->getBalance() >=cost))); } void LLStatusBar::onVolumeChanged(const LLSD& newvalue) { - refresh(); + refresh(); } // Implements secondlife:///app/balance/request to request a L$ balance @@ -611,18 +611,18 @@ void LLStatusBar::onVolumeChanged(const LLSD& newvalue) class LLBalanceHandler : public LLCommandHandler { public: - // Requires "trusted" browser/URL source - LLBalanceHandler() : LLCommandHandler("balance", UNTRUSTED_BLOCK) { } - bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) - { - if (tokens.size() == 1 - && tokens[0].asString() == "request") - { - LLStatusBar::sendMoneyBalanceRequest(); - return true; - } - return false; - } + // Requires "trusted" browser/URL source + LLBalanceHandler() : LLCommandHandler("balance", UNTRUSTED_BLOCK) { } + bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) + { + if (tokens.size() == 1 + && tokens[0].asString() == "request") + { + LLStatusBar::sendMoneyBalanceRequest(); + return true; + } + return false; + } }; // register with command dispatch system LLBalanceHandler gBalanceHandler; diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h index e9be398601..040b7bc949 100644 --- a/indra/newview/llstatusbar.h +++ b/indra/newview/llstatusbar.h @@ -48,82 +48,82 @@ class LLPanelNearByMedia; class LLIconCtrl; class LLStatusBar -: public LLPanel +: public LLPanel { public: - LLStatusBar(const LLRect& rect ); - /*virtual*/ ~LLStatusBar(); - - /*virtual*/ void draw(); + LLStatusBar(const LLRect& rect ); + /*virtual*/ ~LLStatusBar(); + + /*virtual*/ void draw(); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL postBuild(); + /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL postBuild(); - // MANIPULATORS - void setBalance(S32 balance); - void debitBalance(S32 debit); - void creditBalance(S32 credit); + // MANIPULATORS + void setBalance(S32 balance); + void debitBalance(S32 debit); + void creditBalance(S32 credit); - // Request the latest currency balance from the server - static void sendMoneyBalanceRequest(); + // Request the latest currency balance from the server + static void sendMoneyBalanceRequest(); - void setHealth(S32 percent); + void setHealth(S32 percent); - void setLandCredit(S32 credit); - void setLandCommitted(S32 committed); + void setLandCredit(S32 credit); + void setLandCommitted(S32 committed); - void refresh(); - void setVisibleForMouselook(bool visible); - // some elements should hide in mouselook + void refresh(); + void setVisibleForMouselook(bool visible); + // some elements should hide in mouselook - // ACCESSORS - S32 getBalance() const; - S32 getHealth() const; + // ACCESSORS + S32 getBalance() const; + S32 getHealth() const; - BOOL isUserTiered() const; - S32 getSquareMetersCredit() const; - S32 getSquareMetersCommitted() const; - S32 getSquareMetersLeft() const; + BOOL isUserTiered() const; + S32 getSquareMetersCredit() const; + S32 getSquareMetersCommitted() const; + S32 getSquareMetersLeft() const; - LLPanelNearByMedia* getNearbyMediaPanel() { return mPanelNearByMedia; } + LLPanelNearByMedia* getNearbyMediaPanel() { return mPanelNearByMedia; } private: - - void onClickBuyCurrency(); - void onVolumeChanged(const LLSD& newvalue); + + void onClickBuyCurrency(); + void onVolumeChanged(const LLSD& newvalue); - void onMouseEnterPresetsCamera(); - void onMouseEnterPresets(); - void onMouseEnterVolume(); - void onMouseEnterNearbyMedia(); - void onClickScreen(S32 x, S32 y); + void onMouseEnterPresetsCamera(); + void onMouseEnterPresets(); + void onMouseEnterVolume(); + void onMouseEnterNearbyMedia(); + void onClickScreen(S32 x, S32 y); - static void onClickMediaToggle(void* data); - static void onClickBalance(void* data); + static void onClickMediaToggle(void* data); + static void onClickBalance(void* data); private: - LLTextBox *mTextTime; - - LLStatGraph *mSGBandwidth; - LLStatGraph *mSGPacketLoss; - - LLIconCtrl *mIconPresetsCamera; - LLIconCtrl *mIconPresetsGraphic; - LLButton *mBtnVolume; - LLTextBox *mBoxBalance; - LLButton *mMediaToggle; - LLFrameTimer mClockUpdateTimer; - - S32 mBalance; - S32 mHealth; - S32 mSquareMetersCredit; - S32 mSquareMetersCommitted; - LLFrameTimer* mBalanceTimer; - LLFrameTimer* mHealthTimer; - LLPanelPresetsCameraPulldown* mPanelPresetsCameraPulldown; - LLPanelPresetsPulldown* mPanelPresetsPulldown; - LLPanelVolumePulldown* mPanelVolumePulldown; - LLPanelNearByMedia* mPanelNearByMedia; + LLTextBox *mTextTime; + + LLStatGraph *mSGBandwidth; + LLStatGraph *mSGPacketLoss; + + LLIconCtrl *mIconPresetsCamera; + LLIconCtrl *mIconPresetsGraphic; + LLButton *mBtnVolume; + LLTextBox *mBoxBalance; + LLButton *mMediaToggle; + LLFrameTimer mClockUpdateTimer; + + S32 mBalance; + S32 mHealth; + S32 mSquareMetersCredit; + S32 mSquareMetersCommitted; + LLFrameTimer* mBalanceTimer; + LLFrameTimer* mHealthTimer; + LLPanelPresetsCameraPulldown* mPanelPresetsCameraPulldown; + LLPanelPresetsPulldown* mPanelPresetsPulldown; + LLPanelVolumePulldown* mPanelVolumePulldown; + LLPanelNearByMedia* mPanelNearByMedia; }; // *HACK: Status bar owns your cached money balance. JC diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 968472fe4c..5237986cd6 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -166,216 +166,216 @@ class LLFloaterOpenHandler : public LLCommandHandler { public: - // requires trusted browser to trigger - LLFloaterOpenHandler() : LLCommandHandler("openfloater", UNTRUSTED_THROTTLE) { } + // requires trusted browser to trigger + LLFloaterOpenHandler() : LLCommandHandler("openfloater", UNTRUSTED_THROTTLE) { } - bool handle(const LLSD& params, const LLSD& query_map, - LLMediaCtrl* web) - { - if (params.size() != 1) - { - return false; - } + bool handle(const LLSD& params, const LLSD& query_map, + LLMediaCtrl* web) + { + if (params.size() != 1) + { + return false; + } - const std::string floater_name = LLURI::unescape(params[0].asString()); - LLFloaterReg::showInstance(floater_name); + const std::string floater_name = LLURI::unescape(params[0].asString()); + LLFloaterReg::showInstance(floater_name); - return true; - } + return true; + } }; LLFloaterOpenHandler gFloaterOpenHandler; void LLViewerFloaterReg::registerFloaters() { - // *NOTE: Please keep these alphabetized for easier merges + // *NOTE: Please keep these alphabetized for easier merges - LLFloaterAboutUtil::registerFloater(); - LLFloaterReg::add("block_timers", "floater_fast_timers.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("appearance", "floater_my_appearance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("associate_listing", "floater_associate_listing.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("avatar", "floater_avatar.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("avatar_render_settings", "floater_avatar_render_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("avatar_textures", "floater_avatar_textures.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterAboutUtil::registerFloater(); + LLFloaterReg::add("block_timers", "floater_fast_timers.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("appearance", "floater_my_appearance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("associate_listing", "floater_associate_listing.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("avatar", "floater_avatar.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("avatar_render_settings", "floater_avatar_render_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("avatar_textures", "floater_avatar_textures.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("beacons", "floater_beacons.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("bulk_perms", "floater_bulk_perms.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("buy_currency", "floater_buy_currency.xml", &LLFloaterBuyCurrency::buildFloater); - LLFloaterReg::add("buy_currency_html", "floater_buy_currency_html.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("buy_land", "floater_buy_land.xml", &LLFloaterBuyLand::buildFloater); - LLFloaterReg::add("buy_object", "floater_buy_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("buy_object_contents", "floater_buy_contents.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("build", "floater_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("build_options", "floater_build_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("bumps", "floater_bumps.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("beacons", "floater_beacons.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("bulk_perms", "floater_bulk_perms.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("buy_currency", "floater_buy_currency.xml", &LLFloaterBuyCurrency::buildFloater); + LLFloaterReg::add("buy_currency_html", "floater_buy_currency_html.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("buy_land", "floater_buy_land.xml", &LLFloaterBuyLand::buildFloater); + LLFloaterReg::add("buy_object", "floater_buy_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("buy_object_contents", "floater_buy_contents.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("build", "floater_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("build_options", "floater_build_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("bumps", "floater_bumps.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("camera", "floater_camera.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("chat_voice", "floater_voice_chat_volume.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("nearby_chat", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterIMNearbyChat::buildFloater); - LLFloaterReg::add("compile_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("conversation", "floater_conversation_log.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("camera", "floater_camera.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("chat_voice", "floater_voice_chat_volume.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("nearby_chat", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterIMNearbyChat::buildFloater); + LLFloaterReg::add("compile_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("conversation", "floater_conversation_log.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("delete_pref_preset", "floater_delete_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("destinations", "floater_destinations.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("delete_pref_preset", "floater_delete_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("destinations", "floater_destinations.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_post_process", "floater_post_process.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_settings", "floater_environment_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_delete_preset", "floater_delete_env_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_edit_sky", "floater_edit_sky_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_edit_water", "floater_edit_water_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_edit_day_cycle", "floater_edit_day_cycle.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("env_post_process", "floater_post_process.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("env_settings", "floater_environment_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("env_delete_preset", "floater_delete_env_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("env_edit_sky", "floater_edit_sky_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("env_edit_water", "floater_edit_water_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("env_edit_day_cycle", "floater_edit_day_cycle.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("event", "floater_event.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("experiences", "floater_experiences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("experience_profile", "floater_experienceprofile.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("experience_search", "floater_experience_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("experience_profile", "floater_experienceprofile.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("experience_search", "floater_experience_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("font_test", "floater_font_test.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("font_test", "floater_font_test.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("gestures", "floater_gesture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("god_tools", "floater_god_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("grid_status", "floater_grid_status.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("group_picker", "floater_choose_group.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("gestures", "floater_gesture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("god_tools", "floater_god_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("grid_status", "floater_grid_status.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("group_picker", "floater_choose_group.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("help_browser", "floater_help_browser.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("edit_hover_height", "floater_edit_hover_height.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("hud", "floater_hud.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("help_browser", "floater_help_browser.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("edit_hover_height", "floater_edit_hover_height.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("hud", "floater_hud.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("impanel", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("im_container", "floater_im_container.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("im_well_window", "floater_sys_well.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("incoming_call", "floater_incoming_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("inventory", "floater_my_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("inspect", "floater_inspect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("item_properties", "floater_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLInspectAvatarUtil::registerFloater(); - LLInspectGroupUtil::registerFloater(); - LLInspectObjectUtil::registerFloater(); - LLInspectRemoteObjectUtil::registerFloater(); - LLFloaterVoiceVolumeUtil::registerFloater(); - LLNotificationsUI::registerFloater(); - - LLFloaterReg::add("lagmeter", "floater_lagmeter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("land_holdings", "floater_land_holdings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("linkreplace", "floater_linkreplace.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("load_pref_preset", "floater_load_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - - LLFloaterReg::add("mem_leaking", "floater_mem_leaking.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("impanel", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("im_container", "floater_im_container.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("im_well_window", "floater_sys_well.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("incoming_call", "floater_incoming_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("inventory", "floater_my_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("inspect", "floater_inspect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("item_properties", "floater_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLInspectAvatarUtil::registerFloater(); + LLInspectGroupUtil::registerFloater(); + LLInspectObjectUtil::registerFloater(); + LLInspectRemoteObjectUtil::registerFloater(); + LLFloaterVoiceVolumeUtil::registerFloater(); + LLNotificationsUI::registerFloater(); + + LLFloaterReg::add("lagmeter", "floater_lagmeter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("land_holdings", "floater_land_holdings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("linkreplace", "floater_linkreplace.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("load_pref_preset", "floater_load_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + LLFloaterReg::add("mem_leaking", "floater_mem_leaking.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - if(gSavedSettings.getBOOL("TextureFetchDebuggerEnabled")) - { - LLFloaterReg::add("tex_fetch_debugger", "floater_texture_fetch_debugger.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - } - LLFloaterReg::add("media_settings", "floater_media_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("marketplace_listings", "floater_marketplace_listings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("marketplace_validation", "floater_marketplace_validation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("message_critical", "floater_critical.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("message_tos", "floater_tos.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("moveview", "floater_moveview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("mute_object_by_name", "floater_mute_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("mini_map", "floater_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + if(gSavedSettings.getBOOL("TextureFetchDebuggerEnabled")) + { + LLFloaterReg::add("tex_fetch_debugger", "floater_texture_fetch_debugger.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + } + LLFloaterReg::add("media_settings", "floater_media_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("marketplace_listings", "floater_marketplace_listings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("marketplace_validation", "floater_marketplace_validation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("message_critical", "floater_critical.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("message_tos", "floater_tos.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("moveview", "floater_moveview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("mute_object_by_name", "floater_mute_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("mini_map", "floater_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("notifications_console", "floater_notifications_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - - LLFloaterReg::add("notification_well_window", "floater_notifications_tabbed.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("notifications_console", "floater_notifications_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + LLFloaterReg::add("notification_well_window", "floater_notifications_tabbed.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("object_weights", "floater_object_weights.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("openobject", "floater_openobject.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("outgoing_call", "floater_outgoing_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("outfit_photo_preview", "floater_outfit_photo_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterPayUtil::registerFloater(); + LLFloaterReg::add("object_weights", "floater_object_weights.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("openobject", "floater_openobject.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("outgoing_call", "floater_outgoing_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("outfit_photo_preview", "floater_outfit_photo_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterPayUtil::registerFloater(); - LLFloaterReg::add("pathfinding_characters", "floater_pathfinding_characters.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("pathfinding_linksets", "floater_pathfinding_linksets.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("pathfinding_console", "floater_pathfinding_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("people", "floater_people.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("perms_default", "floater_perms_default.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - 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_view_advanced", "floater_preferences_view_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); - LLFloaterReg::add("prefs_spellchecker", "floater_spellcheck.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("prefs_autoreplace", "floater_autoreplace.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("picks", "floater_picks.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("pref_joystick", "floater_joystick.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("preview_anim", "floater_preview_animation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); - LLFloaterReg::add("preview_conversation", "floater_conversation_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("preview_gesture", "floater_preview_gesture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); - LLFloaterReg::add("preview_notecard", "floater_preview_notecard.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); - LLFloaterReg::add("preview_script", "floater_script_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); - LLFloaterReg::add("preview_scriptedit", "floater_live_lsleditor.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); - LLFloaterReg::add("preview_sound", "floater_preview_sound.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); - LLFloaterReg::add("preview_texture", "floater_preview_texture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); - LLFloaterReg::add("preview_trash", "floater_preview_trash.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("properties", "floater_inventory_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("publish_classified", "floater_publish_classified.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("save_pref_preset", "floater_save_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("script_colors", "floater_script_ed_prefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("pathfinding_characters", "floater_pathfinding_characters.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("pathfinding_linksets", "floater_pathfinding_linksets.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("pathfinding_console", "floater_pathfinding_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("people", "floater_people.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("perms_default", "floater_perms_default.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + 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_view_advanced", "floater_preferences_view_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); + LLFloaterReg::add("prefs_spellchecker", "floater_spellcheck.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("prefs_autoreplace", "floater_autoreplace.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("picks", "floater_picks.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("pref_joystick", "floater_joystick.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("preview_anim", "floater_preview_animation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_conversation", "floater_conversation_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("preview_gesture", "floater_preview_gesture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_notecard", "floater_preview_notecard.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_script", "floater_script_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_scriptedit", "floater_live_lsleditor.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_sound", "floater_preview_sound.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_texture", "floater_preview_texture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_trash", "floater_preview_trash.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("properties", "floater_inventory_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("publish_classified", "floater_publish_classified.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("save_pref_preset", "floater_save_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("script_colors", "floater_script_ed_prefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("telehubs", "floater_telehub.xml",&LLFloaterReg::build); - LLFloaterReg::add("test_inspectors", "floater_test_inspectors.xml", &LLFloaterReg::build); - //LLFloaterReg::add("test_list_view", "floater_test_list_view.xml",&LLFloaterReg::build); - LLFloaterReg::add("test_textbox", "floater_test_textbox.xml", &LLFloaterReg::build); - LLFloaterReg::add("test_text_editor", "floater_test_text_editor.xml", &LLFloaterReg::build); - LLFloaterReg::add("test_widgets", "floater_test_widgets.xml", &LLFloaterReg::build); - LLFloaterReg::add("top_objects", "floater_top_objects.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("toybox", "floater_toybox.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - - LLFloaterReg::add("reporter", "floater_report_abuse.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("reset_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("region_debug_console", "floater_region_debug_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("region_info", "floater_region_info.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("region_restarting", "floater_region_restarting.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - - LLFloaterReg::add("script_debug", "floater_script_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("script_debug_output", "floater_script_debug_panel.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("script_floater", "floater_script.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("script_limits", "floater_script_limits.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("sell_land", "floater_sell_land.xml", &LLFloaterSellLand::buildFloater); - LLFloaterReg::add("settings_debug", "floater_settings_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("sound_devices", "floater_sound_devices.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("stats", "floater_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("scene_load_stats", "floater_scene_load_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("telehubs", "floater_telehub.xml",&LLFloaterReg::build); + LLFloaterReg::add("test_inspectors", "floater_test_inspectors.xml", &LLFloaterReg::build); + //LLFloaterReg::add("test_list_view", "floater_test_list_view.xml",&LLFloaterReg::build); + LLFloaterReg::add("test_textbox", "floater_test_textbox.xml", &LLFloaterReg::build); + LLFloaterReg::add("test_text_editor", "floater_test_text_editor.xml", &LLFloaterReg::build); + LLFloaterReg::add("test_widgets", "floater_test_widgets.xml", &LLFloaterReg::build); + LLFloaterReg::add("top_objects", "floater_top_objects.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("toybox", "floater_toybox.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + LLFloaterReg::add("reporter", "floater_report_abuse.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("reset_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("region_debug_console", "floater_region_debug_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("region_info", "floater_region_info.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("region_restarting", "floater_region_restarting.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + LLFloaterReg::add("script_debug", "floater_script_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("script_debug_output", "floater_script_debug_panel.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("script_floater", "floater_script.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("script_limits", "floater_script_limits.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("sell_land", "floater_sell_land.xml", &LLFloaterSellLand::buildFloater); + LLFloaterReg::add("settings_debug", "floater_settings_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("sound_devices", "floater_sound_devices.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("stats", "floater_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("scene_load_stats", "floater_scene_load_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("outfit_snapshot", "floater_outfit_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("my_profile", "floater_my_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create); - LLFloaterReg::add("profile", "floater_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create); - LLFloaterReg::add("how_to", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); + LLFloaterReg::add("my_profile", "floater_my_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create); + LLFloaterReg::add("profile", "floater_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create); + LLFloaterReg::add("how_to", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); - LLFloaterReg::add("fbc_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); - LLFloaterReg::add("flickr_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); - LLFloaterReg::add("twitter_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); - - LLFloaterReg::add("facebook", "floater_facebook.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("flickr", "floater_flickr.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("twitter", "floater_twitter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("big_preview", "floater_big_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - - LLFloaterUIPreviewUtil::registerFloater(); - LLFloaterReg::add("upload_anim_bvh", "floater_animation_bvh_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); - LLFloaterReg::add("upload_anim_anim", "floater_animation_anim_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); - LLFloaterReg::add("upload_image", "floater_image_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); - LLFloaterReg::add("upload_model", "floater_model_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); - LLFloaterReg::add("upload_script", "floater_script_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); - LLFloaterReg::add("upload_sound", "floater_sound_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); + LLFloaterReg::add("fbc_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); + LLFloaterReg::add("flickr_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); + LLFloaterReg::add("twitter_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); + + LLFloaterReg::add("facebook", "floater_facebook.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("flickr", "floater_flickr.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("twitter", "floater_twitter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("big_preview", "floater_big_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + LLFloaterUIPreviewUtil::registerFloater(); + LLFloaterReg::add("upload_anim_bvh", "floater_animation_bvh_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); + LLFloaterReg::add("upload_anim_anim", "floater_animation_anim_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); + LLFloaterReg::add("upload_image", "floater_image_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); + LLFloaterReg::add("upload_model", "floater_model_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); + LLFloaterReg::add("upload_script", "floater_script_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); + LLFloaterReg::add("upload_sound", "floater_sound_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); - LLFloaterReg::add("voice_effect", "floater_voice_effect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("voice_effect", "floater_voice_effect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("web_content", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); - LLFloaterReg::add("whitelist_entry", "floater_whitelist_entry.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("window_size", "floater_window_size.xml", &LLFloaterReg::build); - LLFloaterReg::add("world_map", "floater_world_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("web_content", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); + LLFloaterReg::add("whitelist_entry", "floater_whitelist_entry.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("window_size", "floater_window_size.xml", &LLFloaterReg::build); + LLFloaterReg::add("world_map", "floater_world_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - // *NOTE: Please keep these alphabetized for easier merges - - LLFloaterReg::registerControlVariables(); // Make sure visibility and rect controls get preserved when saving + // *NOTE: Please keep these alphabetized for easier merges + + LLFloaterReg::registerControlVariables(); // Make sure visibility and rect controls get preserved when saving } -- cgit v1.2.3 From bb585d95b5955effb813621942e10429ea97df1f Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 8 May 2019 11:59:20 -0700 Subject: Fix merge by putting back loadFromFilename. --- indra/newview/llfloaterpreference.cpp | 46 +++++++++++++++++++++++++++++++++++ indra/newview/llfloaterpreference.h | 1 + 2 files changed, 47 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 927124f333..28e77deec2 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -849,6 +849,13 @@ void LLFloaterPreference::onOpen(const LLSD& key) save_camera_btn->setEnabled(started); delete_camera_btn->setEnabled(started); } + + collectSearchableItems(); + if (!mFilterEdit->getText().empty()) + { + mFilterEdit->setText(LLStringExplicit("")); + onUpdateFilterTerm(true); + } } void LLFloaterPreference::onVertexShaderEnable() @@ -2029,6 +2036,45 @@ void LLFloaterPreference::updateMaxComplexity() getChild("IndirectMaxComplexityText")); } +bool LLFloaterPreference::loadFromFilename(const std::string& filename, std::map &label_map) +{ + LLXMLNodePtr root; + + if (!LLXMLNode::parseFile(filename, root, NULL)) + { + LL_WARNS() << "Unable to parse file " << filename << LL_ENDL; + return false; + } + + if (!root->hasName("labels")) + { + LL_WARNS() << filename << " is not a valid definition file" << LL_ENDL; + return false; + } + + LabelTable params; + LLXUIParser parser; + parser.readXUI(root, params, filename); + + if (params.validateBlock()) + { + for (LLInitParam::ParamIterator::const_iterator it = params.labels.begin(); + it != params.labels.end(); + ++it) + { + LabelDef label_entry = *it; + label_map[label_entry.name] = label_entry.value; + } + } + else + { + LL_WARNS() << filename << " failed to load" << LL_ENDL; + return false; + } + + return true; +} + void LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity() { // Called when the IndirectMaxComplexity control changes diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 54f985193a..fd6ce0239f 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -199,6 +199,7 @@ private: void onDeleteTranscriptsResponse(const LLSD& notification, const LLSD& response); void updateDeleteTranscriptsButton(); void updateMaxComplexity(); + static bool loadFromFilename(const std::string& filename, std::map &label_map); static std::string sSkin; notifications_map mNotificationOptions; -- cgit v1.2.3 From 36cfb37ebeaa6fa6ac6ff8b706ffdabd933d56bd Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 8 May 2019 16:59:10 -0700 Subject: Put back new panel decl lost in merge. --- indra/newview/llfloaterpreference.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index fd6ce0239f..204916de86 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -272,6 +272,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: @@ -289,7 +301,6 @@ protected: bool hasDirtyChilds(); private: - void onPresetsListChange(); LOG_CLASS(LLPanelPreferenceGraphics); }; -- cgit v1.2.3 From 915587de4501a82487d3c355c247029f6a157341 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Tue, 29 Oct 2019 13:27:21 +0200 Subject: Fix crash on startup and restore missing settings --- indra/newview/app_settings/settings.xml | 22 ++++++++++++++++++++++ indra/newview/llpresetsmanager.cpp | 21 +++++++++++---------- 2 files changed, 33 insertions(+), 10 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 49601ae98f..a02cccb613 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16299,6 +16299,28 @@ 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 + + CefVerboseLog Comment diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index c1702b4132..17fefbe6b1 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -262,8 +262,6 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n } else if(PRESETS_CAMERA == subdirectory) { - gSavedSettings.setString("PresetGraphicActive", name); - name_list.clear(); getControlNames(name_list); name_list.push_back("PresetCameraActive"); @@ -292,14 +290,17 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n { 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; + if (ctrl) + { + 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; + } } } -- cgit v1.2.3 From c75d443c8359f0bceee2df2adc0a67b2890922ea Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Mon, 4 Nov 2019 20:35:34 +0200 Subject: SL-12186 WIP Updating UI for camera controls, including presets --- indra/newview/app_settings/camera/Front.xml | 8 +- indra/newview/app_settings/camera/Pennys_Gamer.xml | 115 -------- indra/newview/app_settings/camera/Side.xml | 8 +- indra/newview/app_settings/settings.xml | 30 +++ indra/newview/llagentcamera.cpp | 17 ++ indra/newview/llagentcamera.h | 9 +- indra/newview/llfloatercamera.cpp | 118 ++++----- indra/newview/llfloatercamera.h | 10 +- indra/newview/llfloaterpreferenceviewadvanced.cpp | 40 +-- indra/newview/llfloaterpreferenceviewadvanced.h | 7 - indra/newview/llfloatersaveprefpreset.cpp | 80 ++++-- indra/newview/llfloatersaveprefpreset.h | 9 +- indra/newview/llpresetsmanager.cpp | 96 ++++--- indra/newview/llpresetsmanager.h | 4 + .../skins/default/xui/en/floater_camera.xml | 292 +++++++++------------ .../xui/en/floater_preferences_view_advanced.xml | 28 +- .../default/xui/en/floater_save_pref_preset.xml | 60 +++-- .../newview/skins/default/xui/en/notifications.xml | 12 + .../default/xui/en/widgets/panel_camera_item.xml | 4 +- 19 files changed, 443 insertions(+), 504 deletions(-) delete mode 100644 indra/newview/app_settings/camera/Pennys_Gamer.xml (limited to 'indra/newview') diff --git a/indra/newview/app_settings/camera/Front.xml b/indra/newview/app_settings/camera/Front.xml index d5ead526b7..a4b5ace33c 100644 --- a/indra/newview/app_settings/camera/Front.xml +++ b/indra/newview/app_settings/camera/Front.xml @@ -37,10 +37,10 @@ 6 - CameraOffsetRearView + CameraOffsetFrontView Comment - Initial camera offset from avatar in Rear View + Initial camera offset from avatar in Front View Persist 1 Type @@ -74,10 +74,10 @@ Value 0 - FocusOffsetRearView + FocusOffsetFrontView Comment - Initial focus point offset relative to avatar for the camera preset Rear View (x-axis is forward) + Initial focus point offset relative to avatar for the camera preset Front View (x-axis is forward) Persist 1 Type 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/Side.xml b/indra/newview/app_settings/camera/Side.xml index 4cd5f2f5a4..677fd47e20 100644 --- a/indra/newview/app_settings/camera/Side.xml +++ b/indra/newview/app_settings/camera/Side.xml @@ -37,10 +37,10 @@ 6 - CameraOffsetRearView + CameraOffsetGroupView Comment - Initial camera offset from avatar in Rear View + Initial camera offset from avatar in Side View Persist 1 Type @@ -74,10 +74,10 @@ Value 0 - FocusOffsetRearView + FocusOffsetGroupView Comment - Initial focus point offset relative to avatar for the camera preset Rear View (x-axis is forward) + Initial focus point offset relative to avatar for the camera preset Side View (x-axis is forward) Persist 1 Type diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index a02cccb613..f44185340a 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1499,6 +1499,21 @@ 0.5 + CameraOffsetCustomPreset + + Comment + Initial camera offset from avatar for the custom camera preset + Persist + 1 + Type + Vector3 + Value + + -3.0 + 0.0 + 0.75 + + CameraOffsetScale Comment @@ -4356,6 +4371,21 @@ 1.0 + FocusOffsetCustomPreset + + Comment + Initial focus point offset relative to avatar for the custom camera preset (x-axis is forward) + Persist + 1 + Type + Vector3D + Value + + 1.0 + 0.0 + 1.0 + + FocusPosOnLogout Comment diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index bbe1354fc3..3e56c1dd71 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -210,10 +210,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_CUSTOM] = gSavedSettings.getControl("CameraOffsetCustomPreset"); 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_CUSTOM] = gSavedSettings.getControl("FocusOffsetCustomPreset"); mCameraCollidePlane.clearVec(); mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"); @@ -1936,6 +1938,21 @@ LLVector3 LLAgentCamera::getCameraOffsetInitial() return convert_from_llsd(mCameraOffsetInitial[mCameraPreset]->get(), TYPE_VEC3, ""); } +LLVector3d LLAgentCamera::getFocusOffsetInitial() +{ + return convert_from_llsd(mFocusOffsetInitial[mCameraPreset]->get(), TYPE_VEC3D, ""); +} + +std::string LLAgentCamera::getCameraOffsetCtrlName() +{ + return mCameraOffsetInitial[mCameraPreset]->getName(); +} + +std::string LLAgentCamera::getFocusOffsetCtrlName() +{ + return mFocusOffsetInitial[mCameraPreset]->getName(); +} + F32 LLAgentCamera::getCameraMaxZoomDistance() { // Ignore "DisableCameraConstraints", we don't want to be out of draw range when we focus onto objects or avatars diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 4575c1501a..294e81c2e1 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -59,7 +59,7 @@ enum ECameraPreset CAMERA_PRESET_GROUP_VIEW, /** Current view when a preset is saved */ - CAMERA_PRESET_CUSTOM0 + CAMERA_PRESET_CUSTOM }; //------------------------------------------------------------------------ @@ -112,9 +112,14 @@ private: //-------------------------------------------------------------------- public: void switchCameraPreset(ECameraPreset preset); -private: /** Determines default camera offset depending on the current camera preset */ LLVector3 getCameraOffsetInitial(); + /** Determines default focus offset depending on the current camera preset */ + LLVector3d getFocusOffsetInitial(); + + std::string getCameraOffsetCtrlName(); + std::string getFocusOffsetCtrlName(); +private: /** Determines maximum camera distance from target for mouselook, opposite to LAND_MIN_ZOOM */ F32 getCameraMaxZoomDistance(); diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index c12ccb386e..933e758653 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -34,6 +34,7 @@ // Viewer includes #include "llagent.h" #include "llagentcamera.h" +#include "llpresetsmanager.h" #include "lljoystickbutton.h" #include "llviewercontrol.h" #include "llviewercamera.h" @@ -53,7 +54,6 @@ const F32 ORBIT_NUDGE_RATE = 0.05f; // fraction of normal speed #define ORBIT "cam_rotate_stick" #define PAN "cam_track_stick" #define ZOOM "zoom" -#define PRESETS "preset_views_list" #define CONTROLS "controls" bool LLFloaterCamera::sFreeCamera = false; @@ -270,13 +270,7 @@ void LLFloaterCamera::onAvatarEditingAppearance(bool editing) void LLFloaterCamera::handleAvatarEditingAppearance(bool editing) { - //camera presets (rear, front, etc.) - getChildView("preset_views_list")->setEnabled(!editing); - getChildView("presets_btn")->setEnabled(!editing); - //camera modes (object view, mouselook view) - getChildView("camera_modes_list")->setEnabled(!editing); - getChildView("avatarview_btn")->setEnabled(!editing); } void LLFloaterCamera::update() @@ -323,6 +317,8 @@ void LLFloaterCamera::onOpen(const LLSD& key) else toPrevMode(); mClosed = FALSE; + + populatePresetCombo(); } void LLFloaterCamera::onClose(bool app_quitting) @@ -354,7 +350,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)); + mCommitCallbackRegistrar.add("CameraPresets.Save", boost::bind(&LLFloaterCamera::onSavePreset, this)); } // virtual @@ -366,9 +362,11 @@ BOOL LLFloaterCamera::postBuild() mZoom = findChild(ZOOM); mTrack = getChild(PAN); - assignButton2Mode(CAMERA_CTRL_MODE_MODES, "avatarview_btn"); - assignButton2Mode(CAMERA_CTRL_MODE_PAN, "pan_btn"); - assignButton2Mode(CAMERA_CTRL_MODE_PRESETS, "presets_btn"); + getChild("precise_ctrs_label")->setShowCursorHand(false); + getChild("precise_ctrs_label")->setSoundFlags(LLView::MOUSE_UP); + getChild("precise_ctrs_label")->setClickedCallback(boost::bind(&LLFloaterReg::showInstance, "prefs_view_advanced", LLSD(), FALSE)); + getChild("preset_combo")->setCommitCallback(boost::bind(&LLFloaterCamera::onCustomPresetSelected, this)); + LLPresetsManager::getInstance()->setPresetListChangeCameraCallback(boost::bind(&LLFloaterCamera::populatePresetCombo, this)); update(); @@ -387,24 +385,6 @@ F32 LLFloaterCamera::getCurrentTransparency() } -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("view"); - 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 @@ -473,13 +453,6 @@ void LLFloaterCamera::switchMode(ECameraControlMode mode) switch (mode) { - case CAMERA_CTRL_MODE_MODES: - if(sFreeCamera) - { - switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); - } - break; - case CAMERA_CTRL_MODE_PAN: sFreeCamera = false; clear_camera_tool(); @@ -503,36 +476,8 @@ void LLFloaterCamera::switchMode(ECameraControlMode mode) } } - -void LLFloaterCamera::onClickBtn(ECameraControlMode mode) -{ - // check for a click on active button - if (mCurrMode == mode) mMode2Button[mode]->setToggleState(TRUE); - - switchMode(mode); - -} - -void LLFloaterCamera::assignButton2Mode(ECameraControlMode mode, const std::string& button_name) -{ - LLButton* button = getChild(button_name); - - button->setClickedCallback(boost::bind(&LLFloaterCamera::onClickBtn, this, mode)); - mMode2Button[mode] = button; -} - void LLFloaterCamera::updateState() { - getChildView(ZOOM)->setVisible(CAMERA_CTRL_MODE_PAN == mCurrMode); - - bool show_presets = (CAMERA_CTRL_MODE_PRESETS == mCurrMode) || (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode - && CAMERA_CTRL_MODE_PRESETS == mPrevMode); - getChildView(PRESETS)->setVisible(show_presets); - - bool show_camera_modes = CAMERA_CTRL_MODE_MODES == mCurrMode || (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode - && CAMERA_CTRL_MODE_MODES == mPrevMode); - getChildView("camera_modes_list")->setVisible( show_camera_modes); - updateItemsSelection(); if (CAMERA_CTRL_MODE_FREE_CAMERA == mCurrMode) @@ -552,11 +497,11 @@ void LLFloaterCamera::updateItemsSelection() { ECameraPreset preset = (ECameraPreset) gSavedSettings.getU32("CameraPreset"); LLSD argument; - argument["selected"] = preset == CAMERA_PRESET_REAR_VIEW; + argument["selected"] = (preset == CAMERA_PRESET_REAR_VIEW) && !sFreeCamera; getChild("rear_view")->setValue(argument); - argument["selected"] = preset == CAMERA_PRESET_GROUP_VIEW; + argument["selected"] = (preset == CAMERA_PRESET_GROUP_VIEW) && !sFreeCamera; getChild("group_view")->setValue(argument); - argument["selected"] = preset == CAMERA_PRESET_FRONT_VIEW; + argument["selected"] = (preset == CAMERA_PRESET_FRONT_VIEW) && !sFreeCamera; getChild("front_view")->setValue(argument); argument["selected"] = gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK; getChild("mouselook_view")->setValue(argument); @@ -580,6 +525,9 @@ void LLFloaterCamera::onClickCameraItem(const LLSD& param) } else { + LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance(); + if (camera_floater) + camera_floater->switchMode(CAMERA_CTRL_MODE_PAN); switchToPreset(name); } @@ -599,14 +547,17 @@ void LLFloaterCamera::switchToPreset(const std::string& name) if ("rear_view" == name) { gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); + LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_REAR); } else if ("group_view" == name) { gAgentCamera.switchCameraPreset(CAMERA_PRESET_GROUP_VIEW); + LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_SIDE); } else if ("front_view" == name) { gAgentCamera.switchCameraPreset(CAMERA_PRESET_FRONT_VIEW); + LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_FRONT); } } @@ -617,3 +568,36 @@ void LLFloaterCamera::fromFreeToPresets() switchMode(CAMERA_CTRL_MODE_PRESETS); } } + +void LLFloaterCamera::populatePresetCombo() +{ + LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, getChild("preset_combo"), EDefaultOptions::DEFAULT_VIEWS_HIDE); + if ((ECameraPreset)gSavedSettings.getU32("CameraPreset") == CAMERA_PRESET_CUSTOM) + { + getChild("preset_combo")->selectByValue(gSavedSettings.getString("PresetCameraActive")); + } + else + { + std::string inactive_text = getString("inactive_combo_text"); + getChild("preset_combo")->setLabel(inactive_text);// add(inactive_text, inactive_text, ADD_TOP); + } +} + +void LLFloaterCamera::onSavePreset() +{ + LLFloaterReg::hideInstance("delete_pref_preset", PRESETS_CAMERA); + LLFloaterReg::hideInstance("load_pref_preset", PRESETS_CAMERA); + LLFloaterReg::showInstance("save_pref_preset", PRESETS_CAMERA); +} + +void LLFloaterCamera::onCustomPresetSelected() +{ + std::string selected_preset = getChild("preset_combo")->getSelectedItemLabel(); + if (gSavedSettings.getString("PresetCameraActive") != selected_preset && getString("inactive_combo_text") != selected_preset) + { + gAgentCamera.switchCameraPreset(CAMERA_PRESET_CUSTOM); + updateItemsSelection(); + fromFreeToPresets(); + LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, selected_preset); + } +} diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index 481e9aec1b..b1e0c83ce0 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -39,7 +39,6 @@ class LLPanelCameraZoom; enum ECameraControlMode { - CAMERA_CTRL_MODE_MODES, CAMERA_CTRL_MODE_PAN, CAMERA_CTRL_MODE_FREE_CAMERA, CAMERA_CTRL_MODE_PRESETS @@ -50,7 +49,6 @@ class LLFloaterCamera : public LLFloater friend class LLFloaterReg; public: - /* whether in free camera mode */ static bool inFreeCameraMode(); /* callback for camera items selection changing */ @@ -77,6 +75,11 @@ public: virtual void onOpen(const LLSD& key); virtual void onClose(bool app_quitting); + void onSavePreset(); + void onCustomPresetSelected(); + + void populatePresetCombo(); + LLJoystickCameraRotate* mRotate; LLPanelCameraZoom* mZoom; LLJoystickCameraTrack* mTrack; @@ -112,9 +115,6 @@ private: /* update camera modes items selection and camera preset items selection according to the currently selected preset */ void updateItemsSelection(); - void onClickBtn(ECameraControlMode mode); - void assignButton2Mode(ECameraControlMode mode, const std::string& button_name); - // fills flatlist with items from given panel void fillFlatlistFromPanel (LLFlatListView* list, LLPanel* panel); diff --git a/indra/newview/llfloaterpreferenceviewadvanced.cpp b/indra/newview/llfloaterpreferenceviewadvanced.cpp index 791ff79d87..57484d0d0a 100644 --- a/indra/newview/llfloaterpreferenceviewadvanced.cpp +++ b/indra/newview/llfloaterpreferenceviewadvanced.cpp @@ -25,6 +25,7 @@ */ #include "llviewerprecompiledheaders.h" +#include "llagentcamera.h" #include "llfloaterpreferenceviewadvanced.h" #include "llfloater.h" #include "llfloaterreg.h" @@ -36,40 +37,12 @@ LLFloaterPreferenceViewAdvanced::LLFloaterPreferenceViewAdvanced(const LLSD& key) : LLFloater(key) { - mCommitCallbackRegistrar.add("Cancel", boost::bind(&LLFloaterPreferenceViewAdvanced::onClickCancel, this)); mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterPreferenceViewAdvanced::onCommitSettings, this)); - mCommitCallbackRegistrar.add("Ok", boost::bind(&LLFloaterPreferenceViewAdvanced::onClickOk, this)); - } LLFloaterPreferenceViewAdvanced::~LLFloaterPreferenceViewAdvanced() {} -void LLFloaterPreferenceViewAdvanced::onClickOk() -{ - closeFloater(); -} - -void LLFloaterPreferenceViewAdvanced::onClickCancel() -{ - gSavedSettings.setVector3("CameraOffsetRearView", mCameraSaved); - gSavedSettings.setVector3d("FocusOffsetRearView", mFocusSaved); - - updateCameraControl(mCameraSaved); - updateFocusControl(mFocusSaved); -} - -BOOL LLFloaterPreferenceViewAdvanced::postBuild() -{ - mCameraSaved = gSavedSettings.getVector3("CameraOffsetRearView"); - mFocusSaved = gSavedSettings.getVector3d("FocusOffsetRearView"); - - updateCameraControl(mCameraSaved); - updateFocusControl(mFocusSaved); - - return TRUE; -} - void LLFloaterPreferenceViewAdvanced::updateCameraControl(const LLVector3& vector) { getChild("camera_x")->setValue(vector[VX]); @@ -86,11 +59,8 @@ void LLFloaterPreferenceViewAdvanced::updateFocusControl(const LLVector3d& vecto void LLFloaterPreferenceViewAdvanced::draw() { - static LLCachedControl camera(gSavedSettings, "CameraOffsetRearView"); - static LLCachedControl focus(gSavedSettings, "FocusOffsetRearView"); - - updateCameraControl(camera); - updateFocusControl(focus); + updateCameraControl(gAgentCamera.getCameraOffsetInitial()); + updateFocusControl(gAgentCamera.getFocusOffsetInitial()); LLFloater::draw(); } @@ -103,10 +73,10 @@ void LLFloaterPreferenceViewAdvanced::onCommitSettings() 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); + gSavedSettings.setVector3(gAgentCamera.getCameraOffsetCtrlName(), 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); + gSavedSettings.setVector3d(gAgentCamera.getFocusOffsetCtrlName(), vector3d); } diff --git a/indra/newview/llfloaterpreferenceviewadvanced.h b/indra/newview/llfloaterpreferenceviewadvanced.h index 8f4b594605..4619fdaab1 100644 --- a/indra/newview/llfloaterpreferenceviewadvanced.h +++ b/indra/newview/llfloaterpreferenceviewadvanced.h @@ -37,21 +37,14 @@ class LLFloaterPreferenceViewAdvanced public: LLFloaterPreferenceViewAdvanced(const LLSD& key); - virtual BOOL postBuild(); virtual void draw(); void onCommitSettings(); - void onClickCancel(); - void onClickOk(); void updateCameraControl(const LLVector3& vector); void updateFocusControl(const LLVector3d& vector3d); private: virtual ~LLFloaterPreferenceViewAdvanced(); - - LLVector3 mCameraSaved; - LLVector3d mFocusSaved; - }; #endif //LLFLOATERPREFERENCEVIEWADVANCED_H diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index bae7602566..10fad347bf 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -32,12 +32,14 @@ #include "llcombobox.h" #include "llfloaterpreference.h" #include "llfloaterreg.h" +#include "lllineeditor.h" #include "llnotificationsutil.h" #include "llpresetsmanager.h" +#include "llradiogroup.h" #include "lltrans.h" LLFloaterSavePrefPreset::LLFloaterSavePrefPreset(const LLSD &key) -: LLFloater(key) + : LLModalDialog(key) { } @@ -49,29 +51,39 @@ BOOL LLFloaterSavePrefPreset::postBuild() { preferences->addDependentFloater(this); } - getChild("preset_combo")->setTextEntryCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); - getChild("preset_combo")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); - getChild("save")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnSave, this)); - getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnCancel, this)); + + mPresetCombo = getChild("preset_combo"); + //mPresetCombo->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); - LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetsListChange, this)); + mNameEditor = getChild("preset_txt_editor"); + mNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this), NULL); mSaveButton = getChild("save"); - mPresetCombo = getChild("preset_combo"); + mSaveButton->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnSave, this)); + + mSaveRadioGroup = getChild("radio_save_preset"); + mSaveRadioGroup->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onSwitchSaveReplace, this)); + + getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnCancel, this)); + + LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetsListChange, this)); return TRUE; } void LLFloaterSavePrefPreset::onPresetNameEdited() { - // Disable saving a preset having empty name. - std::string name = mPresetCombo->getSimple(); - - mSaveButton->setEnabled(!name.empty()); + if (mSaveRadioGroup->getSelectedIndex() == 0) + { + // Disable saving a preset having empty name. + std::string name = mNameEditor->getValue(); + mSaveButton->setEnabled(!name.empty()); + } } void LLFloaterSavePrefPreset::onOpen(const LLSD& key) { + LLModalDialog::onOpen(key); mSubdirectory = key.asString(); std::string floater_title = getString(std::string("title_") + mSubdirectory); @@ -81,22 +93,41 @@ void LLFloaterSavePrefPreset::onOpen(const LLSD& key) EDefaultOptions option = DEFAULT_HIDE; LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); + mSaveRadioGroup->setSelectedIndex(0); onPresetNameEdited(); + onSwitchSaveReplace(); } void LLFloaterSavePrefPreset::onBtnSave() { - std::string name = mPresetCombo->getSimple(); + bool is_saving_new = mSaveRadioGroup->getSelectedIndex() == 0; + std::string name = is_saving_new ? mNameEditor->getValue() : mPresetCombo->getSimple(); if ((name == LLTrans::getString(PRESETS_DEFAULT)) || (name == PRESETS_DEFAULT)) { LLNotificationsUtil::add("DefaultPresetNotSaved"); } - else if (!LLPresetsManager::getInstance()->savePreset(mSubdirectory, name)) + else { - LLSD args; - args["NAME"] = name; - LLNotificationsUtil::add("PresetNotSaved", args); + if (is_saving_new) + { + std::list preset_names; + std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(mSubdirectory); + LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, preset_names, DEFAULT_HIDE); + if (std::find(preset_names.begin(), preset_names.end(), name) != preset_names.end()) + { + LLSD args; + args["NAME"] = name; + LLNotificationsUtil::add("PresetAlreadyExists", args); + return; + } + } + if (!LLPresetsManager::getInstance()->savePreset(mSubdirectory, name)) + { + LLSD args; + args["NAME"] = name; + LLNotificationsUtil::add("PresetNotSaved", args); + } } closeFloater(); @@ -112,3 +143,20 @@ void LLFloaterSavePrefPreset::onBtnCancel() { closeFloater(); } + +void LLFloaterSavePrefPreset::onSwitchSaveReplace() +{ + bool is_saving_new = mSaveRadioGroup->getSelectedIndex() == 0; + std::string label = is_saving_new ? getString("btn_label_save") : getString("btn_label_replace"); + mSaveButton->setLabel(label); + mNameEditor->setEnabled(is_saving_new); + mPresetCombo->setEnabled(!is_saving_new); + if (is_saving_new) + { + onPresetNameEdited(); + } + else + { + mSaveButton->setEnabled(true); + } +} diff --git a/indra/newview/llfloatersaveprefpreset.h b/indra/newview/llfloatersaveprefpreset.h index 09a87b8c62..c61379e5ad 100644 --- a/indra/newview/llfloatersaveprefpreset.h +++ b/indra/newview/llfloatersaveprefpreset.h @@ -28,11 +28,13 @@ #ifndef LL_LLFLOATERSAVEPREFPRESET_H #define LL_LLFLOATERSAVEPREFPRESET_H -#include "llfloater.h" +#include "llmodaldialog.h" class LLComboBox; +class LLRadioGroup; +class LLLineEditor; -class LLFloaterSavePrefPreset : public LLFloater +class LLFloaterSavePrefPreset : public LLModalDialog { public: @@ -43,8 +45,11 @@ public: void onBtnSave(); void onBtnCancel(); + void onSwitchSaveReplace(); private: + LLRadioGroup* mSaveRadioGroup; + LLLineEditor* mNameEditor; LLComboBox* mPresetCombo; LLButton* mSaveButton; diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 17fefbe6b1..94e6e64754 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -65,22 +65,22 @@ void LLPresetsManager::createMissingDefault(const std::string& subdirectory) { if(gDirUtilp->getLindenUserDir().empty()) { - return; +return; } std::string default_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, - subdirectory, PRESETS_DEFAULT + ".xml"); + subdirectory, PRESETS_DEFAULT + ".xml"); if (!gDirUtilp->fileExists(default_file)) { LL_INFOS() << "No default preset found -- creating one at " << default_file << LL_ENDL; // Write current settings as the default - savePreset(subdirectory, PRESETS_DEFAULT, true); + savePreset(subdirectory, PRESETS_DEFAULT, true); + } + else + { + LL_DEBUGS() << "default preset exists; no-op" << LL_ENDL; } - else - { - LL_DEBUGS() << "default preset exists; no-op" << LL_ENDL; - } } void LLPresetsManager::startWatching(const std::string& subdirectory) @@ -99,7 +99,7 @@ void LLPresetsManager::startWatching(const std::string& subdirectory) if (cntrl_ptr.isNull()) { LL_WARNS("Init") << "Unable to set signal on global setting '" << ctrl_name - << "'" << LL_ENDL; + << "'" << LL_ENDL; } else { @@ -120,25 +120,25 @@ std::string LLPresetsManager::getPresetsDir(const std::string& subdirectory) if (!gDirUtilp->fileExists(dest_path)) LLFile::mkdir(dest_path); - if (PRESETS_CAMERA == subdirectory) + if (PRESETS_CAMERA == subdirectory) + { + std::string source_dir = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA); + LLDirIterator dir_iter(source_dir, "*.xml"); + bool found = true; + while (found) { - std::string source_dir = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA); - LLDirIterator dir_iter(source_dir, "*.xml"); - bool found = true; - while (found) - { - std::string file; - found = dir_iter.next(file); + std::string file; + found = dir_iter.next(file); - if (found) - { - std::string source = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA, file); - file = LLURI::escape(file); - std::string dest = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, PRESETS_CAMERA, file); - LLFile::copy(source, dest); - } + if (found) + { + std::string source = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA, file); + file = LLURI::escape(file); + std::string dest = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, PRESETS_CAMERA, file); + LLFile::copy(source, dest); } } + } return dest_path; } @@ -160,8 +160,15 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam { std::string path = gDirUtilp->add(dir, file); std::string name = LLURI::unescape(gDirUtilp->getBaseFileName(path, /*strip_exten = */ true)); - LL_DEBUGS() << " Found preset '" << name << "'" << LL_ENDL; + LL_DEBUGS() << " Found preset '" << name << "'" << LL_ENDL; + if (default_option == DEFAULT_VIEWS_HIDE) + { + if (name == PRESETS_REAR || name == PRESETS_SIDE || name == PRESETS_FRONT) + { + continue; + } + } if (PRESETS_DEFAULT != name) { mPresetNames.push_back(name); @@ -205,11 +212,15 @@ void LLPresetsManager::settingChanged() { setCameraDirty(true); - gSavedSettings.setString("PresetCameraActive", ""); - -// Hack call because this is a static routine - LLPresetsManager::getInstance()->triggerChangeCameraSignal(); + static LLCachedControl preset_camera_active(gSavedSettings, "PresetCameraActive", ""); + std::string preset_name = preset_camera_active; + if (!preset_name.empty()) + { + gSavedSettings.setString("PresetCameraActive", ""); + // Hack call because this is a static routine + LLPresetsManager::getInstance()->triggerChangeCameraSignal(); + } } void LLPresetsManager::getControlNames(std::vector& names) @@ -222,8 +233,6 @@ void LLPresetsManager::getControlNames(std::vector& names) ("AppearanceCameraMovement") // From llagentcamera.cpp ("CameraOffsetBuild") - ("CameraOffsetRearView") - ("FocusOffsetRearView") ("CameraOffsetScale") ("TrackFocusObject") ; @@ -286,9 +295,25 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n } else { + bool custom_camera_offsets = false; + if (subdirectory == PRESETS_CAMERA) + { + name_list.push_back(gAgentCamera.getCameraOffsetCtrlName()); + name_list.push_back(gAgentCamera.getFocusOffsetCtrlName()); + custom_camera_offsets = (name != PRESETS_REAR && name != PRESETS_SIDE && name != PRESETS_FRONT); + } for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) { std::string ctrl_name = *it; + std::string dest_ctrl_name = ctrl_name; + if (custom_camera_offsets && ctrl_name == gAgentCamera.getCameraOffsetCtrlName()) + { + dest_ctrl_name = "CameraOffsetCustomPreset"; + } + if (custom_camera_offsets && ctrl_name == gAgentCamera.getFocusOffsetCtrlName()) + { + dest_ctrl_name = "FocusOffsetCustomPreset"; + } LLControlVariable* ctrl = gSavedSettings.getControl(ctrl_name).get(); if (ctrl) { @@ -296,10 +321,10 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n 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; + paramsData[dest_ctrl_name]["Comment"] = comment; + paramsData[dest_ctrl_name]["Persist"] = 1; + paramsData[dest_ctrl_name]["Type"] = type; + paramsData[dest_ctrl_name]["Value"] = value; } } } @@ -354,6 +379,7 @@ bool LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, combo->clearRows(); + std::string presets_dir = getPresetsDir(subdirectory); if (!presets_dir.empty()) @@ -368,7 +394,7 @@ bool LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, for (std::list::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it) { const std::string& name = *it; - combo->add(name, LLSD().with(0, name)); + combo->add(name, name); } } else diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 7370e0a3b1..cb32b58fc4 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -36,11 +36,15 @@ static const std::string PRESETS_DEFAULT = "Default"; static const std::string PRESETS_DIR = "presets"; static const std::string PRESETS_GRAPHIC = "graphic"; static const std::string PRESETS_CAMERA = "camera"; +static const std::string PRESETS_REAR = "Rear"; +static const std::string PRESETS_FRONT = "Front"; +static const std::string PRESETS_SIDE = "Side"; enum EDefaultOptions { DEFAULT_SHOW, DEFAULT_TOP, + DEFAULT_VIEWS_HIDE, DEFAULT_HIDE // Do not display "Default" in a list }; diff --git a/indra/newview/skins/default/xui/en/floater_camera.xml b/indra/newview/skins/default/xui/en/floater_camera.xml index 25db24da2e..933d50acae 100644 --- a/indra/newview/skins/default/xui/en/floater_camera.xml +++ b/indra/newview/skins/default/xui/en/floater_camera.xml @@ -7,7 +7,7 @@ legacy_header_height="18" can_minimize="true" can_close="true" - height="164" + height="135" layout="topleft" name="camera_floater" help_topic="camera_floater" @@ -16,7 +16,7 @@ title="CAMERA CONTROLS" chrome="true" save_rect="true" - width="228"> + width="400"> Rotate Camera Around Focus @@ -33,6 +33,7 @@ name="free_mode_title"> View Object + Use preset - - - - - - - Front View - - - - - - - - Side View - - - - - - - - Rear View - - - - - - - - Object View - - - - - - - - Mouselook View - - - - - + width="220"> - + width="220"> + top="25" + width="78" /> - - - + left_pad="2" + name="buttons_panel" + top="22" + width="212"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 index 5b2cbee914..3826ead5c2 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml @@ -1,10 +1,10 @@ @@ -113,28 +113,4 @@ - - - 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 a9cda26f0b..178ecad0f3 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 @@ -1,51 +1,71 @@ + width="280"> Save Graphic Preset Save Camera Preset - - Save + Replace + - Type a name for the preset or choose an existing preset. - + top="15" + width="150" + name="radio_save_preset"> + + + + - diff --git a/indra/newview/skins/default/xui/en/panel_preferences_view.xml b/indra/newview/skins/default/xui/en/panel_preferences_view.xml deleted file mode 100644 index a7a69eb829..0000000000 --- a/indra/newview/skins/default/xui/en/panel_preferences_view.xml +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - Preset in use: - - - - (None) - - - - - - Automatic position for: - - - - - - - - - - - - - - - -- cgit v1.2.3 From bf5ee32838b9d4c53ff1ab709e2935d8d0b4ec0b Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 8 Nov 2019 16:47:11 +0200 Subject: SL-12186 WIP Add new icons --- .../skins/default/textures/icons/Presets_Icon.png | Bin 0 -> 1293 bytes indra/newview/skins/default/textures/textures.xml | 2 ++ .../newview/skins/default/textures/windows/Icon_Gear.png | Bin 0 -> 6229 bytes indra/newview/skins/default/xui/en/panel_status_bar.xml | 10 +++++----- 4 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 indra/newview/skins/default/textures/icons/Presets_Icon.png create mode 100644 indra/newview/skins/default/textures/windows/Icon_Gear.png (limited to 'indra/newview') diff --git a/indra/newview/skins/default/textures/icons/Presets_Icon.png b/indra/newview/skins/default/textures/icons/Presets_Icon.png new file mode 100644 index 0000000000..503ee892a5 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Presets_Icon.png differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 40f1d8b88f..b086f7dfa8 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -206,6 +206,7 @@ with the same filename but different name + @@ -256,6 +257,7 @@ with the same filename but different name + diff --git a/indra/newview/skins/default/textures/windows/Icon_Gear.png b/indra/newview/skins/default/textures/windows/Icon_Gear.png new file mode 100644 index 0000000000..e1e89b8f32 Binary files /dev/null and b/indra/newview/skins/default/textures/windows/Icon_Gear.png differ 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 ffcfc3ae91..ada980cda1 100644 --- a/indra/newview/skins/default/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml @@ -148,19 +148,19 @@ + width="16" /> + + -- cgit v1.2.3 From 382c1845012cc4e2be78a5a03334b4157a732349 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 12 Nov 2019 16:26:34 +0200 Subject: SL-12186 WIP Added ability to reset default presets and updated item list in 'My camera presets' floater --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llfloatercamera.cpp | 7 ++- indra/newview/llfloatercamerapresets.cpp | 32 ++++++++++- indra/newview/llfloatercamerapresets.h | 4 ++ indra/newview/llpresetsmanager.cpp | 65 ++++++++++++++++++++-- indra/newview/llpresetsmanager.h | 9 +++ .../default/xui/en/panel_camera_preset_item.xml | 20 +++++++ 7 files changed, 126 insertions(+), 13 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f44185340a..04ab620b3a 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1565,7 +1565,7 @@ CameraPreset Comment - Preset camera position - view (0 - rear, 1 - front, 2 - group) + Preset camera position - view (0 - rear, 1 - front, 2 - group, 3 - custom) Persist 1 Type diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 2f85e7db34..47f05884b3 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -550,17 +550,17 @@ void LLFloaterCamera::switchToPreset(const std::string& name) if ("rear_view" == name) { gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); - LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_REAR); + LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_REAR_VIEW); } else if ("group_view" == name) { gAgentCamera.switchCameraPreset(CAMERA_PRESET_GROUP_VIEW); - LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_SIDE); + LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_SIDE_VIEW); } else if ("front_view" == name) { gAgentCamera.switchCameraPreset(CAMERA_PRESET_FRONT_VIEW); - LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_FRONT); + LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, PRESETS_FRONT_VIEW); } } @@ -590,6 +590,7 @@ void LLFloaterCamera::populatePresetCombo() { mPresetCombo->setLabel(getString("inactive_combo_text")); } + updateItemsSelection(); } void LLFloaterCamera::onSavePreset() diff --git a/indra/newview/llfloatercamerapresets.cpp b/indra/newview/llfloatercamerapresets.cpp index 6a9df5d067..75660e590a 100644 --- a/indra/newview/llfloatercamerapresets.cpp +++ b/indra/newview/llfloatercamerapresets.cpp @@ -58,7 +58,10 @@ void LLFloaterCameraPresets::populateList() std::string presets_dir = presetsMgr->getPresetsDir(PRESETS_CAMERA); std::list preset_names; - presetsMgr->loadPresetNamesFromDir(presets_dir, preset_names, DEFAULT_TOP); + presetsMgr->loadPresetNamesFromDir(presets_dir, preset_names, DEFAULT_VIEWS_HIDE); + preset_names.push_back(PRESETS_FRONT_VIEW); + preset_names.push_back(PRESETS_REAR_VIEW); + preset_names.push_back(PRESETS_SIDE_VIEW); for (std::list::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it) { const std::string& name = *it; @@ -86,10 +89,10 @@ LLCameraPresetFlatItem::~LLCameraPresetFlatItem() BOOL LLCameraPresetFlatItem::postBuild() { mDeleteBtn = getChild("delete_btn"); - mDeleteBtn->setVisible(!mIsDefaultPrest); + mDeleteBtn->setVisible(false); mResetBtn = getChild("reset_btn"); - mResetBtn->setVisible(mIsDefaultPrest); + mResetBtn->setVisible(false); LLStyle::Params style; LLTextBox* name_text = getChild("preset_name"); @@ -102,6 +105,29 @@ BOOL LLCameraPresetFlatItem::postBuild() return true; } +void LLCameraPresetFlatItem::onMouseEnter(S32 x, S32 y, MASK mask) +{ + mDeleteBtn->setVisible(!mIsDefaultPrest); + mResetBtn->setVisible(mIsDefaultPrest); + getChildView("hovered_icon")->setVisible(true); + LLPanel::onMouseEnter(x, y, mask); +} + +void LLCameraPresetFlatItem::onMouseLeave(S32 x, S32 y, MASK mask) +{ + mDeleteBtn->setVisible(false); + mResetBtn->setVisible(false); + getChildView("hovered_icon")->setVisible(false); + LLPanel::onMouseLeave(x, y, mask); +} + +void LLCameraPresetFlatItem::setValue(const LLSD& value) +{ + if (!value.isMap()) return;; + if (!value.has("selected")) return; + getChildView("selected_icon")->setVisible(value["selected"]); +} + void LLCameraPresetFlatItem::onDeleteBtnClick() { if (!LLPresetsManager::getInstance()->deletePreset(PRESETS_CAMERA, mPresetName)) diff --git a/indra/newview/llfloatercamerapresets.h b/indra/newview/llfloatercamerapresets.h index 8c293c57de..66430fa399 100644 --- a/indra/newview/llfloatercamerapresets.h +++ b/indra/newview/llfloatercamerapresets.h @@ -52,7 +52,11 @@ public: LLCameraPresetFlatItem(const std::string &preset_name, bool is_default); virtual ~LLCameraPresetFlatItem(); + void setValue(const LLSD& value); + virtual BOOL postBuild(); + virtual void onMouseEnter(S32 x, S32 y, MASK mask); + virtual void onMouseLeave(S32 x, S32 y, MASK mask); private: void onDeleteBtnClick(); diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index ab4f60d486..057f60a015 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -65,7 +65,13 @@ void LLPresetsManager::createMissingDefault(const std::string& subdirectory) { if(gDirUtilp->getLindenUserDir().empty()) { -return; + return; + } + + if (PRESETS_CAMERA == subdirectory) + { + createCameraDefaultPresets(); + return; } std::string default_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, @@ -83,6 +89,13 @@ return; } } +void LLPresetsManager::createCameraDefaultPresets() +{ + createDefaultCameraPreset(PRESETS_REAR_VIEW); + createDefaultCameraPreset(PRESETS_FRONT_VIEW); + createDefaultCameraPreset(PRESETS_SIDE_VIEW); +} + void LLPresetsManager::startWatching(const std::string& subdirectory) { if (PRESETS_CAMERA == subdirectory) @@ -163,6 +176,10 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam std::string name = LLURI::unescape(gDirUtilp->getBaseFileName(path, /*strip_exten = */ true)); LL_DEBUGS() << " Found preset '" << name << "'" << LL_ENDL; + if (isTemplateCameraPreset(name)) + { + continue; + } if (default_option == DEFAULT_VIEWS_HIDE) { if (isDefaultCameraPreset(name)) @@ -198,6 +215,7 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam } bool LLPresetsManager::mCameraDirty = false; +bool LLPresetsManager::mIgnoreChangedSignal = false; void LLPresetsManager::setCameraDirty(bool dirty) { @@ -215,7 +233,7 @@ void LLPresetsManager::settingChanged() static LLCachedControl preset_camera_active(gSavedSettings, "PresetCameraActive", ""); std::string preset_name = preset_camera_active; - if (!preset_name.empty()) + if (!preset_name.empty() && !mIgnoreChangedSignal) { gSavedSettings.setString("PresetCameraActive", ""); @@ -267,6 +285,12 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n return false; } + if (isTemplateCameraPreset(name)) + { + LL_WARNS() << "Should not overwrite template presets" << LL_ENDL; + return false; + } + bool saved = false; std::vector name_list; @@ -434,8 +458,10 @@ void LLPresetsManager::loadPreset(const std::string& subdirectory, std::string n LL_DEBUGS() << "attempting to load preset '"< 0) { + mIgnoreChangedSignal = false; if(PRESETS_GRAPHIC == subdirectory) { gSavedSettings.setString("PresetGraphicActive", name); @@ -453,10 +479,11 @@ void LLPresetsManager::loadPreset(const std::string& subdirectory, std::string n triggerChangeCameraSignal(); } } - else - { - LL_WARNS("Presets") << "failed to load preset '"<getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, + PRESETS_CAMERA, LLURI::escape(preset_name) + ".xml"); + if (!gDirUtilp->fileExists(preset_file) || force_reset) + { + std::string template_name = preset_name.substr(0, preset_name.size() - PRESETS_VIEW_SUFFIX.size()); + std::string default_template_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, + PRESETS_CAMERA, template_name + ".xml"); + LLFile::copy(default_template_file, preset_file); + } } boost::signals2::connection LLPresetsManager::setPresetListChangeCameraCallback(const preset_list_signal_t::slot_type& cb) diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 9964cc0fcf..d489a0ad5a 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -39,6 +39,10 @@ static const std::string PRESETS_CAMERA = "camera"; static const std::string PRESETS_REAR = "Rear"; static const std::string PRESETS_FRONT = "Front"; static const std::string PRESETS_SIDE = "Side"; +static const std::string PRESETS_VIEW_SUFFIX = " View"; +static const std::string PRESETS_REAR_VIEW = PRESETS_REAR + PRESETS_VIEW_SUFFIX; +static const std::string PRESETS_FRONT_VIEW = PRESETS_FRONT + PRESETS_VIEW_SUFFIX; +static const std::string PRESETS_SIDE_VIEW = PRESETS_SIDE + PRESETS_VIEW_SUFFIX; enum EDefaultOptions { @@ -71,8 +75,12 @@ public: bool isCameraDirty(); static void setCameraDirty(bool dirty); + void createCameraDefaultPresets(); + + bool isTemplateCameraPreset(std::string preset_name); bool isDefaultCameraPreset(std::string preset_name); void resetCameraPreset(std::string preset_name); + void createDefaultCameraPreset(std::string preset_name, bool force_reset = false); // Emitted when a preset gets loaded, deleted, or saved. boost::signals2::connection setPresetListChangeCameraCallback(const preset_list_signal_t::slot_type& cb); @@ -95,6 +103,7 @@ public: boost::signals2::connection mCameraChangedSignal; static bool mCameraDirty; + static bool mIgnoreChangedSignal; }; #endif // LL_PRESETSMANAGER_H diff --git a/indra/newview/skins/default/xui/en/panel_camera_preset_item.xml b/indra/newview/skins/default/xui/en/panel_camera_preset_item.xml index 187f5889eb..9417ab4ac2 100644 --- a/indra/newview/skins/default/xui/en/panel_camera_preset_item.xml +++ b/indra/newview/skins/default/xui/en/panel_camera_preset_item.xml @@ -7,6 +7,26 @@ name="camera_preset_item" top="0" width="280"> + + Date: Wed, 13 Nov 2019 15:55:02 +0200 Subject: SL-12186 WIP Use appropriate offset names when saving presets --- indra/newview/llagentcamera.cpp | 10 ++++ indra/newview/llagentcamera.h | 2 + indra/newview/llpanelpresetscamerapulldown.cpp | 16 +----- indra/newview/llpresetsmanager.cpp | 63 ++++++++++++++++------ .../xui/en/panel_presets_camera_pulldown.xml | 6 +-- 5 files changed, 64 insertions(+), 33 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 3e56c1dd71..882e3cee55 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1948,11 +1948,21 @@ std::string LLAgentCamera::getCameraOffsetCtrlName() return mCameraOffsetInitial[mCameraPreset]->getName(); } +std::string LLAgentCamera::getCameraOffsetCtrlName(ECameraPreset preset) +{ + return mCameraOffsetInitial[preset]->getName(); +} + std::string LLAgentCamera::getFocusOffsetCtrlName() { return mFocusOffsetInitial[mCameraPreset]->getName(); } +std::string LLAgentCamera::getFocusOffsetCtrlName(ECameraPreset preset) +{ + return mFocusOffsetInitial[preset]->getName(); +} + F32 LLAgentCamera::getCameraMaxZoomDistance() { // Ignore "DisableCameraConstraints", we don't want to be out of draw range when we focus onto objects or avatars diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 294e81c2e1..5c8172bbfc 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -118,7 +118,9 @@ public: LLVector3d getFocusOffsetInitial(); std::string getCameraOffsetCtrlName(); + std::string getCameraOffsetCtrlName(ECameraPreset preset); std::string getFocusOffsetCtrlName(); + std::string getFocusOffsetCtrlName(ECameraPreset preset); private: /** Determines maximum camera distance from target for mouselook, opposite to LAND_MIN_ZOOM */ F32 getCameraMaxZoomDistance(); diff --git a/indra/newview/llpanelpresetscamerapulldown.cpp b/indra/newview/llpanelpresetscamerapulldown.cpp index 7612c428d9..1ac105e1c8 100644 --- a/indra/newview/llpanelpresetscamerapulldown.cpp +++ b/indra/newview/llpanelpresetscamerapulldown.cpp @@ -52,7 +52,7 @@ LLPanelPresetsCameraPulldown::LLPanelPresetsCameraPulldown() { mHoverTimer.stop(); - mCommitCallbackRegistrar.add("Presets.GoViewPrefs", boost::bind(&LLPanelPresetsCameraPulldown::onViewButtonClick, this, _2)); + mCommitCallbackRegistrar.add("Presets.toggleCameraFloater", boost::bind(&LLPanelPresetsCameraPulldown::onViewButtonClick, this, _2)); mCommitCallbackRegistrar.add("PresetsCamera.RowClick", boost::bind(&LLPanelPresetsCameraPulldown::onRowClick, this, _2)); buildFromFile( "panel_presets_camera_pulldown.xml"); @@ -205,19 +205,7 @@ 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("view"); - if (tabcontainer && graphicspanel) - { - tabcontainer->selectTabPanel(graphicspanel); - } - } + LLFloaterReg::toggleInstanceOrBringToFront("camera"); } //virtual diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 057f60a015..71f0cd72d4 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -275,6 +275,9 @@ void LLPresetsManager::getOffsetControlNames(std::vector& names) bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string name, bool createDefault) { + bool IS_CAMERA = (PRESETS_CAMERA == subdirectory); + bool IS_GRAPHIC = (PRESETS_GRAPHIC == subdirectory); + if (LLTrans::getString(PRESETS_DEFAULT) == name) { name = PRESETS_DEFAULT; @@ -294,7 +297,7 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n bool saved = false; std::vector name_list; - if(PRESETS_GRAPHIC == subdirectory) + if (IS_GRAPHIC) { LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); if (instance && !createDefault) @@ -309,11 +312,13 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n LL_WARNS("Presets") << "preferences floater instance not found" << LL_ENDL; } } - else if(PRESETS_CAMERA == subdirectory) + else if (IS_CAMERA) { name_list.clear(); getControlNames(name_list); name_list.push_back("PresetCameraActive"); + name_list.push_back(gAgentCamera.getCameraOffsetCtrlName()); + name_list.push_back(gAgentCamera.getFocusOffsetCtrlName()); } else { @@ -324,7 +329,7 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n LLSD paramsData(LLSD::emptyMap()); // Create a default graphics preset from hw recommended settings - if (createDefault && name == PRESETS_DEFAULT && subdirectory == PRESETS_GRAPHIC) + if (IS_GRAPHIC && createDefault && name == PRESETS_DEFAULT) { paramsData = LLFeatureManager::getInstance()->getRecommendedSettingsMap(); if (gSavedSettings.getU32("RenderAvatarMaxComplexity") == 0) @@ -335,25 +340,47 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n } else { - bool custom_camera_offsets = false; - if (subdirectory == PRESETS_CAMERA) + ECameraPreset new_camera_preset = (ECameraPreset)gSavedSettings.getU32("CameraPreset"); + bool new_camera_offsets = false; + if (IS_CAMERA) { - name_list.push_back(gAgentCamera.getCameraOffsetCtrlName()); - name_list.push_back(gAgentCamera.getFocusOffsetCtrlName()); - custom_camera_offsets = !isDefaultCameraPreset(name); + if (isDefaultCameraPreset(name)) + { + if (PRESETS_REAR_VIEW == name) + { + new_camera_preset = CAMERA_PRESET_REAR_VIEW; + } + else if (PRESETS_SIDE_VIEW == name) + { + new_camera_preset = CAMERA_PRESET_GROUP_VIEW; + } + else if (PRESETS_FRONT_VIEW == name) + { + new_camera_preset = CAMERA_PRESET_FRONT_VIEW; + } + } + else + { + new_camera_preset = CAMERA_PRESET_CUSTOM; + } + new_camera_offsets = (!isDefaultCameraPreset(name) || (ECameraPreset)gSavedSettings.getU32("CameraPreset") != new_camera_preset); } for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) { std::string ctrl_name = *it; std::string dest_ctrl_name = ctrl_name; - if (custom_camera_offsets && ctrl_name == gAgentCamera.getCameraOffsetCtrlName()) - { - dest_ctrl_name = "CameraOffsetCustomPreset"; - } - if (custom_camera_offsets && ctrl_name == gAgentCamera.getFocusOffsetCtrlName()) + if (IS_CAMERA && new_camera_offsets) { - dest_ctrl_name = "FocusOffsetCustomPreset"; + if (ctrl_name == gAgentCamera.getCameraOffsetCtrlName()) + { + dest_ctrl_name = gAgentCamera.getCameraOffsetCtrlName(new_camera_preset); + } + if (ctrl_name == gAgentCamera.getFocusOffsetCtrlName()) + { + dest_ctrl_name = gAgentCamera.getFocusOffsetCtrlName(new_camera_preset); + } } + LLControlVariable* ctrl = gSavedSettings.getControl(ctrl_name).get(); if (ctrl) { @@ -367,6 +394,10 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n paramsData[dest_ctrl_name]["Value"] = value; } } + if (IS_CAMERA) + { + gSavedSettings.setU32("CameraPreset", new_camera_preset); + } } std::string pathName(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); @@ -385,14 +416,14 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n LL_DEBUGS() << "saved preset '" << name << "'; " << paramsData.size() << " parameters" << LL_ENDL; - if (subdirectory == PRESETS_GRAPHIC) + if (IS_GRAPHIC) { gSavedSettings.setString("PresetGraphicActive", name); // signal interested parties triggerChangeSignal(); } - if (subdirectory == PRESETS_CAMERA) + if (IS_CAMERA) { gSavedSettings.setString("PresetCameraActive", name); setCameraDirty(false); 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 index dc37270751..25d9c47449 100644 --- a/indra/newview/skins/default/xui/en/panel_presets_camera_pulldown.xml +++ b/indra/newview/skins/default/xui/en/panel_presets_camera_pulldown.xml @@ -57,13 +57,13 @@ width="215" /> -- cgit v1.2.3 From 7637f343865960ee509ae31205c097f0bb04aac1 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Wed, 13 Nov 2019 17:39:40 +0200 Subject: SL-12186 WIP Get rid of excessive offset settings as we moved to store data in xml --- indra/newview/app_settings/camera/Front.xml | 4 +-- indra/newview/app_settings/camera/Side.xml | 4 +-- indra/newview/llagentcamera.cpp | 37 +++------------------ indra/newview/llagentcamera.h | 12 +++---- indra/newview/llfloaterpreferenceviewadvanced.cpp | 4 +-- indra/newview/llpresetsmanager.cpp | 40 ++++------------------- indra/newview/llpresetsmanager.h | 1 - indra/newview/llviewermenu.cpp | 8 ----- 8 files changed, 21 insertions(+), 89 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/camera/Front.xml b/indra/newview/app_settings/camera/Front.xml index a4b5ace33c..cb3380589e 100644 --- a/indra/newview/app_settings/camera/Front.xml +++ b/indra/newview/app_settings/camera/Front.xml @@ -37,7 +37,7 @@ 6 - CameraOffsetFrontView + CameraOffsetRearView Comment Initial camera offset from avatar in Front View @@ -74,7 +74,7 @@ Value 0 - FocusOffsetFrontView + FocusOffsetRearView Comment Initial focus point offset relative to avatar for the camera preset Front View (x-axis is forward) diff --git a/indra/newview/app_settings/camera/Side.xml b/indra/newview/app_settings/camera/Side.xml index 677fd47e20..49582a8a3c 100644 --- a/indra/newview/app_settings/camera/Side.xml +++ b/indra/newview/app_settings/camera/Side.xml @@ -37,7 +37,7 @@ 6 - CameraOffsetGroupView + CameraOffsetRearView Comment Initial camera offset from avatar in Side View @@ -74,7 +74,7 @@ Value 0 - FocusOffsetGroupView + FocusOffsetRearView Comment Initial focus point offset relative to avatar for the camera preset Side View (x-axis is forward) diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 882e3cee55..285a1509cd 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -207,15 +207,8 @@ void LLAgentCamera::init() mCameraPreset = (ECameraPreset) gSavedSettings.getU32("CameraPreset"); - 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_CUSTOM] = gSavedSettings.getControl("CameraOffsetCustomPreset"); - - 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_CUSTOM] = gSavedSettings.getControl("FocusOffsetCustomPreset"); + mCameraOffsetInitial = gSavedSettings.getControl("CameraOffsetRearView"); + mFocusOffsetInitial = gSavedSettings.getControl("FocusOffsetRearView"); mCameraCollidePlane.clearVec(); mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"); @@ -1603,7 +1596,7 @@ LLVector3d LLAgentCamera::calcThirdPersonFocusOffset() agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation(); } - focus_offset = convert_from_llsd(mFocusOffsetInitial[mCameraPreset]->get(), TYPE_VEC3D, ""); + focus_offset = convert_from_llsd(mFocusOffsetInitial->get(), TYPE_VEC3D, ""); return focus_offset * agent_rot; } @@ -1935,32 +1928,12 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) LLVector3 LLAgentCamera::getCameraOffsetInitial() { - return convert_from_llsd(mCameraOffsetInitial[mCameraPreset]->get(), TYPE_VEC3, ""); + return convert_from_llsd(mCameraOffsetInitial->get(), TYPE_VEC3, ""); } LLVector3d LLAgentCamera::getFocusOffsetInitial() { - return convert_from_llsd(mFocusOffsetInitial[mCameraPreset]->get(), TYPE_VEC3D, ""); -} - -std::string LLAgentCamera::getCameraOffsetCtrlName() -{ - return mCameraOffsetInitial[mCameraPreset]->getName(); -} - -std::string LLAgentCamera::getCameraOffsetCtrlName(ECameraPreset preset) -{ - return mCameraOffsetInitial[preset]->getName(); -} - -std::string LLAgentCamera::getFocusOffsetCtrlName() -{ - return mFocusOffsetInitial[mCameraPreset]->getName(); -} - -std::string LLAgentCamera::getFocusOffsetCtrlName(ECameraPreset preset) -{ - return mFocusOffsetInitial[preset]->getName(); + return convert_from_llsd(mFocusOffsetInitial->get(), TYPE_VEC3D, ""); } F32 LLAgentCamera::getCameraMaxZoomDistance() diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 5c8172bbfc..8a922bf678 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -117,10 +117,6 @@ public: /** Determines default focus offset depending on the current camera preset */ LLVector3d getFocusOffsetInitial(); - std::string getCameraOffsetCtrlName(); - std::string getCameraOffsetCtrlName(ECameraPreset preset); - std::string getFocusOffsetCtrlName(); - std::string getFocusOffsetCtrlName(ECameraPreset preset); private: /** Determines maximum camera distance from target for mouselook, opposite to LAND_MIN_ZOOM */ F32 getCameraMaxZoomDistance(); @@ -128,11 +124,11 @@ private: /** Camera preset in Third Person Mode */ ECameraPreset mCameraPreset; - /** Initial camera offsets */ - std::map > mCameraOffsetInitial; + /** Initial camera offset */ + LLPointer mCameraOffsetInitial; - /** Initial focus offsets */ - std::map > mFocusOffsetInitial; + /** Initial focus offset */ + LLPointer mFocusOffsetInitial; //-------------------------------------------------------------------- // Position diff --git a/indra/newview/llfloaterpreferenceviewadvanced.cpp b/indra/newview/llfloaterpreferenceviewadvanced.cpp index 57484d0d0a..f8db738923 100644 --- a/indra/newview/llfloaterpreferenceviewadvanced.cpp +++ b/indra/newview/llfloaterpreferenceviewadvanced.cpp @@ -73,10 +73,10 @@ void LLFloaterPreferenceViewAdvanced::onCommitSettings() 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(gAgentCamera.getCameraOffsetCtrlName(), vector); + 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(gAgentCamera.getFocusOffsetCtrlName(), vector3d); + gSavedSettings.setVector3d("FocusOffsetRearView", vector3d); } diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 71f0cd72d4..4f25e93ebd 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -102,7 +102,6 @@ void LLPresetsManager::startWatching(const std::string& subdirectory) { std::vector name_list; getControlNames(name_list); - getOffsetControlNames(name_list); for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) { @@ -254,23 +253,10 @@ void LLPresetsManager::getControlNames(std::vector& names) ("CameraOffsetBuild") ("CameraOffsetScale") ("TrackFocusObject") - ; - names = camera_controls; -} - -void LLPresetsManager::getOffsetControlNames(std::vector& names) -{ - const std::vector offset_controls = boost::assign::list_of ("CameraOffsetRearView") - ("CameraOffsetFrontView") - ("CameraOffsetGroupView") - ("CameraOffsetCustomPreset") ("FocusOffsetRearView") - ("FocusOffsetFrontView") - ("FocusOffsetGroupView") - ("FocusOffsetCustomPreset") - ; - names.insert(std::end(names), std::begin(offset_controls), std::end(offset_controls)); + ; + names = camera_controls; } bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string name, bool createDefault) @@ -317,8 +303,6 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n name_list.clear(); getControlNames(name_list); name_list.push_back("PresetCameraActive"); - name_list.push_back(gAgentCamera.getCameraOffsetCtrlName()); - name_list.push_back(gAgentCamera.getFocusOffsetCtrlName()); } else { @@ -368,18 +352,6 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) { std::string ctrl_name = *it; - std::string dest_ctrl_name = ctrl_name; - if (IS_CAMERA && new_camera_offsets) - { - if (ctrl_name == gAgentCamera.getCameraOffsetCtrlName()) - { - dest_ctrl_name = gAgentCamera.getCameraOffsetCtrlName(new_camera_preset); - } - if (ctrl_name == gAgentCamera.getFocusOffsetCtrlName()) - { - dest_ctrl_name = gAgentCamera.getFocusOffsetCtrlName(new_camera_preset); - } - } LLControlVariable* ctrl = gSavedSettings.getControl(ctrl_name).get(); if (ctrl) @@ -388,10 +360,10 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n std::string type = LLControlGroup::typeEnumToString(ctrl->type()); LLSD value = ctrl->getValue(); - paramsData[dest_ctrl_name]["Comment"] = comment; - paramsData[dest_ctrl_name]["Persist"] = 1; - paramsData[dest_ctrl_name]["Type"] = type; - paramsData[dest_ctrl_name]["Value"] = value; + paramsData[ctrl_name]["Comment"] = comment; + paramsData[ctrl_name]["Persist"] = 1; + paramsData[ctrl_name]["Type"] = type; + paramsData[ctrl_name]["Value"] = value; } } if (IS_CAMERA) diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index d489a0ad5a..09010413a9 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -97,7 +97,6 @@ public: LOG_CLASS(LLPresetsManager); void getControlNames(std::vector& names); - void getOffsetControlNames(std::vector& names); static void settingChanged(); boost::signals2::connection mCameraChangedSignal; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index c18d63d72b..7dfb6a6ac2 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -4109,14 +4109,6 @@ void handle_reset_view() // switching to outfit selector should automagically save any currently edited wearable LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "my_outfits")); } - if ((ECameraPreset)gSavedSettings.getU32("CameraPreset") == CAMERA_PRESET_CUSTOM) - { - gAgentCamera.switchCameraPreset(CAMERA_PRESET_CUSTOM); - } - else - { - gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); - } reset_view_final( TRUE ); LLFloaterCamera::resetCameraMode(); -- cgit v1.2.3 From 16015cfb9f1e7d9983057e35c5ab41c92271b9a5 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Thu, 14 Nov 2019 17:51:58 +0200 Subject: SL-12186 Buildfix and update for creation of default presets --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llfloatersaveprefpreset.cpp | 2 +- indra/newview/llstartup.cpp | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 04ab620b3a..2fe5817772 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16349,7 +16349,7 @@ Type String Value - + Rear View CefVerboseLog diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index c8d6513f4d..3142991704 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -112,7 +112,7 @@ void LLFloaterSavePrefPreset::onOpen(const LLSD& key) void LLFloaterSavePrefPreset::onBtnSave() { bool is_saving_new = mSaveRadioGroup->getSelectedIndex() == 0; - std::string name = is_saving_new ? mNameEditor->getValue() : mPresetCombo->getSimple(); + std::string name = is_saving_new ? mNameEditor->getText() : mPresetCombo->getSimple(); if ((name == LLTrans::getString(PRESETS_DEFAULT)) || (name == PRESETS_DEFAULT)) { diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 6e0a36be49..8a5dbf317a 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -71,6 +71,7 @@ #include "llnotifications.h" #include "llnotificationsutil.h" #include "llpersistentnotificationstorage.h" +#include "llpresetsmanager.h" #include "llteleporthistory.h" #include "llregionhandle.h" #include "llsd.h" @@ -1960,6 +1961,8 @@ bool idle_startup() // JC - 7/20/2002 gViewerWindow->sendShapeToSim(); + LLPresetsManager::getInstance()->createMissingDefault(PRESETS_CAMERA); + // The reason we show the alert is because we want to // reduce confusion for when you log in and your provided // location is not your expected location. So, if this is -- cgit v1.2.3 From 26732bc576f86fde532e1f9448bd127515f70612 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Thu, 14 Nov 2019 23:43:52 +0200 Subject: Line endings fix --- .../default/xui/en/floater_camera_presets.xml | 46 +++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/floater_camera_presets.xml b/indra/newview/skins/default/xui/en/floater_camera_presets.xml index 0d9a6bb16a..930357f568 100644 --- a/indra/newview/skins/default/xui/en/floater_camera_presets.xml +++ b/indra/newview/skins/default/xui/en/floater_camera_presets.xml @@ -1,23 +1,23 @@ - - - - + + + + -- cgit v1.2.3 From f21da58f05d70c44d810323a533f8b11c8fafb5e Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Fri, 15 Nov 2019 01:47:20 +0200 Subject: Post-merge build fix --- indra/newview/llstatusbar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 359615d46a..3d31aa7003 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -513,8 +513,8 @@ void LLStatusBar::onMouseEnterPresetsCamera() mPanelPresetsCameraPulldown->setShape(pulldown_rect); // show the master presets pull-down - LLUI::clearPopups(); - LLUI::addPopup(mPanelPresetsCameraPulldown); + LLUI::getInstance()->clearPopups(); + LLUI::getInstance()->addPopup(mPanelPresetsCameraPulldown); mPanelNearByMedia->setVisible(FALSE); mPanelVolumePulldown->setVisible(FALSE); mPanelPresetsPulldown->setVisible(FALSE); -- cgit v1.2.3 From 3824624ab1df4eb8809ec31965f251cda74c8d23 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 15 Nov 2019 14:16:12 +0200 Subject: SL-12186 Correctly populate list after creating default presets --- indra/newview/llpresetsmanager.cpp | 16 +++++++++++----- indra/newview/llpresetsmanager.h | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 4f25e93ebd..88b24265e3 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -91,9 +91,14 @@ void LLPresetsManager::createMissingDefault(const std::string& subdirectory) void LLPresetsManager::createCameraDefaultPresets() { - createDefaultCameraPreset(PRESETS_REAR_VIEW); - createDefaultCameraPreset(PRESETS_FRONT_VIEW); - createDefaultCameraPreset(PRESETS_SIDE_VIEW); + bool is_default_created = createDefaultCameraPreset(PRESETS_REAR_VIEW); + is_default_created |= createDefaultCameraPreset(PRESETS_FRONT_VIEW); + is_default_created |= createDefaultCameraPreset(PRESETS_SIDE_VIEW); + + if (is_default_created) + { + triggerChangeCameraSignal(); + } } void LLPresetsManager::startWatching(const std::string& subdirectory) @@ -558,7 +563,7 @@ void LLPresetsManager::resetCameraPreset(std::string preset_name) } } -void LLPresetsManager::createDefaultCameraPreset(std::string preset_name, bool force_reset) +bool LLPresetsManager::createDefaultCameraPreset(std::string preset_name, bool force_reset) { std::string preset_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, PRESETS_CAMERA, LLURI::escape(preset_name) + ".xml"); @@ -567,8 +572,9 @@ void LLPresetsManager::createDefaultCameraPreset(std::string preset_name, bool f std::string template_name = preset_name.substr(0, preset_name.size() - PRESETS_VIEW_SUFFIX.size()); std::string default_template_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, PRESETS_CAMERA, template_name + ".xml"); - LLFile::copy(default_template_file, preset_file); + return LLFile::copy(default_template_file, preset_file); } + return false; } boost::signals2::connection LLPresetsManager::setPresetListChangeCameraCallback(const preset_list_signal_t::slot_type& cb) diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 09010413a9..d9ca178dd7 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -80,7 +80,7 @@ public: bool isTemplateCameraPreset(std::string preset_name); bool isDefaultCameraPreset(std::string preset_name); void resetCameraPreset(std::string preset_name); - void createDefaultCameraPreset(std::string preset_name, bool force_reset = false); + bool createDefaultCameraPreset(std::string preset_name, bool force_reset = false); // Emitted when a preset gets loaded, deleted, or saved. boost::signals2::connection setPresetListChangeCameraCallback(const preset_list_signal_t::slot_type& cb); -- cgit v1.2.3 From 716552a0c014455def500a669b916a68293187de Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 19 Nov 2019 11:55:02 +0200 Subject: SL-12186 Don't copy templates from app_settings directory, because it's excessive --- indra/newview/llpresetsmanager.cpp | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 88b24265e3..dda705eeca 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -138,26 +138,6 @@ std::string LLPresetsManager::getPresetsDir(const std::string& subdirectory) if (!gDirUtilp->fileExists(dest_path)) LLFile::mkdir(dest_path); - if (PRESETS_CAMERA == subdirectory) - { - std::string source_dir = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA); - LLDirIterator dir_iter(source_dir, "*.xml"); - bool found = true; - while (found) - { - std::string file; - found = dir_iter.next(file); - - if (found) - { - std::string source = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA, file); - file = LLURI::escape(file); - std::string dest = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, PRESETS_CAMERA, file); - LLFile::copy(source, dest); - } - } - } - return dest_path; } @@ -570,8 +550,7 @@ bool LLPresetsManager::createDefaultCameraPreset(std::string preset_name, bool f if (!gDirUtilp->fileExists(preset_file) || force_reset) { std::string template_name = preset_name.substr(0, preset_name.size() - PRESETS_VIEW_SUFFIX.size()); - std::string default_template_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, - PRESETS_CAMERA, template_name + ".xml"); + std::string default_template_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, PRESETS_CAMERA, template_name + ".xml"); return LLFile::copy(default_template_file, preset_file); } return false; -- cgit v1.2.3 From f4d4fb2ad0927ebb8545bac1abd1b74918a006f5 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 22 Nov 2019 14:34:20 +0200 Subject: SL-12288 Enhancement for Rotate and Track camera controls --- indra/newview/llagentcamera.cpp | 58 ++++++++++++- indra/newview/llagentcamera.h | 13 ++- indra/newview/lljoystickbutton.cpp | 95 +++++++++++++++++---- indra/newview/lljoystickbutton.h | 9 +- .../textures/bottomtray/Cam_Rotate_Center.png | Bin 0 -> 10689 bytes .../textures/bottomtray/Cam_Tracking_Center.png | Bin 0 -> 1714 bytes indra/newview/skins/default/textures/textures.xml | 2 + 7 files changed, 155 insertions(+), 22 deletions(-) create mode 100644 indra/newview/skins/default/textures/bottomtray/Cam_Rotate_Center.png create mode 100644 indra/newview/skins/default/textures/bottomtray/Cam_Tracking_Center.png (limited to 'indra/newview') diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index e5fba7f28f..67b117657f 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -184,6 +184,9 @@ LLAgentCamera::LLAgentCamera() : clearGeneralKeys(); clearOrbitKeys(); clearPanKeys(); + + resetPanDiff(); + resetOrbitDiff(); } // Requires gSavedSettings to be initialized. @@ -343,7 +346,8 @@ void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera) mCameraFOVZoomFactor = 0.f; } - + resetPanDiff(); + resetOrbitDiff(); mHUDTargetZoom = 1.f; } @@ -822,6 +826,7 @@ void LLAgentCamera::cameraOrbitAround(const F32 radians) } else { + mOrbitAroundRadians += radians; mCameraFocusOffsetTarget.rotVec(radians, 0.f, 0.f, 1.f); cameraZoomIn(1.f); @@ -853,12 +858,34 @@ void LLAgentCamera::cameraOrbitOver(const F32 angle) LLVector3d left_axis; left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); F32 new_angle = llclamp(angle_from_up - angle, 1.f * DEG_TO_RAD, 179.f * DEG_TO_RAD); + mOrbitOverAngle += angle_from_up - new_angle; mCameraFocusOffsetTarget.rotVec(angle_from_up - new_angle, left_axis); cameraZoomIn(1.f); } } +void LLAgentCamera::resetCameraOrbit() +{ + LLVector3 camera_offset_unit(mCameraFocusOffsetTarget); + camera_offset_unit.normalize(); + + LLVector3d left_axis; + left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); + mCameraFocusOffsetTarget.rotVec(-mOrbitOverAngle, left_axis); + + mCameraFocusOffsetTarget.rotVec(-mOrbitAroundRadians, 0.f, 0.f, 1.f); + + cameraZoomIn(1.f); + resetOrbitDiff(); +} + +void LLAgentCamera::resetOrbitDiff() +{ + mOrbitAroundRadians = 0; + mOrbitOverAngle = 0; +} + //----------------------------------------------------------------------------- // cameraZoomIn() //----------------------------------------------------------------------------- @@ -997,6 +1024,8 @@ void LLAgentCamera::cameraPanIn(F32 meters) LLVector3d at_axis; at_axis.setVec(LLViewerCamera::getInstance()->getAtAxis()); + mPanFocusDiff += meters * at_axis; + mFocusTargetGlobal += meters * at_axis; mFocusGlobal = mFocusTargetGlobal; // don't enforce zoom constraints as this is the only way for users to get past them easily @@ -1013,6 +1042,8 @@ void LLAgentCamera::cameraPanLeft(F32 meters) LLVector3d left_axis; left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); + mPanFocusDiff += meters * left_axis; + mFocusTargetGlobal += meters * left_axis; mFocusGlobal = mFocusTargetGlobal; @@ -1033,6 +1064,8 @@ void LLAgentCamera::cameraPanUp(F32 meters) LLVector3d up_axis; up_axis.setVec(LLViewerCamera::getInstance()->getUpAxis()); + mPanFocusDiff += meters * up_axis; + mFocusTargetGlobal += meters * up_axis; mFocusGlobal = mFocusTargetGlobal; @@ -1045,6 +1078,26 @@ void LLAgentCamera::cameraPanUp(F32 meters) mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); } +void LLAgentCamera::resetCameraPan() +{ + mFocusTargetGlobal -= mPanFocusDiff; + + mFocusGlobal = mFocusTargetGlobal; + mCameraSmoothingStop = true; + + cameraZoomIn(1.f); + updateFocusOffset(); + + mCameraSmoothingLastPositionGlobal = calcCameraPositionTargetGlobal(); + + resetPanDiff(); +} + +void LLAgentCamera::resetPanDiff() +{ + mPanFocusDiff.clear(); +} + //----------------------------------------------------------------------------- // updateLookAt() //----------------------------------------------------------------------------- @@ -2330,6 +2383,9 @@ void LLAgentCamera::switchCameraPreset(ECameraPreset preset) mCameraPreset = preset; + resetPanDiff(); + resetOrbitDiff(); + gSavedSettings.setU32("CameraPreset", mCameraPreset); } diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 8a922bf678..0608507d1a 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -262,7 +262,8 @@ public: void cameraOrbitAround(const F32 radians); // Rotate camera CCW radians about build focus point void cameraOrbitOver(const F32 radians); // Rotate camera forward radians over build focus point void cameraOrbitIn(const F32 meters); // Move camera in toward build focus point - + void resetCameraOrbit(); + void resetOrbitDiff(); //-------------------------------------------------------------------- // Zoom //-------------------------------------------------------------------- @@ -279,8 +280,9 @@ public: public: void cameraPanIn(const F32 meters); void cameraPanLeft(const F32 meters); - void cameraPanUp(const F32 meters); - + void cameraPanUp(const F32 meters); + void resetCameraPan(); + void resetPanDiff(); //-------------------------------------------------------------------- // View //-------------------------------------------------------------------- @@ -367,6 +369,9 @@ private: F32 mOrbitInKey; F32 mOrbitOutKey; + F32 mOrbitAroundRadians; + F32 mOrbitOverAngle; + //-------------------------------------------------------------------- // Pan //-------------------------------------------------------------------- @@ -394,6 +399,8 @@ private: F32 mPanInKey; F32 mPanOutKey; + LLVector3d mPanFocusDiff; + /** Keys ** ** *******************************************************************************/ diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp index 59e14e6cc0..eb4e4f4100 100644 --- a/indra/newview/lljoystickbutton.cpp +++ b/indra/newview/lljoystickbutton.cpp @@ -37,6 +37,7 @@ #include "llui.h" #include "llagent.h" #include "llagentcamera.h" +#include "llviewercamera.h" #include "llviewertexture.h" #include "llviewertexturelist.h" #include "llviewerwindow.h" @@ -54,6 +55,8 @@ static LLDefaultChildRegistry::Register r5("joystick_trac const F32 NUDGE_TIME = 0.25f; // in seconds const F32 ORBIT_NUDGE_RATE = 0.05f; // fraction of normal speed +const S32 CENTER_DOT_RADIUS = 7; + // // Public Methods // @@ -138,9 +141,25 @@ bool LLJoystick::pointInCircle(S32 x, S32 y) const //center is x and y coordinates of center of joystick circle, and also its radius int center = this->getLocalRect().getHeight()/2; bool in_circle = (x - center) * (x - center) + (y - center) * (y - center) <= center * center; + return in_circle; } +bool LLJoystick::pointInCenterDot(S32 x, S32 y, S32 radius) const +{ + if (this->getLocalRect().getHeight() != this->getLocalRect().getWidth()) + { + LL_WARNS() << "Joystick shape is not square" << LL_ENDL; + return true; + } + + S32 center = this->getLocalRect().getHeight() / 2; + + bool in_center_circle = (x - center) * (x - center) + (y - center) * (y - center) <= radius * radius; + + return in_center_circle; +} + BOOL LLJoystick::handleMouseDown(S32 x, S32 y, MASK mask) { //LL_INFOS() << "joystick mouse down " << x << ", " << y << LL_ENDL; @@ -403,8 +422,11 @@ LLJoystickCameraRotate::LLJoystickCameraRotate(const LLJoystickCameraRotate::Par mInLeft( FALSE ), mInTop( FALSE ), mInRight( FALSE ), - mInBottom( FALSE ) -{ } + mInBottom( FALSE ), + mInCenter( FALSE ) +{ + mCenterImageName = "Cam_Rotate_Center"; +} void LLJoystickCameraRotate::updateSlop() @@ -434,7 +456,16 @@ BOOL LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask) S32 dx = x - horiz_center; S32 dy = y - vert_center; - if (dy > dx && dy > -dx) + if (pointInCenterDot(x, y, CENTER_DOT_RADIUS)) + { + mInitialOffset.mX = 0; + mInitialOffset.mY = 0; + mInitialQuadrant = JQ_ORIGIN; + mInCenter = TRUE; + + resetJoystickCamera(); + } + else if (dy > dx && dy > -dx) { // top mInitialOffset.mX = 0; @@ -469,9 +500,20 @@ BOOL LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLJoystickCameraRotate::handleMouseUp(S32 x, S32 y, MASK mask) { gAgent.setMovementLocked(FALSE); + mInCenter = FALSE; return LLJoystick::handleMouseUp(x, y, mask); } +BOOL LLJoystickCameraRotate::handleHover(S32 x, S32 y, MASK mask) +{ + if (!pointInCenterDot(x, y, CENTER_DOT_RADIUS)) + { + mInCenter = FALSE; + } + + return LLJoystick::handleHover(x, y, mask); +} + void LLJoystickCameraRotate::onHeldDown() { updateSlop(); @@ -504,6 +546,11 @@ void LLJoystickCameraRotate::onHeldDown() } } +void LLJoystickCameraRotate::resetJoystickCamera() +{ + gAgentCamera.resetCameraOrbit(); +} + F32 LLJoystickCameraRotate::getOrbitRate() { F32 time = getElapsedHeldDownTime(); @@ -536,24 +583,31 @@ void LLJoystickCameraRotate::draw() getImageUnselected()->draw( 0, 0 ); LLPointer image = getImageSelected(); - if( mInTop ) + if (mInCenter) { - drawRotatedImage( getImageSelected(), 0 ); + drawRotatedImage(LLUI::getUIImage(mCenterImageName), 0); } - - if( mInRight ) + else { - drawRotatedImage( getImageSelected(), 1 ); - } + if (mInTop) + { + drawRotatedImage(getImageSelected(), 0); + } - if( mInBottom ) - { - drawRotatedImage( getImageSelected(), 2 ); - } + if (mInRight) + { + drawRotatedImage(getImageSelected(), 1); + } - if( mInLeft ) - { - drawRotatedImage( getImageSelected(), 3 ); + if (mInBottom) + { + drawRotatedImage(getImageSelected(), 2); + } + + if (mInLeft) + { + drawRotatedImage(getImageSelected(), 3); + } } } @@ -613,7 +667,9 @@ LLJoystickCameraTrack::Params::Params() LLJoystickCameraTrack::LLJoystickCameraTrack(const LLJoystickCameraTrack::Params& p) : LLJoystickCameraRotate(p) -{} +{ + mCenterImageName = "Cam_Tracking_Center"; +} void LLJoystickCameraTrack::onHeldDown() @@ -646,3 +702,8 @@ void LLJoystickCameraTrack::onHeldDown() gAgentCamera.setPanDownKey(getOrbitRate()); } } + +void LLJoystickCameraTrack::resetJoystickCamera() +{ + gAgentCamera.resetCameraPan(); +} diff --git a/indra/newview/lljoystickbutton.h b/indra/newview/lljoystickbutton.h index 4e6c774cad..3e29215f61 100644 --- a/indra/newview/lljoystickbutton.h +++ b/indra/newview/lljoystickbutton.h @@ -79,7 +79,8 @@ public: * Image containing circle is square and this square has adherent points with joystick * circle. Make sure to change method according to shape other than square. */ - bool pointInCircle(S32 x, S32 y) const; + bool pointInCircle(S32 x, S32 y) const; + bool pointInCenterDot(S32 x, S32 y, S32 radius) const; static std::string nameFromQuadrant(const EJoystickQuadrant quadrant); static EJoystickQuadrant quadrantFromName(const std::string& name); @@ -147,7 +148,9 @@ public: virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual void onHeldDown(); + virtual void resetJoystickCamera(); virtual void draw(); protected: @@ -160,6 +163,9 @@ protected: BOOL mInTop; BOOL mInRight; BOOL mInBottom; + BOOL mInCenter; + + std::string mCenterImageName; }; @@ -176,6 +182,7 @@ public: LLJoystickCameraTrack(const LLJoystickCameraTrack::Params&); virtual void onHeldDown(); + virtual void resetJoystickCamera(); }; #endif // LL_LLJOYSTICKBUTTON_H diff --git a/indra/newview/skins/default/textures/bottomtray/Cam_Rotate_Center.png b/indra/newview/skins/default/textures/bottomtray/Cam_Rotate_Center.png new file mode 100644 index 0000000000..ffc3c85ea2 Binary files /dev/null and b/indra/newview/skins/default/textures/bottomtray/Cam_Rotate_Center.png differ diff --git a/indra/newview/skins/default/textures/bottomtray/Cam_Tracking_Center.png b/indra/newview/skins/default/textures/bottomtray/Cam_Tracking_Center.png new file mode 100644 index 0000000000..2812d614e6 Binary files /dev/null and b/indra/newview/skins/default/textures/bottomtray/Cam_Tracking_Center.png differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index b086f7dfa8..2a4171f11b 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -113,8 +113,10 @@ with the same filename but different name + + -- cgit v1.2.3 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(-) (limited to 'indra/newview') 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" /> Date: Tue, 10 Dec 2019 15:44:01 +0200 Subject: SL-12429 Use different setting name to prevent crash on old viewer --- indra/newview/app_settings/settings.xml | 15 +++++++++++++-- indra/newview/llagentcamera.cpp | 4 ++-- indra/newview/llfloatercamera.cpp | 6 +++--- indra/newview/llpresetsmanager.cpp | 6 +++--- 4 files changed, 21 insertions(+), 10 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 2fe5817772..86c3e6cf3f 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1562,10 +1562,10 @@ Value 1.0 - CameraPreset + CameraPreset Comment - Preset camera position - view (0 - rear, 1 - front, 2 - group, 3 - custom) + Preset camera position - view (0 - rear, 1 - front, 2 - group) Persist 1 Type @@ -16351,6 +16351,17 @@ Value Rear View + CameraPresetType + + Comment + Preset camera position - view (0 - rear, 1 - front, 2 - group, 3 - custom) + Persist + 1 + Type + U32 + Value + 0 + CefVerboseLog Comment diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 67b117657f..eb730d105d 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -208,7 +208,7 @@ void LLAgentCamera::init() mCameraFocusOffsetTarget = LLVector4(gSavedSettings.getVector3("CameraOffsetBuild")); - mCameraPreset = (ECameraPreset) gSavedSettings.getU32("CameraPreset"); + mCameraPreset = (ECameraPreset) gSavedSettings.getU32("CameraPresetType"); mCameraOffsetInitial = gSavedSettings.getControl("CameraOffsetRearView"); mFocusOffsetInitial = gSavedSettings.getControl("FocusOffsetRearView"); @@ -2386,7 +2386,7 @@ void LLAgentCamera::switchCameraPreset(ECameraPreset preset) resetPanDiff(); resetOrbitDiff(); - gSavedSettings.setU32("CameraPreset", mCameraPreset); + gSavedSettings.setU32("CameraPresetType", mCameraPreset); } diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index d3c1ba764b..7e538d1bfc 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -498,7 +498,7 @@ void LLFloaterCamera::updateState() void LLFloaterCamera::updateItemsSelection() { - ECameraPreset preset = (ECameraPreset) gSavedSettings.getU32("CameraPreset"); + ECameraPreset preset = (ECameraPreset) gSavedSettings.getU32("CameraPresetType"); LLSD argument; argument["selected"] = (preset == CAMERA_PRESET_REAR_VIEW) && !sFreeCamera; getChild("rear_view")->setValue(argument); @@ -588,11 +588,11 @@ void LLFloaterCamera::populatePresetCombo() std::string active_preset_name = gSavedSettings.getString("PresetCameraActive"); if (active_preset_name.empty()) { - gSavedSettings.setU32("CameraPreset", CAMERA_PRESET_CUSTOM); + gSavedSettings.setU32("CameraPresetType", CAMERA_PRESET_CUSTOM); updateItemsSelection(); mPresetCombo->setLabel(getString("inactive_combo_text")); } - else if ((ECameraPreset)gSavedSettings.getU32("CameraPreset") == CAMERA_PRESET_CUSTOM) + else if ((ECameraPreset)gSavedSettings.getU32("CameraPresetType") == CAMERA_PRESET_CUSTOM) { mPresetCombo->selectByValue(active_preset_name); } diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index dda705eeca..c4161ed1bc 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -309,7 +309,7 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n } else { - ECameraPreset new_camera_preset = (ECameraPreset)gSavedSettings.getU32("CameraPreset"); + ECameraPreset new_camera_preset = (ECameraPreset)gSavedSettings.getU32("CameraPresetType"); bool new_camera_offsets = false; if (IS_CAMERA) { @@ -332,7 +332,7 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n { new_camera_preset = CAMERA_PRESET_CUSTOM; } - new_camera_offsets = (!isDefaultCameraPreset(name) || (ECameraPreset)gSavedSettings.getU32("CameraPreset") != new_camera_preset); + new_camera_offsets = (!isDefaultCameraPreset(name) || (ECameraPreset)gSavedSettings.getU32("CameraPresetType") != new_camera_preset); } for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) { @@ -353,7 +353,7 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n } if (IS_CAMERA) { - gSavedSettings.setU32("CameraPreset", new_camera_preset); + gSavedSettings.setU32("CameraPresetType", new_camera_preset); } } -- cgit v1.2.3 From abd5277a7b3dac90e8a555eefe855cfcca1536dc Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Wed, 18 Dec 2019 11:26:22 +0200 Subject: SL-12424 WIP Save mousewheel zoom fraction in preset --- indra/newview/app_settings/camera/Front.xml | 11 +++++++++++ indra/newview/app_settings/camera/Rear.xml | 11 +++++++++++ indra/newview/app_settings/camera/Side.xml | 11 +++++++++++ indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llfloatercamera.cpp | 1 + indra/newview/llpresetsmanager.cpp | 4 +++- 6 files changed, 48 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/camera/Front.xml b/indra/newview/app_settings/camera/Front.xml index cb3380589e..e4839d48ec 100644 --- a/indra/newview/app_settings/camera/Front.xml +++ b/indra/newview/app_settings/camera/Front.xml @@ -63,6 +63,17 @@ Value 1 + CameraZoomFraction + + Comment + Mousewheel driven fraction of zoom + Persist + 1 + Type + F32 + Value + 0.9 + EditCameraMovement Comment diff --git a/indra/newview/app_settings/camera/Rear.xml b/indra/newview/app_settings/camera/Rear.xml index 0bfe5a9ed8..72e6c5d93a 100644 --- a/indra/newview/app_settings/camera/Rear.xml +++ b/indra/newview/app_settings/camera/Rear.xml @@ -63,6 +63,17 @@ Value 1 + CameraZoomFraction + + Comment + Mousewheel driven fraction of zoom + Persist + 1 + Type + F32 + Value + 0.9 + EditCameraMovement Comment diff --git a/indra/newview/app_settings/camera/Side.xml b/indra/newview/app_settings/camera/Side.xml index 49582a8a3c..eb3b3253c1 100644 --- a/indra/newview/app_settings/camera/Side.xml +++ b/indra/newview/app_settings/camera/Side.xml @@ -63,6 +63,17 @@ Value 1 + CameraZoomFraction + + Comment + Mousewheel driven fraction of zoom + Persist + 1 + Type + F32 + Value + 0.9 + EditCameraMovement Comment diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 5be89c92a8..93a3c29530 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1525,6 +1525,17 @@ Value 1.0 + CameraZoomFraction + + Comment + Mousewheel driven fraction of zoom + Persist + 1 + Type + F32 + Value + 0.9 + CameraPosOnLogout Comment diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 7e538d1bfc..f45033aa20 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -565,6 +565,7 @@ void LLFloaterCamera::switchToPreset(const std::string& name) { LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, name); } + gAgentCamera.setCameraZoomFraction(gSavedSettings.getF32("CameraZoomFraction")); LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance(); if (camera_floater) diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index c4161ed1bc..73978e9dfb 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -236,7 +236,6 @@ void LLPresetsManager::getControlNames(std::vector& names) ("AppearanceCameraMovement") // From llagentcamera.cpp ("CameraOffsetBuild") - ("CameraOffsetScale") ("TrackFocusObject") ("CameraOffsetRearView") ("FocusOffsetRearView") @@ -288,6 +287,9 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n name_list.clear(); getControlNames(name_list); name_list.push_back("PresetCameraActive"); + + gSavedSettings.setF32("CameraZoomFraction", gAgentCamera.getCameraZoomFraction()); + name_list.push_back("CameraZoomFraction"); } else { -- cgit v1.2.3 From a2f0fd64e947f96305200edbdfd496529cadb90e Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 8 Jan 2020 18:14:21 +0200 Subject: SL-12510 Revert changes and separate 'Save Graphic Preset' floater --- indra/newview/CMakeLists.txt | 2 + indra/newview/llfloatercamera.cpp | 3 +- indra/newview/llfloatersavecamerapreset.cpp | 153 +++++++++++++++++++++ indra/newview/llfloatersavecamerapreset.h | 60 ++++++++ indra/newview/llfloatersaveprefpreset.cpp | 97 +++---------- indra/newview/llfloatersaveprefpreset.h | 12 +- indra/newview/llpresetsmanager.cpp | 2 +- indra/newview/llviewerfloaterreg.cpp | 2 + .../default/xui/en/floater_save_camera_preset.xml | 70 ++++++++++ .../default/xui/en/floater_save_pref_preset.xml | 72 ++++------ 10 files changed, 335 insertions(+), 138 deletions(-) create mode 100644 indra/newview/llfloatersavecamerapreset.cpp create mode 100644 indra/newview/llfloatersavecamerapreset.h create mode 100644 indra/newview/skins/default/xui/en/floater_save_camera_preset.xml (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 6472b464d8..8016ce496a 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -296,6 +296,7 @@ set(viewer_SOURCE_FILES llfloaterregioninfo.cpp llfloaterreporter.cpp llfloaterregionrestarting.cpp + llfloatersavecamerapreset.cpp llfloatersaveprefpreset.cpp llfloatersceneloadstats.cpp llfloaterscriptdebug.cpp @@ -923,6 +924,7 @@ set(viewer_HEADER_FILES llfloaterregioninfo.h llfloaterreporter.h llfloaterregionrestarting.h + llfloatersavecamerapreset.h llfloatersaveprefpreset.h llfloatersceneloadstats.h llfloaterscriptdebug.h diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index f45033aa20..860005bfbe 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -610,11 +610,10 @@ void LLFloaterCamera::onSavePreset() LLFloaterReg::hideInstance("load_pref_preset", PRESETS_CAMERA); LLSD key; - key["subdirectory"] = PRESETS_CAMERA; std::string current_preset = gSavedSettings.getString("PresetCameraActive"); bool is_custom_preset = current_preset != "" && !LLPresetsManager::getInstance()->isDefaultCameraPreset(current_preset); key["index"] = is_custom_preset ? 1 : 0; - LLFloaterReg::showInstance("save_pref_preset", key); + LLFloaterReg::showInstance("save_camera_preset", key); } void LLFloaterCamera::onCustomPresetSelected() diff --git a/indra/newview/llfloatersavecamerapreset.cpp b/indra/newview/llfloatersavecamerapreset.cpp new file mode 100644 index 0000000000..b1c9e561f7 --- /dev/null +++ b/indra/newview/llfloatersavecamerapreset.cpp @@ -0,0 +1,153 @@ +/** + * @file llfloatersavecamerapreset.cpp + * @brief Floater to save a camera preset + * + * $LicenseInfo:firstyear=2020&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2020, 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 "LLFloaterSaveCameraPreset.h" + +#include "llbutton.h" +#include "llcombobox.h" +#include "llfloaterpreference.h" +#include "llfloaterreg.h" +#include "lllineeditor.h" +#include "llnotificationsutil.h" +#include "llpresetsmanager.h" +#include "llradiogroup.h" +#include "lltrans.h" + +LLFloaterSaveCameraPreset::LLFloaterSaveCameraPreset(const LLSD &key) + : LLModalDialog(key) +{ +} + +// virtual +BOOL LLFloaterSaveCameraPreset::postBuild() +{ + mPresetCombo = getChild("preset_combo"); + + mNameEditor = getChild("preset_txt_editor"); + mNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterSaveCameraPreset::onPresetNameEdited, this), NULL); + + mSaveButton = getChild("save"); + mSaveButton->setCommitCallback(boost::bind(&LLFloaterSaveCameraPreset::onBtnSave, this)); + + mSaveRadioGroup = getChild("radio_save_preset"); + mSaveRadioGroup->setCommitCallback(boost::bind(&LLFloaterSaveCameraPreset::onSwitchSaveReplace, this)); + + getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterSaveCameraPreset::onBtnCancel, this)); + + LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterSaveCameraPreset::onPresetsListChange, this)); + + return TRUE; +} + +void LLFloaterSaveCameraPreset::onPresetNameEdited() +{ + if (mSaveRadioGroup->getSelectedIndex() == 0) + { + // Disable saving a preset having empty name. + std::string name = mNameEditor->getValue(); + mSaveButton->setEnabled(!name.empty()); + } +} + +void LLFloaterSaveCameraPreset::onOpen(const LLSD& key) +{ + LLModalDialog::onOpen(key); + S32 index = 0; + if (key.has("index")) + { + index = key["index"].asInteger(); + } + + LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, DEFAULT_HIDE); + + mSaveRadioGroup->setSelectedIndex(index); + onPresetNameEdited(); + onSwitchSaveReplace(); +} + +void LLFloaterSaveCameraPreset::onBtnSave() +{ + bool is_saving_new = mSaveRadioGroup->getSelectedIndex() == 0; + std::string name = is_saving_new ? mNameEditor->getText() : mPresetCombo->getSimple(); + + if ((name == LLTrans::getString(PRESETS_DEFAULT)) || (name == PRESETS_DEFAULT)) + { + LLNotificationsUtil::add("DefaultPresetNotSaved"); + } + else + { + if (is_saving_new) + { + std::list preset_names; + std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_CAMERA); + LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, preset_names, DEFAULT_HIDE); + if (std::find(preset_names.begin(), preset_names.end(), name) != preset_names.end()) + { + LLSD args; + args["NAME"] = name; + LLNotificationsUtil::add("PresetAlreadyExists", args); + return; + } + } + if (!LLPresetsManager::getInstance()->savePreset(PRESETS_CAMERA, name)) + { + LLSD args; + args["NAME"] = name; + LLNotificationsUtil::add("PresetNotSaved", args); + } + } + + closeFloater(); +} + +void LLFloaterSaveCameraPreset::onPresetsListChange() +{ + LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, DEFAULT_HIDE); +} + +void LLFloaterSaveCameraPreset::onBtnCancel() +{ + closeFloater(); +} + +void LLFloaterSaveCameraPreset::onSwitchSaveReplace() +{ + bool is_saving_new = mSaveRadioGroup->getSelectedIndex() == 0; + std::string label = is_saving_new ? getString("btn_label_save") : getString("btn_label_replace"); + mSaveButton->setLabel(label); + mNameEditor->setEnabled(is_saving_new); + mPresetCombo->setEnabled(!is_saving_new); + if (is_saving_new) + { + onPresetNameEdited(); + } + else + { + mSaveButton->setEnabled(true); + } +} diff --git a/indra/newview/llfloatersavecamerapreset.h b/indra/newview/llfloatersavecamerapreset.h new file mode 100644 index 0000000000..282f213438 --- /dev/null +++ b/indra/newview/llfloatersavecamerapreset.h @@ -0,0 +1,60 @@ +/** + * @file llfloatersavecamerapreset.h + * @brief Floater to save a camera preset + + * + * $LicenseInfo:firstyear=2020&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2020, 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_LLFLOATERSAVECAMERAPRESET_H +#define LL_LLFLOATERSAVECAMERAPRESET_H + +#include "llmodaldialog.h" + +class LLComboBox; +class LLRadioGroup; +class LLLineEditor; + +class LLFloaterSaveCameraPreset : public LLModalDialog +{ + +public: + LLFloaterSaveCameraPreset(const LLSD &key); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + + void onBtnSave(); + void onBtnCancel(); + void onSwitchSaveReplace(); + +private: + LLRadioGroup* mSaveRadioGroup; + LLLineEditor* mNameEditor; + LLComboBox* mPresetCombo; + LLButton* mSaveButton; + + void onPresetsListChange(); + void onPresetNameEdited(); +}; + +#endif // LL_LLFLOATERSAVECAMERAPRESET_H diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index 3142991704..5f3cf9d95b 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -1,6 +1,6 @@ /** * @file llfloatersaveprefpreset.cpp - * @brief Floater to save a graphics / camera preset + * @brief Floater to save a graphics preset * * $LicenseInfo:firstyear=2014&license=viewerlgpl$ * Second Life Viewer Source Code @@ -32,14 +32,12 @@ #include "llcombobox.h" #include "llfloaterpreference.h" #include "llfloaterreg.h" -#include "lllineeditor.h" #include "llnotificationsutil.h" #include "llpresetsmanager.h" -#include "llradiogroup.h" #include "lltrans.h" LLFloaterSavePrefPreset::LLFloaterSavePrefPreset(const LLSD &key) - : LLModalDialog(key) + : LLFloater(key) { } @@ -52,93 +50,51 @@ BOOL LLFloaterSavePrefPreset::postBuild() preferences->addDependentFloater(this); } - mPresetCombo = getChild("preset_combo"); - - mNameEditor = getChild("preset_txt_editor"); - mNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this), NULL); + getChild("preset_combo")->setTextEntryCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); + getChild("preset_combo")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); + getChild("save")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnSave, this)); - mSaveButton = getChild("save"); - mSaveButton->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnSave, this)); - - mSaveRadioGroup = getChild("radio_save_preset"); - mSaveRadioGroup->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onSwitchSaveReplace, this)); - getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnCancel, this)); LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetsListChange, this)); + + mSaveButton = getChild("save"); + mPresetCombo = getChild("preset_combo"); return TRUE; } void LLFloaterSavePrefPreset::onPresetNameEdited() { - if (mSaveRadioGroup->getSelectedIndex() == 0) - { - // Disable saving a preset having empty name. - std::string name = mNameEditor->getValue(); - mSaveButton->setEnabled(!name.empty()); - } + // Disable saving a preset having empty name. + std::string name = mPresetCombo->getSimple(); + + mSaveButton->setEnabled(!name.empty()); } void LLFloaterSavePrefPreset::onOpen(const LLSD& key) { - LLModalDialog::onOpen(key); - S32 index = 0; - if (key.has("subdirectory")) - { - mSubdirectory = key["subdirectory"].asString(); - if (key.has("index")) - { - index = key["index"].asInteger(); - } - } - else - { - mSubdirectory = key.asString(); - } - - std::string floater_title = getString(std::string("title_") + mSubdirectory); - - setTitle(floater_title); + mSubdirectory = key.asString(); EDefaultOptions option = DEFAULT_HIDE; LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); - mSaveRadioGroup->setSelectedIndex(index); onPresetNameEdited(); - onSwitchSaveReplace(); } void LLFloaterSavePrefPreset::onBtnSave() { - bool is_saving_new = mSaveRadioGroup->getSelectedIndex() == 0; - std::string name = is_saving_new ? mNameEditor->getText() : mPresetCombo->getSimple(); + std::string name = mPresetCombo->getSimple(); if ((name == LLTrans::getString(PRESETS_DEFAULT)) || (name == PRESETS_DEFAULT)) { LLNotificationsUtil::add("DefaultPresetNotSaved"); } - else + else if (!LLPresetsManager::getInstance()->savePreset(mSubdirectory, name)) { - if (is_saving_new) - { - std::list preset_names; - std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(mSubdirectory); - LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, preset_names, DEFAULT_HIDE); - if (std::find(preset_names.begin(), preset_names.end(), name) != preset_names.end()) - { - LLSD args; - args["NAME"] = name; - LLNotificationsUtil::add("PresetAlreadyExists", args); - return; - } - } - if (!LLPresetsManager::getInstance()->savePreset(mSubdirectory, name)) - { - LLSD args; - args["NAME"] = name; - LLNotificationsUtil::add("PresetNotSaved", args); - } + LLSD args; + args["NAME"] = name; + LLNotificationsUtil::add("PresetNotSaved", args); } closeFloater(); @@ -154,20 +110,3 @@ void LLFloaterSavePrefPreset::onBtnCancel() { closeFloater(); } - -void LLFloaterSavePrefPreset::onSwitchSaveReplace() -{ - bool is_saving_new = mSaveRadioGroup->getSelectedIndex() == 0; - std::string label = is_saving_new ? getString("btn_label_save") : getString("btn_label_replace"); - mSaveButton->setLabel(label); - mNameEditor->setEnabled(is_saving_new); - mPresetCombo->setEnabled(!is_saving_new); - if (is_saving_new) - { - onPresetNameEdited(); - } - else - { - mSaveButton->setEnabled(true); - } -} diff --git a/indra/newview/llfloatersaveprefpreset.h b/indra/newview/llfloatersaveprefpreset.h index c61379e5ad..ae58180e7f 100644 --- a/indra/newview/llfloatersaveprefpreset.h +++ b/indra/newview/llfloatersaveprefpreset.h @@ -1,6 +1,6 @@ /** * @file llfloatersaveprefpreset.h - * @brief Floater to save a graphics / camera preset + * @brief Floater to save a graphics preset * * $LicenseInfo:firstyear=2014&license=viewerlgpl$ @@ -28,13 +28,11 @@ #ifndef LL_LLFLOATERSAVEPREFPRESET_H #define LL_LLFLOATERSAVEPREFPRESET_H -#include "llmodaldialog.h" +#include "llfloater.h" class LLComboBox; -class LLRadioGroup; -class LLLineEditor; -class LLFloaterSavePrefPreset : public LLModalDialog +class LLFloaterSavePrefPreset : public LLFloater { public: @@ -45,11 +43,9 @@ public: void onBtnSave(); void onBtnCancel(); - void onSwitchSaveReplace(); private: - LLRadioGroup* mSaveRadioGroup; - LLLineEditor* mNameEditor; + LLComboBox* mPresetCombo; LLButton* mSaveButton; diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 73978e9dfb..6b83be2b70 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -430,7 +430,7 @@ bool LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, else { combo->setLabel(LLTrans::getString("preset_combo_label")); - combo->setEnabled(FALSE); + combo->setEnabled(PRESETS_CAMERA != subdirectory); sts = false; } } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index d897d59217..90682f8f43 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -112,6 +112,7 @@ #include "llfloaterregioninfo.h" #include "llfloaterregionrestarting.h" #include "llfloaterreporter.h" +#include "llfloatersavecamerapreset.h" #include "llfloatersaveprefpreset.h" #include "llfloatersceneloadstats.h" #include "llfloaterscriptdebug.h" @@ -318,6 +319,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("properties", "floater_inventory_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("publish_classified", "floater_publish_classified.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("save_pref_preset", "floater_save_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("save_camera_preset", "floater_save_camera_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("script_colors", "floater_script_ed_prefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("telehubs", "floater_telehub.xml",&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/floater_save_camera_preset.xml b/indra/newview/skins/default/xui/en/floater_save_camera_preset.xml new file mode 100644 index 0000000000..54fdb6d167 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_save_camera_preset.xml @@ -0,0 +1,70 @@ + + + + Save + Replace + + + + + +