Skip to content

Commit 2290400

Browse files
author
Roberto De Ioris
committed
added print_string() shortcut
1 parent 4171a64 commit 2290400

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎Source/UnrealEnginePython/Private/UEPyModule.cpp‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,23 @@ static PyObject *py_unreal_engine_add_on_screen_debug_message(PyObject * self, P
6969
return Py_None;
7070
}
7171

72+
static PyObject *py_unreal_engine_print_string(PyObject * self, PyObject * args) {
73+
74+
char *message;
75+
if (!PyArg_ParseTuple(args, "s:print_string", &message)) {
76+
return NULL;
77+
}
78+
79+
if (!GEngine)
80+
goto end;
81+
82+
GEngine->AddOnScreenDebugMessage(-1, 2.0, FColor::Cyan, FString::Printf(TEXT("%s"), UTF8_TO_TCHAR(message)));
83+
84+
end:
85+
Py_INCREF(Py_None);
86+
return Py_None;
87+
}
88+
7289
static PyObject *py_unreal_engine_find_class(PyObject * self, PyObject * args) {
7390
char *name;
7491
if (!PyArg_ParseTuple(args, "s:find_class", &name)) {
@@ -229,6 +246,7 @@ static PyMethodDef unreal_engine_methods[] = {
229246
{ "log_warning", py_unreal_engine_log_warning, METH_VARARGS, "" },
230247
{ "log_error", py_unreal_engine_log_error, METH_VARARGS, "" },
231248
{ "add_on_screen_debug_message", py_unreal_engine_add_on_screen_debug_message, METH_VARARGS, "" },
249+
{ "print_string", py_unreal_engine_print_string, METH_VARARGS, "" },
232250
{ "find_class", py_unreal_engine_find_class, METH_VARARGS, "" },
233251
{ "vector_add_vector", py_unreal_engine_vector_add_vector, METH_VARARGS, "" },
234252
{ "vector_add_float", py_unreal_engine_vector_add_float, METH_VARARGS, "" },

0 commit comments

Comments
 (0)