mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 03:37:49 +02:00
fixing some menu reog bugs
This commit is contained in:
parent
dd05afa974
commit
e676348c4f
6 changed files with 160 additions and 172 deletions
|
@ -79,7 +79,7 @@ ScrollingWindow {
|
||||||
interval: 1000
|
interval: 1000
|
||||||
repeat: true
|
repeat: true
|
||||||
running: false
|
running: false
|
||||||
onTriggered: developerMenuEnabled = MenuInterface.isMenuEnabled("Developer Menus");
|
onTriggered: developerMenuEnabled = MenuInterface.isOptionChecked("Developer Menu");
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
|
@ -98,7 +98,7 @@ ScrollingWindow {
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
isHMD = HMD.active;
|
isHMD = HMD.active;
|
||||||
updateRunningScripts();
|
updateRunningScripts();
|
||||||
developerMenuEnabled = MenuInterface.isMenuEnabled("Developer Menus");
|
developerMenuEnabled = MenuInterface.isOptionChecked("Developer Menu");
|
||||||
checkMenu.restart();
|
checkMenu.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ Rectangle {
|
||||||
interval: 1000
|
interval: 1000
|
||||||
repeat: true
|
repeat: true
|
||||||
running: false
|
running: false
|
||||||
onTriggered: developerMenuEnabled = MenuInterface.isMenuEnabled("Developer Menus");
|
onTriggered: developerMenuEnabled = MenuInterface.isOptionChecked("Developer Menu");
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
|
@ -84,7 +84,7 @@ Rectangle {
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
isHMD = HMD.active;
|
isHMD = HMD.active;
|
||||||
updateRunningScripts();
|
updateRunningScripts();
|
||||||
developerMenuEnabled = MenuInterface.isMenuEnabled("Developer Menus");
|
developerMenuEnabled = MenuInterface.isOptionChecked("Developer Menu");
|
||||||
checkMenu.restart();
|
checkMenu.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,19 +100,19 @@ Menu::Menu() {
|
||||||
addActionToQMenuAndActionHash(editMenu, redoAction);
|
addActionToQMenuAndActionHash(editMenu, redoAction);
|
||||||
|
|
||||||
editMenu->addSeparator();
|
editMenu->addSeparator();
|
||||||
|
|
||||||
// Edit > Cut
|
// Edit > Cut
|
||||||
addActionToQMenuAndActionHash(editMenu, "Cut", Qt::CTRL | Qt::Key_X);
|
addActionToQMenuAndActionHash(editMenu, "Cut", Qt::CTRL | Qt::Key_X);
|
||||||
|
|
||||||
// Edit > Copy
|
// Edit > Copy
|
||||||
addActionToQMenuAndActionHash(editMenu, "Copy", Qt::CTRL | Qt::Key_C);
|
addActionToQMenuAndActionHash(editMenu, "Copy", Qt::CTRL | Qt::Key_C);
|
||||||
|
|
||||||
// Edit > Paste
|
// Edit > Paste
|
||||||
addActionToQMenuAndActionHash(editMenu, "Paste", Qt::CTRL | Qt::Key_V);
|
addActionToQMenuAndActionHash(editMenu, "Paste", Qt::CTRL | Qt::Key_V);
|
||||||
|
|
||||||
// Edit > Delete
|
// Edit > Delete
|
||||||
addActionToQMenuAndActionHash(editMenu, "Delete", Qt::Key_Delete);
|
addActionToQMenuAndActionHash(editMenu, "Delete", Qt::Key_Delete);
|
||||||
|
|
||||||
editMenu->addSeparator();
|
editMenu->addSeparator();
|
||||||
|
|
||||||
// Edit > Running Scripts
|
// Edit > Running Scripts
|
||||||
|
@ -280,7 +280,7 @@ Menu::Menu() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Settings > Notifications
|
// Settings > Notifications
|
||||||
MenuWrapper * notificationsMenu = settingsMenu->addMenu("Notifications"); //This was in notifications.js. The menu needs to be moved here.
|
MenuWrapper * notificationsMenu = settingsMenu->addMenu("Notifications"); //This was in notifications.js. The menu needs to be moved here.
|
||||||
|
|
||||||
//TODO: Hookup notification actions below.
|
//TODO: Hookup notification actions below.
|
||||||
// Settings > Notifications > Play Notification Sounds
|
// Settings > Notifications > Play Notification Sounds
|
||||||
|
@ -308,43 +308,9 @@ Menu::Menu() {
|
||||||
settings->setValue(MenuOption::NotificationSoundsTablet, action->isChecked());
|
settings->setValue(MenuOption::NotificationSoundsTablet, action->isChecked());
|
||||||
});
|
});
|
||||||
|
|
||||||
//Further sound notificaions disabled until new notification system will be implemented
|
|
||||||
/*
|
|
||||||
// Settings > Notifications > Level of Detail
|
|
||||||
action = addCheckableActionToQMenuAndActionHash(notificationsMenu, "Level of Detail", 0,
|
|
||||||
settings->getValue("play_notification_sounds_type_1").toBool());
|
|
||||||
connect(action, &QAction::triggered, [action, settings] {
|
|
||||||
settings->setValue("play_notification_sounds_type_1", action->isChecked());
|
|
||||||
});
|
|
||||||
// Settings > Notifications > Connection
|
|
||||||
action = addCheckableActionToQMenuAndActionHash(notificationsMenu, "Connection", 0,
|
|
||||||
settings->getValue("play_notification_sounds_type_2").toBool());
|
|
||||||
connect(action, &QAction::triggered, [action, settings] {
|
|
||||||
settings->setValue("play_notification_sounds_type_2", action->isChecked());
|
|
||||||
});
|
|
||||||
// Settings > Notifications > Connection Refused
|
|
||||||
action = addCheckableActionToQMenuAndActionHash(notificationsMenu, "Connection Refused", 0,
|
|
||||||
settings->getValue("play_notification_sounds_type_3").toBool());
|
|
||||||
connect(action, &QAction::triggered, [action, settings] {
|
|
||||||
settings->setValue("play_notification_sounds_type_3", action->isChecked());
|
|
||||||
});
|
|
||||||
// Settings > Notifications > Edit Error
|
|
||||||
action = addCheckableActionToQMenuAndActionHash(notificationsMenu, "Edit Error", 0,
|
|
||||||
settings->getValue("play_notification_sounds_type_4").toBool());
|
|
||||||
connect(action, &QAction::triggered, [action, settings] {
|
|
||||||
settings->setValue("play_notification_sounds_type_4", action->isChecked());
|
|
||||||
});
|
|
||||||
// Settings > Notifications > Wallet
|
|
||||||
addActionToQMenuAndActionHash(notificationsMenu, "Wallet");
|
|
||||||
action = addCheckableActionToQMenuAndActionHash(notificationsMenu, "Wallet", 0,
|
|
||||||
settings->getValue("play_notification_sounds_type_6").toBool());
|
|
||||||
connect(action, &QAction::triggered, [action, settings] {
|
|
||||||
settings->setValue("play_notification_sounds_type_6", action->isChecked());
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
// Settings > Developer Menu
|
// Settings > Developer Menu
|
||||||
addCheckableActionToQMenuAndActionHash(settingsMenu, "Developer Menu", 0, false, this, SLOT(toggleDeveloperMenus()));
|
addCheckableActionToQMenuAndActionHash(settingsMenu, "Developer Menu", 0, false, this, SLOT(toggleDeveloperMenus()));
|
||||||
|
|
||||||
// Settings > Ask to Reset Settings
|
// Settings > Ask to Reset Settings
|
||||||
addCheckableActionToQMenuAndActionHash(settingsMenu, MenuOption::AskToResetSettings, 0, false);
|
addCheckableActionToQMenuAndActionHash(settingsMenu, MenuOption::AskToResetSettings, 0, false);
|
||||||
|
|
||||||
|
@ -375,7 +341,7 @@ Menu::Menu() {
|
||||||
if (mainViewShadowTaskConfig) {
|
if (mainViewShadowTaskConfig) {
|
||||||
if (action->isChecked()) {
|
if (action->isChecked()) {
|
||||||
mainViewShadowTaskConfig->setPreset("Enabled");
|
mainViewShadowTaskConfig->setPreset("Enabled");
|
||||||
} else {
|
} else {
|
||||||
mainViewShadowTaskConfig->setPreset("None");
|
mainViewShadowTaskConfig->setPreset("None");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -844,7 +810,7 @@ Menu::Menu() {
|
||||||
|
|
||||||
// Help/Application menu ----------------------------------
|
// Help/Application menu ----------------------------------
|
||||||
MenuWrapper * helpMenu = addMenu("Help");
|
MenuWrapper * helpMenu = addMenu("Help");
|
||||||
|
|
||||||
// Help > About High Fidelity
|
// Help > About High Fidelity
|
||||||
action = addActionToQMenuAndActionHash(helpMenu, "About High Fidelity");
|
action = addActionToQMenuAndActionHash(helpMenu, "About High Fidelity");
|
||||||
connect(action, &QAction::triggered, [] {
|
connect(action, &QAction::triggered, [] {
|
||||||
|
@ -852,35 +818,35 @@ Menu::Menu() {
|
||||||
QString("hifi/dialogs/TabletAboutDialog.qml"), "AboutDialog");
|
QString("hifi/dialogs/TabletAboutDialog.qml"), "AboutDialog");
|
||||||
});
|
});
|
||||||
helpMenu->addSeparator();
|
helpMenu->addSeparator();
|
||||||
|
|
||||||
// Help > HiFi Docs
|
// Help > HiFi Docs
|
||||||
action = addActionToQMenuAndActionHash(helpMenu, "Online Documentation");
|
action = addActionToQMenuAndActionHash(helpMenu, "Online Documentation");
|
||||||
connect(action, &QAction::triggered, qApp, [] {
|
connect(action, &QAction::triggered, qApp, [] {
|
||||||
QDesktopServices::openUrl(QUrl("https://docs.highfidelity.com/"));
|
QDesktopServices::openUrl(QUrl("https://docs.highfidelity.com/"));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Help > HiFi Forum
|
// Help > HiFi Forum
|
||||||
action = addActionToQMenuAndActionHash(helpMenu, "Online Forums");
|
action = addActionToQMenuAndActionHash(helpMenu, "Online Forums");
|
||||||
connect(action, &QAction::triggered, qApp, [] {
|
connect(action, &QAction::triggered, qApp, [] {
|
||||||
QDesktopServices::openUrl(QUrl("https://forums.highfidelity.com/"));
|
QDesktopServices::openUrl(QUrl("https://forums.highfidelity.com/"));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Help > Scripting Reference
|
// Help > Scripting Reference
|
||||||
action = addActionToQMenuAndActionHash(helpMenu, "Online Script Reference");
|
action = addActionToQMenuAndActionHash(helpMenu, "Online Script Reference");
|
||||||
connect(action, &QAction::triggered, qApp, [] {
|
connect(action, &QAction::triggered, qApp, [] {
|
||||||
QDesktopServices::openUrl(QUrl("https://docs.highfidelity.com/api-reference"));
|
QDesktopServices::openUrl(QUrl("https://docs.highfidelity.com/api-reference"));
|
||||||
});
|
});
|
||||||
|
|
||||||
addActionToQMenuAndActionHash(helpMenu, "Controls Reference", 0, qApp, SLOT(showHelp()));
|
addActionToQMenuAndActionHash(helpMenu, "Controls Reference", 0, qApp, SLOT(showHelp()));
|
||||||
|
|
||||||
helpMenu->addSeparator();
|
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, [] {
|
||||||
QDesktopServices::openUrl(QUrl("http://steamcommunity.com/games/390540/announcements/"));
|
QDesktopServices::openUrl(QUrl("http://steamcommunity.com/games/390540/announcements/"));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Help > Report a Bug!
|
// Help > Report a Bug!
|
||||||
action = addActionToQMenuAndActionHash(helpMenu, "Report a Bug!");
|
action = addActionToQMenuAndActionHash(helpMenu, "Report a Bug!");
|
||||||
connect(action, &QAction::triggered, qApp, [] {
|
connect(action, &QAction::triggered, qApp, [] {
|
||||||
|
|
|
@ -2654,7 +2654,6 @@ void MyAvatar::updateMotionBehaviorFromMenu() {
|
||||||
} else {
|
} else {
|
||||||
_motionBehaviors &= ~AVATAR_MOTION_SCRIPTED_MOTOR_ENABLED;
|
_motionBehaviors &= ~AVATAR_MOTION_SCRIPTED_MOTOR_ENABLED;
|
||||||
}
|
}
|
||||||
setCollisionsEnabled(menu->isOptionChecked(MenuOption::EnableAvatarCollisions));
|
|
||||||
setProperty("lookAtSnappingEnabled", menu->isOptionChecked(MenuOption::EnableLookAtSnapping));
|
setProperty("lookAtSnappingEnabled", menu->isOptionChecked(MenuOption::EnableLookAtSnapping));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -266,16 +266,7 @@ void setupPreferences() {
|
||||||
|
|
||||||
static const QString movementsControlChannel = QStringLiteral("Hifi-Advanced-Movement-Disabler");
|
static const QString movementsControlChannel = QStringLiteral("Hifi-Advanced-Movement-Disabler");
|
||||||
auto getter = [=]()->bool { return myAvatar->useAdvancedMovementControls(); };
|
auto getter = [=]()->bool { return myAvatar->useAdvancedMovementControls(); };
|
||||||
auto setter = [=](bool value) {
|
auto setter = [=](bool value) { myAvatar->setUseAdvancedMovementControls(value); };
|
||||||
auto messagesClient = DependencyManager::get<MessagesClient>().data();
|
|
||||||
myAvatar->setUseAdvancedMovementControls(value);
|
|
||||||
if (value) {
|
|
||||||
messagesClient->sendMessage(movementsControlChannel, QStringLiteral("enable_mappings"), true);
|
|
||||||
} else {
|
|
||||||
messagesClient->sendMessage(movementsControlChannel, QStringLiteral("disable_mappings"), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
preferences->addPreference(new CheckPreference(MOVEMENT,
|
preferences->addPreference(new CheckPreference(MOVEMENT,
|
||||||
QStringLiteral("Advanced movement for hand controllers"),
|
QStringLiteral("Advanced movement for hand controllers"),
|
||||||
getter, setter));
|
getter, setter));
|
||||||
|
|
|
@ -11,132 +11,164 @@
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
|
/* jslint bitwise: true */
|
||||||
|
|
||||||
|
/* global Script, Quat, MyAvatar, HMD, Controller, Messages*/
|
||||||
|
|
||||||
(function() { // BEGIN LOCAL_SCOPE
|
(function() { // BEGIN LOCAL_SCOPE
|
||||||
|
|
||||||
var mappingName, basicMapping, isChecked;
|
var TWO_SECONDS_INTERVAL = 2000;
|
||||||
|
var FLYING_MAPPING_NAME = 'Hifi-Flying-Dev-' + Math.random();
|
||||||
|
var DRIVING_MAPPING_NAME = 'Hifi-Driving-Dev-' + Math.random();
|
||||||
|
|
||||||
var TURN_RATE = 1000;
|
var flyingMapping = null;
|
||||||
var isDisabled = false;
|
var drivingMapping = null;
|
||||||
var previousSetting = MyAvatar.useAdvancedMovementControls;
|
|
||||||
if (previousSetting === false) {
|
|
||||||
previousSetting = false;
|
|
||||||
isChecked = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (previousSetting === true) {
|
var TURN_RATE = 1000;
|
||||||
previousSetting = true;
|
var isDisabled = false;
|
||||||
isChecked = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function rotate180() {
|
var previousFlyingState = MyAvatar.getFlyingEnabled();
|
||||||
var newOrientation = Quat.multiply(MyAvatar.orientation, Quat.angleAxis(180, {
|
var previousDrivingState = MyAvatar.useAdvancedMovementControls;
|
||||||
x: 0,
|
|
||||||
y: 1,
|
|
||||||
z: 0
|
|
||||||
}))
|
|
||||||
MyAvatar.orientation = newOrientation
|
|
||||||
}
|
|
||||||
|
|
||||||
var inFlipTurn = false;
|
function rotate180() {
|
||||||
|
var newOrientation = Quat.multiply(MyAvatar.orientation, Quat.angleAxis(180, {
|
||||||
|
x: 0,
|
||||||
|
y: 1,
|
||||||
|
z: 0
|
||||||
|
}));
|
||||||
|
MyAvatar.orientation = newOrientation;
|
||||||
|
}
|
||||||
|
|
||||||
function registerBasicMapping() {
|
var inFlipTurn = false;
|
||||||
mappingName = 'Hifi-AdvancedMovement-Dev-' + Math.random();
|
|
||||||
basicMapping = Controller.newMapping(mappingName);
|
function registerBasicMapping() {
|
||||||
basicMapping.from(Controller.Standard.LY).to(function(value) {
|
|
||||||
if (isDisabled) {
|
drivingMapping = Controller.newMapping(DRIVING_MAPPING_NAME);
|
||||||
return;
|
drivingMapping.from(Controller.Standard.LY).to(function(value) {
|
||||||
}
|
if (isDisabled) {
|
||||||
var stick = Controller.getValue(Controller.Standard.LS);
|
return;
|
||||||
if (value === 1 && Controller.Hardware.OculusTouch !== undefined) {
|
}
|
||||||
rotate180();
|
|
||||||
} else if (Controller.Hardware.Vive !== undefined) {
|
if (value === 1 && Controller.Hardware.OculusTouch !== undefined) {
|
||||||
if (value > 0.75 && inFlipTurn === false) {
|
|
||||||
inFlipTurn = true;
|
|
||||||
rotate180();
|
rotate180();
|
||||||
Script.setTimeout(function() {
|
} else if (Controller.Hardware.Vive !== undefined) {
|
||||||
inFlipTurn = false;
|
if (value > 0.75 && inFlipTurn === false) {
|
||||||
}, TURN_RATE)
|
inFlipTurn = true;
|
||||||
|
rotate180();
|
||||||
|
Script.setTimeout(function() {
|
||||||
|
inFlipTurn = false;
|
||||||
|
}, TURN_RATE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
|
||||||
|
flyingMapping = Controller.newMapping(FLYING_MAPPING_NAME);
|
||||||
|
flyingMapping.from(Controller.Standard.RY).to(function(value) {
|
||||||
|
if (isDisabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value === 1 && Controller.Hardware.OculusTouch !== undefined) {
|
||||||
|
rotate180();
|
||||||
|
} else if (Controller.Hardware.Vive !== undefined) {
|
||||||
|
if (value > 0.75 && inFlipTurn === false) {
|
||||||
|
inFlipTurn = true;
|
||||||
|
rotate180();
|
||||||
|
Script.setTimeout(function() {
|
||||||
|
inFlipTurn = false;
|
||||||
|
}, TURN_RATE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function scriptEnding() {
|
||||||
|
Controller.disableMapping(FLYING_MAPPING_NAME);
|
||||||
|
Controller.disableMapping(DRIVING_MAPPING_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
Script.scriptEnding.connect(scriptEnding);
|
||||||
|
|
||||||
|
registerBasicMapping();
|
||||||
|
|
||||||
|
Script.setTimeout(function() {
|
||||||
|
if (MyAvatar.useAdvanceMovementControls) {
|
||||||
|
Controller.disableMapping(DRIVING_MAPPING_NAME);
|
||||||
|
} else {
|
||||||
|
Controller.enableMapping(DRIVING_MAPPING_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MyAvatar.getFyingEnabled()) {
|
||||||
|
Controller.disableMapping(FLYING_MAPPING_NAME);
|
||||||
|
} else {
|
||||||
|
Controller.enableMapping(FLYING_MAPPING_NAME);
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
|
||||||
|
|
||||||
|
HMD.displayModeChanged.connect(function(isHMDMode) {
|
||||||
|
if (isHMDMode) {
|
||||||
|
if (Controller.Hardware.Vive !== undefined || Controller.Hardware.OculusTouch !== undefined) {
|
||||||
|
if (MyAvatar.useAdvancedMovementControls) {
|
||||||
|
Controller.disableMapping(DRIVING_MAPPING_NAME);
|
||||||
|
} else {
|
||||||
|
Controller.enableMapping(DRIVING_MAPPING_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MyAvatar.getFlyingEnabled()) {
|
||||||
|
Controller.disableMapping(FLYING_MAPPING_NAME);
|
||||||
|
} else {
|
||||||
|
Controller.enableMapping(FLYING_MAPPING_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
});
|
});
|
||||||
basicMapping.from(Controller.Standard.RY).to(function(value) {
|
|
||||||
if (isDisabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var stick = Controller.getValue(Controller.Standard.RS);
|
|
||||||
if (value === 1 && Controller.Hardware.OculusTouch !== undefined) {
|
|
||||||
rotate180();
|
|
||||||
} else if (Controller.Hardware.Vive !== undefined) {
|
|
||||||
if (value > 0.75 && inFlipTurn === false) {
|
|
||||||
inFlipTurn = true;
|
|
||||||
rotate180();
|
|
||||||
Script.setTimeout(function() {
|
|
||||||
inFlipTurn = false;
|
|
||||||
}, TURN_RATE)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function enableMappings() {
|
function update() {
|
||||||
Controller.enableMapping(mappingName);
|
if ((Controller.Hardware.Vive !== undefined || Controller.Hardware.OculusTouch !== undefined) && HMD.active) {
|
||||||
}
|
var flying = MyAvatar.getFlyingEnabled();
|
||||||
|
var driving = MyAvatar.useAdvancedMovementControls;
|
||||||
|
|
||||||
function disableMappings() {
|
if (flying !== previousFlyingState) {
|
||||||
Controller.disableMapping(mappingName);
|
if (flying) {
|
||||||
}
|
Controller.disableMapping(FLYING_MAPPING_NAME);
|
||||||
|
} else {
|
||||||
|
Controller.enableMapping(FLYING_MAPPING_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
function scriptEnding() {
|
previousFlyingState = flying;
|
||||||
disableMappings();
|
|
||||||
}
|
|
||||||
|
|
||||||
Script.scriptEnding.connect(scriptEnding);
|
|
||||||
|
|
||||||
registerBasicMapping();
|
|
||||||
|
|
||||||
Script.setTimeout(function() {
|
|
||||||
if (previousSetting === true) {
|
|
||||||
disableMappings();
|
|
||||||
} else {
|
|
||||||
enableMappings();
|
|
||||||
}
|
|
||||||
}, 100)
|
|
||||||
|
|
||||||
|
|
||||||
HMD.displayModeChanged.connect(function(isHMDMode) {
|
|
||||||
if (isHMDMode) {
|
|
||||||
if (Controller.Hardware.Vive !== undefined || Controller.Hardware.OculusTouch !== undefined) {
|
|
||||||
if (isChecked === true) {
|
|
||||||
disableMappings();
|
|
||||||
} else if (isChecked === false) {
|
|
||||||
enableMappings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (driving !== previousDrivingState) {
|
||||||
|
if (driving) {
|
||||||
|
Controller.disableMapping(DRIVING_MAPPING_NAME);
|
||||||
|
} else {
|
||||||
|
Controller.enableMapping(DRIVING_MAPPING_NAME);
|
||||||
|
}
|
||||||
|
previousDrivingState = driving;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Script.setTimeout(update, TWO_SECONDS_INTERVAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
Script.setTimeout(update, TWO_SECONDS_INTERVAL);
|
||||||
|
|
||||||
|
var HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL = 'Hifi-Advanced-Movement-Disabler';
|
||||||
|
function handleMessage(channel, message, sender) {
|
||||||
|
if (channel === HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL) {
|
||||||
|
if (message === 'disable') {
|
||||||
|
isDisabled = true;
|
||||||
|
} else if (message === 'enable') {
|
||||||
|
isDisabled = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
|
Messages.subscribe(HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL);
|
||||||
var HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL = 'Hifi-Advanced-Movement-Disabler';
|
Messages.messageReceived.connect(handleMessage);
|
||||||
function handleMessage(channel, message, sender) {
|
|
||||||
if (channel === HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL) {
|
|
||||||
if (message === 'disable') {
|
|
||||||
isDisabled = true;
|
|
||||||
} else if (message === 'enable') {
|
|
||||||
isDisabled = false;
|
|
||||||
} else if (message === 'enable_mappings') {
|
|
||||||
print("enable mappings")
|
|
||||||
enableMappings();
|
|
||||||
} else if (message === 'disable_mappings') {
|
|
||||||
disableMappings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Messages.subscribe(HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL);
|
|
||||||
Messages.messageReceived.connect(handleMessage);
|
|
||||||
|
|
||||||
}()); // END LOCAL_SCOPE
|
}()); // END LOCAL_SCOPE
|
||||||
|
|
Loading…
Reference in a new issue