summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorJonathan Yap <jhwelch@gmail.com>2018-01-13 12:18:40 -0500
committerJonathan Yap <jhwelch@gmail.com>2018-01-13 12:18:40 -0500
commit527388694a8bb3f3c3bf1510e1e79562dd426385 (patch)
treea693760373ac1f7f34443b78068b6e5014a4af00 /indra/newview
parent1e586749efeeb8c40503330572680a8709ae5487 (diff)
STORM-2145 Added a small floater
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/app_settings/settings.xml31
-rw-r--r--indra/newview/llagentcamera.cpp2
-rw-r--r--indra/newview/llfloaterpreference.cpp2
-rw-r--r--indra/newview/llfloaterpreferencemoveadvanced.cpp151
-rw-r--r--indra/newview/llfloaterpreferencemoveadvanced.h58
-rw-r--r--indra/newview/llpanelpresetscamerapulldown.cpp2
-rw-r--r--indra/newview/llpresetsmanager.cpp10
-rw-r--r--indra/newview/llviewerfloaterreg.cpp2
-rw-r--r--indra/newview/skins/default/xui/en/floater_preferences_move_advanced.xml140
-rw-r--r--indra/newview/skins/default/xui/en/panel_preferences_move.xml14
11 files changed, 369 insertions, 45 deletions
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 @@
<key>Value</key>
<string />
</map>
- <key>CameraOffsetCustom0</key>
- <map>
- <key>Comment</key>
- <string>Customized camera offset from avatar</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Vector3</string>
- <key>Value</key>
- <array>
- <real>-3.0</real>
- <real>0.0</real>
- <real>0.75</real>
- </array>
- </map>
- <key>FocusOffsetCustom0</key>
- <map>
- <key>Comment</key>
- <string>Custom focus point offset relative to avatar (x-axis is forward)</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Vector3D</string>
- <key>Value</key>
- <array>
- <real>1.0</real>
- <real>0.0</real>
- <real>1.0</real>
- </array>
- </map>
</map>
</llsd>
-
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<LLSpinCtrl>("camera_x");
+ LLSpinCtrl* spinnery = getChild<LLSpinCtrl>("camera_y");
+ LLSpinCtrl* spinnerz = getChild<LLSpinCtrl>("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<LLSpinCtrl>("focus_x");
+ LLSpinCtrl* spinnery = getChild<LLSpinCtrl>("focus_y");
+ LLSpinCtrl* spinnerz = getChild<LLSpinCtrl>("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<LLUICtrl>("camera_x")->getValue().asReal();
+ vector.mV[VY] = (F32)getChild<LLUICtrl>("camera_y")->getValue().asReal();
+ vector.mV[VZ] = (F32)getChild<LLUICtrl>("camera_z")->getValue().asReal();
+ gSavedSettings.setVector3("CameraOffsetRearView", vector);
+
+ vector3d.mdV[VX] = (F32)getChild<LLUICtrl>("focus_x")->getValue().asReal();
+ vector3d.mdV[VY] = (F32)getChild<LLUICtrl>("focus_y")->getValue().asReal();
+ vector3d.mdV[VZ] = (F32)getChild<LLUICtrl>("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<std::string>::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<LLControlVariable> 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<std::string>& 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<LLFloaterSidePanelContainer>);
LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>);
LLFloaterReg::add("prefs_graphics_advanced", "floater_preferences_graphics_advanced.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreferenceGraphicsAdvanced>);
+ LLFloaterReg::add("prefs_move_advanced", "floater_preferences_move_advanced.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreferenceMoveAdvanced>);
LLFloaterReg::add("prefs_proxy", "floater_preferences_proxy.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreferenceProxy>);
LLFloaterReg::add("prefs_spellchecker_import", "floater_spellcheck_import.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSpellCheckerImport>);
LLFloaterReg::add("prefs_translation", "floater_translation_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTranslationSettings>);
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 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+ height="170"
+ layout="topleft"
+ name="floaterpreferencesmoveadvanced"
+ help_topic="floatermoveadvanced"
+ title="ADJUST CAMERA VIEW"
+ save_rect="true"
+ width="280">
+
+ <text
+ follows="top|left|right"
+ height="16"
+ layout="topleft"
+ left="10"
+ top="10"
+ width="100">
+ Camera offset:
+ </text>
+
+ <spinner
+ height="20"
+ label="X"
+ label_width="12"
+ follows="topl|eft"
+ left="10"
+ name="camera_x"
+ top_pad="5"
+ min_val="-1e+007"
+ max_val="1e+007"
+ width="70">
+ <spinner.commit_callback
+ function="CommitSettings" />
+ </spinner>
+
+ <spinner
+ height="20"
+ label="Y"
+ label_width="12"
+ follows="topl|eft"
+ name="camera_y"
+ left_pad="20"
+ min_val="-1e+007"
+ max_val="1e+007"
+ width="70">
+ <spinner.commit_callback
+ function="CommitSettings" />
+ </spinner>
+
+ <spinner
+ height="20"
+ label="Z"
+ label_width="12"
+ follows="topl|eft"
+ name="camera_z"
+ left_pad="20"
+ min_val="-1e+007"
+ max_val="1e+007"
+ width="70">
+ <spinner.commit_callback
+ function="CommitSettings" />
+ </spinner>
+
+ <text
+ follows="top|left|right"
+ height="16"
+ layout="topleft"
+ left="10"
+ top_pad="20"
+ width="100">
+ Focus offset:
+ </text>
+
+ <spinner
+ height="20"
+ label="X"
+ label_width="12"
+ follows="topl|eft"
+ left="10"
+ name="focus_x"
+ top_pad="5"
+ min_val="-1e+007"
+ max_val="1e+007"
+ width="70">
+ <spinner.commit_callback
+ function="CommitSettings" />
+ </spinner>
+
+ <spinner
+ height="20"
+ label="Y"
+ label_width="12"
+ follows="topl|eft"
+ name="focus_y"
+ left_pad="20"
+ min_val="-1e+007"
+ max_val="1e+007"
+ width="70">
+ <spinner.commit_callback
+ function="CommitSettings" />
+ </spinner>
+
+ <spinner
+ height="20"
+ label="Z"
+ label_width="12"
+ follows="topl|eft"
+ name="focus_z"
+ left_pad="20"
+ min_val="-1e+007"
+ max_val="1e+007"
+ width="70">
+ <spinner.commit_callback
+ function="CommitSettings" />
+ </spinner>
+
+ <button
+ follows="left|top"
+ height="23"
+ label="OK"
+ layout="topleft"
+ left="90"
+ name="ok"
+ top_pad="30"
+ width="90">
+ <button.commit_callback
+ function="Ok"/>
+ </button>
+ <button
+ follows="left|top"
+ height="23"
+ label="Cancel"
+ layout="topleft"
+ left_pad="5"
+ name="cancel"
+ width="90">
+ <button.commit_callback
+ function="Cancel"/>
+ </button>
+</floater>
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
@@ -130,6 +130,20 @@
<button
follows="top|left"
height="23"
+ label="Advanced..."
+ layout="topleft"
+ left_pad="-102"
+ name="PreferencesMoveAdvanced"
+ tool_tip="Adjust camera positioning"
+ width="115">
+ <button.commit_callback
+ function="Floater.Show"
+ parameter="prefs_move_advanced" />
+ </button>
+
+ <button
+ follows="top|left"
+ height="23"
label="Save settings as a preset..."
layout="topleft"
left="30"