@@ -21,27 +21,51 @@ static PyObject *py_ue_fslowtask_destroy(ue_PyFSlowTask *self, PyObject * args)
2121static PyObject *py_ue_fslowtask_make_dialog_delayed (ue_PyFSlowTask *self, PyObject * args)
2222{
2323 float threshold;
24- int show_cancel_button = 0 ;
25- int allow_in_pie = 0 ;
26- if (!PyArg_ParseTuple (args, " f|ii :make_dialog_delayed" , &threshold, &show_cancel_button , &allow_in_pie ))
24+ PyObject *py_show_cancel_button = nullptr ;
25+ PyObject *py_allow_in_pie = nullptr ;
26+ if (!PyArg_ParseTuple (args, " f|OO :make_dialog_delayed" , &threshold, &py_show_cancel_button , &py_allow_in_pie ))
2727 {
2828 return nullptr ;
2929 }
3030
31+ bool show_cancel_button = false ;
32+ if (nullptr != py_show_cancel_button && PyObject_IsTrue (py_show_cancel_button))
33+ {
34+ show_cancel_button = true ;
35+ }
36+
37+ bool allow_in_pie = false ;
38+ if (nullptr != py_allow_in_pie && PyObject_IsTrue (py_allow_in_pie))
39+ {
40+ allow_in_pie = true ;
41+ }
42+
3143 self->slowtask .MakeDialogDelayed (threshold, show_cancel_button, allow_in_pie);
3244
3345 Py_RETURN_NONE;
3446}
3547
3648static PyObject *py_ue_fslowtask_make_dialog (ue_PyFSlowTask *self, PyObject * args)
3749{
38- int show_cancel_button = 0 ;
39- int allow_in_pie = 0 ;
40- if (!PyArg_ParseTuple (args, " |ii :make_dialog" , &show_cancel_button , &allow_in_pie ))
50+ PyObject *py_show_cancel_button = nullptr ;
51+ PyObject *py_allow_in_pie = nullptr ;
52+ if (!PyArg_ParseTuple (args, " |OO :make_dialog" , &py_show_cancel_button , &py_allow_in_pie ))
4153 {
4254 return nullptr ;
4355 }
4456
57+ bool show_cancel_button = false ;
58+ if (nullptr != py_show_cancel_button && PyObject_IsTrue (py_show_cancel_button))
59+ {
60+ show_cancel_button = true ;
61+ }
62+
63+ bool allow_in_pie = false ;
64+ if (nullptr != py_allow_in_pie && PyObject_IsTrue (py_allow_in_pie))
65+ {
66+ allow_in_pie = true ;
67+ }
68+
4569 self->slowtask .MakeDialog (show_cancel_button, allow_in_pie);
4670
4771 Py_RETURN_NONE;
@@ -130,12 +154,18 @@ static int py_ue_fslowtask_init(ue_PyFSlowTask *self, PyObject * args)
130154{
131155 float amount_of_work;
132156 char *default_message = " " ;
133- int enabled = 1 ;
134- if (!PyArg_ParseTuple (args, " f|si :__init__" , &amount_of_work, &default_message, &enabled ))
157+ PyObject *py_enabled = nullptr ;
158+ if (!PyArg_ParseTuple (args, " f|sO :__init__" , &amount_of_work, &default_message, &py_enabled ))
135159 {
136160 return -1 ;
137161 }
138162
163+ bool enabled = true ;
164+ if (nullptr != py_enabled && !PyObject_IsTrue (py_enabled))
165+ {
166+ enabled = false ;
167+ }
168+
139169 new (&self->slowtask ) FSlowTask (amount_of_work, FText::FromString (UTF8_TO_TCHAR (default_message)), enabled);
140170 return 0 ;
141171}
0 commit comments