From 6f1c48743d6bf516f060f01c06e3e673a738f260 Mon Sep 17 00:00:00 2001 From: SummerGuardian64 Date: Sun, 3 Nov 2024 14:50:33 +0100 Subject: [PATCH] Fixed Camera Sensitivity setting not saving --- interface/src/avatar/MyAvatar.cpp | 13 +++++++++++++ interface/src/avatar/MyAvatar.h | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 1779d64dc6..cbe2b8e77f 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -75,6 +75,8 @@ #include "WarningsSuppression.h" #include "ScriptPermissions.h" +#include "Application.h" + using namespace std; const float DEFAULT_REAL_WORLD_FIELD_OF_VIEW_DEGREES = 30.0f; @@ -226,6 +228,7 @@ MyAvatar::MyAvatar(QThread* thread) : _scaleSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "scale", _targetScale), _yawSpeedSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "yawSpeed", _yawSpeed), _hmdYawSpeedSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "hmdYawSpeed", _hmdYawSpeed), + _cameraSensitivitySetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "cameraSensitivity", qApp->getCamera().getSensitivity()), _pitchSpeedSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "pitchSpeed", _pitchSpeed), _fullAvatarURLSetting(QStringList() << SETTINGS_FULL_PRIVATE_GROUP_NAME << AVATAR_SETTINGS_GROUP_NAME << "fullAvatarURL", AvatarData::defaultFullAvatarModelUrl()), @@ -1324,6 +1327,7 @@ void MyAvatar::saveData() { _scaleSetting.set(_targetScale); _yawSpeedSetting.set(_yawSpeed); _hmdYawSpeedSetting.set(_hmdYawSpeed); + _cameraSensitivitySetting.set(getCameraSensitivity()); _pitchSpeedSetting.set(_pitchSpeed); // only save the fullAvatarURL if it has not been overwritten on command line @@ -2084,6 +2088,7 @@ void MyAvatar::loadData() { _yawSpeed = _yawSpeedSetting.get(_yawSpeed); _hmdYawSpeed = _hmdYawSpeedSetting.get(_hmdYawSpeed); + setCameraSensitivity(_cameraSensitivitySetting.get(getCameraSensitivity())); _pitchSpeed = _pitchSpeedSetting.get(_pitchSpeed); _prefOverrideAnimGraphUrl.set(_animGraphURLSetting.get().toString()); @@ -7002,3 +7007,11 @@ void MyAvatar::resetPointAt() { POINT_BLEND_LINEAR_ALPHA_NAME, POINT_ALPHA_BLENDING); } } + +float MyAvatar::getCameraSensitivity() const { + return qApp->getCamera().getSensitivity(); +} + +void MyAvatar::setCameraSensitivity(float cameraSensitivity) { + qApp->getCamera().setSensitivity(cameraSensitivity); +} diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index 2777d2c82f..a3586db6db 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -1407,6 +1407,9 @@ class MyAvatar : public Avatar { float getHMDYawSpeed() const { return _hmdYawSpeed; } void setHMDYawSpeed(float speed) { _hmdYawSpeed = speed; } + float getCameraSensitivity() const; + void setCameraSensitivity(float cameraSensitivity); + static const float ZOOM_MIN; static const float ZOOM_MAX; static const float ZOOM_DEFAULT; @@ -3007,6 +3010,7 @@ private slots: Setting::Handle _scaleSetting; Setting::Handle _yawSpeedSetting; Setting::Handle _hmdYawSpeedSetting; + Setting::Handle _cameraSensitivitySetting; Setting::Handle _pitchSpeedSetting; Setting::Handle _fullAvatarURLSetting; Setting::Handle _fullAvatarModelNameSetting;