Updates to Goto Position to work with the new camera system (#1212)

* add support for 'GoTo Position' to work with the new camera enabled

* small updates to move away from more legacy calls

* minor formatting change

* ensure values are converted from degrees to radians

* revert change to use Enumerate viewport call

* remove formatting changes from SandboxIntegration
This commit is contained in:
Tom Hulton-Harrop
2021-06-10 17:46:01 +01:00
committed by GitHub
parent fedc85f51f
commit 1946561b8d
11 changed files with 328 additions and 427 deletions
-34
View File
@@ -267,14 +267,12 @@ AZ_POP_DISABLE_WARNING
m_levelExtension = EditorUtils::LevelFile::GetDefaultFileExtension();
m_playerViewTM.SetIdentity();
GetIEditor()->RegisterNotifyListener(this);
AZ::Interface<IEditorCameraController>::Register(this);
}
AZ_PUSH_DISABLE_WARNING(4273, "-Wunknown-warning-option")
CGameEngine::~CGameEngine()
{
AZ_POP_DISABLE_WARNING
AZ::Interface<IEditorCameraController>::Unregister(this);
GetIEditor()->UnregisterNotifyListener(this);
m_pISystem->GetIMovieSystem()->SetCallback(NULL);
@@ -349,38 +347,6 @@ static void CmdGotoEditor(IConsoleCmdArgs* pArgs)
}
}
void CGameEngine::SetCurrentViewPosition(const AZ::Vector3& position)
{
CViewport* pRenderViewport = GetIEditor()->GetViewManager()->GetGameViewport();
if (pRenderViewport)
{
CUndo undo("Set Current View Position");
if (CUndo::IsRecording())
{
CUndo::Record(new CUndoViewPosition());
}
Matrix34 tm = pRenderViewport->GetViewTM();
tm.SetTranslation(Vec3(position.GetX(), position.GetY(), position.GetZ()));
pRenderViewport->SetViewTM(tm);
}
}
void CGameEngine::SetCurrentViewRotation(const AZ::Vector3& rotation)
{
CViewport* pRenderViewport = GetIEditor()->GetViewManager()->GetGameViewport();
if (pRenderViewport)
{
CUndo undo("Set Current View Rotation");
if (CUndo::IsRecording())
{
CUndo::Record(new CUndoViewRotation());
}
Matrix34 tm = pRenderViewport->GetViewTM();
tm.SetRotationXYZ(Ang3(DEG2RAD(rotation.GetX()), DEG2RAD(rotation.GetY()), DEG2RAD(rotation.GetZ())), tm.GetTranslation());
pRenderViewport->SetViewTM(tm);
}
}
AZ::Outcome<void, AZStd::string> CGameEngine::Init(
bool bPreviewMode,
bool bTestMode,