Skip to content

Commit c0a6ab6

Browse files
author
Roberto De Ioris
committed
first round of slate patches
1 parent da172d3 commit c0a6ab6

File tree

12 files changed

+302
-420
lines changed

12 files changed

+302
-420
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#pragma once
2+
3+
#include "UEPyIHttpBase.h"
4+
#include "UEPyIHttpRequest.h"
5+
#include "UEPyIHttpResponse.h"
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#if WITH_EDITOR
2+
3+
#include "UnrealEnginePythonPrivatePCH.h"
4+
5+
#include "UEPySCompoundWidget.h"
6+
7+
static PyObject *ue_PySCompoundWidget_str(ue_PySCompoundWidget *self)
8+
{
9+
return PyUnicode_FromFormat("<unreal_engine.SCompoundWidget '%p'>",
10+
&self->s_widget.s_widget.Get());
11+
}
12+
13+
static PyMethodDef ue_PySCompoundWidget_methods[] = {
14+
{ NULL } /* Sentinel */
15+
};
16+
17+
18+
PyTypeObject ue_PySCompoundWidgetType = {
19+
PyVarObject_HEAD_INIT(NULL, 0)
20+
"unreal_engine.SCompoundWidget", /* tp_name */
21+
sizeof(ue_PySCompoundWidget), /* tp_basicsize */
22+
0, /* tp_itemsize */
23+
0, /* tp_dealloc */
24+
0, /* tp_print */
25+
0, /* tp_getattr */
26+
0, /* tp_setattr */
27+
0, /* tp_reserved */
28+
0, /* tp_repr */
29+
0, /* tp_as_number */
30+
0, /* tp_as_sequence */
31+
0, /* tp_as_mapping */
32+
0, /* tp_hash */
33+
0, /* tp_call */
34+
(reprfunc)ue_PySCompoundWidget_str, /* tp_str */
35+
0, /* tp_getattro */
36+
0, /* tp_setattro */
37+
0, /* tp_as_buffer */
38+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
39+
"Unreal Engine SCompoundWidget", /* tp_doc */
40+
0, /* tp_traverse */
41+
0, /* tp_clear */
42+
0, /* tp_richcompare */
43+
0, /* tp_weaklistoffset */
44+
0, /* tp_iter */
45+
0, /* tp_iternext */
46+
ue_PySCompoundWidget_methods, /* tp_methods */
47+
};
48+
49+
extern struct ue_PySWidgetType;
50+
51+
void ue_python_init_scompound_widget(PyObject *ue_module) {
52+
ue_PySCompoundWidgetType.tp_new = PyType_GenericNew;
53+
54+
//ue_PySCompoundWidgetType.tp_base = &ue_PySWidgetType;
55+
56+
if (PyType_Ready(&ue_PySCompoundWidgetType) < 0)
57+
return;
58+
59+
Py_INCREF(&ue_PySCompoundWidgetType);
60+
PyModule_AddObject(ue_module, "SCompoundWidget", (PyObject *)&ue_PySCompoundWidgetType);
61+
}
62+
63+
64+
#endif
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#pragma once
2+
3+
4+
#include "UnrealEnginePython.h"
5+
6+
#if WITH_EDITOR
7+
8+
#include "UEPySWidget.h"
9+
10+
struct ue_PySCompoundWidgetType;
11+
12+
typedef struct {
13+
ue_PySWidget s_widget;
14+
/* Type-specific fields go here. */
15+
} ue_PySCompoundWidget;
16+
17+
void ue_python_init_scompound_widget(PyObject *);
18+
19+
#endif
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#if WITH_EDITOR
2+
3+
#include "UnrealEnginePythonPrivatePCH.h"
4+
5+
6+
7+
#include "UEPySWidget.h"
8+
9+
static PyObject *ue_PySWidget_str(ue_PySWidget *self)
10+
{
11+
return PyUnicode_FromFormat("<unreal_engine.SWidget '%p'>",
12+
&self->s_widget.Get());
13+
}
14+
15+
static PyObject *py_ue_swidget_get_children(ue_PySWidget *self, PyObject * args) {
16+
FChildren *children = self->s_widget->GetChildren();
17+
PyObject *py_list = PyList_New(0);
18+
for (int32 i = 0; i < children->Num(); i++) {
19+
TSharedRef<SWidget> widget = children->GetChildAt(i);
20+
}
21+
return py_list;
22+
}
23+
24+
25+
static PyMethodDef ue_PySWidget_methods[] = {
26+
{ "get_children", (PyCFunction)py_ue_swidget_get_children, METH_VARARGS, "" },
27+
{ NULL } /* Sentinel */
28+
};
29+
30+
PyTypeObject ue_PySWidgetType = {
31+
PyVarObject_HEAD_INIT(NULL, 0)
32+
"unreal_engine.SWidget", /* tp_name */
33+
sizeof(ue_PySWidget), /* tp_basicsize */
34+
0, /* tp_itemsize */
35+
0, /* tp_dealloc */
36+
0, /* tp_print */
37+
0, /* tp_getattr */
38+
0, /* tp_setattr */
39+
0, /* tp_reserved */
40+
0, /* tp_repr */
41+
0, /* tp_as_number */
42+
0, /* tp_as_sequence */
43+
0, /* tp_as_mapping */
44+
0, /* tp_hash */
45+
0, /* tp_call */
46+
(reprfunc)ue_PySWidget_str, /* tp_str */
47+
0, /* tp_getattro */
48+
0, /* tp_setattro */
49+
0, /* tp_as_buffer */
50+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
51+
"Unreal Engine SWidget", /* tp_doc */
52+
0, /* tp_traverse */
53+
0, /* tp_clear */
54+
0, /* tp_richcompare */
55+
0, /* tp_weaklistoffset */
56+
0, /* tp_iter */
57+
0, /* tp_iternext */
58+
ue_PySWidget_methods, /* tp_methods */
59+
};
60+
61+
void ue_python_init_swidget(PyObject *ue_module) {
62+
ue_PySWidgetType.tp_new = PyType_GenericNew;
63+
64+
if (PyType_Ready(&ue_PySWidgetType) < 0)
65+
return;
66+
67+
Py_INCREF(&ue_PySWidgetType);
68+
PyModule_AddObject(ue_module, "SWidget", (PyObject *)&ue_PySWidgetType);
69+
}
70+
71+
72+
#endif
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#pragma once
2+
3+
#include "UnrealEnginePython.h"
4+
5+
#if WITH_EDITOR
6+
7+
struct ue_PySWidgetType;
8+
9+
typedef struct {
10+
PyObject_HEAD
11+
/* Type-specific fields go here. */
12+
TSharedRef<SWidget> s_widget;
13+
PyObject *py_dict;
14+
} ue_PySWidget;
15+
16+
void ue_python_init_swidget(PyObject *);
17+
18+
#endif
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#if WITH_EDITOR
2+
3+
#include "UnrealEnginePythonPrivatePCH.h"
4+
5+
#include "UEPySWindow.h"
6+
7+
#include "Runtime/SlateCore/Public/Widgets/SWindow.h"
8+
9+
#define GET_s_window TSharedRef<SWindow> s_window = StaticCastSharedRef<SWindow>(self->s_compound_widget.s_widget.s_widget)
10+
11+
static PyObject *py_ue_swindow_set_title(ue_PySWindow *self, PyObject * args) {
12+
char *title;
13+
if (!PyArg_ParseTuple(args, "s:set_title", &title)) {
14+
return NULL;
15+
}
16+
17+
GET_s_window;
18+
19+
s_window.Get().SetTitle(FText::FromString(UTF8_TO_TCHAR(title)));
20+
21+
return (PyObject *)self;
22+
}
23+
24+
static PyObject *ue_PySWindow_str(ue_PySWindow *self)
25+
{
26+
return PyUnicode_FromFormat("<unreal_engine.SWindow '%p'>",
27+
&self->s_compound_widget.s_widget.s_widget.Get());
28+
}
29+
30+
static PyMethodDef ue_PySWindow_methods[] = {
31+
{ "set_title", (PyCFunction)py_ue_swindow_set_title, METH_VARARGS, "" },
32+
{ NULL } /* Sentinel */
33+
};
34+
35+
PyTypeObject ue_PySWindowType = {
36+
PyVarObject_HEAD_INIT(NULL, 0)
37+
"unreal_engine.SWindow", /* tp_name */
38+
sizeof(ue_PySWindow), /* tp_basicsize */
39+
0, /* tp_itemsize */
40+
0, /* tp_dealloc */
41+
0, /* tp_print */
42+
0, /* tp_getattr */
43+
0, /* tp_setattr */
44+
0, /* tp_reserved */
45+
0, /* tp_repr */
46+
0, /* tp_as_number */
47+
0, /* tp_as_sequence */
48+
0, /* tp_as_mapping */
49+
0, /* tp_hash */
50+
0, /* tp_call */
51+
(reprfunc)ue_PySWindow_str, /* tp_str */
52+
0, /* tp_getattro */
53+
0, /* tp_setattro */
54+
0, /* tp_as_buffer */
55+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
56+
"Unreal Engine SWindow", /* tp_doc */
57+
0, /* tp_traverse */
58+
0, /* tp_clear */
59+
0, /* tp_richcompare */
60+
0, /* tp_weaklistoffset */
61+
0, /* tp_iter */
62+
0, /* tp_iternext */
63+
ue_PySWindow_methods, /* tp_methods */
64+
};
65+
66+
static int ue_py_swindow_init(ue_PySWindow *self, PyObject *args, PyObject *kwargs) {
67+
self->s_compound_widget.s_widget.s_widget = TSharedRef<SWindow>(SNew(SWindow));
68+
return 0;
69+
}
70+
71+
void ue_python_init_swindow(PyObject *ue_module) {
72+
ue_PySWindowType.tp_new = PyType_GenericNew;
73+
74+
ue_PySWindowType.tp_init = (initproc)ue_py_swindow_init;
75+
76+
ue_PySWindowType.tp_base = &ue_PySCompoundWidgetType;
77+
78+
if (PyType_Ready(&ue_PySWindowType) < 0)
79+
return;
80+
81+
Py_INCREF(&ue_PySWindowType);
82+
PyModule_AddObject(ue_module, "SWindow", (PyObject *)&ue_PySWindowType);
83+
}
84+
85+
86+
#endif
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#pragma once
2+
3+
#include "UnrealEnginePython.h"
4+
5+
#if WITH_EDITOR
6+
7+
#include "UEPySCompoundWidget.h"
8+
9+
struct ue_PySWindowType;
10+
11+
typedef struct {
12+
ue_PySCompoundWidget s_compound_widget;
13+
/* Type-specific fields go here. */
14+
} ue_PySWindow;
15+
16+
void ue_python_init_swindow(PyObject *);
17+
18+
#endif

0 commit comments

Comments
 (0)