1+ #if WITH_EDITOR
2+
3+ #include " UnrealEnginePythonPrivatePCH.h"
4+
5+ #include " UEPySImage.h"
6+
7+ #define GET_s_image SImage *s_image = (SImage *)self->s_leaf_widget.s_widget.s_widget
8+
9+ static PyObject *py_ue_simage_set_brush (ue_PySImage *self, PyObject * args) {
10+ PyObject *py_brush;
11+ if (!PyArg_ParseTuple (args, " O:set_brush" , &py_brush)) {
12+ return NULL ;
13+ }
14+
15+ FSlateBrush *brush = ue_py_check_struct<FSlateBrush>(py_brush);
16+ if (!brush)
17+ return PyErr_Format (PyExc_Exception, " argument is not a FSlateBrush" );
18+
19+ GET_s_image;
20+
21+ s_image->SetImage (brush);
22+
23+ Py_INCREF (self);
24+ return (PyObject *)self;
25+ }
26+
27+ static PyObject *ue_PySImage_str (ue_PySImage *self)
28+ {
29+ return PyUnicode_FromFormat (" <unreal_engine.SImage '%p'>" ,
30+ self->s_leaf_widget .s_widget .s_widget );
31+ }
32+
33+ static PyMethodDef ue_PySImage_methods[] = {
34+ { " set_brush" , (PyCFunction)py_ue_simage_set_brush, METH_VARARGS, " " },
35+ { " set_image" , (PyCFunction)py_ue_simage_set_brush, METH_VARARGS, " " },
36+ { NULL } /* Sentinel */
37+ };
38+
39+ PyTypeObject ue_PySImageType = {
40+ PyVarObject_HEAD_INIT (NULL , 0 )
41+ " unreal_engine.SImage" , /* tp_name */
42+ sizeof (ue_PySImage), /* tp_basicsize */
43+ 0 , /* tp_itemsize */
44+ 0 , /* tp_dealloc */
45+ 0 , /* tp_print */
46+ 0 , /* tp_getattr */
47+ 0 , /* tp_setattr */
48+ 0 , /* tp_reserved */
49+ 0 , /* tp_repr */
50+ 0 , /* tp_as_number */
51+ 0 , /* tp_as_sequence */
52+ 0 , /* tp_as_mapping */
53+ 0 , /* tp_hash */
54+ 0 , /* tp_call */
55+ (reprfunc)ue_PySImage_str, /* tp_str */
56+ 0 , /* tp_getattro */
57+ 0 , /* tp_setattro */
58+ 0 , /* tp_as_buffer */
59+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
60+ " Unreal Engine SImage" , /* tp_doc */
61+ 0 , /* tp_traverse */
62+ 0 , /* tp_clear */
63+ 0 , /* tp_richcompare */
64+ 0 , /* tp_weaklistoffset */
65+ 0 , /* tp_iter */
66+ 0 , /* tp_iternext */
67+ ue_PySImage_methods, /* tp_methods */
68+ };
69+
70+ static int ue_py_simage_init (ue_PySImage *self, PyObject *args, PyObject *kwargs) {
71+ ue_py_snew (SImage, s_leaf_widget.s_widget );
72+ return 0 ;
73+ }
74+
75+ void ue_python_init_simage (PyObject *ue_module) {
76+ ue_PySImageType.tp_new = PyType_GenericNew;
77+
78+ ue_PySImageType.tp_init = (initproc)ue_py_simage_init;
79+
80+ ue_PySImageType.tp_base = &ue_PySLeafWidgetType;
81+
82+ if (PyType_Ready (&ue_PySImageType) < 0 )
83+ return ;
84+
85+ Py_INCREF (&ue_PySImageType);
86+ PyModule_AddObject (ue_module, " SImage" , (PyObject *)&ue_PySImageType);
87+ }
88+
89+
90+ #endif
0 commit comments