summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaxim_productengine <mnikolenko@productengine.com>2019-11-13 17:39:40 +0200
committermaxim_productengine <mnikolenko@productengine.com>2019-11-13 17:39:40 +0200
commit7637f343865960ee509ae31205c097f0bb04aac1 (patch)
tree45c20e7b9337d5a068ce0cf39ef0eef012b4c58a
parent4778417f25f070e9019e975c979d93fb8881b5ac (diff)
SL-12186 WIP Get rid of excessive offset settings as we moved to store data in xml
-rw-r--r--indra/newview/app_settings/camera/Front.xml4
-rw-r--r--indra/newview/app_settings/camera/Side.xml4
-rw-r--r--indra/newview/llagentcamera.cpp37
-rw-r--r--indra/newview/llagentcamera.h12
-rw-r--r--indra/newview/llfloaterpreferenceviewadvanced.cpp4
-rw-r--r--indra/newview/llpresetsmanager.cpp40
-rw-r--r--indra/newview/llpresetsmanager.h1
-rw-r--r--indra/newview/llviewermenu.cpp8
8 files changed, 21 insertions, 89 deletions
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 @@
<real>6</real>
</array>
</map>
- <key>CameraOffsetFrontView</key>
+ <key>CameraOffsetRearView</key>
<map>
<key>Comment</key>
<string>Initial camera offset from avatar in Front View</string>
@@ -74,7 +74,7 @@
<key>Value</key>
<integer>0</integer>
</map>
- <key>FocusOffsetFrontView</key>
+ <key>FocusOffsetRearView</key>
<map>
<key>Comment</key>
<string>Initial focus point offset relative to avatar for the camera preset Front View (x-axis is forward)</string>
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 @@
<real>6</real>
</array>
</map>
- <key>CameraOffsetGroupView</key>
+ <key>CameraOffsetRearView</key>
<map>
<key>Comment</key>
<string>Initial camera offset from avatar in Side View</string>
@@ -74,7 +74,7 @@
<key>Value</key>
<integer>0</integer>
</map>
- <key>FocusOffsetGroupView</key>
+ <key>FocusOffsetRearView</key>
<map>
<key>Comment</key>
<string>Initial focus point offset relative to avatar for the camera preset Side View (x-axis is forward)</string>
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<LLVector3d>(mFocusOffsetInitial[mCameraPreset]->get(), TYPE_VEC3D, "");
+ focus_offset = convert_from_llsd<LLVector3d>(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<LLVector3>(mCameraOffsetInitial[mCameraPreset]->get(), TYPE_VEC3, "");
+ return convert_from_llsd<LLVector3>(mCameraOffsetInitial->get(), TYPE_VEC3, "");
}
LLVector3d LLAgentCamera::getFocusOffsetInitial()
{
- return convert_from_llsd<LLVector3d>(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<LLVector3d>(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<ECameraPreset, LLPointer<LLControlVariable> > mCameraOffsetInitial;
+ /** Initial camera offset */
+ LLPointer<LLControlVariable> mCameraOffsetInitial;
- /** Initial focus offsets */
- std::map<ECameraPreset, LLPointer<LLControlVariable> > mFocusOffsetInitial;
+ /** Initial focus offset */
+ LLPointer<LLControlVariable> 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<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(gAgentCamera.getCameraOffsetCtrlName(), vector);
+ 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(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<std::string> name_list;
getControlNames(name_list);
- getOffsetControlNames(name_list);
for (std::vector<std::string>::iterator it = name_list.begin(); it != name_list.end(); ++it)
{
@@ -254,23 +253,10 @@ void LLPresetsManager::getControlNames(std::vector<std::string>& names)
("CameraOffsetBuild")
("CameraOffsetScale")
("TrackFocusObject")
- ;
- names = camera_controls;
-}
-
-void LLPresetsManager::getOffsetControlNames(std::vector<std::string>& names)
-{
- const std::vector<std::string> 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<std::string>::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<std::string>& names);
- void getOffsetControlNames(std::vector<std::string>& 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();