|
| 1 | +#include "UnrealEnginePythonPrivatePCH.h" |
| 2 | + |
| 3 | +#include "Runtime/Engine/Public/VisualLogger/VisualLogger.h" |
| 4 | + |
| 5 | +PyObject *py_ue_vlog(ue_PyUObject *self, PyObject * args) |
| 6 | +{ |
| 7 | + |
| 8 | + ue_py_check(self); |
| 9 | + |
| 10 | + char *category; |
| 11 | + char *text; |
| 12 | + int verbosity = ELogVerbosity::Log; |
| 13 | + |
| 14 | + if (!PyArg_ParseTuple(args, "ss|i:vlog", &category, &text, &verbosity)) |
| 15 | + return nullptr; |
| 16 | +#if ENABLE_VISUAL_LOG |
| 17 | + if (FVisualLogger::IsRecording()) |
| 18 | + { |
| 19 | + FVisualLogger::CategorizedLogf(self->ue_object, |
| 20 | + FLogCategoryBase(UTF8_TO_TCHAR(category), (ELogVerbosity::Type)verbosity, (ELogVerbosity::Type)verbosity), |
| 21 | + (ELogVerbosity::Type)verbosity, TEXT("%s"), UTF8_TO_TCHAR(text)); |
| 22 | + } |
| 23 | +#endif |
| 24 | + Py_RETURN_NONE; |
| 25 | +} |
| 26 | + |
| 27 | +PyObject *py_ue_vlog_cylinder(ue_PyUObject *self, PyObject * args) |
| 28 | +{ |
| 29 | + |
| 30 | + ue_py_check(self); |
| 31 | + |
| 32 | + char *category; |
| 33 | + PyObject *py_start; |
| 34 | + PyObject *py_end; |
| 35 | + float radius; |
| 36 | + |
| 37 | + PyObject *py_color = nullptr; |
| 38 | + char *text = (char*)""; |
| 39 | + int verbosity = ELogVerbosity::Log; |
| 40 | + |
| 41 | + if (!PyArg_ParseTuple(args, "sOOf|Osi:vlog_cylinder", &category, &py_start, &py_end, &radius, &py_color, &text, &verbosity)) |
| 42 | + return nullptr; |
| 43 | + |
| 44 | + ue_PyFVector *py_vec_start = py_ue_is_fvector(py_start); |
| 45 | + if (!py_vec_start) |
| 46 | + return PyErr_Format(PyExc_Exception, "argument is not a FVector"); |
| 47 | + |
| 48 | + ue_PyFVector *py_vec_end = py_ue_is_fvector(py_end); |
| 49 | + if (!py_vec_end) |
| 50 | + return PyErr_Format(PyExc_Exception, "argument is not a FVector"); |
| 51 | + |
| 52 | + FColor color = FColor::White; |
| 53 | + |
| 54 | + if (py_color) |
| 55 | + { |
| 56 | + ue_PyFColor *py_fcolor = py_ue_is_fcolor(py_color); |
| 57 | + if (!py_fcolor) |
| 58 | + return PyErr_Format(PyExc_Exception, "argument is not a FColor"); |
| 59 | + color = py_fcolor->color; |
| 60 | + } |
| 61 | + |
| 62 | +#if ENABLE_VISUAL_LOG |
| 63 | + if (FVisualLogger::IsRecording()) |
| 64 | + { |
| 65 | + FVisualLogger::GeometryShapeLogf(self->ue_object, |
| 66 | + FLogCategoryBase(UTF8_TO_TCHAR(category), (ELogVerbosity::Type)verbosity, (ELogVerbosity::Type)verbosity), |
| 67 | + (ELogVerbosity::Type)verbosity, |
| 68 | + py_vec_start->vec, py_vec_end->vec, radius, color, |
| 69 | + TEXT("%s"), UTF8_TO_TCHAR(text)); |
| 70 | + } |
| 71 | +#endif |
| 72 | + Py_RETURN_NONE; |
| 73 | +} |
| 74 | + |
| 75 | + |
0 commit comments