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') 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