Skip to content

Commit 28e06de

Browse files
author
Roberto De Ioris
committed
added support for FQuat
1 parent 1cc26ae commit 28e06de

File tree

7 files changed

+408
-5
lines changed

7 files changed

+408
-5
lines changed

Source/UnrealEnginePython/Private/UEPyModule.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "UObject/UEPyPawn.h"
3232
#include "UObject/UEPyController.h"
3333
#include "UObject/UEPyHUD.h"
34+
#include "UObject/UEPyAnimSequence.h"
3435

3536

3637

@@ -449,10 +450,13 @@ static PyMethodDef ue_PyUObject_methods[] = {
449450
#if WITH_EDITOR
450451
// AssetUserData
451452
{ "asset_import_data", (PyCFunction)py_ue_asset_import_data, METH_VARARGS, "" },
453+
#endif
452454

453455
// AnimSequence
454456
{ "anim_sequence_get_skeleton", (PyCFunction)py_ue_anim_sequence_get_skeleton, METH_VARARGS, "" },
455-
#endif
457+
{ "get_raw_animation_data", (PyCFunction)py_ue_anim_sequence_get_raw_animation_data, METH_VARARGS, "" },
458+
{ "get_raw_animation_track", (PyCFunction)py_ue_anim_sequence_get_raw_animation_track, METH_VARARGS, "" },
459+
456460

457461
// StaticMesh
458462
#if WITH_EDITOR
@@ -1277,6 +1281,7 @@ void unreal_engine_init_py_module() {
12771281
ue_python_init_fhitresult(new_unreal_engine_module);
12781282
ue_python_init_fcolor(new_unreal_engine_module);
12791283
ue_python_init_flinearcolor(new_unreal_engine_module);
1284+
ue_python_init_fquat(new_unreal_engine_module);
12801285

12811286
ue_python_init_frandomstream(new_unreal_engine_module);
12821287

Source/UnrealEnginePython/Private/UObject/UEPyAnimSequence.cpp

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
PyObject *py_ue_anim_sequence_get_skeleton(ue_PyUObject * self, PyObject * args) {
66
ue_py_check(self);
77

8-
if (!self->ue_object->IsA<UAnimSequence>())
8+
UAnimSequence *anim_seq = ue_py_check_type<UAnimSequence>(self);
9+
if (!anim_seq)
910
return PyErr_Format(PyExc_Exception, "UObject is not a UAnimSequence.");
1011

11-
UAnimSequence *anim_seq = (UAnimSequence *)self->ue_object;
1212
USkeleton *skeleton = anim_seq->GetSkeleton();
1313
if (!skeleton) {
1414
Py_INCREF(Py_None);
@@ -21,3 +21,36 @@ PyObject *py_ue_anim_sequence_get_skeleton(ue_PyUObject * self, PyObject * args)
2121
Py_INCREF(ret);
2222
return (PyObject *)ret;
2323
}
24+
25+
26+
PyObject *py_ue_anim_sequence_get_raw_animation_data(ue_PyUObject * self, PyObject * args) {
27+
ue_py_check(self);
28+
29+
UAnimSequence *anim_seq = ue_py_check_type<UAnimSequence>(self);
30+
if (!anim_seq)
31+
return PyErr_Format(PyExc_Exception, "UObject is not a UAnimSequence.");
32+
33+
PyObject *py_list = PyList_New(0);
34+
35+
for (FRawAnimSequenceTrack rast : anim_seq->GetRawAnimationData()) {
36+
PyObject *py_item = py_ue_new_fraw_anim_sequence_track(rast);
37+
PyList_Append(py_list, py_item);
38+
Py_DECREF(py_item);
39+
}
40+
41+
return py_list;
42+
}
43+
44+
PyObject *py_ue_anim_sequence_get_raw_animation_track(ue_PyUObject * self, PyObject * args) {
45+
ue_py_check(self);
46+
47+
int index;
48+
if (!PyArg_ParseTuple(args, "i:get_raw_animation_track", &index))
49+
return nullptr;
50+
51+
UAnimSequence *anim_seq = ue_py_check_type<UAnimSequence>(self);
52+
if (!anim_seq)
53+
return PyErr_Format(PyExc_Exception, "UObject is not a UAnimSequence.");
54+
55+
return py_ue_new_fraw_anim_sequence_track(anim_seq->GetRawAnimationTrack(index));
56+
}

Source/UnrealEnginePython/Private/UObject/UEPyAnimSequence.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44

55
#include "UnrealEnginePython.h"
66

7-
PyObject *py_ue_anim_sequence_get_skeleton(ue_PyUObject *, PyObject *);
7+
PyObject *py_ue_anim_sequence_get_skeleton(ue_PyUObject *, PyObject *);
8+
PyObject *py_ue_anim_sequence_get_raw_animation_data(ue_PyUObject *, PyObject *);
9+
PyObject *py_ue_anim_sequence_get_raw_animation_track(ue_PyUObject *, PyObject *);

Source/UnrealEnginePython/Private/UnrealEnginePythonPrivatePCH.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "Wrappers/UEPyFColor.h"
3737
#include "Wrappers/UEPyFLinearColor.h"
3838
#include "Wrappers/UEPyFSocket.h"
39+
#include "Wrappers/UEPyFQuat.h"
3940

4041
#include "Wrappers/UEPyFRawAnimSequenceTrack.h"
4142

0 commit comments

Comments
 (0)