From 527388694a8bb3f3c3bf1510e1e79562dd426385 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sat, 13 Jan 2018 12:18:40 -0500 Subject: STORM-2145 Added a small floater --- indra/llui/llfloater.cpp | 2 + indra/newview/CMakeLists.txt | 2 + indra/newview/app_settings/settings.xml | 31 ----- indra/newview/llagentcamera.cpp | 2 - indra/newview/llfloaterpreference.cpp | 2 +- indra/newview/llfloaterpreferencemoveadvanced.cpp | 151 +++++++++++++++++++++ indra/newview/llfloaterpreferencemoveadvanced.h | 58 ++++++++ indra/newview/llpanelpresetscamerapulldown.cpp | 2 +- indra/newview/llpresetsmanager.cpp | 10 -- indra/newview/llviewerfloaterreg.cpp | 2 + .../xui/en/floater_preferences_move_advanced.xml | 140 +++++++++++++++++++ .../default/xui/en/panel_preferences_move.xml | 14 ++ 12 files changed, 371 insertions(+), 45 deletions(-) create mode 100644 indra/newview/llfloaterpreferencemoveadvanced.cpp create mode 100644 indra/newview/llfloaterpreferencemoveadvanced.h create mode 100644 indra/newview/skins/default/xui/en/floater_preferences_move_advanced.xml diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index e5fe6967d1..663d96bdd4 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -64,6 +64,8 @@ // use this to control "jumping" behavior when Ctrl-Tabbing const S32 TABBED_FLOATER_OFFSET = 0; +extern LLControlGroup gSavedSettings; + namespace LLInitParam { void TypeValues::declareValues() diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 658c3c56fc..7de4e85316 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -277,6 +277,7 @@ set(viewer_SOURCE_FILES llfloaterperms.cpp llfloaterpostprocess.cpp llfloaterpreference.cpp + llfloaterpreferencemoveadvanced.cpp llfloaterpreviewtrash.cpp llfloaterproperties.cpp llfloaterregiondebugconsole.cpp @@ -901,6 +902,7 @@ set(viewer_HEADER_FILES llfloaterperms.h llfloaterpostprocess.h llfloaterpreference.h + llfloaterpreferencemoveadvanced.h llfloaterpreviewtrash.h llfloaterproperties.h llfloaterregiondebugconsole.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9b5b614111..bcce87dc13 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16176,36 +16176,5 @@ Value - CameraOffsetCustom0 - - Comment - Customized camera offset from avatar - Persist - 1 - Type - Vector3 - Value - - -3.0 - 0.0 - 0.75 - - - FocusOffsetCustom0 - - Comment - Custom focus point offset relative to avatar (x-axis is forward) - Persist - 1 - Type - Vector3D - Value - - 1.0 - 0.0 - 1.0 - - - diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index e0ade4d395..5b9f1b9d4f 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -208,12 +208,10 @@ void LLAgentCamera::init() mCameraOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("CameraOffsetRearView"); mCameraOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("CameraOffsetFrontView"); mCameraOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("CameraOffsetGroupView"); - mCameraOffsetInitial[CAMERA_PRESET_CUSTOM0] = gSavedSettings.getControl("CameraOffsetCustom0"); mFocusOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("FocusOffsetRearView"); mFocusOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("FocusOffsetFrontView"); mFocusOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("FocusOffsetGroupView"); - mFocusOffsetInitial[CAMERA_PRESET_CUSTOM0] = gSavedSettings.getControl("FocusOffsetCustom0"); mCameraCollidePlane.clearVec(); mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"); diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 212cb922f2..872e961a70 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -661,7 +661,7 @@ void LLFloaterPreference::cancel() // hide spellchecker settings folder LLFloaterReg::hideInstance("prefs_spellchecker"); - // hide advancede floater + // hide advanced graphics floater LLFloaterReg::hideInstance("prefs_graphics_advanced"); // reverts any changes to current skin diff --git a/indra/newview/llfloaterpreferencemoveadvanced.cpp b/indra/newview/llfloaterpreferencemoveadvanced.cpp new file mode 100644 index 0000000000..3ff19147b1 --- /dev/null +++ b/indra/newview/llfloaterpreferencemoveadvanced.cpp @@ -0,0 +1,151 @@ +/** + * @file llfloaterpreferencemoveadvanced.cpp + * @brief floater for adjusting camera position + * + * $LicenseInfo:firstyear=2018&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2018, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llfloaterpreferencemoveadvanced.h" +#include "llfloater.h" +#include "llfloaterreg.h" +#include "lluictrlfactory.h" +#include "llspinctrl.h" +#include "llviewercontrol.h" + + +LLFloaterPreferenceMoveAdvanced::LLFloaterPreferenceMoveAdvanced(const LLSD& key) +: LLFloater(key) +{ + mCommitCallbackRegistrar.add("Cancel", boost::bind(&LLFloaterPreferenceMoveAdvanced::onClickCancel, this)); + mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterPreferenceMoveAdvanced::onCommitSettings, this)); + mCommitCallbackRegistrar.add("Ok", boost::bind(&LLFloaterPreferenceMoveAdvanced::onClickOk, this)); + +} + +LLFloaterPreferenceMoveAdvanced::~LLFloaterPreferenceMoveAdvanced() +{} + +void LLFloaterPreferenceMoveAdvanced::onClickOk() +{ + closeFloater(); +} + +void LLFloaterPreferenceMoveAdvanced::onClickCancel() +{ + gSavedSettings.setVector3("CameraOffsetRearView", mCameraSaved); + gSavedSettings.setVector3d("FocusOffsetRearView", mFocusSaved); + + updateCameraControl(mCameraSaved); + updateFocusControl(mFocusSaved); +} + +BOOL LLFloaterPreferenceMoveAdvanced::postBuild() +{ + mCameraSaved = gSavedSettings.getVector3("CameraOffsetRearView"); + mFocusSaved = gSavedSettings.getVector3d("FocusOffsetRearView"); + + updateCameraControl(mCameraSaved); + updateFocusControl(mFocusSaved); + + return TRUE; +} + +void LLFloaterPreferenceMoveAdvanced::updateCameraControl(LLVector3 vector) +{ + LLSpinCtrl* spinnerx = getChild("camera_x"); + LLSpinCtrl* spinnery = getChild("camera_y"); + LLSpinCtrl* spinnerz = getChild("camera_z"); + + if (!spinnerx || !spinnery || !spinnerz) + { + LL_WARNS() << "Could not find all desired UI camera elements" + << LL_ENDL; + return; + } + + if (!spinnerx->hasFocus()) + { + spinnerx->setValue(vector[VX]); + } + + if (!spinnery->hasFocus()) + { + spinnery->setValue(vector[VY]); + } + + if (!spinnerz->hasFocus()) + { + spinnerz->setValue(vector[VZ]); + } +} + +void LLFloaterPreferenceMoveAdvanced::updateFocusControl(LLVector3d vector3d) +{ + LLSpinCtrl* spinnerx = getChild("focus_x"); + LLSpinCtrl* spinnery = getChild("focus_y"); + LLSpinCtrl* spinnerz = getChild("focus_z"); + + if (!spinnerx || !spinnery || !spinnerz) + { + LL_WARNS() << "Could not find all desired UI focus elements" + << LL_ENDL; + return; + } + + if (!spinnerx->hasFocus()) + { + spinnerx->setValue(vector3d[VX]); + } + + if (!spinnery->hasFocus()) + { + spinnery->setValue(vector3d[VY]); + } + + if (!spinnerz->hasFocus()) + { + spinnerz->setValue(vector3d[VZ]); + } +} + + void LLFloaterPreferenceMoveAdvanced::draw() +{ +// updateControl(); + LLFloater::draw(); +} + +void LLFloaterPreferenceMoveAdvanced::onCommitSettings() +{ + LLVector3 vector; + LLVector3d vector3d; + + vector.mV[VX] = (F32)getChild("camera_x")->getValue().asReal(); + vector.mV[VY] = (F32)getChild("camera_y")->getValue().asReal(); + vector.mV[VZ] = (F32)getChild("camera_z")->getValue().asReal(); + gSavedSettings.setVector3("CameraOffsetRearView", vector); + + vector3d.mdV[VX] = (F32)getChild("focus_x")->getValue().asReal(); + vector3d.mdV[VY] = (F32)getChild("focus_y")->getValue().asReal(); + vector3d.mdV[VZ] = (F32)getChild("focus_z")->getValue().asReal(); + gSavedSettings.setVector3d("FocusOffsetRearView", vector3d); +} diff --git a/indra/newview/llfloaterpreferencemoveadvanced.h b/indra/newview/llfloaterpreferencemoveadvanced.h new file mode 100644 index 0000000000..98648af19e --- /dev/null +++ b/indra/newview/llfloaterpreferencemoveadvanced.h @@ -0,0 +1,58 @@ +/** + * @file llfloaterpreferencemoveadvanced.h + * @brief floater for adjusting camera position + * + * $LicenseInfo:firstyear=2018&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2018, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LLFLOATERPREFERENCEMOVEADVANCED_H +#define LLFLOATERPREFERENCEMOVEADVANCED_H + +#include "llcontrol.h" +#include "llfloater.h" + +class LLFloaterPreferenceMoveAdvanced +: public LLFloater +{ + friend class LLFloaterReg; + +public: + LLFloaterPreferenceMoveAdvanced(const LLSD& key); + virtual BOOL postBuild(); + virtual void draw(); + + void onCommitSettings(); + void onClickCancel(); + void onClickOk(); + void updateCameraControl(LLVector3 vector); + void updateFocusControl(LLVector3d vector3d); + +private: + virtual ~LLFloaterPreferenceMoveAdvanced(); + + LLVector3 mCameraSaved; + LLVector3d mFocusSaved; + +}; + +#endif //LLFLOATERPREFERENCEMOVEADVANCED_H + diff --git a/indra/newview/llpanelpresetscamerapulldown.cpp b/indra/newview/llpanelpresetscamerapulldown.cpp index 2c95c06c31..ffdfc445ce 100644 --- a/indra/newview/llpanelpresetscamerapulldown.cpp +++ b/indra/newview/llpanelpresetscamerapulldown.cpp @@ -64,9 +64,9 @@ BOOL LLPanelPresetsCameraPulldown::postBuild() if (presetsMgr) { presetsMgr->setPresetListChangeCameraCallback(boost::bind(&LLPanelPresetsCameraPulldown::populatePanel, this)); -LL_WARNS() << "DBG pulldown" << LL_ENDL; // Make sure there is a default preference file presetsMgr->createMissingDefault(PRESETS_CAMERA); + presetsMgr->startWatching(PRESETS_CAMERA); } diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 80386b61f7..3daa6894f0 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -92,7 +92,6 @@ void LLPresetsManager::startWatching(const std::string& subdirectory) for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) { std::string ctrl_name = *it; -LL_WARNS() << "DBG starting watch on " << ctrl_name << LL_ENDL; if (gSavedSettings.controlExists(ctrl_name)) { LLPointer cntrl_ptr = gSavedSettings.getControl(ctrl_name); @@ -189,23 +188,18 @@ bool LLPresetsManager::isCameraDirty() void LLPresetsManager::settingChanged() { -LL_WARNS() << "DBG setting changed" << LL_ENDL; setCameraDirty(true); } void LLPresetsManager::getControlNames(std::vector& names) { names = boost::assign::list_of - ("CameraOffsetCustom0") - ("FocusOffsetCustom0") // From panel_preferences_move.xml ("CameraAngle") ("CameraOffsetScale") - ("CameraOpacity") ("EditCameraMovement") ("AppearanceCameraMovement") // From llagentcamera.cpp - ("RenderFarClip") ("CameraOffsetBuild") ("CameraPreset") ("CameraOffsetRearView") @@ -246,10 +240,6 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n else if(PRESETS_CAMERA == subdirectory) { gSavedSettings.setString("PresetGraphicActive", name); -// gSavedSettings.setU32("CameraPreset", CAMERA_PRESET_CUSTOM0); - -// gSavedSettings.setVector3d("CameraOffsetCustom0", gAgentCamera.calcCameraPositionTargetGlobal()); -// gSavedSettings.setVector3d("FocusOffsetCustom0", gAgentCamera.calcFocusPositionTargetGlobal()); getControlNames(name_list); name_list.push_back("PresetCameraActive"); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 0ebacddd9b..440bf46b1e 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -104,6 +104,7 @@ #include "llfloaterperms.h" #include "llfloaterpostprocess.h" #include "llfloaterpreference.h" +#include "llfloaterpreferencemoveadvanced.h" #include "llfloaterpreviewtrash.h" #include "llfloaterproperties.h" #include "llfloaterregiondebugconsole.h" @@ -295,6 +296,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("places", "floater_places.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_graphics_advanced", "floater_preferences_graphics_advanced.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("prefs_move_advanced", "floater_preferences_move_advanced.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_proxy", "floater_preferences_proxy.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_spellchecker_import", "floater_spellcheck_import.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_translation", "floater_translation_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/floater_preferences_move_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_move_advanced.xml new file mode 100644 index 0000000000..28e5d2c607 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_preferences_move_advanced.xml @@ -0,0 +1,140 @@ + + + + + Camera offset: + + + + + + + + + + + + + + + + Focus offset: + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_preferences_move.xml b/indra/newview/skins/default/xui/en/panel_preferences_move.xml index e4a5f5e283..d832dac4ff 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_move.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_move.xml @@ -127,6 +127,20 @@ tool_tip="Use automatic camera positioning while in edit mode" width="242" /> + +