mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 19:29:47 +02:00
Removed check for updates menu item. POC: settings for advanced movements mappings
This commit is contained in:
parent
a16b2c0d20
commit
4adfe94ed5
2 changed files with 66 additions and 7 deletions
|
@ -818,12 +818,6 @@ Menu::Menu() {
|
||||||
|
|
||||||
helpMenu->addSeparator();
|
helpMenu->addSeparator();
|
||||||
|
|
||||||
// Help > Check for Updates
|
|
||||||
//ToDo: Add check for updates
|
|
||||||
addActionToQMenuAndActionHash(helpMenu, "Check for Updates");
|
|
||||||
|
|
||||||
helpMenu->addSeparator();
|
|
||||||
|
|
||||||
// Help > Release Notes
|
// Help > Release Notes
|
||||||
action = addActionToQMenuAndActionHash(helpMenu, "Release Notes");
|
action = addActionToQMenuAndActionHash(helpMenu, "Release Notes");
|
||||||
connect(action, &QAction::triggered, qApp, [] {
|
connect(action, &QAction::triggered, qApp, [] {
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <ScriptEngines.h>
|
#include <ScriptEngines.h>
|
||||||
#include <OffscreenUi.h>
|
#include <OffscreenUi.h>
|
||||||
#include <Preferences.h>
|
#include <Preferences.h>
|
||||||
|
#include <QRandomGenerator>
|
||||||
#include <display-plugins/CompositorHelper.h>
|
#include <display-plugins/CompositorHelper.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
@ -24,6 +25,9 @@
|
||||||
#include "SnapshotAnimated.h"
|
#include "SnapshotAnimated.h"
|
||||||
#include "UserActivityLogger.h"
|
#include "UserActivityLogger.h"
|
||||||
|
|
||||||
|
#include "controllers/impl/MappingBuilderProxy.h"
|
||||||
|
#include "controllers/impl/RouteBuilderProxy.h"
|
||||||
|
|
||||||
void setupPreferences() {
|
void setupPreferences() {
|
||||||
auto preferences = DependencyManager::get<Preferences>();
|
auto preferences = DependencyManager::get<Preferences>();
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
@ -214,8 +218,69 @@ void setupPreferences() {
|
||||||
|
|
||||||
//TODO: Update with advanced movement logic, test that it works
|
//TODO: Update with advanced movement logic, test that it works
|
||||||
{
|
{
|
||||||
|
|
||||||
|
using namespace controller;
|
||||||
|
auto controllerScriptingInterface = DependencyManager::get<ScriptingInterface>().data();
|
||||||
|
static QString advMovementsMappingName = QString("Hifi-AdvancedMovement-Dev-%1").arg(QRandomGenerator().generateDouble());
|
||||||
|
static bool advMovementsIsDisabled = false;
|
||||||
|
static bool inFlipTurn = false;
|
||||||
|
|
||||||
|
//code need to be revise so it should make correct iteration thru controller interface
|
||||||
|
/*
|
||||||
|
if (!advMovementsIsDisabled) {
|
||||||
|
MappingBuilderProxy* basicMapping = static_cast<MappingBuilderProxy*>
|
||||||
|
(controllerScriptingInterface->newMapping(advMovementsMappingName));
|
||||||
|
const auto standard = controllerScriptingInterface->getStandard();
|
||||||
|
const auto hardware = controllerScriptingInterface->getHardware();
|
||||||
|
qDebug() << "hardware" << hardware;
|
||||||
|
RouteBuilderProxy* fromMapping = static_cast<RouteBuilderProxy*>
|
||||||
|
(basicMapping->fromQml(QJSValue(standard.value("LY").toFloat())));
|
||||||
|
for(QMap<QString, QVariant>::const_iterator i = standard.find("LY"); i != standard.end(); ++i) {
|
||||||
|
auto stick = controllerScriptingInterface->getValue(standard.value("LS").toInt());
|
||||||
|
const float value = i.value().toFloat();
|
||||||
|
if(value == 1.0f && hardware.contains("OculusTouch")) {
|
||||||
|
//rotate180
|
||||||
|
myAvatar->setWorldOrientation(Quat().multiply(myAvatar->getWorldOrientation(),
|
||||||
|
Quat().angleAxis(180.0, glm::vec3(0,1,0))));
|
||||||
|
|
||||||
|
} else if (hardware.contains("Vive")) {
|
||||||
|
if (value > 0.75f && inFlipTurn == false) {
|
||||||
|
inFlipTurn = true;
|
||||||
|
//rotate180();
|
||||||
|
QTimer::singleShot(1000, []() { inFlipTurn = false; } );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(QMap<QString, QVariant>::const_iterator i = standard.find("RY"); i != standard.end(); ++i) {
|
||||||
|
auto stick = controllerScriptingInterface->getValue(standard.value("RS").toInt());
|
||||||
|
const float value = i.value().toFloat();
|
||||||
|
if(value == 1.0f && hardware.contains("OculusTouch")) {
|
||||||
|
//rotate180
|
||||||
|
myAvatar->setWorldOrientation(Quat().multiply(myAvatar->getWorldOrientation(),
|
||||||
|
Quat().angleAxis(180.0, glm::vec3(0,1,0))));
|
||||||
|
} else if (hardware.contains("Vive")) {
|
||||||
|
if (value > 0.75f && inFlipTurn == false) {
|
||||||
|
inFlipTurn = true;
|
||||||
|
//rotate180
|
||||||
|
myAvatar->setWorldOrientation(Quat().multiply(myAvatar->getWorldOrientation(),
|
||||||
|
Quat().angleAxis(180.0, glm::vec3(0,1,0))));
|
||||||
|
|
||||||
|
QTimer::singleShot(1000, []() { inFlipTurn = false; } );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
auto getter = [=]()->bool { return myAvatar->useAdvancedMovementControls(); };
|
auto getter = [=]()->bool { return myAvatar->useAdvancedMovementControls(); };
|
||||||
auto setter = [=](bool value) { myAvatar->setUseAdvancedMovementControls(value); };
|
auto setter = [=](bool value) {
|
||||||
|
auto controllerScriptingInterface = DependencyManager::get<ScriptingInterface>().data();
|
||||||
|
myAvatar->setUseAdvancedMovementControls(value);
|
||||||
|
if (value) {
|
||||||
|
controllerScriptingInterface->enableMapping(advMovementsMappingName);
|
||||||
|
} else {
|
||||||
|
controllerScriptingInterface->disableMapping(advMovementsMappingName);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
preferences->addPreference(new CheckPreference(MOVEMENT, "Advanced movement for hand controllers", getter, setter));
|
preferences->addPreference(new CheckPreference(MOVEMENT, "Advanced movement for hand controllers", getter, setter));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue