22
33#include " UEPyFSlateStyleSet.h"
44
5- static PyObject *py_ue_fslate_style_set_set_content_root (ue_PyFSlateStyleSet *self, PyObject * args) {
5+ static PyObject *py_ue_fslate_style_set_set_content_root (ue_PyFSlateStyleSet *self, PyObject * args)
6+ {
67 char *path;
78 if (!PyArg_ParseTuple (args, " s:set_content_root" , &path))
89 return NULL ;
@@ -13,57 +14,70 @@ static PyObject *py_ue_fslate_style_set_set_content_root(ue_PyFSlateStyleSet *se
1314 return Py_None;
1415}
1516
16- static PyObject *py_ue_fslate_style_set_register (ue_PyFSlateStyleSet *self, PyObject * args) {
17+ static PyObject *py_ue_fslate_style_set_register (ue_PyFSlateStyleSet *self, PyObject * args)
18+ {
1719
20+ if (FSlateStyleRegistry::FindSlateStyle (self->style_set ->GetStyleSetName ()))
21+ {
22+ UE_LOG (LogPython, Warning, TEXT (" StyleSet already registered" ));
23+ Py_RETURN_NONE;
24+ }
1825 FSlateStyleRegistry::RegisterSlateStyle (*self->style_set );
1926
20- Py_INCREF (Py_None);
21- return Py_None;
27+ Py_RETURN_NONE;
2228}
2329
24- static PyObject *py_ue_fslate_style_set_set (ue_PyFSlateStyleSet *self, PyObject * args) {
30+ static PyObject *py_ue_fslate_style_set_set (ue_PyFSlateStyleSet *self, PyObject * args)
31+ {
2532 char *name;
2633 PyObject *py_value;
2734 if (!PyArg_ParseTuple (args, " sO:set" , &name, &py_value))
2835 return NULL ;
2936
3037 FSlateSound *slate_sound = ue_py_check_struct<FSlateSound>(py_value);
31- if (slate_sound) {
38+ if (slate_sound)
39+ {
3240 self->style_set ->Set (FName (name), *slate_sound);
3341 Py_RETURN_NONE;
3442 }
3543
3644 FSlateBrush *slate_brush = ue_py_check_struct<FSlateBrush>(py_value);
37- if (slate_brush) {
45+ if (slate_brush)
46+ {
3847 self->style_set ->Set (FName (name), slate_brush);
3948 Py_RETURN_NONE;
4049 }
4150
4251 FSlateColor *slate_color = ue_py_check_struct<FSlateColor>(py_value);
43- if (slate_brush) {
52+ if (slate_brush)
53+ {
4454 self->style_set ->Set (FName (name), *slate_color);
4555 Py_RETURN_NONE;
4656 }
4757
4858 FSlateFontInfo *slate_font = ue_py_check_struct<FSlateFontInfo>(py_value);
49- if (slate_font) {
59+ if (slate_font)
60+ {
5061 self->style_set ->Set (FName (name), *slate_font);
5162 Py_RETURN_NONE;
5263 }
5364
5465 ue_PyFLinearColor *py_linear_color = py_ue_is_flinearcolor (py_value);
55- if (py_linear_color) {
66+ if (py_linear_color)
67+ {
5668 self->style_set ->Set (FName (name), py_linear_color->color );
5769 Py_RETURN_NONE;
5870 }
5971
6072 ue_PyFColor *py_color = py_ue_is_fcolor (py_value);
61- if (py_color) {
73+ if (py_color)
74+ {
6275 self->style_set ->Set (FName (name), py_color->color );
6376 Py_RETURN_NONE;
6477 }
6578
66- if (PyNumber_Check (py_value)) {
79+ if (PyNumber_Check (py_value))
80+ {
6781 PyObject *py_float = PyNumber_Float (py_value);
6882 self->style_set ->Set (FName (name), (float )PyFloat_AsDouble (py_float));
6983 Py_DECREF (py_float);
@@ -118,17 +132,20 @@ static PyTypeObject ue_PyFSlateStyleSetType = {
118132 ue_PyFSlateStyleSet_methods, /* tp_methods */
119133};
120134
121- static int ue_py_fslate_style_set_init (ue_PyFSlateStyleSet *self, PyObject *args, PyObject *kwargs) {
135+ static int ue_py_fslate_style_set_init (ue_PyFSlateStyleSet *self, PyObject *args, PyObject *kwargs)
136+ {
122137 char *name;
123- if (!PyArg_ParseTuple (args, " s" , &name)) {
138+ if (!PyArg_ParseTuple (args, " s" , &name))
139+ {
124140 return -1 ;
125141 }
126142
127143 self->style_set = new FSlateStyleSet (name);
128144 return 0 ;
129145}
130146
131- void ue_python_init_fslate_style_set (PyObject *ue_module) {
147+ void ue_python_init_fslate_style_set (PyObject *ue_module)
148+ {
132149 ue_PyFSlateStyleSetType.tp_new = PyType_GenericNew;
133150
134151 ue_PyFSlateStyleSetType.tp_init = (initproc)ue_py_fslate_style_set_init;
0 commit comments