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:
@@ -17,10 +17,24 @@
|
||||
// Editor
|
||||
#include "ViewManager.h"
|
||||
|
||||
#include <AzCore/Math/Matrix3x3.h>
|
||||
#include <AzCore/Math/Matrix3x4.h>
|
||||
#include <AzFramework/Components/CameraBus.h>
|
||||
#include <MathConversion.h>
|
||||
|
||||
Ang3 CUndoViewRotation::GetActiveCameraRotation()
|
||||
{
|
||||
AZ::Transform activeCameraTm = AZ::Transform::CreateIdentity();
|
||||
EBUS_EVENT_RESULT(activeCameraTm, Camera::ActiveCameraRequestBus, GetActiveCameraTransform);
|
||||
const AZ::Matrix3x4 cameraMatrix = AZ::Matrix3x4::CreateFromTransform(activeCameraTm);
|
||||
const Matrix33 cameraMatrixCry = AZMatrix3x3ToLYMatrix3x3(AZ::Matrix3x3::CreateFromMatrix3x4(cameraMatrix));
|
||||
return RAD2DEG(Ang3::GetAnglesXYZ(cameraMatrixCry));
|
||||
}
|
||||
|
||||
CUndoViewRotation::CUndoViewRotation(const QString& pUndoDescription)
|
||||
{
|
||||
m_undoDescription = pUndoDescription;
|
||||
m_undo = RAD2DEG(Ang3::GetAnglesXYZ(Matrix33(GetIEditor()->GetSystem()->GetViewCamera().GetMatrix())));
|
||||
m_undo = GetActiveCameraRotation();
|
||||
}
|
||||
|
||||
int CUndoViewRotation::GetSize()
|
||||
@@ -40,7 +54,7 @@ void CUndoViewRotation::Undo(bool bUndo)
|
||||
{
|
||||
if (bUndo)
|
||||
{
|
||||
m_redo = RAD2DEG(Ang3::GetAnglesXYZ(Matrix33(GetIEditor()->GetSystem()->GetViewCamera().GetMatrix())));
|
||||
m_redo = GetActiveCameraRotation();
|
||||
}
|
||||
|
||||
Matrix34 tm = pRenderViewport->GetViewTM();
|
||||
|
||||
Reference in New Issue
Block a user