Skip to content

Commit e6a4d23

Browse files
author
Roberto De Ioris
committed
fixed UEPyTimer/Ticker inclusion and modernized api for set_viw_target()
1 parent 8e70f06 commit e6a4d23

4 files changed

Lines changed: 8 additions & 12 deletions

File tree

‎Source/UnrealEnginePython/Private/UEPyTicker.cpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "UnrealEnginePythonPrivatePCH.h"
22

3+
#include "UEPyTicker.h"
4+
35
// destructor
46
static void ue_pyfdelegatehandle_dealloc(ue_PyFDelegateHandle *self) {
57
Py_DECREF(self->py_callable);

‎Source/UnrealEnginePython/Private/UEPyTimer.cpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "UnrealEnginePythonPrivatePCH.h"
22

3+
#include "UEPyTimer.h"
4+
35
static PyObject *py_ue_ftimerhandle_clear(ue_PyFTimerHandle *self, PyObject * args) {
46
self->world->GetTimerManager().ClearTimer(self->thandle);
57
Py_INCREF(Py_None);

‎Source/UnrealEnginePython/Private/UEPyWorld.cpp‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -159,24 +159,17 @@ PyObject *py_ue_set_view_target(ue_PyUObject * self, PyObject * args) {
159159
if (!world)
160160
return PyErr_Format(PyExc_Exception, "unable to retrieve UWorld from uobject");
161161

162-
PyObject *obj;
162+
PyObject *py_obj;
163163
int controller_id = 0;
164-
if (!PyArg_ParseTuple(args, "O|i:set_view_target", &obj, &controller_id)) {
164+
if (!PyArg_ParseTuple(args, "O|i:set_view_target", &py_obj, &controller_id)) {
165165
return NULL;
166166
}
167167

168-
if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyUObjectType)) {
169-
return PyErr_Format(PyExc_Exception, "argument is not a UObject");
170-
}
171-
172-
ue_PyUObject *py_obj = (ue_PyUObject *)obj;
173-
174-
if (!py_obj->ue_object->IsA<AActor>()) {
168+
AActor *actor = ue_py_check_type<AActor>(py_obj);
169+
if (!actor) {
175170
return PyErr_Format(PyExc_Exception, "argument is not an actor");
176171
}
177172

178-
AActor *actor = (AActor *)py_obj->ue_object;
179-
180173
APlayerController *controller = UGameplayStatics::GetPlayerController(world, controller_id);
181174
if (!controller)
182175
return PyErr_Format(PyExc_Exception, "unable to retrieve controller %d", controller_id);

‎Source/UnrealEnginePython/UnrealEnginePython.Build.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public class UnrealEnginePython : ModuleRules
3333
public UnrealEnginePython(TargetInfo Target)
3434
{
3535

36-
3736
PublicIncludePaths.AddRange(
3837
new string[] {
3938
"UnrealEnginePython/Public",

0 commit comments

Comments
 (0)