mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 07:27:04 +02:00
platform states, edit controller mapping, separate mac/win delete
This commit is contained in:
parent
467fe56103
commit
b6edb2c9d6
3 changed files with 42 additions and 4 deletions
|
@ -726,6 +726,9 @@ static const QString STATE_SNAP_TURN = "SnapTurn";
|
||||||
static const QString STATE_ADVANCED_MOVEMENT_CONTROLS = "AdvancedMovement";
|
static const QString STATE_ADVANCED_MOVEMENT_CONTROLS = "AdvancedMovement";
|
||||||
static const QString STATE_GROUNDED = "Grounded";
|
static const QString STATE_GROUNDED = "Grounded";
|
||||||
static const QString STATE_NAV_FOCUSED = "NavigationFocused";
|
static const QString STATE_NAV_FOCUSED = "NavigationFocused";
|
||||||
|
static const QString STATE_PLATFORM_WINDOWS = "PlatformWindows";
|
||||||
|
static const QString STATE_PLATFORM_MAC = "PlatformMac";
|
||||||
|
static const QString STATE_PLATFORM_ANDROID = "PlatformAndroid";
|
||||||
|
|
||||||
// Statically provided display and input plugins
|
// Statically provided display and input plugins
|
||||||
extern DisplayPluginList getDisplayPlugins();
|
extern DisplayPluginList getDisplayPlugins();
|
||||||
|
@ -909,7 +912,8 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
||||||
DependencyManager::set<MessagesClient>();
|
DependencyManager::set<MessagesClient>();
|
||||||
controller::StateController::setStateVariables({ { STATE_IN_HMD, STATE_CAMERA_FULL_SCREEN_MIRROR,
|
controller::StateController::setStateVariables({ { STATE_IN_HMD, STATE_CAMERA_FULL_SCREEN_MIRROR,
|
||||||
STATE_CAMERA_FIRST_PERSON, STATE_CAMERA_THIRD_PERSON, STATE_CAMERA_ENTITY, STATE_CAMERA_INDEPENDENT,
|
STATE_CAMERA_FIRST_PERSON, STATE_CAMERA_THIRD_PERSON, STATE_CAMERA_ENTITY, STATE_CAMERA_INDEPENDENT,
|
||||||
STATE_SNAP_TURN, STATE_ADVANCED_MOVEMENT_CONTROLS, STATE_GROUNDED, STATE_NAV_FOCUSED } });
|
STATE_SNAP_TURN, STATE_ADVANCED_MOVEMENT_CONTROLS, STATE_GROUNDED, STATE_NAV_FOCUSED,
|
||||||
|
STATE_PLATFORM_WINDOWS, STATE_PLATFORM_MAC, STATE_PLATFORM_WINDOWS } });
|
||||||
DependencyManager::set<UserInputMapper>();
|
DependencyManager::set<UserInputMapper>();
|
||||||
DependencyManager::set<controller::ScriptingInterface, ControllerScriptingInterface>();
|
DependencyManager::set<controller::ScriptingInterface, ControllerScriptingInterface>();
|
||||||
DependencyManager::set<InterfaceParentFinder>();
|
DependencyManager::set<InterfaceParentFinder>();
|
||||||
|
@ -1683,6 +1687,27 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
_applicationStateDevice->setInputVariant(STATE_NAV_FOCUSED, []() -> float {
|
_applicationStateDevice->setInputVariant(STATE_NAV_FOCUSED, []() -> float {
|
||||||
return DependencyManager::get<OffscreenUi>()->navigationFocused() ? 1 : 0;
|
return DependencyManager::get<OffscreenUi>()->navigationFocused() ? 1 : 0;
|
||||||
});
|
});
|
||||||
|
_applicationStateDevice->setInputVariant(STATE_PLATFORM_WINDOWS, []() -> float {
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
return 1;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
});
|
||||||
|
_applicationStateDevice->setInputVariant(STATE_PLATFORM_MAC, []() -> float {
|
||||||
|
#if defined(Q_OS_MAC)
|
||||||
|
return 1;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
});
|
||||||
|
_applicationStateDevice->setInputVariant(STATE_PLATFORM_ANDROID, []() -> float {
|
||||||
|
#if defined(Q_OS_ANDROID)
|
||||||
|
return 1;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
});
|
||||||
|
|
||||||
// Setup the _keyboardMouseDevice, _touchscreenDevice, _touchscreenVirtualPadDevice and the user input mapper with the default bindings
|
// Setup the _keyboardMouseDevice, _touchscreenDevice, _touchscreenVirtualPadDevice and the user input mapper with the default bindings
|
||||||
userInputMapper->registerDevice(_keyboardMouseDevice->getInputDevice());
|
userInputMapper->registerDevice(_keyboardMouseDevice->getInputDevice());
|
||||||
|
|
|
@ -302,6 +302,8 @@ controller::Input::NamedVector KeyboardMouseDevice::InputDevice::getAvailableInp
|
||||||
availableInputs.append(Input::NamedPair(makeInput(Qt::Key_PageDown), QKeySequence(Qt::Key_PageDown).toString()));
|
availableInputs.append(Input::NamedPair(makeInput(Qt::Key_PageDown), QKeySequence(Qt::Key_PageDown).toString()));
|
||||||
availableInputs.append(Input::NamedPair(makeInput(Qt::Key_Tab), QKeySequence(Qt::Key_Tab).toString()));
|
availableInputs.append(Input::NamedPair(makeInput(Qt::Key_Tab), QKeySequence(Qt::Key_Tab).toString()));
|
||||||
availableInputs.append(Input::NamedPair(makeInput(Qt::Key_Control), "Control"));
|
availableInputs.append(Input::NamedPair(makeInput(Qt::Key_Control), "Control"));
|
||||||
|
availableInputs.append(Input::NamedPair(makeInput(Qt::Key_Delete), "Delete"));
|
||||||
|
availableInputs.append(Input::NamedPair(makeInput(Qt::Key_Backspace), QKeySequence(Qt::Key_Backspace).toString()));
|
||||||
|
|
||||||
availableInputs.append(Input::NamedPair(makeInput(Qt::LeftButton), "LeftMouseButton"));
|
availableInputs.append(Input::NamedPair(makeInput(Qt::LeftButton), "LeftMouseButton"));
|
||||||
availableInputs.append(Input::NamedPair(makeInput(Qt::MiddleButton), "MiddleMouseButton"));
|
availableInputs.append(Input::NamedPair(makeInput(Qt::MiddleButton), "MiddleMouseButton"));
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
var EDIT_TOGGLE_BUTTON = "com.highfidelity.interface.system.editButton";
|
var EDIT_TOGGLE_BUTTON = "com.highfidelity.interface.system.editButton";
|
||||||
|
|
||||||
|
var CONTROLLER_MAPPING_NAME = "com.highfidelity.editMode";
|
||||||
|
|
||||||
Script.include([
|
Script.include([
|
||||||
"libraries/stringHelpers.js",
|
"libraries/stringHelpers.js",
|
||||||
"libraries/dataViewHelpers.js",
|
"libraries/dataViewHelpers.js",
|
||||||
|
@ -860,6 +862,7 @@ var toolBar = (function () {
|
||||||
cameraManager.disable();
|
cameraManager.disable();
|
||||||
selectionDisplay.triggerMapping.disable();
|
selectionDisplay.triggerMapping.disable();
|
||||||
tablet.landscape = false;
|
tablet.landscape = false;
|
||||||
|
Controller.disableMapping(CONTROLLER_MAPPING_NAME);
|
||||||
} else {
|
} else {
|
||||||
if (shouldUseEditTabletApp()) {
|
if (shouldUseEditTabletApp()) {
|
||||||
tablet.loadQMLSource("hifi/tablet/Edit.qml", true);
|
tablet.loadQMLSource("hifi/tablet/Edit.qml", true);
|
||||||
|
@ -876,6 +879,7 @@ var toolBar = (function () {
|
||||||
selectionDisplay.triggerMapping.enable();
|
selectionDisplay.triggerMapping.enable();
|
||||||
print("starting tablet in landscape mode");
|
print("starting tablet in landscape mode");
|
||||||
tablet.landscape = true;
|
tablet.landscape = true;
|
||||||
|
Controller.enableMapping(CONTROLLER_MAPPING_NAME);
|
||||||
// Not sure what the following was meant to accomplish, but it currently causes
|
// Not sure what the following was meant to accomplish, but it currently causes
|
||||||
// everybody else to think that Interface has lost focus overall. fogbugzid:558
|
// everybody else to think that Interface has lost focus overall. fogbugzid:558
|
||||||
// Window.setFocus();
|
// Window.setFocus();
|
||||||
|
@ -1859,9 +1863,7 @@ var keyReleaseEvent = function (event) {
|
||||||
cameraManager.keyReleaseEvent(event);
|
cameraManager.keyReleaseEvent(event);
|
||||||
}
|
}
|
||||||
// since sometimes our menu shortcut keys don't work, trap our menu items here also and fire the appropriate menu items
|
// since sometimes our menu shortcut keys don't work, trap our menu items here also and fire the appropriate menu items
|
||||||
if (event.text === "DELETE") {
|
if (event.text === 'd' && event.isControl) {
|
||||||
deleteSelectedEntities();
|
|
||||||
} else if (event.text === 'd' && event.isControl) {
|
|
||||||
selectionManager.clearSelections();
|
selectionManager.clearSelections();
|
||||||
} else if (event.text === "t") {
|
} else if (event.text === "t") {
|
||||||
selectionDisplay.toggleSpaceMode();
|
selectionDisplay.toggleSpaceMode();
|
||||||
|
@ -1893,6 +1895,15 @@ var keyReleaseEvent = function (event) {
|
||||||
Controller.keyReleaseEvent.connect(keyReleaseEvent);
|
Controller.keyReleaseEvent.connect(keyReleaseEvent);
|
||||||
Controller.keyPressEvent.connect(keyPressEvent);
|
Controller.keyPressEvent.connect(keyPressEvent);
|
||||||
|
|
||||||
|
function deleteKey(value) {
|
||||||
|
if (value === 0) { // on release
|
||||||
|
deleteSelectedEntities();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var mapping = Controller.newMapping(CONTROLLER_MAPPING_NAME);
|
||||||
|
mapping.from([Controller.Hardware.Keyboard.Delete]).when([Controller.Hardware.Application.PlatformWindows]).peek().to(deleteKey);
|
||||||
|
mapping.from([Controller.Hardware.Keyboard.Backspace]).when([Controller.Hardware.Application.PlatformMac]).peek().to(deleteKey);
|
||||||
|
|
||||||
function recursiveAdd(newParentID, parentData) {
|
function recursiveAdd(newParentID, parentData) {
|
||||||
if (parentData.children !== undefined) {
|
if (parentData.children !== undefined) {
|
||||||
var children = parentData.children;
|
var children = parentData.children;
|
||||||
|
|
Loading…
Reference in a new issue