Skip to content

Commit

Permalink
Fixed Camera Sensitivity setting not saving
Browse files Browse the repository at this point in the history
  • Loading branch information
SummerGuardian64 committed Nov 3, 2024
1 parent 620be77 commit 6f1c487
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions interface/src/avatar/MyAvatar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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);
}
4 changes: 4 additions & 0 deletions interface/src/avatar/MyAvatar.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -3007,6 +3010,7 @@ private slots:
Setting::Handle<float> _scaleSetting;
Setting::Handle<float> _yawSpeedSetting;
Setting::Handle<float> _hmdYawSpeedSetting;
Setting::Handle<float> _cameraSensitivitySetting;
Setting::Handle<float> _pitchSpeedSetting;
Setting::Handle<QUrl> _fullAvatarURLSetting;
Setting::Handle<QUrl> _fullAvatarModelNameSetting;
Expand Down

0 comments on commit 6f1c487

Please sign in to comment.