Revive: Add the new "Trigger As Grip" setting.
Also update some old defaults.
This commit is contained in:
@@ -145,12 +145,12 @@ MyStackViewPage {
|
||||
RowLayout {
|
||||
MyText {
|
||||
text: "Grip Button Mode:"
|
||||
Layout.preferredWidth: 350
|
||||
Layout.preferredWidth: 250
|
||||
}
|
||||
|
||||
MyComboBox {
|
||||
id: gripButtonModeComboBox
|
||||
Layout.preferredWidth: 300
|
||||
Layout.preferredWidth: 250
|
||||
model: ["Normal Mode", "Toggle Mode", "Hybrid Mode"]
|
||||
onCurrentIndexChanged: {
|
||||
if (componentCompleted) {
|
||||
@@ -160,9 +160,9 @@ MyStackViewPage {
|
||||
}
|
||||
|
||||
MyText {
|
||||
Layout.leftMargin: 50
|
||||
Layout.preferredWidth: 150
|
||||
Layout.leftMargin: 25
|
||||
text: "Toggle Delay: "
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
MyTextField {
|
||||
@@ -170,7 +170,7 @@ MyStackViewPage {
|
||||
text: "0.50"
|
||||
keyBoardUID: 225
|
||||
Layout.preferredWidth: 100
|
||||
Layout.leftMargin: 10
|
||||
Layout.leftMargin: 25
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
function onInputEvent(input) {
|
||||
var val = parseFloat(input)
|
||||
@@ -184,6 +184,15 @@ MyStackViewPage {
|
||||
}
|
||||
}
|
||||
|
||||
MyToggleButton {
|
||||
id: triggerAsGripToggle
|
||||
text: "Trigger As Grip"
|
||||
Layout.preferredWidth: 250
|
||||
Layout.leftMargin: 25
|
||||
onCheckedChanged: {
|
||||
ReviveTabController.setTriggerAsGrip(checked, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GroupBox {
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace advsettings {
|
||||
const char* section_revive = "revive";
|
||||
const char* key_pixelsPerDisplayPixel = "pixelsPerDisplayPixel";
|
||||
const char* key_toggleGrip = "ToggleGrip";
|
||||
const char* key_triggerAsGrip = "TriggerAsGrip";
|
||||
const char* key_toggleDelay = "ToggleDelay";
|
||||
const char* key_thumbDeadzone = "ThumbDeadzone";
|
||||
const char* key_thumbSensitivity = "ThumbSensitivity";
|
||||
@@ -50,6 +51,13 @@ namespace advsettings {
|
||||
m_gripButtonMode = valuei;
|
||||
}
|
||||
|
||||
bool valueb = vr::VRSettings()->GetBool(section_revive, key_triggerAsGrip, &vrSettingsError);
|
||||
if (vrSettingsError != vr::VRSettingsError_None) {
|
||||
LOG(WARNING) << "Could not read \"revive::" << key_triggerAsGrip << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError);
|
||||
} else {
|
||||
m_triggerAsGrip = valueb;
|
||||
}
|
||||
|
||||
valuef = vr::VRSettings()->GetFloat(section_revive, key_toggleDelay, &vrSettingsError);
|
||||
if (vrSettingsError != vr::VRSettingsError_None) {
|
||||
LOG(WARNING) << "Could not read \"revive::" << key_toggleDelay << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError);
|
||||
@@ -185,6 +193,11 @@ namespace advsettings {
|
||||
setGripButtonMode(valuei);
|
||||
}
|
||||
|
||||
bool valueb = vr::VRSettings()->GetBool(section_revive, key_triggerAsGrip, &vrSettingsError);
|
||||
if (vrSettingsError == vr::VRSettingsError_None) {
|
||||
setTriggerAsGrip(valueb);
|
||||
}
|
||||
|
||||
valuef = vr::VRSettings()->GetFloat(section_revive, key_toggleDelay, &vrSettingsError);
|
||||
if (vrSettingsError == vr::VRSettingsError_None) {
|
||||
setToggleDelay(valuef);
|
||||
@@ -276,6 +289,10 @@ namespace advsettings {
|
||||
return m_gripButtonMode;
|
||||
}
|
||||
|
||||
bool ReviveTabController::triggerAsGrip() const {
|
||||
return m_triggerAsGrip;
|
||||
}
|
||||
|
||||
float ReviveTabController::toggleDelay() const {
|
||||
return m_toggleDelay;
|
||||
}
|
||||
@@ -355,6 +372,21 @@ namespace advsettings {
|
||||
}
|
||||
}
|
||||
|
||||
void ReviveTabController::setTriggerAsGrip(bool value, bool notify) {
|
||||
if (m_triggerAsGrip != value) {
|
||||
m_triggerAsGrip = value;
|
||||
vr::EVRSettingsError vrSettingsError;
|
||||
vr::VRSettings()->SetBool(section_revive, key_triggerAsGrip, m_triggerAsGrip, &vrSettingsError);
|
||||
if (vrSettingsError != vr::VRSettingsError_None) {
|
||||
LOG(WARNING) << "Could not set \"revive::" << key_toggleGrip << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError);
|
||||
}
|
||||
vr::VRSettings()->Sync();
|
||||
if (notify) {
|
||||
emit triggerAsGripChanged(m_triggerAsGrip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ReviveTabController::setToggleDelay(float value, bool notify) {
|
||||
if (m_toggleDelay != value) {
|
||||
m_toggleDelay = value;
|
||||
@@ -631,12 +663,15 @@ namespace advsettings {
|
||||
LOG(WARNING) << "Could not remove \"revive::" << key_toggleGrip << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError);
|
||||
}
|
||||
|
||||
// This setting has no default value listed in Revive's default.vrsettings yet.
|
||||
/*vr::VRSettings()->RemoveKeyInSection(section_revive, key_toggleDelay, &vrSettingsError);
|
||||
vr::VRSettings()->RemoveKeyInSection(section_revive, key_triggerAsGrip, &vrSettingsError);
|
||||
if (vrSettingsError != vr::VRSettingsError_None) {
|
||||
LOG(WARNING) << "Could not remove \"revive::" << key_triggerAsGrip << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError);
|
||||
}
|
||||
|
||||
vr::VRSettings()->RemoveKeyInSection(section_revive, key_toggleDelay, &vrSettingsError);
|
||||
if (vrSettingsError != vr::VRSettingsError_None) {
|
||||
LOG(WARNING) << "Could not remove \"revive::" << key_toggleDelay << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError);
|
||||
}*/
|
||||
setToggleDelay(0.5f);
|
||||
}
|
||||
|
||||
vr::VRSettings()->RemoveKeyInSection(section_revive, key_thumbDeadzone, &vrSettingsError);
|
||||
if (vrSettingsError != vr::VRSettingsError_None) {
|
||||
@@ -707,6 +742,7 @@ namespace advsettings {
|
||||
auto& entry = controllerProfiles[i];
|
||||
entry.profileName = settings->value("profileName").toString().toStdString();
|
||||
entry.gripButtonMode = settings->value("gripButtonMode", 0).toInt();
|
||||
entry.triggerAsGrip = settings->value("triggerAsGrip", 0).toBool();
|
||||
entry.thumbDeadzone = settings->value("thumbDeadzone", 0.3f).toFloat();
|
||||
entry.thumbRange = settings->value("thumbRange", 2.0f).toFloat();
|
||||
entry.touchPitch = settings->value("touchPitch", -28.0f).toFloat();
|
||||
@@ -730,6 +766,7 @@ namespace advsettings {
|
||||
settings->setArrayIndex(i);
|
||||
settings->setValue("profileName", QString::fromStdString(p.profileName));
|
||||
settings->setValue("gripButtonMode", p.gripButtonMode);
|
||||
settings->setValue("triggerAsGrip", p.triggerAsGrip);
|
||||
settings->setValue("thumbDeadzone", p.thumbDeadzone);
|
||||
settings->setValue("thumbRange", p.thumbRange);
|
||||
settings->setValue("touchPitch", p.touchPitch);
|
||||
@@ -771,6 +808,7 @@ namespace advsettings {
|
||||
}
|
||||
profile->profileName = name.toStdString();
|
||||
profile->gripButtonMode = gripButtonMode();
|
||||
profile->triggerAsGrip = triggerAsGrip();
|
||||
profile->thumbDeadzone = thumbDeadzone();
|
||||
profile->thumbRange = thumbRange();
|
||||
profile->touchPitch = touchPitch();
|
||||
@@ -788,6 +826,7 @@ namespace advsettings {
|
||||
if (index < controllerProfiles.size()) {
|
||||
auto& profile = controllerProfiles[index];
|
||||
setGripButtonMode(profile.gripButtonMode);
|
||||
setTriggerAsGrip(profile.triggerAsGrip);
|
||||
setThumbDeadzone(profile.thumbDeadzone);
|
||||
setThumbRange(profile.thumbRange);
|
||||
setTouchPitch(profile.touchPitch);
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace advsettings {
|
||||
struct ReviveControllerProfile {
|
||||
std::string profileName;
|
||||
int gripButtonMode;
|
||||
bool triggerAsGrip;
|
||||
float thumbDeadzone;
|
||||
float thumbRange;
|
||||
float touchPitch;
|
||||
@@ -30,6 +31,7 @@ namespace advsettings {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int isOverlayInstalled READ isOverlayInstalled NOTIFY isOverlayInstalledChanged)
|
||||
Q_PROPERTY(int gripButtonMode READ gripButtonMode WRITE setGripButtonMode NOTIFY gripButtonModeChanged)
|
||||
Q_PROPERTY(int triggerAsGrip READ triggerAsGrip WRITE setTriggerAsGrip NOTIFY triggerAsGripChanged)
|
||||
Q_PROPERTY(bool pixelsPerDisplayPixelOverrideEnabled READ isPixelsPerDisplayPixelOverrideEnabled WRITE setPixelsPerDisplayPixelOverrideEnabled NOTIFY pixelsPerDisplayPixelOverrideEnabledChanged)
|
||||
Q_PROPERTY(float toggleDelay READ toggleDelay WRITE setToggleDelay NOTIFY toggleDelayChanged)
|
||||
Q_PROPERTY(float pixelsPerDisplayPixelOverride READ pixelsPerDisplayPixelOverride WRITE setPixelsPerDisplayPixelOverride NOTIFY pixelsPerDisplayPixelOverrideChanged)
|
||||
@@ -54,6 +56,7 @@ namespace advsettings {
|
||||
bool m_isOverlayInstalled = false;
|
||||
int m_gripButtonMode = 0;
|
||||
float m_toggleDelay = 0.5f;
|
||||
bool m_triggerAsGrip = false;
|
||||
bool m_pixelsPerDisplayPixelOverrideEnabled = false;
|
||||
float m_pixelsPerDisplayPixelOverride = 1.0f;
|
||||
float m_thumbDeadzone = 0.3f;
|
||||
@@ -62,7 +65,7 @@ namespace advsettings {
|
||||
float m_touchYaw = 0.0f;
|
||||
float m_touchRoll = -14.0f;
|
||||
float m_touchX = 0.016f;
|
||||
float m_touchY = 0.0f;
|
||||
float m_touchY = -0.036f;
|
||||
float m_touchZ = 0.016f;
|
||||
float m_piPlayerHeight = 1.778f;
|
||||
float m_piEyeHeight = 1.675f;
|
||||
@@ -83,6 +86,7 @@ namespace advsettings {
|
||||
bool isOverlayInstalled() const;
|
||||
|
||||
int gripButtonMode() const;
|
||||
bool triggerAsGrip() const;
|
||||
float toggleDelay() const;
|
||||
|
||||
bool isPixelsPerDisplayPixelOverrideEnabled() const;
|
||||
@@ -114,6 +118,7 @@ namespace advsettings {
|
||||
|
||||
public slots:
|
||||
void setGripButtonMode(int value, bool notify = true);
|
||||
void setTriggerAsGrip(bool value, bool notify = true);
|
||||
void setToggleDelay(float value, bool notify = true);
|
||||
|
||||
void setPixelsPerDisplayPixelOverrideEnabled(bool value, bool notify = true);
|
||||
@@ -145,6 +150,7 @@ namespace advsettings {
|
||||
void isOverlayInstalledChanged(bool value);
|
||||
|
||||
void gripButtonModeChanged(int value);
|
||||
void triggerAsGripChanged(bool value);
|
||||
void toggleDelayChanged(float value);
|
||||
|
||||
void pixelsPerDisplayPixelOverrideEnabledChanged(bool value);
|
||||
|
||||
Reference in New Issue
Block a user