From 944b908be10367ae5770db03bddddd40cd4d18d8 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 10 Apr 2020 18:38:56 +0300 Subject: SL-12994 FIXED [Camera Presets] Zoom fraction should be saved as a part of Camera preset, not as separate setting --- indra/newview/llagentcamera.cpp | 8 ++++++-- indra/newview/llagentcamera.h | 3 +++ indra/newview/llfloatercamera.cpp | 3 ++- indra/newview/llfloatersavecamerapreset.cpp | 6 ++++++ indra/newview/llpresetsmanager.cpp | 3 --- 5 files changed, 17 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index d1da132587..f1d8bf3cf1 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1987,8 +1987,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) LLVector3 LLAgentCamera::getCurrentCameraOffset() { - LLVector3 camera_offset = (LLViewerCamera::getInstance()->getOrigin() - getAvatarRootPosition() - mThirdPersonHeadOffset) * ~getCurrentAvatarRotation(); - return camera_offset / mCameraZoomFraction / gSavedSettings.getF32("CameraOffsetScale"); + return (LLViewerCamera::getInstance()->getOrigin() - getAvatarRootPosition() - mThirdPersonHeadOffset) * ~getCurrentAvatarRotation(); } LLVector3d LLAgentCamera::getCurrentFocusOffset() @@ -2829,6 +2828,11 @@ BOOL LLAgentCamera::setPointAt(EPointAtType target_type, LLViewerObject *object, return mPointAt->setPointAt(target_type, object, position); } +void LLAgentCamera::resetCameraZoomFraction() +{ + mCameraZoomFraction = INITIAL_ZOOM_FRACTION; +} + ELookAtType LLAgentCamera::getLookAtType() { if (mLookAt) diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 357dd5e12a..420cc0b601 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -282,6 +282,9 @@ public: F32 calcCameraFOVZoomFactor(); F32 getAgentHUDTargetZoom(); + void resetCameraZoomFraction(); + F32 getCurrentCameraZoomFraction() { return mCameraZoomFraction; } + //-------------------------------------------------------------------- // Pan //-------------------------------------------------------------------- diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index cc02862868..e1e7ee8445 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -565,7 +565,8 @@ void LLFloaterCamera::switchToPreset(const std::string& name) { LLPresetsManager::getInstance()->loadPreset(PRESETS_CAMERA, name); } - gAgentCamera.setCameraZoomFraction(gSavedSettings.getF32("CameraZoomFraction")); + + gAgentCamera.resetCameraZoomFraction(); LLFloaterCamera* camera_floater = LLFloaterCamera::findInstance(); if (camera_floater) diff --git a/indra/newview/llfloatersavecamerapreset.cpp b/indra/newview/llfloatersavecamerapreset.cpp index 34aefdf1c1..e2bd2e6d6a 100644 --- a/indra/newview/llfloatersavecamerapreset.cpp +++ b/indra/newview/llfloatersavecamerapreset.cpp @@ -107,6 +107,12 @@ void LLFloaterSaveCameraPreset::onBtnSave() gSavedSettings.setVector3("CameraOffsetRearView", gAgentCamera.getCurrentCameraOffset()); gSavedSettings.setVector3d("FocusOffsetRearView", gAgentCamera.getCurrentFocusOffset()); } + else + { + LLVector3 camera_offset = gSavedSettings.getVector3("CameraOffsetRearView") * gAgentCamera.getCurrentCameraZoomFraction(); + gSavedSettings.setVector3("CameraOffsetRearView", camera_offset); + gAgentCamera.resetCameraZoomFraction(); + } if (is_saving_new) { std::list preset_names; diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index fd89a1fcb6..129187ccbd 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -309,9 +309,6 @@ 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(true)); - name_list.push_back("CameraZoomFraction"); } else { -- cgit v1.2.3