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:
committed by
GitHub
parent
fedc85f51f
commit
1946561b8d
@@ -32,6 +32,7 @@
|
||||
#include "GameEngine.h"
|
||||
#include "UndoConfigSpec.h"
|
||||
#include "ViewManager.h"
|
||||
#include "EditorViewportCamera.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
namespace
|
||||
@@ -241,26 +242,15 @@ namespace
|
||||
|
||||
void PySetCurrentViewPosition(float x, float y, float z)
|
||||
{
|
||||
AzToolsFramework::IEditorCameraController* editorCameraController = AZ::Interface<AzToolsFramework::IEditorCameraController>::Get();
|
||||
AZ_Error("editor", editorCameraController, "IEditorCameraController is not registered.");
|
||||
if (editorCameraController)
|
||||
{
|
||||
editorCameraController->SetCurrentViewPosition(AZ::Vector3{ x, y, z });
|
||||
}
|
||||
SandboxEditor::SetDefaultViewportCameraPosition(AZ::Vector3(x, y, z));
|
||||
}
|
||||
|
||||
void PySetCurrentViewRotation(float x, float y, float z)
|
||||
void PySetCurrentViewRotation(float x, [[maybe_unused]] float y, float z)
|
||||
{
|
||||
AzToolsFramework::IEditorCameraController* editorCameraController = AZ::Interface<AzToolsFramework::IEditorCameraController>::Get();
|
||||
AZ_Error("editor", editorCameraController, "IEditorCameraController is not registered.");
|
||||
if (editorCameraController)
|
||||
{
|
||||
editorCameraController->SetCurrentViewRotation(AZ::Vector3{ x, y, z });
|
||||
}
|
||||
SandboxEditor::SetDefaultViewportCameraRotation(AZ::DegToRad(x), AZ::DegToRad(z));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
void PyStartProcessDetached(const char* process, const char* args)
|
||||
@@ -488,9 +478,9 @@ namespace AzToolsFramework
|
||||
|
||||
addLegacyGeneral(behaviorContext->Method("load_all_plugins", ::Command_LoadPlugins, nullptr, "Loads all available plugins."));
|
||||
addLegacyGeneral(behaviorContext->Method("get_current_view_position", PyGetCurrentViewPosition, nullptr, "Returns the position of the current view as a Vec3."));
|
||||
addLegacyGeneral(behaviorContext->Method("get_current_view_rotation", PyGetCurrentViewRotation, nullptr, "Returns the rotation of the current view as a Vec3 of Euler angles."));
|
||||
addLegacyGeneral(behaviorContext->Method("get_current_view_rotation", PyGetCurrentViewRotation, nullptr, "Returns the rotation of the current view as a Vec3 of Euler angles in degrees."));
|
||||
addLegacyGeneral(behaviorContext->Method("set_current_view_position", PySetCurrentViewPosition, nullptr, "Sets the position of the current view as given x, y, z coordinates."));
|
||||
addLegacyGeneral(behaviorContext->Method("set_current_view_rotation", PySetCurrentViewRotation, nullptr, "Sets the rotation of the current view as given x, y, z Euler angles."));
|
||||
addLegacyGeneral(behaviorContext->Method("set_current_view_rotation", PySetCurrentViewRotation, nullptr, "Sets the rotation of the current view as given x, y, z Euler angles in degrees."));
|
||||
|
||||
addLegacyGeneral(behaviorContext->Method("export_to_engine", CCryEditApp::Command_ExportToEngine, nullptr, "Exports the current level to the engine."));
|
||||
addLegacyGeneral(behaviorContext->Method("set_config_spec", PySetConfigSpec, nullptr, "Sets the system config spec and platform."));
|
||||
|
||||
Reference in New Issue
Block a user