@@ -45,11 +45,11 @@ static PyObject *py_ue_iplugin_is_enabled(ue_PyIPlugin *self, PyObject * args) {
4545 return Py_False;
4646}
4747
48- static PyObject *py_ue_iplugin_write (ue_PyIPlugin *self, PyObject * args) {
48+ static PyObject *py_ue_iplugin_to_json (ue_PyIPlugin *self, PyObject * args) {
49+
4950
50- char *json;
5151 PyObject *py_bool;
52- if (!PyArg_ParseTuple (args, " sO:write " , &json , &py_bool)) {
52+ if (!PyArg_ParseTuple (args, " O:to_json " , &py_bool)) {
5353 return NULL ;
5454 }
5555
@@ -59,17 +59,17 @@ static PyObject *py_ue_iplugin_write(ue_PyIPlugin *self, PyObject * args) {
5959 }
6060
6161 FPluginDescriptor descriptor = self->plugin ->GetDescriptor ();
62- FString text = FString ( UTF8_TO_TCHAR (json)) ;
62+ FString text;
6363 descriptor.Write (text, enabled_by_default);
6464
65- Py_INCREF (Py_None);
66- return Py_None;
65+ return PyUnicode_FromString (TCHAR_TO_UTF8 (*text));
6766}
6867
69- static PyObject *py_ue_iplugin_read (ue_PyIPlugin *self, PyObject * args) {
68+ static PyObject *py_ue_iplugin_from_json (ue_PyIPlugin *self, PyObject * args) {
7069
70+ char *json;
7171 PyObject *py_bool;
72- if (!PyArg_ParseTuple (args, " O:read " , &py_bool)) {
72+ if (!PyArg_ParseTuple (args, " sO:from_json " , &json , &py_bool)) {
7373 return NULL ;
7474 }
7575
@@ -79,13 +79,14 @@ static PyObject *py_ue_iplugin_read(ue_PyIPlugin *self, PyObject * args) {
7979 }
8080
8181 FText error;
82- FString text;
82+ FString text = FString ( UTF8_TO_TCHAR (json)) ;
8383 FPluginDescriptor descriptor = self->plugin ->GetDescriptor ();
8484 if (!descriptor.Read (text, enabled_by_default, error)) {
85- return PyErr_Format (PyExc_Exception, " unable to read json descriptor" );
85+ return PyErr_Format (PyExc_Exception, " unable to update descriptor from json " );
8686 }
8787
88- return PyUnicode_FromString (TCHAR_TO_UTF8 (*text));
88+ Py_INCREF (Py_None);
89+ return Py_None;
8990}
9091
9192static PyMethodDef ue_PyIPlugin_methods[] = {
@@ -96,8 +97,8 @@ static PyMethodDef ue_PyIPlugin_methods[] = {
9697 { " get_mounted_asset_path" , (PyCFunction)py_ue_iplugin_get_mounted_asset_path, METH_VARARGS , " " },
9798 { " can_contain_content" , (PyCFunction)py_ue_iplugin_can_contain_content, METH_VARARGS , " " },
9899 { " is_enabled" , (PyCFunction)py_ue_iplugin_is_enabled, METH_VARARGS , " " },
99- { " read " , (PyCFunction)py_ue_iplugin_read , METH_VARARGS , " " },
100- { " write " , (PyCFunction)py_ue_iplugin_write , METH_VARARGS , " " },
100+ { " to_json " , (PyCFunction)py_ue_iplugin_to_json , METH_VARARGS , " " },
101+ { " from_json " , (PyCFunction)py_ue_iplugin_from_json , METH_VARARGS , " " },
101102 { NULL } /* Sentinel */
102103};
103104
0 commit comments