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