From 244e1b8e165e2ed0452e54bf5489a7dc929110b0 Mon Sep 17 00:00:00 2001 From: hultonha Date: Fri, 15 Oct 2021 16:55:40 +0100 Subject: [PATCH] add a switch to enable/disable cursor lock (default off) Signed-off-by: hultonha --- .../ViewportSelection/EditorHelpers.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorHelpers.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorHelpers.cpp index b6dbf79a2d..3d48fabe95 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorHelpers.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorHelpers.cpp @@ -44,6 +44,13 @@ AZ_CVAR( nullptr, AZ::ConsoleFunctorFlags::Null, "Display the aggregate world bounds for a given entity (the union of all world component Aabbs)"); +AZ_CVAR( + bool, + ed_useCursorLockIconInFocusMode, + false, + nullptr, + AZ::ConsoleFunctorFlags::Null, + "Use a lock icon when the cursor is over entities that cannot be interacted with"); namespace AzToolsFramework { @@ -195,9 +202,12 @@ namespace AzToolsFramework // verify if the entity Id corresponds to an entity that is focused; if not, halt selection. if (entityIdUnderCursor.IsValid() && !IsSelectableAccordingToFocusMode(entityIdUnderCursor)) { - ViewportInteraction::ViewportMouseCursorRequestBus::Event( - viewportId, &ViewportInteraction::ViewportMouseCursorRequestBus::Events::SetOverrideCursor, - ViewportInteraction::CursorStyleOverride::Forbidden); + if (ed_useCursorLockIconInFocusMode) + { + ViewportInteraction::ViewportMouseCursorRequestBus::Event( + viewportId, &ViewportInteraction::ViewportMouseCursorRequestBus::Events::SetOverrideCursor, + ViewportInteraction::CursorStyleOverride::Forbidden); + } if (mouseInteraction.m_mouseInteraction.m_mouseButtons.Left() && mouseInteraction.m_mouseEvent == ViewportInteraction::MouseEvent::Down ||