mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 04:08:13 +02:00
finished calibration-ui
This commit is contained in:
parent
33b89c9d32
commit
2c3db0fb91
12 changed files with 234 additions and 80 deletions
BIN
interface/resources/images/loader-calibrate-blue.png
Normal file
BIN
interface/resources/images/loader-calibrate-blue.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
BIN
interface/resources/images/loader-calibrate-white.png
Normal file
BIN
interface/resources/images/loader-calibrate-white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
|
@ -25,23 +25,40 @@ Rectangle {
|
||||||
signal canceled()
|
signal canceled()
|
||||||
signal restart()
|
signal restart()
|
||||||
|
|
||||||
property int count: 3
|
property int count: 3
|
||||||
|
property string calibratingText: "CALIBRATING..."
|
||||||
|
property string calibratingCountText: "CALIBRATION STARTING IN"
|
||||||
|
property string calibrationSuccess: "CALIBRATION COMPLETED"
|
||||||
|
property string calibrationFailed: "CALIBRATION FAILED"
|
||||||
|
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
visible: true
|
visible: true
|
||||||
color: hifi.colors.baseGray
|
color: hifi.colors.baseGray
|
||||||
|
|
||||||
BusyIndicator {
|
property string whiteIndicator: "../../../images/loader-calibrate-white.png"
|
||||||
|
property string blueIndicator: "../../../images/loader-calibrate-blue.png"
|
||||||
|
|
||||||
|
Image {
|
||||||
id: busyIndicator
|
id: busyIndicator
|
||||||
width: 350
|
width: 350
|
||||||
height: 350
|
height: 350
|
||||||
|
|
||||||
|
property bool running: true
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
horizontalCenter: parent.horizontalCenter
|
horizontalCenter: parent.horizontalCenter
|
||||||
top: parent.top
|
top: parent.top
|
||||||
topMargin: 60
|
topMargin: 60
|
||||||
}
|
}
|
||||||
running: true
|
visible: busyIndicator.running
|
||||||
|
source: blueIndicator
|
||||||
|
NumberAnimation on rotation {
|
||||||
|
id: busyRotation
|
||||||
|
running: busyIndicator.running
|
||||||
|
loops: Animation.Infinite
|
||||||
|
duration: 1000
|
||||||
|
from: 0 ; to: 360
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +77,7 @@ Rectangle {
|
||||||
|
|
||||||
RalewayBold {
|
RalewayBold {
|
||||||
id: statusText
|
id: statusText
|
||||||
text: "CALIBRATION STARTING IN"
|
text: info.calibratingCountText
|
||||||
size: 16
|
size: 16
|
||||||
color: hifi.colors.blueHighlight
|
color: hifi.colors.blueHighlight
|
||||||
|
|
||||||
|
@ -102,10 +119,27 @@ Rectangle {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
id: numberAnimation
|
id: numberAnimation
|
||||||
target: info
|
target: info
|
||||||
property: count
|
property: "count"
|
||||||
to: 0
|
to: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: timer
|
||||||
|
|
||||||
|
repeat: false
|
||||||
|
interval: 3000
|
||||||
|
onTriggered: {
|
||||||
|
info.calibrating();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: closeWindow
|
||||||
|
repeat: false
|
||||||
|
interval: 3000
|
||||||
|
onTriggered: stack.pop();
|
||||||
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
|
|
||||||
spacing: 20
|
spacing: 20
|
||||||
|
@ -124,6 +158,10 @@ Rectangle {
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
restart();
|
restart();
|
||||||
|
numberAnimation.stop();
|
||||||
|
info.count = (timer.interval / 1000);
|
||||||
|
numberAnimation.start();
|
||||||
|
timer.restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,14 +172,42 @@ Rectangle {
|
||||||
text: "CANCEL"
|
text: "CANCEL"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
stack.pop();
|
|
||||||
canceled();
|
canceled();
|
||||||
|
stack.pop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function start() {
|
function start(interval, countNumber) {
|
||||||
|
countDown.visible = true;
|
||||||
|
statusText.color = hifi.colors.blueHighlight;
|
||||||
|
numberAnimation.duration = interval
|
||||||
|
info.count = countNumber;
|
||||||
|
timer.interval = interval;
|
||||||
|
numberAnimation.start();
|
||||||
|
timer.start();
|
||||||
}
|
}
|
||||||
function callingFunction() {
|
|
||||||
|
function calibrating() {
|
||||||
|
countDown.visible = false;
|
||||||
|
busyIndicator.source = whiteIndicator;
|
||||||
|
busyRotation.from = 360
|
||||||
|
busyRotation.to = 0
|
||||||
|
statusText.text = info.calibratingText;
|
||||||
|
statusText.color = hifi.colors.white
|
||||||
|
}
|
||||||
|
|
||||||
|
function success() {
|
||||||
|
busyIndicator.running = false;
|
||||||
|
statusText.text = info.calibrationSuccess
|
||||||
|
statusText.color = hifi.colors.greenHighlight
|
||||||
|
closeWindow.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
function failure() {
|
||||||
|
busyIndicator.running = false;
|
||||||
|
statusText.text = info.calibrationFailed
|
||||||
|
statusText.color = hifi.colors.redHighlight
|
||||||
|
closeWindow.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,10 +103,9 @@ StackView {
|
||||||
HifiControls.CheckBox {
|
HifiControls.CheckBox {
|
||||||
id: checkBox
|
id: checkBox
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
text: "show all input plugins"
|
text: "show all input devices"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.log("clicked");
|
|
||||||
inputPlugins();
|
inputPlugins();
|
||||||
changeSource();
|
changeSource();
|
||||||
}
|
}
|
||||||
|
@ -162,12 +161,16 @@ StackView {
|
||||||
source: InputConfiguration.configurationLayout(box.currentText);
|
source: InputConfiguration.configurationLayout(box.currentText);
|
||||||
onLoaded: {
|
onLoaded: {
|
||||||
if (loader.item.hasOwnProperty("pluginName")) {
|
if (loader.item.hasOwnProperty("pluginName")) {
|
||||||
loader.item.pluginName = box.currentText
|
if (box.currentText === "Vive") {
|
||||||
|
loader.item.pluginName = "OpenVR";
|
||||||
if (loader.item.hasOwnProperty("displayInformation")) {
|
} else {
|
||||||
loader.item.displayInformation();
|
loader.item.pluginName = box.currentText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (loader.item.hasOwnProperty("displayInformation")) {
|
||||||
|
loader.item.displayConfiguration();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,7 +190,13 @@ StackView {
|
||||||
|
|
||||||
function changeSource() {
|
function changeSource() {
|
||||||
loader.source = "";
|
loader.source = "";
|
||||||
var source = InputConfiguration.configurationLayout(box.currentText);
|
var source = "";
|
||||||
|
if (box.currentText == "Vive") {
|
||||||
|
source = InputConfiguration.configurationLayout("OpenVR");
|
||||||
|
} else {
|
||||||
|
source = InputConfiguration.configurationLayout(box.currentText);
|
||||||
|
}
|
||||||
|
|
||||||
loader.source = source;
|
loader.source = source;
|
||||||
if (source === "") {
|
if (source === "") {
|
||||||
box.label = "(not configurable)";
|
box.label = "(not configurable)";
|
||||||
|
|
|
@ -27,7 +27,7 @@ Rectangle {
|
||||||
property int leftMargin: 75
|
property int leftMargin: 75
|
||||||
property int countDown: 0
|
property int countDown: 0
|
||||||
property string pluginName: ""
|
property string pluginName: ""
|
||||||
property var displayInformation: openVrConfiguration.displayConfiguration()
|
property var displayInformation: null
|
||||||
|
|
||||||
readonly property bool feetChecked: feetBox.checked
|
readonly property bool feetChecked: feetBox.checked
|
||||||
readonly property bool hipsChecked: hipBox.checked
|
readonly property bool hipsChecked: hipBox.checked
|
||||||
|
@ -144,7 +144,7 @@ Rectangle {
|
||||||
decimals: 4
|
decimals: 4
|
||||||
width: 112
|
width: 112
|
||||||
label: "Y: offset"
|
label: "Y: offset"
|
||||||
value: -0.0254
|
minimumValue: -10
|
||||||
stepSize: 0.0254
|
stepSize: 0.0254
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ Rectangle {
|
||||||
id: headZOffset
|
id: headZOffset
|
||||||
width: 112
|
width: 112
|
||||||
label: "Z: offset"
|
label: "Z: offset"
|
||||||
value: -0.152
|
minimumValue: -10
|
||||||
stepSize: 0.0254
|
stepSize: 0.0254
|
||||||
decimals: 4
|
decimals: 4
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
|
@ -249,7 +249,7 @@ Rectangle {
|
||||||
decimals: 4
|
decimals: 4
|
||||||
width: 112
|
width: 112
|
||||||
label: "Y: offset"
|
label: "Y: offset"
|
||||||
value: -0.0508
|
minimumValue: -10
|
||||||
stepSize: 0.0254
|
stepSize: 0.0254
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ Rectangle {
|
||||||
id: handZOffset
|
id: handZOffset
|
||||||
width: 112
|
width: 112
|
||||||
label: "Z: offset"
|
label: "Z: offset"
|
||||||
value: -0.0254
|
minimumValue: -10
|
||||||
stepSize: 0.0254
|
stepSize: 0.0254
|
||||||
decimals: 4
|
decimals: 4
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
|
@ -528,17 +528,19 @@ Rectangle {
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (calibrationButton.enabled) {
|
if (calibrationButton.enabled) {
|
||||||
calibrationTimer.interval = timeToCalibrate.value * 1000
|
if (openVrConfiguration.state === buttonState.apply) {
|
||||||
openVrConfiguration.countDown = timeToCalibrate.value;
|
InputConfiguration.uncalibratePlugin(pluginName);
|
||||||
numberAnimation.duration = calibrationTimer.interval
|
updateCalibrationButton();
|
||||||
numberAnimation.start();
|
} else {
|
||||||
calibrationTimer.start();
|
calibrationTimer.interval = timeToCalibrate.value * 1000
|
||||||
var calibratingScreen = screen.createObject();
|
openVrConfiguration.countDown = timeToCalibrate.value;
|
||||||
stack.push(calibratingScreen);
|
var calibratingScreen = screen.createObject();
|
||||||
|
stack.push(calibratingScreen);
|
||||||
calibratingScreen.callingFunction();
|
calibratingScreen.canceled.connect(cancelCalibration);
|
||||||
calibratingScreen.canceled.connect(cancelCalibration);
|
calibratingScreen.restart.connect(restartCalibration);
|
||||||
calibratingScreen.restart.connect(restartCalibration);
|
calibratingScreen.start(calibrationTimer.interval, timeToCalibrate.value);
|
||||||
|
calibrationTimer.start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,7 +549,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
onReleased: {
|
onReleased: {
|
||||||
calibrationButton.pressed = false;
|
calibrationButton.pressed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
onEntered: {
|
onEntered: {
|
||||||
|
@ -592,7 +594,6 @@ Rectangle {
|
||||||
|
|
||||||
minimumValue: 3
|
minimumValue: 3
|
||||||
value: 3
|
value: 3
|
||||||
label: "Time til calibration ( in seconds )"
|
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
|
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
|
@ -602,6 +603,31 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RalewayBold {
|
||||||
|
id: delayTextInfo
|
||||||
|
size: 10
|
||||||
|
text: "Delay Before Calibration Starts"
|
||||||
|
color: hifi.colors.white
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
left: timeToCalibrate.right
|
||||||
|
leftMargin: 20
|
||||||
|
verticalCenter: timeToCalibrate.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RalewayRegular {
|
||||||
|
size: 12
|
||||||
|
text: "sec"
|
||||||
|
color: hifi.colors.lightGray
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
left: delayTextInfo.right
|
||||||
|
leftMargin: 10
|
||||||
|
verticalCenter: delayTextInfo.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
id: numberAnimation
|
id: numberAnimation
|
||||||
target: openVrConfiguration
|
target: openVrConfiguration
|
||||||
|
@ -610,16 +636,17 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
function calibrationStatusInfo(status) {
|
function calibrationStatusInfo(status) {
|
||||||
|
var calibrationScreen = stack.currentItem;
|
||||||
if (status["calibrated"]) {
|
if (status["calibrated"]) {
|
||||||
|
calibrationScreen.success();
|
||||||
} else if (!status["calibrated"]) {
|
} else if (!status["calibrated"]) {
|
||||||
var uncalibrated = status["success"];
|
var uncalibrated = status["success"];
|
||||||
if (uncalibrated) {
|
if (!uncalibrated) {
|
||||||
|
calibrationScreen.failure();
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
displayTimer.start();
|
|
||||||
|
updateCalibrationButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -650,11 +677,11 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancelCalibration() {
|
function cancelCalibration() {
|
||||||
console.log("canceling calibration");
|
calibrationTimer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
function restartCalibration() {
|
function restartCalibration() {
|
||||||
console.log("restating calibration");
|
calibrationTimer.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayConfiguration() {
|
function displayConfiguration() {
|
||||||
|
@ -681,6 +708,9 @@ Rectangle {
|
||||||
handPuckBox.checked = true;
|
handPuckBox.checked = true;
|
||||||
handBox.checked = false;
|
handBox.checked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initializeButtonState();
|
||||||
|
updateCalibrationText();
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayTrackerConfiguration(type) {
|
function displayTrackerConfiguration(type) {
|
||||||
|
@ -732,25 +762,45 @@ Rectangle {
|
||||||
if (settingsChanged) {
|
if (settingsChanged) {
|
||||||
if ((!handOverride) && (!headOverride) && (bodySetting === "None")) {
|
if ((!handOverride) && (!headOverride) && (bodySetting === "None")) {
|
||||||
state = buttonState.apply;
|
state = buttonState.apply;
|
||||||
console.log("apply");
|
|
||||||
} else {
|
} else {
|
||||||
state = buttonState.applyAndCalibrate;
|
state = buttonState.applyAndCalibrate;
|
||||||
console.log("apply and calibrate");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (state == buttonState.apply) {
|
if (state == buttonState.apply) {
|
||||||
state = buttonState.disabled;
|
state = buttonState.disabled;
|
||||||
console.log("disable");
|
} else if (state == buttonState.applyAndCalibrate) {
|
||||||
|
state = buttonState.calibrate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastConfiguration = settings;
|
lastConfiguration = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCalibrationText() {
|
function initializeButtonState() {
|
||||||
|
var settings = composeConfigurationSettings();
|
||||||
|
var bodySetting = settings["bodyConfiguration"];
|
||||||
|
var headSetting = settings["headConfiguration"];
|
||||||
|
var headOverride = headSetting["override"];
|
||||||
|
var handSetting = settings["handConfiguration"];
|
||||||
|
var handOverride = handSetting["override"];
|
||||||
|
|
||||||
|
|
||||||
|
if ((!handOverride) && (!headOverride) && (bodySetting === "None")) {
|
||||||
|
state = buttonState.disabled;
|
||||||
|
} else {
|
||||||
|
state = buttonState.calibrate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateCalibrationButton() {
|
||||||
updateButtonState();
|
updateButtonState();
|
||||||
|
updateCalibrationText();
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateCalibrationText() {
|
||||||
if (buttonState.disabled == state) {
|
if (buttonState.disabled == state) {
|
||||||
calibrationButton.enabled = false;
|
calibrationButton.enabled = false;
|
||||||
|
calibrationButton.text = "Apply";
|
||||||
} else if (buttonState.apply == state) {
|
} else if (buttonState.apply == state) {
|
||||||
calibrationButton.enabled = true;
|
calibrationButton.enabled = true;
|
||||||
calibrationButton.text = "Apply";
|
calibrationButton.text = "Apply";
|
||||||
|
@ -818,6 +868,6 @@ Rectangle {
|
||||||
function sendConfigurationSettings() {
|
function sendConfigurationSettings() {
|
||||||
var settings = composeConfigurationSettings();
|
var settings = composeConfigurationSettings();
|
||||||
InputConfiguration.setConfigurationSettings(settings, pluginName);
|
InputConfiguration.setConfigurationSettings(settings, pluginName);
|
||||||
updateCalibrationText();
|
updateCalibrationButton();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,6 +109,7 @@
|
||||||
#include <plugins/PluginManager.h>
|
#include <plugins/PluginManager.h>
|
||||||
#include <plugins/PluginUtils.h>
|
#include <plugins/PluginUtils.h>
|
||||||
#include <plugins/SteamClientPlugin.h>
|
#include <plugins/SteamClientPlugin.h>
|
||||||
|
#include <plugins/InputConfiguration.h>
|
||||||
#include <RecordingScriptingInterface.h>
|
#include <RecordingScriptingInterface.h>
|
||||||
#include <RenderableWebEntityItem.h>
|
#include <RenderableWebEntityItem.h>
|
||||||
#include <RenderShadowTask.h>
|
#include <RenderShadowTask.h>
|
||||||
|
@ -1997,6 +1998,7 @@ void Application::initializeUi() {
|
||||||
surfaceContext->setContextProperty("TextureCache", DependencyManager::get<TextureCache>().data());
|
surfaceContext->setContextProperty("TextureCache", DependencyManager::get<TextureCache>().data());
|
||||||
surfaceContext->setContextProperty("ModelCache", DependencyManager::get<ModelCache>().data());
|
surfaceContext->setContextProperty("ModelCache", DependencyManager::get<ModelCache>().data());
|
||||||
surfaceContext->setContextProperty("SoundCache", DependencyManager::get<SoundCache>().data());
|
surfaceContext->setContextProperty("SoundCache", DependencyManager::get<SoundCache>().data());
|
||||||
|
surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data());
|
||||||
|
|
||||||
surfaceContext->setContextProperty("Account", AccountScriptingInterface::getInstance());
|
surfaceContext->setContextProperty("Account", AccountScriptingInterface::getInstance());
|
||||||
surfaceContext->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
|
surfaceContext->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "render/DrawStatus.h"
|
#include "render/DrawStatus.h"
|
||||||
#include "scripting/MenuScriptingInterface.h"
|
#include "scripting/MenuScriptingInterface.h"
|
||||||
|
#include "scripting/HMDScriptingInterface.h"
|
||||||
#include "ui/DialogsManager.h"
|
#include "ui/DialogsManager.h"
|
||||||
#include "ui/StandAloneJSConsole.h"
|
#include "ui/StandAloneJSConsole.h"
|
||||||
#include "InterfaceLogging.h"
|
#include "InterfaceLogging.h"
|
||||||
|
@ -310,10 +311,15 @@ Menu::Menu() {
|
||||||
QString("../../hifi/tablet/TabletLodPreferences.qml"), "LodPreferencesDialog");
|
QString("../../hifi/tablet/TabletLodPreferences.qml"), "LodPreferencesDialog");
|
||||||
});
|
});
|
||||||
|
|
||||||
action = addActionToQMenuAndActionHash(settingsMenu, "InputConfiguration");
|
action = addActionToQMenuAndActionHash(settingsMenu, "Controller Settings");
|
||||||
connect(action, &QAction::triggered, [] {
|
connect(action, &QAction::triggered, [] {
|
||||||
auto tablet = DependencyManager::get<TabletScriptingInterface>()->getTablet("com.highfidelity.interface.tablet.system");
|
auto tablet = DependencyManager::get<TabletScriptingInterface>()->getTablet("com.highfidelity.interface.tablet.system");
|
||||||
|
auto hmd = DependencyManager::get<HMDScriptingInterface>();
|
||||||
tablet->loadQMLSource("ControllerSettings.qml");
|
tablet->loadQMLSource("ControllerSettings.qml");
|
||||||
|
|
||||||
|
if (!hmd->getShouldShowTablet()) {
|
||||||
|
hmd->toggleShouldShowTablet();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Settings > Control with Speech [advanced]
|
// Settings > Control with Speech [advanced]
|
||||||
|
|
|
@ -28,7 +28,12 @@ QStringList InputConfiguration::inputPlugins() {
|
||||||
|
|
||||||
QStringList inputPlugins;
|
QStringList inputPlugins;
|
||||||
for (auto plugin : PluginManager::getInstance()->getInputPlugins()) {
|
for (auto plugin : PluginManager::getInstance()->getInputPlugins()) {
|
||||||
inputPlugins << QString(plugin->getName());
|
QString pluginName = plugin->getName();
|
||||||
|
if (pluginName == QString("OpenVR")) {
|
||||||
|
inputPlugins << QString("Vive");
|
||||||
|
} else {
|
||||||
|
inputPlugins << pluginName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return inputPlugins;
|
return inputPlugins;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +50,12 @@ QStringList InputConfiguration::activeInputPlugins() {
|
||||||
QStringList activePlugins;
|
QStringList activePlugins;
|
||||||
for (auto plugin : PluginManager::getInstance()->getInputPlugins()) {
|
for (auto plugin : PluginManager::getInstance()->getInputPlugins()) {
|
||||||
if (plugin->configurable()) {
|
if (plugin->configurable()) {
|
||||||
activePlugins << QString(plugin->getName());
|
QString pluginName = plugin->getName();
|
||||||
|
if (pluginName == QString("OpenVR")) {
|
||||||
|
activePlugins << QString("Vive");
|
||||||
|
} else {
|
||||||
|
activePlugins << pluginName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return activePlugins;
|
return activePlugins;
|
||||||
|
@ -113,3 +123,19 @@ void InputConfiguration::calibratePlugin(QString pluginName) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool InputConfiguration::uncalibratePlugin(QString pluginName) {
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
bool result;
|
||||||
|
QMetaObject::invokeMethod(this, "uncalibratePlugin", Qt::BlockingQueuedConnection,
|
||||||
|
Q_ARG(bool, result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto plugin : PluginManager::getInstance()->getInputPlugins()) {
|
||||||
|
if (plugin->getName() == pluginName) {
|
||||||
|
return plugin->uncalibrate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ public:
|
||||||
Q_INVOKABLE void setConfigurationSettings(QJsonObject configurationSettings, QString pluginName);
|
Q_INVOKABLE void setConfigurationSettings(QJsonObject configurationSettings, QString pluginName);
|
||||||
Q_INVOKABLE void calibratePlugin(QString pluginName);
|
Q_INVOKABLE void calibratePlugin(QString pluginName);
|
||||||
Q_INVOKABLE QJsonObject configurationSettings(QString pluginName);
|
Q_INVOKABLE QJsonObject configurationSettings(QString pluginName);
|
||||||
|
Q_INVOKABLE bool uncalibratePlugin(QString pluginName);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void calibrationStatus(const QJsonObject& status);
|
void calibrationStatus(const QJsonObject& status);
|
||||||
|
|
|
@ -29,6 +29,7 @@ public:
|
||||||
virtual QJsonObject configurationSettings() { return QJsonObject(); }
|
virtual QJsonObject configurationSettings() { return QJsonObject(); }
|
||||||
virtual QString configurationLayout() { return QString(); }
|
virtual QString configurationLayout() { return QString(); }
|
||||||
virtual void calibrate() {}
|
virtual void calibrate() {}
|
||||||
|
virtual bool uncalibrate() { return false; }
|
||||||
virtual bool configurable() { return false; }
|
virtual bool configurable() { return false; }
|
||||||
virtual bool isHandController() const { return false; }
|
virtual bool isHandController() const { return false; }
|
||||||
virtual bool isHeadController() const { return false; }
|
virtual bool isHeadController() const { return false; }
|
||||||
|
|
|
@ -127,6 +127,14 @@ void ViveControllerManager::calibrate() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ViveControllerManager::uncalibrate() {
|
||||||
|
if (isSupported()) {
|
||||||
|
_inputDevice->uncalibrate();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool ViveControllerManager::isSupported() const {
|
bool ViveControllerManager::isSupported() const {
|
||||||
return openVrSupported();
|
return openVrSupported();
|
||||||
}
|
}
|
||||||
|
@ -241,10 +249,6 @@ ViveControllerManager::InputDevice::InputDevice(vr::IVRSystem*& system) : contro
|
||||||
_configStringMap[Config::FeetAndHips] = QString("FeetAndHips");
|
_configStringMap[Config::FeetAndHips] = QString("FeetAndHips");
|
||||||
_configStringMap[Config::FeetHipsAndChest] = QString("FeetHipsAndChest");
|
_configStringMap[Config::FeetHipsAndChest] = QString("FeetHipsAndChest");
|
||||||
_configStringMap[Config::FeetHipsAndShoulders] = QString("FeetHipsAndShoulders");
|
_configStringMap[Config::FeetHipsAndShoulders] = QString("FeetHipsAndShoulders");
|
||||||
|
|
||||||
if (openVrSupported()) {
|
|
||||||
loadSettings();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViveControllerManager::InputDevice::update(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) {
|
void ViveControllerManager::InputDevice::update(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) {
|
||||||
|
@ -319,7 +323,8 @@ void ViveControllerManager::InputDevice::calibrateFromHandController(const contr
|
||||||
|
|
||||||
void ViveControllerManager::InputDevice::calibrateFromUI(const controller::InputCalibrationData& inputCalibrationData) {
|
void ViveControllerManager::InputDevice::calibrateFromUI(const controller::InputCalibrationData& inputCalibrationData) {
|
||||||
if (_calibrate) {
|
if (_calibrate) {
|
||||||
calibrateOrUncalibrate(inputCalibrationData);
|
uncalibrate();
|
||||||
|
calibrate(inputCalibrationData);
|
||||||
_calibrate = false;
|
_calibrate = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,6 +342,8 @@ void ViveControllerManager::InputDevice::configureCalibrationSettings(const QJso
|
||||||
bool overrideHead = headObject["override"].toBool();
|
bool overrideHead = headObject["override"].toBool();
|
||||||
if (overrideHead) {
|
if (overrideHead) {
|
||||||
_headConfig = HeadConfig::Puck;
|
_headConfig = HeadConfig::Puck;
|
||||||
|
HEAD_PUCK_Y_OFFSET = (float)headObject["Y"].toDouble();
|
||||||
|
HEAD_PUCK_Z_OFFSET = (float)headObject["Z"].toDouble();
|
||||||
} else {
|
} else {
|
||||||
_headConfig = HeadConfig::HMD;
|
_headConfig = HeadConfig::HMD;
|
||||||
}
|
}
|
||||||
|
@ -345,6 +352,8 @@ void ViveControllerManager::InputDevice::configureCalibrationSettings(const QJso
|
||||||
bool overrideHands = handsObject["override"].toBool();
|
bool overrideHands = handsObject["override"].toBool();
|
||||||
if (overrideHands) {
|
if (overrideHands) {
|
||||||
_handConfig = HandConfig::Pucks;
|
_handConfig = HandConfig::Pucks;
|
||||||
|
HAND_PUCK_Y_OFFSET = (float)handsObject["Y"].toDouble();
|
||||||
|
HAND_PUCK_Z_OFFSET = (float)handsObject["Z"].toDouble();
|
||||||
} else {
|
} else {
|
||||||
_handConfig = HandConfig::HandController;
|
_handConfig = HandConfig::HandController;
|
||||||
}
|
}
|
||||||
|
@ -352,10 +361,6 @@ void ViveControllerManager::InputDevice::configureCalibrationSettings(const QJso
|
||||||
iter++;
|
iter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << configToString(_preferedConfig);
|
|
||||||
|
|
||||||
saveSettings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViveControllerManager::InputDevice::calibrateNextFrame() {
|
void ViveControllerManager::InputDevice::calibrateNextFrame() {
|
||||||
|
@ -444,15 +449,22 @@ void ViveControllerManager::InputDevice::calibrateOrUncalibrate(const controller
|
||||||
void ViveControllerManager::InputDevice::calibrate(const controller::InputCalibrationData& inputCalibration) {
|
void ViveControllerManager::InputDevice::calibrate(const controller::InputCalibrationData& inputCalibration) {
|
||||||
qDebug() << "Puck Calibration: Starting...";
|
qDebug() << "Puck Calibration: Starting...";
|
||||||
|
|
||||||
|
int puckCount = (int)_validTrackedObjects.size();
|
||||||
|
qDebug() << "Puck Calibration: " << puckCount << " pucks found for calibration";
|
||||||
|
|
||||||
|
if (puckCount == 0) {
|
||||||
|
uncalibrate();
|
||||||
|
emitCalibrationStatus(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
glm::mat4 defaultToReferenceMat = glm::mat4();
|
glm::mat4 defaultToReferenceMat = glm::mat4();
|
||||||
if (_headConfig == HeadConfig::HMD) {
|
if (_headConfig == HeadConfig::HMD) {
|
||||||
defaultToReferenceMat = calculateDefaultToReferenceForHmd(inputCalibration);
|
defaultToReferenceMat = calculateDefaultToReferenceForHmd(inputCalibration);
|
||||||
} else if (_headConfig == HeadConfig::Puck) {
|
} else if (_headConfig == HeadConfig::Puck) {
|
||||||
defaultToReferenceMat = calculateDefaultToReferenceForHeadPuck(inputCalibration);
|
defaultToReferenceMat = calculateDefaultToReferenceForHeadPuck(inputCalibration);
|
||||||
}
|
}
|
||||||
|
|
||||||
int puckCount = (int)_validTrackedObjects.size();
|
|
||||||
qDebug() << "Puck Calibration: " << puckCount << " pucks found for calibration";
|
|
||||||
_config = _preferedConfig;
|
_config = _preferedConfig;
|
||||||
|
|
||||||
bool headConfigured = configureHead(defaultToReferenceMat, inputCalibration);
|
bool headConfigured = configureHead(defaultToReferenceMat, inputCalibration);
|
||||||
|
@ -1006,24 +1018,6 @@ void ViveControllerManager::InputDevice::calibrateHead(glm::mat4& defaultToRefer
|
||||||
_pucksOffset[head.first] = computeOffset(defaultToReferenceMat, inputCalibration.defaultHeadMat, newHead);
|
_pucksOffset[head.first] = computeOffset(defaultToReferenceMat, inputCalibration.defaultHeadMat, newHead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ViveControllerManager::InputDevice::loadSettings() {
|
|
||||||
Settings settings;
|
|
||||||
settings.beginGroup("PUCK_CONFIG");
|
|
||||||
{
|
|
||||||
}
|
|
||||||
settings.endGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ViveControllerManager::InputDevice::saveSettings() const {
|
|
||||||
Settings settings;
|
|
||||||
settings.beginGroup("PUCK_CONFIG");
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
settings.endGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ViveControllerManager::InputDevice::configToString(Config config) {
|
QString ViveControllerManager::InputDevice::configToString(Config config) {
|
||||||
return _configStringMap[config];
|
return _configStringMap[config];
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ public:
|
||||||
void setConfigurationSettings(const QJsonObject configurationSettings) override;
|
void setConfigurationSettings(const QJsonObject configurationSettings) override;
|
||||||
QJsonObject configurationSettings() override;
|
QJsonObject configurationSettings() override;
|
||||||
void calibrate() override;
|
void calibrate() override;
|
||||||
|
bool uncalibrate() override;
|
||||||
bool isHeadController() const override { return true; }
|
bool isHeadController() const override { return true; }
|
||||||
bool isHeadControllerMounted() const;
|
bool isHeadControllerMounted() const;
|
||||||
|
|
||||||
|
@ -91,8 +92,6 @@ private:
|
||||||
void partitionTouchpad(int sButton, int xAxis, int yAxis, int centerPsuedoButton, int xPseudoButton, int yPseudoButton);
|
void partitionTouchpad(int sButton, int xAxis, int yAxis, int centerPsuedoButton, int xPseudoButton, int yPseudoButton);
|
||||||
void printDeviceTrackingResultChange(uint32_t deviceIndex);
|
void printDeviceTrackingResultChange(uint32_t deviceIndex);
|
||||||
void setConfigFromString(const QString& value);
|
void setConfigFromString(const QString& value);
|
||||||
void loadSettings();
|
|
||||||
void saveSettings() const;
|
|
||||||
bool configureHead(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration);
|
bool configureHead(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration);
|
||||||
bool configureHands(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration);
|
bool configureHands(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration);
|
||||||
bool configureBody(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration);
|
bool configureBody(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration);
|
||||||
|
|
Loading…
Reference in a new issue