Camera Component, Editor Viewport Widget refactoring.

- Handle changing of active camera entirely inside CameraComponentController
- Remove a LOT of legacy Cry things related to cameras
- Add a CameraSystemComponent to handle ActiveCameraRequestBus and CameraSystemRequestBus

Signed-off-by: Yuriy Toporovskyy <toporovskyy.y@gmail.com>
This commit is contained in:
Yuriy Toporovskyy
2021-08-04 10:39:57 -04:00
parent 6d2765ef42
commit 73fee0c57e
47 changed files with 1126 additions and 6046 deletions
+11 -8
View File
@@ -161,16 +161,19 @@ void CCommentNodeAnimator::Render(CTrackViewAnimNode* pNode, [[maybe_unused]] co
Vec2 CCommentNodeAnimator::GetScreenPosFromNormalizedPos(const Vec2& unitPos)
{
const CCamera& cam = gEnv->pSystem->GetViewCamera();
float width = (float)cam.GetViewSurfaceX();
int height = cam.GetViewSurfaceZ();
float fAspectRatio = gSettings.viewports.fDefaultAspectRatio;
float camWidth = height * fAspectRatio;
(void)unitPos;
AZ_Error("CryLegacy", false, "CCommentNodeAnimator::GetScreenPosFromNormalizedPos not supported");
return Vec2(0, 0);
//const CCamera& cam = gEnv->pSystem->GetViewCamera();
//float width = (float)cam.GetViewSurfaceX();
//int height = cam.GetViewSurfaceZ();
//float fAspectRatio = gSettings.viewports.fDefaultAspectRatio;
//float camWidth = height * fAspectRatio;
float x = 0.5f * width + 0.5f * camWidth * unitPos.x;
float y = 0.5f * height * (1.f - unitPos.y);
//float x = 0.5f * width + 0.5f * camWidth * unitPos.x;
//float y = 0.5f * height * (1.f - unitPos.y);
return Vec2(x, y);
//return Vec2(x, y);
}
void CCommentNodeAnimator::DrawText(const char* szFontName, float fSize, const Vec2& unitPos, const ColorF col, const char* szText, int align)
@@ -44,7 +44,12 @@ namespace
{
const int g_useActiveViewportResolution = -1; // reserved value to indicate the use of the active viewport resolution
int resolutions[][2] = {
{ 1280, 720 }, { 1920, 1080 }, { 1998, 1080 }, { 2048, 858 }, { 2560, 1440 },
{1280, 720},
{1920, 1080},
{1998, 1080},
{2048, 858},
{2560, 1440},
{3840, 2160},
{ g_useActiveViewportResolution, g_useActiveViewportResolution } // active viewport res must be the last element of the resolution array
};
@@ -1067,6 +1072,10 @@ void CSequenceBatchRenderDialog::OnUpdateEnd(IAnimSequence* sequence)
{
GetIEditor()->GetMovieSystem()->DisableFixedStepForCapture();
// Important: End batch render mode BEFORE leaving Game Mode.
// Otherwise track view will set the active camera based on the directors in the current sequence while leaving game mode
GetIEditor()->GetMovieSystem()->EnableBatchRenderMode(false);
GetIEditor()->GetMovieSystem()->RemoveMovieListener(sequence, this);
GetIEditor()->SetInGameMode(false);
GetIEditor()->GetGameEngine()->Update(); // Update is needed because SetInGameMode() queues game mode, Update() executes it.
@@ -1186,7 +1195,6 @@ void CSequenceBatchRenderDialog::OnUpdateFinalize()
m_ui->m_pGoBtn->setText(tr("Start"));
m_ui->m_pGoBtn->setIcon(QPixmap(":/Trackview/clapperboard_ready.png"));
GetIEditor()->GetMovieSystem()->EnableBatchRenderMode(false);
m_renderContext.currentItemIndex = -1;
m_ui->BATCH_RENDER_PRESS_ESC_TO_CANCEL->setText(m_ffmpegPluginStatusMsg);
@@ -27,6 +27,7 @@
#include <CryCommon/Maestro/Types/AnimNodeType.h>
#include <CryCommon/Maestro/Types/AnimValueType.h>
#include <CryCommon/Maestro/Types/AnimParamType.h>
#include <CryCommon/MathConversion.h>
// Editor
#include "AnimationContext.h"