|
| 1 | + |
| 2 | +#include "UEPyFAutomationEditorCommonUtils.h" |
| 3 | + |
| 4 | +#include "UnrealEnginePython.h" |
| 5 | +#include "Engine/World.h" |
| 6 | + |
| 7 | + |
| 8 | +static PyObject *py_ue_fautomation_editor_common_utils_run_pie(PyObject *cls, PyObject * args) |
| 9 | +{ |
| 10 | + FAutomationEditorCommonUtils::RunPIE(); |
| 11 | + Py_RETURN_NONE; |
| 12 | +} |
| 13 | + |
| 14 | +static PyObject *py_ue_fautomation_editor_common_utils_load_map(PyObject *cls, PyObject * args) |
| 15 | +{ |
| 16 | + char *map_name; |
| 17 | + if (!PyArg_ParseTuple(args, "s:load_map", &map_name)) |
| 18 | + return nullptr; |
| 19 | + FAutomationEditorCommonUtils::LoadMap(FString(UTF8_TO_TCHAR(map_name))); |
| 20 | + Py_RETURN_NONE; |
| 21 | +} |
| 22 | + |
| 23 | +static PyObject *py_ue_fautomation_editor_common_utils_create_new_map(PyObject *cls, PyObject * args) |
| 24 | +{ |
| 25 | + Py_RETURN_UOBJECT(FAutomationEditorCommonUtils::CreateNewMap()); |
| 26 | +} |
| 27 | + |
| 28 | +static PyMethodDef ue_PyFAutomationEditorCommonUtils_methods[] = { |
| 29 | + { "run_pie", (PyCFunction)py_ue_fautomation_editor_common_utils_run_pie, METH_VARARGS | METH_CLASS, "" }, |
| 30 | + { "load_map", (PyCFunction)py_ue_fautomation_editor_common_utils_load_map, METH_VARARGS | METH_CLASS, "" }, |
| 31 | + { "create_new_map", (PyCFunction)py_ue_fautomation_editor_common_utils_create_new_map, METH_VARARGS | METH_CLASS, "" }, |
| 32 | + |
| 33 | + { NULL } /* Sentinel */ |
| 34 | +}; |
| 35 | + |
| 36 | + |
| 37 | +static PyTypeObject ue_PyFAutomationEditorCommonUtilsType = { |
| 38 | + PyVarObject_HEAD_INIT(NULL, 0) |
| 39 | + "unreal_engine.FAutomationEditorCommonUtils", /* tp_name */ |
| 40 | + sizeof(ue_PyFAutomationEditorCommonUtils), /* tp_basicsize */ |
| 41 | + 0, /* tp_itemsize */ |
| 42 | + 0, /* tp_dealloc */ |
| 43 | + 0, /* tp_print */ |
| 44 | + 0, /* tp_getattr */ |
| 45 | + 0, /* tp_setattr */ |
| 46 | + 0, /* tp_reserved */ |
| 47 | + 0, /* tp_repr */ |
| 48 | + 0, /* tp_as_number */ |
| 49 | + 0, /* tp_as_sequence */ |
| 50 | + 0, /* tp_as_mapping */ |
| 51 | + 0, /* tp_hash */ |
| 52 | + 0, /* tp_call */ |
| 53 | + 0, /* tp_str */ |
| 54 | + 0, /* tp_getattro */ |
| 55 | + 0, /* tp_setattro */ |
| 56 | + 0, /* tp_as_buffer */ |
| 57 | + Py_TPFLAGS_DEFAULT, /* tp_flags */ |
| 58 | + "Unreal Engine AutomationEditorCommonUtils", /* tp_doc */ |
| 59 | + 0, /* tp_traverse */ |
| 60 | + 0, /* tp_clear */ |
| 61 | + 0, /* tp_richcompare */ |
| 62 | + 0, /* tp_weaklistoffset */ |
| 63 | + 0, /* tp_iter */ |
| 64 | + 0, /* tp_iternext */ |
| 65 | + ue_PyFAutomationEditorCommonUtils_methods, /* tp_methods */ |
| 66 | + 0, |
| 67 | + 0, |
| 68 | +}; |
| 69 | + |
| 70 | +static int py_ue_fautomation_editor_common_utils_init(ue_PyFAutomationEditorCommonUtils *self, PyObject * args) |
| 71 | +{ |
| 72 | + PyErr_SetString(PyExc_Exception, "FAutomationEditorCommonUtils is a singleton"); |
| 73 | + return -1; |
| 74 | +} |
| 75 | + |
| 76 | +void ue_python_init_fautomation_editor_common_utils(PyObject *ue_module) |
| 77 | +{ |
| 78 | + ue_PyFAutomationEditorCommonUtilsType.tp_new = PyType_GenericNew; |
| 79 | + ue_PyFAutomationEditorCommonUtilsType.tp_init = (initproc)py_ue_fautomation_editor_common_utils_init; |
| 80 | + |
| 81 | + if (PyType_Ready(&ue_PyFAutomationEditorCommonUtilsType) < 0) |
| 82 | + return; |
| 83 | + |
| 84 | + Py_INCREF(&ue_PyFAutomationEditorCommonUtilsType); |
| 85 | + PyModule_AddObject(ue_module, "FAutomationEditorCommonUtils", (PyObject *)&ue_PyFAutomationEditorCommonUtilsType); |
| 86 | +} |
0 commit comments