diff --git a/include/openspace/navigation/navigationhandler.h b/include/openspace/navigation/navigationhandler.h index ed17a81d7d..5899b7b9fb 100644 --- a/include/openspace/navigation/navigationhandler.h +++ b/include/openspace/navigation/navigationhandler.h @@ -90,6 +90,8 @@ public: // Callback functions void keyboardCallback(Key key, KeyModifier modifier, KeyAction action); + bool disabledKeybindings() const; + void mouseButtonCallback(MouseButton button, MouseAction action); void mousePositionCallback(double x, double y); void mouseScrollWheelCallback(double pos); @@ -169,6 +171,7 @@ private: std::optional _pendingNavigationState; + properties::BoolProperty _disableKeybindings; properties::BoolProperty _disableMouseInputs; properties::BoolProperty _disableJoystickInputs; properties::BoolProperty _useKeyFrameInteraction; diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 17d75934b3..5ebce6a3cf 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -1443,7 +1443,11 @@ void OpenSpaceEngine::keyboardCallback(Key key, KeyModifier mod, KeyAction actio } global::navigationHandler->keyboardCallback(key, mod, action); - global::keybindingManager->keyboardCallback(key, mod, action); + + if (!global::navigationHandler->disabledKeybindings()) { + global::keybindingManager->keyboardCallback(key, mod, action); + } + global::interactionMonitor->markInteraction(); } diff --git a/src/navigation/navigationhandler.cpp b/src/navigation/navigationhandler.cpp index 44785df83e..fc6c60dc50 100644 --- a/src/navigation/navigationhandler.cpp +++ b/src/navigation/navigationhandler.cpp @@ -59,20 +59,26 @@ namespace { constexpr std::string_view _loggerCat = "NavigationHandler"; - using namespace openspace; - constexpr properties::Property::PropertyInfo KeyDisableMouseInputInfo = { + constexpr openspace::properties::Property::PropertyInfo DisableKeybindingsInfo = { + "DisableKeybindings", + "Disable all Keybindings", + "Disables all keybindings without removing them. Please note that this does not " + "apply to the key to open the console" + }; + + constexpr openspace::properties::Property::PropertyInfo DisableMouseInputInfo = { "DisableMouseInputs", "Disable all mouse inputs", "Disables all mouse inputs and prevents them from affecting the camera" }; - constexpr properties::Property::PropertyInfo KeyDisableJoystickInputInfo = { + constexpr openspace::properties::Property::PropertyInfo DisableJoystickInputInfo = { "DisableJoystickInputs", "Disable all joystick inputs", "Disables all joystick inputs and prevents them from affecting the camera" }; - constexpr properties::Property::PropertyInfo KeyFrameInfo = { + constexpr openspace::properties::Property::PropertyInfo FrameInfo = { "UseKeyFrameInteraction", "Use keyframe interaction", "If this is set to 'true' the entire interaction is based off key frames rather " @@ -84,13 +90,15 @@ namespace openspace::interaction { NavigationHandler::NavigationHandler() : properties::PropertyOwner({ "NavigationHandler" }) - , _disableMouseInputs(KeyDisableMouseInputInfo, false) - , _disableJoystickInputs(KeyDisableJoystickInputInfo, false) - , _useKeyFrameInteraction(KeyFrameInfo, false) + , _disableKeybindings(DisableKeybindingsInfo, false) + , _disableMouseInputs(DisableMouseInputInfo, false) + , _disableJoystickInputs(DisableJoystickInputInfo, false) + , _useKeyFrameInteraction(FrameInfo, false) { addPropertySubOwner(_orbitalNavigator); addPropertySubOwner(_pathNavigator); + addProperty(_disableKeybindings); addProperty(_disableMouseInputs); addProperty(_disableJoystickInputs); addProperty(_useKeyFrameInteraction); @@ -368,6 +376,10 @@ void NavigationHandler::keyboardCallback(Key key, KeyModifier modifier, KeyActio _keyboardInputState.keyboardCallback(key, modifier, action); } +bool NavigationHandler::disabledKeybindings() const { + return _disableKeybindings; +} + NavigationState NavigationHandler::navigationState() const { const SceneGraphNode* referenceFrame = _orbitalNavigator.followingAnchorRotation() ? _orbitalNavigator.anchorNode() :