Skip to content

Commit 535a350

Browse files
author
Roberto De Ioris
committed
added SPythonWidget for custom slate widgets, first round of Unreal-style indentation (what to do with variable names is still under discussion)
1 parent b4da73c commit 535a350

36 files changed

Lines changed: 2856 additions & 1347 deletions

‎Source/UnrealEnginePython/Private/ConsoleManager/UEPyIConsoleManager.cpp‎

Lines changed: 172 additions & 86 deletions
Large diffs are not rendered by default.

‎Source/UnrealEnginePython/Private/ConsoleManager/UEPyIConsoleManager.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
#include "Runtime/Core/Public/HAL/IConsoleManager.h"
66

7-
typedef struct {
7+
typedef struct
8+
{
89
PyObject_HEAD
9-
/* Type-specific fields go here. */
10+
/* Type-specific fields go here. */
1011
} ue_PyIConsoleManager;
1112

1213

‎Source/UnrealEnginePython/Private/Fbx/UEPyFbxImporter.cpp‎

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66

77
#include "UEPyFbx.h"
88

9-
static PyObject *py_ue_fbx_importer_get_anim_stack_count(ue_PyFbxImporter *self, PyObject *args) {
9+
static PyObject *py_ue_fbx_importer_get_anim_stack_count(ue_PyFbxImporter *self, PyObject *args)
10+
{
1011
return PyLong_FromLong(self->fbx_importer->GetAnimStackCount());
1112
}
1213

13-
static PyObject *py_ue_fbx_importer_get_take_local_time_span(ue_PyFbxImporter *self, PyObject *args) {
14+
static PyObject *py_ue_fbx_importer_get_take_local_time_span(ue_PyFbxImporter *self, PyObject *args)
15+
{
1416
int index;
15-
if (!PyArg_ParseTuple(args, "i", &index)) {
17+
if (!PyArg_ParseTuple(args, "i", &index))
18+
{
1619
return nullptr;
1720
}
1821

@@ -24,37 +27,45 @@ static PyObject *py_ue_fbx_importer_get_take_local_time_span(ue_PyFbxImporter *s
2427
return Py_BuildValue((char *)"(ff)", time_span.GetStart().GetSecondDouble(), time_span.GetStop().GetSecondDouble());
2528
}
2629

27-
static PyObject *py_ue_fbx_importer_initialize(ue_PyFbxImporter *self, PyObject *args) {
30+
static PyObject *py_ue_fbx_importer_initialize(ue_PyFbxImporter *self, PyObject *args)
31+
{
2832
char *filename;
2933
PyObject *py_object;
30-
if (!PyArg_ParseTuple(args, "sO", &filename, &py_object)) {
34+
if (!PyArg_ParseTuple(args, "sO", &filename, &py_object))
35+
{
3136
return nullptr;
3237
}
3338

3439
ue_PyFbxIOSettings *py_fbx_io_settings = py_ue_is_fbx_io_settings(py_object);
35-
if (!py_fbx_io_settings) {
40+
if (!py_fbx_io_settings)
41+
{
3642
return PyErr_Format(PyExc_Exception, "argument is not a FbxIOSettings");
3743
}
3844

39-
if (self->fbx_importer->Initialize(filename, -1, py_fbx_io_settings->fbx_io_settings)) {
45+
if (self->fbx_importer->Initialize(filename, -1, py_fbx_io_settings->fbx_io_settings))
46+
{
4047
Py_RETURN_TRUE;
4148
}
4249

4350
Py_RETURN_FALSE;
4451
}
4552

46-
static PyObject *py_ue_fbx_importer_import(ue_PyFbxImporter *self, PyObject *args) {
53+
static PyObject *py_ue_fbx_importer_import(ue_PyFbxImporter *self, PyObject *args)
54+
{
4755
PyObject *py_object;
48-
if (!PyArg_ParseTuple(args, "O", &py_object)) {
56+
if (!PyArg_ParseTuple(args, "O", &py_object))
57+
{
4958
return nullptr;
5059
}
5160

5261
ue_PyFbxScene *py_fbx_scene = py_ue_is_fbx_scene(py_object);
53-
if (!py_fbx_scene) {
62+
if (!py_fbx_scene)
63+
{
5464
return PyErr_Format(PyExc_Exception, "argument is not a FbxScene");
5565
}
5666

57-
if (self->fbx_importer->Import(py_fbx_scene->fbx_scene)) {
67+
if (self->fbx_importer->Import(py_fbx_scene->fbx_scene))
68+
{
5869
Py_RETURN_TRUE;
5970
}
6071

@@ -102,15 +113,18 @@ static PyTypeObject ue_PyFbxImporterType = {
102113
0, /* tp_getset */
103114
};
104115

105-
static int py_ue_fbx_importer_init(ue_PyFbxImporter *self, PyObject * args) {
116+
static int py_ue_fbx_importer_init(ue_PyFbxImporter *self, PyObject * args)
117+
{
106118
PyObject *py_object;
107119
char *name;
108-
if (!PyArg_ParseTuple(args, "Os", &py_object, &name)) {
120+
if (!PyArg_ParseTuple(args, "Os", &py_object, &name))
121+
{
109122
return -1;
110123
}
111124

112125
ue_PyFbxManager *py_fbx_manager = py_ue_is_fbx_manager(py_object);
113-
if (!py_fbx_manager) {
126+
if (!py_fbx_manager)
127+
{
114128
PyErr_SetString(PyExc_Exception, "argument is not a FbxManager");
115129
return -1;
116130
}
@@ -119,7 +133,8 @@ static int py_ue_fbx_importer_init(ue_PyFbxImporter *self, PyObject * args) {
119133
return 0;
120134
}
121135

122-
void ue_python_init_fbx_importer(PyObject *ue_module) {
136+
void ue_python_init_fbx_importer(PyObject *ue_module)
137+
{
123138
ue_PyFbxImporterType.tp_new = PyType_GenericNew;;
124139
ue_PyFbxImporterType.tp_init = (initproc)py_ue_fbx_importer_init;
125140
if (PyType_Ready(&ue_PyFbxImporterType) < 0)

‎Source/UnrealEnginePython/Private/Fbx/UEPyFbxMesh.cpp‎

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,93 +5,110 @@
55

66
#include "UEPyFbx.h"
77

8-
static PyObject *py_ue_fbx_mesh_get_polygon_count(ue_PyFbxMesh *self, PyObject *args) {
8+
static PyObject *py_ue_fbx_mesh_get_polygon_count(ue_PyFbxMesh *self, PyObject *args)
9+
{
910
return PyLong_FromLong(self->fbx_mesh->GetPolygonCount());
1011
}
1112

12-
static PyObject *py_ue_fbx_mesh_get_control_points_count(ue_PyFbxMesh *self, PyObject *args) {
13+
static PyObject *py_ue_fbx_mesh_get_control_points_count(ue_PyFbxMesh *self, PyObject *args)
14+
{
1315
return PyLong_FromLong(self->fbx_mesh->GetControlPointsCount());
1416
}
1517

16-
static PyObject *py_ue_fbx_mesh_get_polygon_vertex_count(ue_PyFbxMesh *self, PyObject *args) {
18+
static PyObject *py_ue_fbx_mesh_get_polygon_vertex_count(ue_PyFbxMesh *self, PyObject *args)
19+
{
1720
return PyLong_FromLong(self->fbx_mesh->GetPolygonVertexCount());
1821
}
1922

20-
static PyObject *py_ue_fbx_mesh_get_name(ue_PyFbxMesh *self, PyObject *args) {
23+
static PyObject *py_ue_fbx_mesh_get_name(ue_PyFbxMesh *self, PyObject *args)
24+
{
2125
return PyUnicode_FromString(self->fbx_mesh->GetName());
2226
}
2327

24-
static PyObject *py_ue_fbx_mesh_get_polygon_vertices(ue_PyFbxMesh *self, PyObject *args) {
28+
static PyObject *py_ue_fbx_mesh_get_polygon_vertices(ue_PyFbxMesh *self, PyObject *args)
29+
{
2530
PyObject *py_list = PyList_New(0);
2631
int *indices = self->fbx_mesh->GetPolygonVertices();
27-
for (int i = 0; i < self->fbx_mesh->GetPolygonVertexCount(); i++) {
32+
for (int i = 0; i < self->fbx_mesh->GetPolygonVertexCount(); i++)
33+
{
2834
PyList_Append(py_list, PyLong_FromLong(indices[i]));
2935
}
3036
return py_list;
3137
}
3238

33-
static PyObject *py_ue_fbx_mesh_get_control_points(ue_PyFbxMesh *self, PyObject *args) {
39+
static PyObject *py_ue_fbx_mesh_get_control_points(ue_PyFbxMesh *self, PyObject *args)
40+
{
3441
PyObject *py_list = PyList_New(0);
3542
FbxVector4* control_points = self->fbx_mesh->GetControlPoints();
36-
for (int i = 0; i < self->fbx_mesh->GetControlPointsCount(); i++) {
43+
for (int i = 0; i < self->fbx_mesh->GetControlPointsCount(); i++)
44+
{
3745
FbxVector4 vec4 = control_points[i];
3846
PyList_Append(py_list, py_ue_new_fvector(FVector(vec4[0], vec4[1], vec4[2])));
3947
}
4048
return py_list;
4149
}
4250

43-
static PyObject *py_ue_fbx_mesh_get_polygon_vertex_normals(ue_PyFbxMesh *self, PyObject *args) {
51+
static PyObject *py_ue_fbx_mesh_get_polygon_vertex_normals(ue_PyFbxMesh *self, PyObject *args)
52+
{
4453

4554
FbxArray<FbxVector4> normals;
4655

47-
if (!self->fbx_mesh->GetPolygonVertexNormals(normals)) {
56+
if (!self->fbx_mesh->GetPolygonVertexNormals(normals))
57+
{
4858
Py_RETURN_NONE;
4959
}
5060

5161
PyObject *py_list = PyList_New(0);
5262

53-
for (int i = 0; i < normals.Size(); i++) {
63+
for (int i = 0; i < normals.Size(); i++)
64+
{
5465
FbxVector4 vec = normals.GetAt(i);
5566
PyList_Append(py_list, py_ue_new_fvector(FVector(vec[0], vec[1], vec[2])));
5667
}
5768

5869
return py_list;
5970
}
6071

61-
static PyObject *py_ue_fbx_mesh_get_uv_set_names(ue_PyFbxMesh *self, PyObject *args) {
72+
static PyObject *py_ue_fbx_mesh_get_uv_set_names(ue_PyFbxMesh *self, PyObject *args)
73+
{
6274
PyObject *py_list = PyList_New(0);
6375
FbxStringList name_list;
6476
self->fbx_mesh->GetUVSetNames(name_list);
6577

66-
for (int i = 0; i < name_list.GetCount(); i++) {
78+
for (int i = 0; i < name_list.GetCount(); i++)
79+
{
6780
PyList_Append(py_list, PyUnicode_FromString(name_list.GetStringAt(i)));
6881
}
6982

7083
return py_list;
7184
}
7285

73-
static PyObject *py_ue_fbx_mesh_get_polygon_vertex_uvs(ue_PyFbxMesh *self, PyObject *args) {
86+
static PyObject *py_ue_fbx_mesh_get_polygon_vertex_uvs(ue_PyFbxMesh *self, PyObject *args)
87+
{
7488
char *uv_set;
7589
if (!PyArg_ParseTuple(args, "s", &uv_set))
7690
return nullptr;
7791

7892
FbxArray<FbxVector2> uvs;
7993

80-
if (!self->fbx_mesh->GetPolygonVertexUVs(uv_set, uvs)) {
94+
if (!self->fbx_mesh->GetPolygonVertexUVs(uv_set, uvs))
95+
{
8196
Py_RETURN_NONE;
8297
}
8398

8499
PyObject *py_list = PyList_New(0);
85-
86-
for (int i = 0; i < uvs.Size(); i++) {
100+
101+
for (int i = 0; i < uvs.Size(); i++)
102+
{
87103
FbxVector2 vec = uvs.GetAt(i);
88104
PyList_Append(py_list, Py_BuildValue((char *)"(ff)", vec[0], vec[1]));
89105
}
90106

91107
return py_list;
92108
}
93109

94-
static PyObject *py_ue_fbx_mesh_remove_bad_polygons(ue_PyFbxMesh *self, PyObject *args) {
110+
static PyObject *py_ue_fbx_mesh_remove_bad_polygons(ue_PyFbxMesh *self, PyObject *args)
111+
{
95112
self->fbx_mesh->RemoveBadPolygons();
96113
Py_RETURN_NONE;
97114
}
@@ -143,15 +160,18 @@ static PyTypeObject ue_PyFbxMeshType = {
143160
0, /* tp_getset */
144161
};
145162

146-
static int py_ue_fbx_mesh_init(ue_PyFbxMesh *self, PyObject * args) {
163+
static int py_ue_fbx_mesh_init(ue_PyFbxMesh *self, PyObject * args)
164+
{
147165
PyObject *py_object;
148166
char *name;
149-
if (!PyArg_ParseTuple(args, "Os", &py_object, &name)) {
167+
if (!PyArg_ParseTuple(args, "Os", &py_object, &name))
168+
{
150169
return -1;
151170
}
152171

153172
ue_PyFbxManager *py_fbx_manager = py_ue_is_fbx_manager(py_object);
154-
if (!py_fbx_manager) {
173+
if (!py_fbx_manager)
174+
{
155175
PyErr_SetString(PyExc_Exception, "argument is not a FbxManager");
156176
return -1;
157177
}
@@ -160,7 +180,8 @@ static int py_ue_fbx_mesh_init(ue_PyFbxMesh *self, PyObject * args) {
160180
return 0;
161181
}
162182

163-
void ue_python_init_fbx_mesh(PyObject *ue_module) {
183+
void ue_python_init_fbx_mesh(PyObject *ue_module)
184+
{
164185
ue_PyFbxMeshType.tp_new = PyType_GenericNew;;
165186
ue_PyFbxMeshType.tp_init = (initproc)py_ue_fbx_mesh_init;
166187
if (PyType_Ready(&ue_PyFbxMeshType) < 0)
@@ -170,7 +191,8 @@ void ue_python_init_fbx_mesh(PyObject *ue_module) {
170191
PyModule_AddObject(ue_module, "FbxMesh", (PyObject *)&ue_PyFbxMeshType);
171192
}
172193

173-
PyObject *py_ue_new_fbx_mesh(FbxMesh *fbx_mesh) {
194+
PyObject *py_ue_new_fbx_mesh(FbxMesh *fbx_mesh)
195+
{
174196
ue_PyFbxMesh *ret = (ue_PyFbxMesh *)PyObject_New(ue_PyFbxMesh, &ue_PyFbxMeshType);
175197
ret->fbx_mesh = fbx_mesh;
176198
return (PyObject *)ret;

‎Source/UnrealEnginePython/Private/Fbx/UEPyFbxMesh.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
#include <fbxsdk.h>
77

8-
struct ue_PyFbxMesh {
8+
struct ue_PyFbxMesh
9+
{
910
PyObject_HEAD
1011
/* Type-specific fields go here. */
1112
FbxMesh *fbx_mesh;

0 commit comments

Comments
 (0)