Merge pull request #7112 from howard-stearns/snap-turn-preference

Snap turn preference
This commit is contained in:
Brad Hefta-Gaub 2016-02-17 09:19:38 -08:00
commit 38430d8d2c
9 changed files with 17 additions and 10 deletions

View file

@ -18,7 +18,7 @@
[ "Keyboard.MouseMoveRight" ]
]
},
"when": [ "Application.InHMD", "Application.ComfortMode", "Keyboard.RightMouseButton" ],
"when": [ "Application.InHMD", "Application.SnapTurn", "Keyboard.RightMouseButton" ],
"to": "Actions.StepYaw",
"filters":
[
@ -34,7 +34,7 @@
[ "Keyboard.TouchpadRight" ]
]
},
"when": [ "Application.InHMD", "Application.ComfortMode" ],
"when": [ "Application.InHMD", "Application.SnapTurn" ],
"to": "Actions.StepYaw",
"filters":
[
@ -49,7 +49,7 @@
["Keyboard.D", "Keyboard.Right"]
]
},
"when": [ "Application.InHMD", "Application.ComfortMode" ],
"when": [ "Application.InHMD", "Application.SnapTurn" ],
"to": "Actions.StepYaw",
"filters":
[

View file

@ -5,7 +5,7 @@
{ "from": "Standard.LX", "to": "Actions.TranslateX" },
{ "from": "Standard.RX",
"when": [ "Application.InHMD", "Application.ComfortMode" ],
"when": [ "Application.InHMD", "Application.SnapTurn" ],
"to": "Actions.StepYaw",
"filters":
[

View file

@ -35,7 +35,6 @@ QtObject {
readonly property string centerPlayerInView: "Center Player In View";
readonly property string chat: "Chat...";
readonly property string collisions: "Collisions";
readonly property string comfortMode: "Comfort Mode";
readonly property string connexion: "Activate 3D Connexion Devices";
readonly property string console_: "Console...";
readonly property string controlWithSpeech: "Control With Speech";

View file

@ -849,8 +849,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
_applicationStateDevice->addInputVariant(QString("InHMD"), controller::StateController::ReadLambda([]() -> float {
return (float)qApp->getAvatarUpdater()->isHMDMode();
}));
_applicationStateDevice->addInputVariant(QString("ComfortMode"), controller::StateController::ReadLambda([]() -> float {
return (float)Menu::getInstance()->isOptionChecked(MenuOption::ComfortMode);
_applicationStateDevice->addInputVariant(QString("SnapTurn"), controller::StateController::ReadLambda([]() -> float {
return (float)qApp->getMyAvatar()->getSnapTurn();
}));
_applicationStateDevice->addInputVariant(QString("Grounded"), controller::StateController::ReadLambda([]() -> float {
return (float)qApp->getMyAvatar()->getCharacterController()->onGround();

View file

@ -490,7 +490,6 @@ Menu::Menu() {
avatar, SLOT(setEnableMeshVisible(bool)));
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::DisableEyelidAdjustment, 0, false);
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::TurnWithHead, 0, false);
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::ComfortMode, 0, true);
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::UseAnimPreAndPostRotations, 0, false,
avatar, SLOT(setUseAnimPreAndPostRotations(bool)));
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::EnableInverseKinematics, 0, true,

View file

@ -177,7 +177,6 @@ namespace MenuOption {
const QString CenterPlayerInView = "Center Player In View";
const QString Chat = "Chat...";
const QString Collisions = "Collisions";
const QString ComfortMode = "Comfort Mode";
const QString Connexion = "Activate 3D Connexion Devices";
const QString Console = "Console...";
const QString ControlWithSpeech = "Control With Speech";

View file

@ -653,6 +653,7 @@ void MyAvatar::saveData() {
settings.setValue("displayName", _displayName);
settings.setValue("collisionSoundURL", _collisionSoundURL);
settings.setValue("snapTurn", _useSnapTurn);
settings.endGroup();
}
@ -746,6 +747,7 @@ void MyAvatar::loadData() {
setDisplayName(settings.value("displayName").toString());
setCollisionSoundURL(settings.value("collisionSoundURL", DEFAULT_AVATAR_COLLISION_SOUND_URL).toString());
setSnapTurn(settings.value("snapTurn").toBool());
settings.endGroup();

View file

@ -151,6 +151,9 @@ public:
// Removes a handler previously added by addAnimationStateHandler.
Q_INVOKABLE void removeAnimationStateHandler(QScriptValue handler) { _rig->removeAnimationStateHandler(handler); }
Q_INVOKABLE bool getSnapTurn() const { return _useSnapTurn; }
Q_INVOKABLE void setSnapTurn(bool on) { _useSnapTurn = on; }
// get/set avatar data
void saveData();
void loadData();
@ -370,6 +373,7 @@ private:
QUrl _fullAvatarURLFromPreferences;
QString _fullAvatarModelName;
QUrl _animGraphUrl {""};
bool _useSnapTurn { true };
// cache of the current HMD sensor position and orientation
// in sensor space.

View file

@ -57,7 +57,11 @@ void setupPreferences() {
auto preference = new AvatarPreference(AVATAR_BASICS, "Appearance: ", getter, setter);
preferences->addPreference(preference);
}
{
auto getter = [=]()->bool {return myAvatar->getSnapTurn(); };
auto setter = [=](bool value) { myAvatar->setSnapTurn(value); };
preferences->addPreference(new CheckPreference(AVATAR_BASICS, "Snap Turn when in HMD", getter, setter));
}
{
auto getter = []()->QString { return Snapshot::snapshotsLocation.get(); };
auto setter = [](const QString& value) { Snapshot::snapshotsLocation.set(value); };