Remove legacy Cry dependencies from the Camera Gem

Signed-off-by: nvsickle <nvsickle@amazon.com>
This commit is contained in:
nvsickle
2021-09-16 14:33:15 -07:00
parent a5306f10f3
commit 6914cfe5bc
10 changed files with 34 additions and 126 deletions
@@ -12,10 +12,9 @@
#include "EditorCameraComponent.h"
#include "ViewportCameraSelectorWindow.h"
#include <MathConversion.h>
#include <IRenderer.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
#include <Atom/RPI.Public/ViewportContext.h>
#include <Atom/RPI.Public/View.h>
@@ -33,6 +32,14 @@ namespace Camera
CameraComponentConfig controllerConfig = m_controller.GetConfiguration();
controllerConfig.m_editorEntityId = GetEntityId().operator AZ::u64();
m_controller.SetConfiguration(controllerConfig);
// Only allow our camera to activate with the component if we're currently in game mode.
m_controller.SetShouldActivateFunction([]()
{
bool isInGameMode = true;
AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(
isInGameMode, &AzToolsFramework::EditorEntityContextRequestBus::Events::IsEditorRunningGame);
return isInGameMode;
});
// Call base class activate, which in turn calls Activate on our controller.
EditorCameraComponentBase::Activate();