@@ -342,6 +342,7 @@ static PyMethodDef ue_PyUObject_methods[] = {
342342
343343 { " post_edit_change" , (PyCFunction)py_ue_post_edit_change, METH_VARARGS , " " },
344344 { " pre_edit_change" , (PyCFunction)py_ue_pre_edit_change, METH_VARARGS , " " },
345+ { " modify" , (PyCFunction)py_ue_modify, METH_VARARGS , " " },
345346
346347#if WITH_EDITOR
347348 { " save_config" , (PyCFunction)py_ue_save_config, METH_VARARGS , " " },
@@ -775,6 +776,37 @@ static PyObject *ue_PyUObject_call(ue_PyUObject *self, PyObject *args, PyObject
775776#if WITH_EDITOR
776777 u_script_struct->InitializeDefaultValue (data);
777778#endif
779+ if (kw) {
780+ PyObject *struct_keys = PyObject_GetIter (kw);
781+ for (;;) {
782+ PyObject *key = PyIter_Next (struct_keys);
783+ if (!key) {
784+ if (PyErr_Occurred ())
785+ return PyErr_Format (PyExc_Exception, " unable to build struct from dictionary" );
786+ break ;
787+ }
788+ if (!PyUnicodeOrString_Check (key))
789+ continue ;
790+ char *struct_key = PyUnicode_AsUTF8 (key);
791+
792+ PyObject *value = PyDict_GetItem (kw, key);
793+ if (!value) {
794+ if (PyErr_Occurred ())
795+ return PyErr_Format (PyExc_Exception, " unable to build struct from dictionary" );
796+ break ;
797+ }
798+
799+ UProperty *u_property = ue_struct_get_field_from_name (u_script_struct, struct_key);
800+ if (u_property) {
801+ if (!ue_py_convert_pyobject (value, u_property, data)) {
802+ return PyErr_Format (PyExc_Exception, " invalid value for UProperty" );
803+ }
804+ }
805+ else {
806+ return PyErr_Format (PyExc_Exception, " UProperty %s not found" , struct_key);
807+ }
808+ }
809+ }
778810 return py_ue_new_uscriptstruct (u_script_struct, data);
779811 }
780812 return PyErr_Format (PyExc_Exception, " the specified uobject has no __call__ support" );
0 commit comments