Preparatory work to allow for more viewport integration tests (#3961)
* preparatory work to allow for more viewport integration tests Signed-off-by: hultonha <hultonha@amazon.co.uk> * minor grammatical fix Signed-off-by: hultonha <hultonha@amazon.co.uk> * fix for missed bus call update Signed-off-by: hultonha <hultonha@amazon.co.uk>
This commit is contained in:
@@ -1087,6 +1087,7 @@ void EditorViewportWidget::ConnectViewportInteractionRequestBus()
|
||||
{
|
||||
AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler::BusConnect(GetViewportId());
|
||||
AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler::BusConnect(GetViewportId());
|
||||
AzToolsFramework::ViewportInteraction::EditorEntityViewportInteractionRequestBus::Handler::BusConnect(GetViewportId());
|
||||
m_viewportUi.ConnectViewportUiBus(GetViewportId());
|
||||
|
||||
AzFramework::InputSystemCursorConstraintRequestBus::Handler::BusConnect();
|
||||
@@ -1097,6 +1098,7 @@ void EditorViewportWidget::DisconnectViewportInteractionRequestBus()
|
||||
AzFramework::InputSystemCursorConstraintRequestBus::Handler::BusDisconnect();
|
||||
|
||||
m_viewportUi.DisconnectViewportUiBus();
|
||||
AzToolsFramework::ViewportInteraction::EditorEntityViewportInteractionRequestBus::Handler::BusDisconnect();
|
||||
AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler::BusDisconnect();
|
||||
AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ class SANDBOX_API EditorViewportWidget final
|
||||
, private AzFramework::InputSystemCursorConstraintRequestBus::Handler
|
||||
, private AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler
|
||||
, private AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler
|
||||
, private AzToolsFramework::ViewportInteraction::EditorEntityViewportInteractionRequestBus::Handler
|
||||
, private AzFramework::AssetCatalogEventBus::Handler
|
||||
, private AZ::RPI::SceneNotificationBus::Handler
|
||||
{
|
||||
@@ -128,10 +129,12 @@ private:
|
||||
CameraComponent,
|
||||
ViewSourceTypesCount,
|
||||
};
|
||||
|
||||
enum class PlayInEditorState
|
||||
{
|
||||
Editor, Starting, Started
|
||||
};
|
||||
|
||||
enum class KeyPressedState
|
||||
{
|
||||
AllUp,
|
||||
@@ -142,7 +145,7 @@ private:
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Method overrides ...
|
||||
|
||||
// QWidget
|
||||
// QWidget overrides ...
|
||||
void focusOutEvent(QFocusEvent* event) override;
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
bool event(QEvent* event) override;
|
||||
@@ -150,7 +153,7 @@ private:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
|
||||
// QtViewport/IDisplayViewport/CViewport
|
||||
// QtViewport/IDisplayViewport/CViewport overrides ...
|
||||
EViewportType GetType() const override { return ET_ViewportCamera; }
|
||||
void SetType([[maybe_unused]] EViewportType type) override { assert(type == ET_ViewportCamera); };
|
||||
AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteraction(
|
||||
@@ -176,16 +179,17 @@ private:
|
||||
void Update() override;
|
||||
void UpdateContent(int flags) override;
|
||||
|
||||
// SceneNotificationBus
|
||||
// SceneNotificationBus overrides ...
|
||||
void OnBeginPrepareRender() override;
|
||||
|
||||
// Camera::CameraNotificationBus
|
||||
// Camera::CameraNotificationBus overrides ...
|
||||
void OnActiveViewChanged(const AZ::EntityId&) override;
|
||||
|
||||
// IEditorEventListener
|
||||
// IEditorEventListener overrides ...
|
||||
void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
|
||||
|
||||
// AzToolsFramework::EditorEntityContextNotificationBus (handler moved to cpp to resolve link issues in unity builds)
|
||||
// AzToolsFramework::EditorEntityContextNotificationBus overrides ...
|
||||
// note: handler moved to cpp to resolve link issues in unity builds
|
||||
void OnStartPlayInEditor();
|
||||
void OnStopPlayInEditor();
|
||||
void OnStartPlayInEditorBegin();
|
||||
@@ -194,10 +198,10 @@ private:
|
||||
void BeginUndoTransaction() override;
|
||||
void EndUndoTransaction() override;
|
||||
|
||||
// AzFramework::InputSystemCursorConstraintRequestBus
|
||||
// AzFramework::InputSystemCursorConstraintRequestBus overrides ...
|
||||
void* GetSystemCursorConstraintWindow() const override;
|
||||
|
||||
// AzToolsFramework::ViewportFreezeRequestBus
|
||||
// AzToolsFramework::ViewportFreezeRequestBus overrides ...
|
||||
bool IsViewportInputFrozen() override;
|
||||
void FreezeViewportInput(bool freeze) override;
|
||||
|
||||
@@ -205,13 +209,15 @@ private:
|
||||
AZ::EntityId PickEntity(const AzFramework::ScreenPoint& point) override;
|
||||
AZ::Vector3 PickTerrain(const AzFramework::ScreenPoint& point) override;
|
||||
float TerrainHeight(const AZ::Vector2& position) override;
|
||||
void FindVisibleEntities(AZStd::vector<AZ::EntityId>& visibleEntitiesOut) override;
|
||||
bool ShowingWorldSpace() override;
|
||||
QWidget* GetWidgetForViewportContextMenu() override;
|
||||
void BeginWidgetContext() override;
|
||||
void EndWidgetContext() override;
|
||||
|
||||
// Camera::EditorCameraRequestBus
|
||||
// EditorEntityViewportInteractionRequestBus overrides ...
|
||||
void FindVisibleEntities(AZStd::vector<AZ::EntityId>& visibleEntities) override;
|
||||
|
||||
// Camera::EditorCameraRequestBus overrides ...
|
||||
void SetViewFromEntityPerspective(const AZ::EntityId& entityId) override;
|
||||
void SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, bool lockCameraMovement) override;
|
||||
AZ::EntityId GetCurrentViewEntityId() override;
|
||||
@@ -327,7 +333,7 @@ private:
|
||||
// Determines also if the current camera for this viewport is default editor camera
|
||||
ViewSourceType m_viewSourceType = ViewSourceType::None;
|
||||
|
||||
// During play game in editor, holds the editor entity ID of the last
|
||||
// During play game in editor, holds the editor entity ID of the last
|
||||
AZ::EntityId m_viewEntityIdCachedForEditMode;
|
||||
|
||||
// The editor camera TM before switching to game mode
|
||||
|
||||
@@ -1092,9 +1092,8 @@ bool QtViewport::HitTest(const QPoint& point, HitContext& hitInfo)
|
||||
const int viewportId = GetViewportId();
|
||||
|
||||
AzToolsFramework::EntityIdList visibleEntityIds;
|
||||
AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Event(
|
||||
viewportId,
|
||||
&AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequests::FindVisibleEntities,
|
||||
AzToolsFramework::ViewportInteraction::EditorEntityViewportInteractionRequestBus::Event(
|
||||
viewportId, &AzToolsFramework::ViewportInteraction::EditorEntityViewportInteractionRequestBus::Events::FindVisibleEntities,
|
||||
visibleEntityIds);
|
||||
|
||||
// Look through all visible entities to find the closest one to the specified mouse point
|
||||
|
||||
Reference in New Issue
Block a user