Skip to content

Commit 9ea52f9

Browse files
author
Roberto De Ioris
committed
improved EditorViewportClient
1 parent 2aac28d commit 9ea52f9

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

Source/UnrealEnginePython/Private/Slate/UEPySPythonEditorViewport.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,20 @@
44
#if WITH_EDITOR
55

66
#include "Components/DirectionalLightComponent.h"
7+
#include "Wrappers/UEPyFEditorViewportClient.h"
78

89
static PyObject *py_ue_spython_editor_viewport_get_world(ue_PySPythonEditorViewport *self, PyObject * args)
910
{
1011
ue_py_slate_cast(SPythonEditorViewport);
1112
Py_RETURN_UOBJECT(py_SPythonEditorViewport->GetPythonWorld());
1213
}
1314

15+
static PyObject *py_ue_spython_editor_viewport_get_editor_viewport_client(ue_PySPythonEditorViewport *self, PyObject * args)
16+
{
17+
ue_py_slate_cast(SPythonEditorViewport);
18+
return py_ue_new_feditor_viewport_client(py_SPythonEditorViewport->GetViewportClient().ToSharedRef());
19+
}
20+
1421
static PyObject *py_ue_spython_editor_viewport_set_show_bounds(ue_PySPythonEditorViewport *self, PyObject * args)
1522
{
1623
ue_py_slate_cast(SPythonEditorViewport);
@@ -241,6 +248,7 @@ static PyObject *py_ue_spython_editor_viewport_get_light(ue_PySPythonEditorViewp
241248
static PyMethodDef ue_PySPythonEditorViewport_methods[] = {
242249
{ "simulate", (PyCFunction)py_ue_spython_editor_viewport_simulate, METH_VARARGS, "" },
243250
{ "get_world", (PyCFunction)py_ue_spython_editor_viewport_get_world, METH_VARARGS, "" },
251+
{ "get_editor_viewport_client", (PyCFunction)py_ue_spython_editor_viewport_get_editor_viewport_client, METH_VARARGS, "" },
244252
{ "set_show_bounds", (PyCFunction)py_ue_spython_editor_viewport_set_show_bounds, METH_VARARGS, "" },
245253
{ "set_show_stats", (PyCFunction)py_ue_spython_editor_viewport_set_show_stats, METH_VARARGS, "" },
246254
{ "set_view_mode", (PyCFunction)py_ue_spython_editor_viewport_set_view_mode, METH_VARARGS, "" },

Source/UnrealEnginePython/Private/Wrappers/UEPyFEditorViewportClient.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ static PyObject *py_ue_feditor_viewport_client_get_view_location(ue_PyFEditorVie
3737
return py_ue_new_fvector(self->editor_viewport_client->GetViewLocation());
3838
}
3939

40+
static PyObject *py_ue_feditor_viewport_client_get_view_rotation(ue_PyFEditorViewportClient *self, PyObject * args)
41+
{
42+
return py_ue_new_frotator(self->editor_viewport_client->GetViewRotation());
43+
}
44+
4045
static PyObject *py_ue_feditor_viewport_client_get_camera_speed(ue_PyFEditorViewportClient *self, PyObject * args)
4146
{
4247
return PyFloat_FromDouble(self->editor_viewport_client->GetCameraSpeed());
@@ -84,6 +89,15 @@ static PyObject *py_ue_feditor_viewport_client_set_view_location(ue_PyFEditorVie
8489
Py_RETURN_NONE;
8590
}
8691

92+
static PyObject *py_ue_feditor_viewport_client_set_view_rotation(ue_PyFEditorViewportClient *self, PyObject * args)
93+
{
94+
FRotator rot;
95+
if (!py_ue_rotator_arg(args, rot))
96+
return PyErr_Format(PyExc_Exception, "argument is not a FRotator");
97+
self->editor_viewport_client->SetViewRotation(rot);
98+
Py_RETURN_NONE;
99+
}
100+
87101
static PyObject *py_ue_feditor_viewport_client_set_realtime(ue_PyFEditorViewportClient *self, PyObject * args)
88102
{
89103
PyObject* bInRealtime;
@@ -101,12 +115,14 @@ static PyMethodDef ue_PyFEditorViewportClient_methods[] = {
101115
{ "tick", (PyCFunction)py_ue_feditor_viewport_client_tick, METH_VARARGS, "" },
102116
{ "get_look_at_location", (PyCFunction)py_ue_feditor_viewport_client_get_look_at_location, METH_VARARGS, "" },
103117
{ "get_view_location", (PyCFunction)py_ue_feditor_viewport_client_get_view_location, METH_VARARGS, "" },
118+
{ "get_view_rotation", (PyCFunction)py_ue_feditor_viewport_client_get_view_location, METH_VARARGS, "" },
104119
{ "get_camera_speed", (PyCFunction)py_ue_feditor_viewport_client_get_camera_speed, METH_VARARGS, "" },
105120
{ "get_viewport_dimensions", (PyCFunction)py_ue_feditor_viewport_client_get_viewport_dimensions, METH_VARARGS, "" },
106121
{ "is_visible", (PyCFunction)py_ue_feditor_viewport_client_is_visible, METH_VARARGS, "" },
107122
{ "get_scene_depth_at_location", (PyCFunction)py_ue_feditor_viewport_client_get_scene_depth_at_location, METH_VARARGS, "" },
108123
{ "set_look_at_location", (PyCFunction)py_ue_feditor_viewport_client_set_look_at_location, METH_VARARGS, "" },
109124
{ "set_view_location", (PyCFunction)py_ue_feditor_viewport_client_set_view_location, METH_VARARGS, "" },
125+
{ "set_view_rotation", (PyCFunction)py_ue_feditor_viewport_client_set_view_rotation, METH_VARARGS, "" },
110126
{ "set_realtime", (PyCFunction)py_ue_feditor_viewport_client_set_realtime, METH_VARARGS, "" },
111127
{ nullptr } /* Sentinel */
112128
};
110 KB
Loading

0 commit comments

Comments
 (0)