Skip to content

Commit 4908e63

Browse files
author
rdeioris
committed
added SVectorInputBox
1 parent c58c342 commit 4908e63

7 files changed

Lines changed: 41 additions & 5 deletions

File tree

‎Source/UnrealEnginePython/Private/Slate/UEPySFilePathPicker.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ PyTypeObject ue_PySFilePathPickerType = {
3131
0, /* tp_setattro */
3232
0, /* tp_as_buffer */
3333
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
34-
"Unreal Engine FilePathPicker", /* tp_doc */
34+
"Unreal Engine SFilePathPicker", /* tp_doc */
3535
0, /* tp_traverse */
3636
0, /* tp_clear */
3737
0, /* tp_richcompare */

‎Source/UnrealEnginePython/Private/Slate/UEPySlate.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ void ue_python_init_slate(PyObject *module) {
528528
ue_python_init_snumeric_entry_box(module);
529529
ue_python_init_scanvas(module);
530530
ue_python_init_sslider(module);
531+
ue_python_init_svector_input_box(module);
531532

532533

533534
#if WITH_EDITOR

‎Source/UnrealEnginePython/Private/Slate/UEPySlate.h‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "UEPySNumericEntryBox.h"
4646
#include "UEPySCanvas.h"
4747
#include "UEPySSlider.h"
48+
#include "UEPySVectorInputBox.h"
4849

4950

5051

@@ -96,11 +97,13 @@ template<typename T> ue_PySWidget *py_ue_new_swidget(TSharedRef<SWidget> s_widge
9697
return ret;
9798
}
9899

99-
#define ue_py_snew_base(T, field, arguments) self->field.s_widget = TSharedRef<T>(MakeTDecl<T>(#T, __FILE__, __LINE__, RequiredArgs::MakeRequiredArgs()) <<= arguments); ue_py_register_swidget((SWidget *)&self->field.s_widget.Get(), (ue_PySWidget *)self)
100+
#define ue_py_snew_base(T, field, required, arguments) self->field.s_widget = TSharedRef<T>(MakeTDecl<T>(#T, __FILE__, __LINE__, required) <<= arguments); ue_py_register_swidget((SWidget *)&self->field.s_widget.Get(), (ue_PySWidget *)self)
100101

101-
#define ue_py_snew_simple(T, field) ue_py_snew_base(T, field, T::FArguments())
102+
#define ue_py_snew_simple(T, field) ue_py_snew_base(T, field, RequiredArgs::MakeRequiredArgs(), T::FArguments())
102103

103-
#define ue_py_snew(T, field) ue_py_snew_base(T, field, arguments)
104+
#define ue_py_snew(T, field) ue_py_snew_base(T, field, RequiredArgs::MakeRequiredArgs(), arguments)
105+
106+
#define ue_py_snew_with_args(T, field, args) ue_py_snew_base(T, field, RequiredArgs::MakeRequiredArgs(args), arguments)
104107

105108
ue_PySWidget *ue_py_get_swidget(TSharedRef<SWidget> s_widget);
106109

‎Source/UnrealEnginePython/Private/UEPyModule.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ static PyMethodDef ue_PyUObject_methods[] = {
347347
{ "properties", (PyCFunction)py_ue_properties, METH_VARARGS, "" },
348348
{ "get_property_class", (PyCFunction)py_ue_get_property_class, METH_VARARGS, "" },
349349
{ "has_property", (PyCFunction)py_ue_has_property, METH_VARARGS, "" },
350+
{ "get_uproperty", (PyCFunction)py_ue_get_uproperty, METH_VARARGS, "" },
350351

351352
{ "functions", (PyCFunction)py_ue_functions, METH_VARARGS, "" },
352353

‎Source/UnrealEnginePython/Private/UEPyObject.cpp‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,36 @@ PyObject *py_ue_get_property(ue_PyUObject *self, PyObject * args) {
561561
return ue_py_convert_property(u_property, (uint8 *)self->ue_object);
562562
}
563563

564+
PyObject *py_ue_get_uproperty(ue_PyUObject *self, PyObject * args) {
565+
566+
ue_py_check(self);
567+
568+
char *property_name;
569+
if (!PyArg_ParseTuple(args, "s:get_uproperty", &property_name)) {
570+
return NULL;
571+
}
572+
573+
UStruct *u_struct = nullptr;
574+
575+
if (self->ue_object->IsA<UClass>()) {
576+
u_struct = (UStruct *)self->ue_object;
577+
}
578+
else {
579+
u_struct = (UStruct *)self->ue_object->GetClass();
580+
}
581+
582+
UProperty *u_property = u_struct->FindPropertyByName(FName(UTF8_TO_TCHAR(property_name)));
583+
if (!u_property)
584+
return PyErr_Format(PyExc_Exception, "unable to find property %s", property_name);
585+
586+
ue_PyUObject *ret = ue_get_python_wrapper(u_property);
587+
if (!ret)
588+
return PyErr_Format(PyExc_Exception, "PyUObject is in invalid state");
589+
Py_INCREF(ret);
590+
return (PyObject *)ret;
591+
592+
}
593+
564594
PyObject *py_ue_has_property(ue_PyUObject *self, PyObject * args) {
565595

566596
ue_py_check(self);

‎Source/UnrealEnginePython/Private/UEPyObject.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ PyObject *py_ue_set_property(ue_PyUObject *, PyObject *);
1717
PyObject *py_ue_properties(ue_PyUObject *, PyObject *);
1818
PyObject *py_ue_call(ue_PyUObject *, PyObject *);
1919
PyObject *py_ue_get_property(ue_PyUObject *, PyObject *);
20+
PyObject *py_ue_get_uproperty(ue_PyUObject *, PyObject *);
2021
PyObject *py_ue_get_property_class(ue_PyUObject *, PyObject *);
2122
PyObject *py_ue_has_property(ue_PyUObject *, PyObject *);
2223
PyObject *py_ue_is_rooted(ue_PyUObject *, PyObject *);

‎Source/UnrealEnginePython/UnrealEnginePython.Build.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public UnrealEnginePython(TargetInfo Target)
143143
"UMGEditor",
144144
"AIGraph",
145145
"RawMesh",
146-
"DesktopWidgets"
146+
"DesktopWidgets",
147147
});
148148
}
149149

0 commit comments

Comments
 (0)