Merge pull request #1684 from aws-lumberyard-dev/hultonha_LYN-4304_viewport_ui_gamemode
Cherry-pick hiding viewport ui change from development to stabilization
This commit is contained in:
+22
-5
@@ -488,6 +488,13 @@ namespace AzToolsFramework
|
||||
return worldFromLocal.TransformPoint(CalculateCenterOffset(entityId, pivot));
|
||||
}
|
||||
|
||||
void EditorTransformComponentSelection::SetAllViewportUiVisible(const bool visible)
|
||||
{
|
||||
SetViewportUiClusterVisible(m_transformModeClusterId, visible);
|
||||
SetViewportUiClusterVisible(m_spaceCluster.m_spaceClusterId, visible);
|
||||
m_viewportUiVisible = visible;
|
||||
}
|
||||
|
||||
void EditorTransformComponentSelection::UpdateSpaceCluster(const ReferenceFrame referenceFrame)
|
||||
{
|
||||
auto buttonIdFromFrameFn = [this](const ReferenceFrame referenceFrame)
|
||||
@@ -1009,6 +1016,7 @@ namespace AzToolsFramework
|
||||
ToolsApplicationNotificationBus::Handler::BusConnect();
|
||||
Camera::EditorCameraNotificationBus::Handler::BusConnect();
|
||||
ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusConnect(entityContextId);
|
||||
EditorEntityContextNotificationBus::Handler::BusConnect();
|
||||
EditorEntityVisibilityNotificationBus::Router::BusRouterConnect();
|
||||
EditorEntityLockComponentNotificationBus::Router::BusRouterConnect();
|
||||
EditorManipulatorCommandUndoRedoRequestBus::Handler::BusConnect(entityContextId);
|
||||
@@ -1037,6 +1045,7 @@ namespace AzToolsFramework
|
||||
EditorManipulatorCommandUndoRedoRequestBus::Handler::BusDisconnect();
|
||||
EditorEntityLockComponentNotificationBus::Router::BusRouterDisconnect();
|
||||
EditorEntityVisibilityNotificationBus::Router::BusRouterDisconnect();
|
||||
EditorEntityContextNotificationBus::Handler::BusDisconnect();
|
||||
ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusDisconnect();
|
||||
Camera::EditorCameraNotificationBus::Handler::BusDisconnect();
|
||||
ToolsApplicationNotificationBus::Handler::BusDisconnect();
|
||||
@@ -2387,9 +2396,7 @@ namespace AzToolsFramework
|
||||
/*ID_VIEWPORTUI_VISIBLE=*/50040, "Toggle Viewport UI", "Hide/Show Viewport UI",
|
||||
[this]()
|
||||
{
|
||||
SetViewportUiClusterVisible(m_transformModeClusterId, !m_viewportUiVisible);
|
||||
SetViewportUiClusterVisible(m_spaceCluster.m_spaceClusterId, !m_viewportUiVisible);
|
||||
m_viewportUiVisible = !m_viewportUiVisible;
|
||||
SetAllViewportUiVisible(!m_viewportUiVisible);
|
||||
});
|
||||
|
||||
EditorMenuRequestBus::Broadcast(&EditorMenuRequests::RestoreEditMenuToDefault);
|
||||
@@ -3560,7 +3567,7 @@ namespace AzToolsFramework
|
||||
|
||||
void EditorTransformComponentSelection::EnteredComponentMode([[maybe_unused]] const AZStd::vector<AZ::Uuid>& componentModeTypes)
|
||||
{
|
||||
SetViewportUiClusterVisible(m_transformModeClusterId, false);
|
||||
SetAllViewportUiVisible(false);
|
||||
|
||||
EditorEntityLockComponentNotificationBus::Router::BusRouterDisconnect();
|
||||
EditorEntityVisibilityNotificationBus::Router::BusRouterDisconnect();
|
||||
@@ -3569,7 +3576,7 @@ namespace AzToolsFramework
|
||||
|
||||
void EditorTransformComponentSelection::LeftComponentMode([[maybe_unused]] const AZStd::vector<AZ::Uuid>& componentModeTypes)
|
||||
{
|
||||
SetViewportUiClusterVisible(m_transformModeClusterId, true);
|
||||
SetAllViewportUiVisible(true);
|
||||
|
||||
ToolsApplicationNotificationBus::Handler::BusConnect();
|
||||
EditorEntityVisibilityNotificationBus::Router::BusRouterConnect();
|
||||
@@ -3625,6 +3632,16 @@ namespace AzToolsFramework
|
||||
ETCS::SetEntityLocalRotation(entityId, localRotation, m_transformChangedInternally);
|
||||
}
|
||||
|
||||
void EditorTransformComponentSelection::OnStartPlayInEditor()
|
||||
{
|
||||
SetAllViewportUiVisible(false);
|
||||
}
|
||||
|
||||
void EditorTransformComponentSelection::OnStopPlayInEditor()
|
||||
{
|
||||
SetAllViewportUiVisible(true);
|
||||
}
|
||||
|
||||
namespace ETCS
|
||||
{
|
||||
// little raii wrapper to switch a value from true to false and back
|
||||
|
||||
+9
-1
@@ -128,6 +128,7 @@ namespace AzToolsFramework
|
||||
, private ToolsApplicationNotificationBus::Handler
|
||||
, private Camera::EditorCameraNotificationBus::Handler
|
||||
, private ComponentModeFramework::EditorComponentModeNotificationBus::Handler
|
||||
, private EditorEntityContextNotificationBus::Handler
|
||||
, private EditorEntityVisibilityNotificationBus::Router
|
||||
, private EditorEntityLockComponentNotificationBus::Router
|
||||
, private EditorManipulatorCommandUndoRedoRequestBus::Handler
|
||||
@@ -264,6 +265,10 @@ namespace AzToolsFramework
|
||||
void EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
|
||||
void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
|
||||
|
||||
// EditorEntityContextNotificationBus overrides ...
|
||||
void OnStartPlayInEditor() override;
|
||||
void OnStopPlayInEditor() override;
|
||||
|
||||
// Helpers to safely interact with the TransformBus (requests).
|
||||
void SetEntityWorldTranslation(AZ::EntityId entityId, const AZ::Vector3& worldTranslation);
|
||||
void SetEntityLocalTranslation(AZ::EntityId entityId, const AZ::Vector3& localTranslation);
|
||||
@@ -271,9 +276,12 @@ namespace AzToolsFramework
|
||||
void SetEntityLocalScale(AZ::EntityId entityId, float localScale);
|
||||
void SetEntityLocalRotation(AZ::EntityId entityId, const AZ::Vector3& localRotation);
|
||||
|
||||
// Responsible for keeping the space cluster in sync with the current reference frame.
|
||||
//! Responsible for keeping the space cluster in sync with the current reference frame.
|
||||
void UpdateSpaceCluster(ReferenceFrame referenceFrame);
|
||||
|
||||
//! Hides/Shows all viewportUi toolbars.
|
||||
void SetAllViewportUiVisible(bool visible);
|
||||
|
||||
AZ::EntityId m_hoveredEntityId; //!< What EntityId is the mouse currently hovering over (if any).
|
||||
AZ::EntityId m_cachedEntityIdUnderCursor; //!< Store the EntityId on each mouse move for use in Display.
|
||||
AZ::EntityId m_editorCameraComponentEntityId; //!< The EditorCameraComponent EntityId if it is set.
|
||||
|
||||
Reference in New Issue
Block a user