SL-12994 FIXED [Camera Presets] Zoom fraction should be saved as a part of Camera preset, not as separate setting

master
Mnikolenko Productengine 2020-04-10 18:38:56 +03:00
parent 1ec8c7a68a
commit 944b908be1
5 changed files with 17 additions and 6 deletions

View File

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

View File

@ -282,6 +282,9 @@ public:
F32 calcCameraFOVZoomFactor();
F32 getAgentHUDTargetZoom();
void resetCameraZoomFraction();
F32 getCurrentCameraZoomFraction() { return mCameraZoomFraction; }
//--------------------------------------------------------------------
// Pan
//--------------------------------------------------------------------

View File

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

View File

@ -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<std::string> preset_names;

View File

@ -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
{