text
stringlengths
9
39.2M
dir
stringlengths
26
295
lang
stringclasses
185 values
created_date
timestamp[us]
updated_date
timestamp[us]
repo_name
stringlengths
1
97
repo_full_name
stringlengths
7
106
star
int64
1k
183k
len_tokens
int64
1
13.8M
```objective-c #pragma once #include "UnrealEnginePython.h" #if ENGINE_MINOR_VERSION <= 17 #include "Runtime/Core/Public/GenericPlatform/GenericApplication.h" #else #include "Runtime/ApplicationCore/Public/GenericPlatform/GenericApplication.h" #endif typedef struct { PyObject_HEAD /* Type-specific fields go here. */ FModifierKeysState modifier; } ue_PyFModifierKeysState; void ue_python_init_fmodifier_keys_state(PyObject *); PyObject *py_ue_new_fmodifier_keys_state(FModifierKeysState); ue_PyFModifierKeysState *py_ue_is_fmodifier_keys_state(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFModifierKeysState.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
127
```c++ #include "UEPyFSlateIcon.h" static PyObject *py_ue_fslate_icon_get_icon(ue_PyFSlateIcon *self, PyObject * args) { return py_ue_new_owned_uscriptstruct(FSlateBrush::StaticStruct(), (uint8*)self->icon.GetIcon()); } static PyMethodDef ue_PyFSlateIcon_methods[] = { { "get_icon", (PyCFunction)py_ue_fslate_icon_get_icon, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; static PyObject *ue_PyFSlateIcon_str(ue_PyFSlateIcon *self) { return PyUnicode_FromFormat("<unreal_engine.SlateIcon {'name': %s}>", TCHAR_TO_UTF8(*self->icon.GetStyleName().ToString())); } static PyTypeObject ue_PyFSlateIconType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.FSlateIcon", /* tp_name */ sizeof(ue_PyFSlateIcon), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc)ue_PyFSlateIcon_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ "Unreal Engine FSlateIcon", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PyFSlateIcon_methods, /* tp_methods */ }; static int ue_py_fslate_icon_init(ue_PyFSlateIcon *self, PyObject *args, PyObject *kwargs) { char *style_set = nullptr; char *style = nullptr; if (!PyArg_ParseTuple(args, "|ss", &style_set, &style)) { return -1; } if (style_set) { if (!style) { PyErr_SetString(PyExc_ValueError, "you have not specified as style name"); return -1; } new(&self->icon) FSlateIcon(FName(style_set), FName(style)); } else { new(&self->icon) FSlateIcon(); } return 0; } void ue_python_init_fslate_icon(PyObject *ue_module) { ue_PyFSlateIconType.tp_new = PyType_GenericNew; ue_PyFSlateIconType.tp_init = (initproc)ue_py_fslate_icon_init; if (PyType_Ready(&ue_PyFSlateIconType) < 0) return; Py_INCREF(&ue_PyFSlateIconType); PyModule_AddObject(ue_module, "FSlateIcon", (PyObject *)&ue_PyFSlateIconType); } ue_PyFSlateIcon *py_ue_new_fslate_icon(const FSlateIcon slate_icon) { ue_PyFSlateIcon *ret = (ue_PyFSlateIcon *)PyObject_New(ue_PyFSlateIcon, &ue_PyFSlateIconType); ret->icon = slate_icon; return ret; } ue_PyFSlateIcon *py_ue_is_fslate_icon(PyObject *obj) { if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFSlateIconType)) return nullptr; return (ue_PyFSlateIcon *)obj; } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFSlateIcon.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
851
```objective-c #pragma once #include "UnrealEnginePython.h" #if WITH_EDITOR #include "UEPySCompoundWidget.h" extern PyTypeObject ue_PySCompoundWidgetType; typedef struct { ue_PySCompoundWidget s_compound_widget; /* Type-specific fields go here. */ } ue_PyIDetailsView; void ue_python_init_idetails_view(PyObject *); ue_PyIDetailsView * py_ue_is_idetails_view(PyObject *obj); #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyIDetailsView.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
96
```objective-c #pragma once #include "UEPySLeafWidget.h" #include "Runtime/Slate/Public/Widgets/Text/STextBlock.h" extern PyTypeObject ue_PySTextBlockType; typedef struct { ue_PySLeafWidget s_leaf_widget; /* Type-specific fields go here. */ } ue_PySTextBlock; void ue_python_init_stext_block(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySTextBlock.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
82
```c++ #include "UEPySDropTarget.h" #if WITH_EDITOR static PyMethodDef ue_PySDropTarget_methods[] = { { NULL } /* Sentinel */ }; PyTypeObject ue_PySDropTargetType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SDropTarget", /* tp_name */ sizeof(ue_PySDropTarget), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SDropTarget", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySDropTarget_methods, /* tp_methods */ }; void ue_python_init_sdrop_target(PyObject *ue_module) { ue_PySDropTargetType.tp_base = &ue_PySCompoundWidgetType; if (PyType_Ready(&ue_PySDropTargetType) < 0) return; Py_INCREF(&ue_PySDropTargetType); PyModule_AddObject(ue_module, "SDropTarget", (PyObject *)&ue_PySDropTargetType); } #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySDropTarget.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
419
```objective-c #pragma once #include "UEPySLeafWidget.h" #include "Runtime/Slate/Public/Widgets/Colors/SColorBlock.h" extern PyTypeObject ue_PySColorBlockType; typedef struct { ue_PySLeafWidget s_leaf_widget; /* Type-specific fields go here. */ } ue_PySColorBlock; void ue_python_init_scolor_block(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySColorBlock.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
80
```objective-c #pragma once #include "UnrealEnginePython.h" #include "Runtime/Slate/Public/Framework/Docking/TabManager.h" typedef struct { PyObject_HEAD /* Type-specific fields go here. */ FTabSpawnerEntry *spawner_entry; } ue_PyFTabSpawnerEntry; PyObject *py_ue_new_ftab_spawner_entry(FTabSpawnerEntry *); void ue_python_init_ftab_spawner_entry(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFTabSpawnerEntry.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
91
```objective-c #pragma once #include "UEPySBorder.h" #include "Runtime/Slate/Public/Widgets/Input/SEditableTextBox.h" extern PyTypeObject ue_PySEditableTextBoxType; typedef struct { ue_PySBorder s_border; /* Type-specific fields go here. */ } ue_PySEditableTextBox; void ue_python_init_seditable_text_box(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySEditableTextBox.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
81
```c++ #include "UEPySWidget.h" #include "Runtime/Slate/Public/Framework/Application/SlateApplication.h" static PyObject *ue_PySWidget_str(ue_PySWidget *self) { #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromFormat("<unreal_engine.%s '%p' (slate ref count: %d, py ref count: %d)>", TCHAR_TO_UTF8(*self->Widget->GetTypeAsString()), &self->Widget.Get(), self->Widget.GetSharedReferenceCount(), self->ob_base.ob_refcnt); #else return PyUnicode_FromFormat("<unreal_engine.%s '%p' (slate ref count: %d)>", TCHAR_TO_UTF8(*self->Widget->GetTypeAsString()), &self->Widget.Get(), self->Widget.GetSharedReferenceCount()); #endif } static PyObject *py_ue_swidget_get_children(ue_PySWidget *self, PyObject * args) { FChildren *children = self->Widget->GetChildren(); PyObject *py_list = PyList_New(0); for (int32 i = 0; i < children->Num(); i++) { TSharedRef<SWidget> widget = children->GetChildAt(i); PyObject *item = (PyObject *)ue_py_get_swidget(widget); PyList_Append(py_list, item); Py_DECREF(item); } return py_list; } static PyObject *py_ue_swidget_set_visibility(ue_PySWidget *self, PyObject * args) { PyObject* py_object; if (!PyArg_ParseTuple(args, "O:set_visibility", &py_object)) { return nullptr; } if (!PyNumber_Check(py_object)) { return PyErr_Format(PyExc_Exception, "argument is not a ESlateVisibility"); } PyObject *py_value = PyNumber_Long(py_object); ESlateVisibility slateVisibility = (ESlateVisibility)PyLong_AsLong(py_value); Py_DECREF(py_value); EVisibility visibility; switch (slateVisibility) { case ESlateVisibility::Visible: visibility = EVisibility::Visible; break; case ESlateVisibility::Collapsed: visibility = EVisibility::Collapsed; break; case ESlateVisibility::Hidden: visibility = EVisibility::Hidden; break; case ESlateVisibility::HitTestInvisible: visibility = EVisibility::HitTestInvisible; break; case ESlateVisibility::SelfHitTestInvisible: visibility = EVisibility::SelfHitTestInvisible; break; } self->Widget->SetVisibility(visibility); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_swidget_set_tooltip_text(ue_PySWidget *self, PyObject * args) { char *text; if (!PyArg_ParseTuple(args, "s:set_tooltip_text", &text)) { return NULL; } self->Widget->SetToolTipText(FText::FromString(UTF8_TO_TCHAR(text))); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_swidget_set_cursor(ue_PySWidget *self, PyObject * args) { int cursor; if (!PyArg_ParseTuple(args, "i:set_cursor", &cursor)) { return NULL; } self->Widget->SetCursor((EMouseCursor::Type)cursor); Py_INCREF(self); return (PyObject *)self; } static PyObject *py_ue_swidget_set_enabled(ue_PySWidget *self, PyObject * args) { PyObject *py_bool; if (!PyArg_ParseTuple(args, "O:set_enabled", &py_bool)) { return NULL; } self->Widget->SetEnabled(PyObject_IsTrue(py_bool) ? true : false); Py_RETURN_SLATE_SELF; } #if ENGINE_MINOR_VERSION > 12 static PyObject *py_ue_swidget_bind_on_mouse_button_down(ue_PySWidget *self, PyObject * args) { PyObject *py_callable; if (!PyArg_ParseTuple(args, "O:bind_on_mouse_button_down", &py_callable)) { return NULL; } if (!PyCallable_Check(py_callable)) { return PyErr_Format(PyExc_Exception, "argument is not callable"); } FPointerEventHandler handler; TSharedRef<FPythonSlateDelegate> py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewSlateDelegate(self->Widget, py_callable); handler.BindSP(py_delegate, &FPythonSlateDelegate::OnMouseEvent); self->Widget->SetOnMouseButtonDown(handler); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_swidget_bind_on_mouse_button_up(ue_PySWidget *self, PyObject * args) { PyObject *py_callable; if (!PyArg_ParseTuple(args, "O:bind_on_mouse_button_up", &py_callable)) { return nullptr; } if (!PyCallable_Check(py_callable)) { return PyErr_Format(PyExc_Exception, "argument is not callable"); } FPointerEventHandler handler; TSharedRef<FPythonSlateDelegate> py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewSlateDelegate(self->Widget, py_callable); handler.BindSP(py_delegate, &FPythonSlateDelegate::OnMouseEvent); self->Widget->SetOnMouseButtonUp(handler); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_swidget_bind_on_mouse_double_click(ue_PySWidget *self, PyObject * args) { PyObject *py_callable; if (!PyArg_ParseTuple(args, "O:bind_on_mouse_double_click", &py_callable)) { return NULL; } if (!PyCallable_Check(py_callable)) { return PyErr_Format(PyExc_Exception, "argument is not callable"); } FPointerEventHandler handler; TSharedRef<FPythonSlateDelegate> py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewSlateDelegate(self->Widget, py_callable); handler.BindSP(py_delegate, &FPythonSlateDelegate::OnMouseEvent); self->Widget->SetOnMouseDoubleClick(handler); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_swidget_bind_on_mouse_move(ue_PySWidget *self, PyObject * args) { PyObject *py_callable; if (!PyArg_ParseTuple(args, "O:bind_on_mouse_move", &py_callable)) { return NULL; } if (!PyCallable_Check(py_callable)) { return PyErr_Format(PyExc_Exception, "argument is not callable"); } FPointerEventHandler handler; TSharedRef<FPythonSlateDelegate> py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewSlateDelegate(self->Widget, py_callable); handler.BindSP(py_delegate, &FPythonSlateDelegate::OnMouseEvent); self->Widget->SetOnMouseMove(handler); Py_RETURN_SLATE_SELF; } #endif static PyObject *py_ue_swidget_has_keyboard_focus(ue_PySWidget *self, PyObject * args) { if (self->Widget->HasKeyboardFocus()) { Py_RETURN_TRUE; } Py_RETURN_FALSE; } static PyObject *py_ue_swidget_set_keyboard_focus(ue_PySWidget *self, PyObject * args) { FSlateApplication::Get().SetKeyboardFocus(self->Widget, EFocusCause::SetDirectly); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_swidget_get_type(ue_PySWidget *self, PyObject * args) { return PyUnicode_FromString(TCHAR_TO_UTF8(*(self->Widget->GetTypeAsString()))); } static PyObject *py_ue_swidget_get_cached_geometry(ue_PySWidget *self, PyObject * args) { return py_ue_new_fgeometry(self->Widget->GetCachedGeometry()); } static PyObject *py_ue_swidget_get_shared_reference_count(ue_PySWidget *self, PyObject * args) { return PyLong_FromLong(self->Widget.GetSharedReferenceCount()); } static PyObject *py_ue_swidget_invalidate(ue_PySWidget *self, PyObject * args) { int invalidate_mode = 0; if (!PyArg_ParseTuple(args, "|i:invalidate", &invalidate_mode)) { return nullptr; } self->Widget->Invalidate((EInvalidateWidget)invalidate_mode); Py_RETURN_NONE; } static PyObject *py_ue_swidget_on_mouse_button_down(ue_PySWidget *self, PyObject * args) { PyObject *py_geometry; PyObject *py_pointer_event; if (!PyArg_ParseTuple(args, "OO:on_mouse_button_down", &py_geometry, &py_pointer_event)) { return nullptr; } ue_PyFGeometry *geometry = py_ue_is_fgeometry(py_geometry); if (!geometry) { return PyErr_Format(PyExc_Exception, "argument is not a FGeomtry"); } ue_PyFPointerEvent *pointer = py_ue_is_fpointer_event(py_pointer_event); if (!pointer) { return PyErr_Format(PyExc_Exception, "argument is not a FPointerEvent"); } FReply reply = self->Widget->OnMouseButtonDown(geometry->geometry, pointer->pointer); if (reply.IsEventHandled()) { Py_RETURN_TRUE; } Py_RETURN_FALSE; } static PyObject *py_ue_swidget_on_mouse_button_up(ue_PySWidget *self, PyObject * args) { PyObject *py_geometry; PyObject *py_pointer_event; if (!PyArg_ParseTuple(args, "OO:on_mouse_button_up", &py_geometry, &py_pointer_event)) { return nullptr; } ue_PyFGeometry *geometry = py_ue_is_fgeometry(py_geometry); if (!geometry) { return PyErr_Format(PyExc_Exception, "argument is not a FGeomtry"); } ue_PyFPointerEvent *pointer = py_ue_is_fpointer_event(py_pointer_event); if (!pointer) { return PyErr_Format(PyExc_Exception, "argument is not a FPointerEvent"); } FReply reply = self->Widget->OnMouseButtonUp(geometry->geometry, pointer->pointer); if (reply.IsEventHandled()) { Py_RETURN_TRUE; } Py_RETURN_FALSE; } static PyObject *py_ue_swidget_new_ref(ue_PySWidget *self, PyObject * args) { PyObject *py_widget; if (!PyArg_ParseTuple(args, "O:new_ref", &py_widget)) { return nullptr; } TSharedPtr<SWidget> Widget = py_ue_is_swidget<SWidget>(py_widget); if (!Widget.IsValid()) return nullptr; return (PyObject *)py_ue_new_swidget<ue_PySWidget>(Widget.ToSharedRef(), &ue_PySWidgetType); } static PyObject *py_ue_swidget_assign(ue_PySWidget *self, PyObject * args) { char *global_name; if (!PyArg_ParseTuple(args, "s:assign", &global_name)) { return nullptr; } PyObject *py_globals = PyEval_GetGlobals(); if (!py_globals) { return PyErr_Format(PyExc_Exception, "unable to retrieve globals"); } if (!PyDict_GetItemString(py_globals, global_name)) { PyErr_Clear(); return PyErr_Format(PyExc_Exception, "global \"%s\" not found", global_name); } if (PyDict_SetItemString(py_globals, global_name, (PyObject *)self) < 0) { return PyErr_Format(PyExc_Exception, "unable to assign global \"%s\" to SWidget", global_name); } Py_RETURN_SLATE_SELF; } static PyMethodDef ue_PySWidget_methods[] = { { "new_ref", (PyCFunction)py_ue_swidget_new_ref, METH_VARARGS, "" }, { "get_shared_reference_count", (PyCFunction)py_ue_swidget_get_shared_reference_count, METH_VARARGS, "" }, { "get_cached_geometry", (PyCFunction)py_ue_swidget_get_cached_geometry, METH_VARARGS, "" }, { "get_children", (PyCFunction)py_ue_swidget_get_children, METH_VARARGS, "" }, { "get_type", (PyCFunction)py_ue_swidget_get_type, METH_VARARGS, "" }, { "set_tooltip_text", (PyCFunction)py_ue_swidget_set_tooltip_text, METH_VARARGS, "" }, { "set_cursor", (PyCFunction)py_ue_swidget_set_cursor, METH_VARARGS, "" }, { "set_enabled", (PyCFunction)py_ue_swidget_set_enabled, METH_VARARGS, "" }, { "has_keyboard_focus", (PyCFunction)py_ue_swidget_has_keyboard_focus, METH_VARARGS, "" }, { "invalidate", (PyCFunction)py_ue_swidget_invalidate, METH_VARARGS, "" }, { "set_keyboard_focus", (PyCFunction)py_ue_swidget_set_keyboard_focus, METH_VARARGS, "" }, { "set_visibility", (PyCFunction)py_ue_swidget_set_visibility, METH_VARARGS, "" }, #if ENGINE_MINOR_VERSION > 12 { "bind_on_mouse_button_down", (PyCFunction)py_ue_swidget_bind_on_mouse_button_down, METH_VARARGS, "" }, { "bind_on_mouse_button_up", (PyCFunction)py_ue_swidget_bind_on_mouse_button_down, METH_VARARGS, "" }, { "bind_on_mouse_double_click", (PyCFunction)py_ue_swidget_bind_on_mouse_double_click, METH_VARARGS, "" }, { "bind_on_mouse_move", (PyCFunction)py_ue_swidget_bind_on_mouse_move, METH_VARARGS, "" }, #endif { "on_mouse_button_down", (PyCFunction)py_ue_swidget_on_mouse_button_down, METH_VARARGS, "" }, { "on_mouse_button_up", (PyCFunction)py_ue_swidget_on_mouse_button_up, METH_VARARGS, "" }, { "assign", (PyCFunction)py_ue_swidget_assign, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; static void ue_PySWidget_dealloc(ue_PySWidget *self) { #if defined(UEPY_MEMORY_DEBUG) UE_LOG(LogPython, Warning, TEXT("Destroying ue_PySWidget %p mapped to %s %p (slate refcount: %d)"), self, *self->s_widget->GetTypeAsString(), &self->s_widget.Get(), self->s_widget.GetSharedReferenceCount()); #endif if (self->weakreflist != nullptr) PyObject_ClearWeakRefs((PyObject *)self); // decrement widget reference count // but only if python vm is still fully active (hack to avoid crashes on editor shutdown) if (Py_IsInitialized()) { self->Widget = SNullWidget::NullWidget; } else { UE_LOG(LogPython, Warning, TEXT("Python VM is being destroyed, skipping ue_PySWidget destruction")); } Py_TYPE(self)->tp_free((PyObject *)self); } PyTypeObject ue_PySWidgetType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SWidget", /* tp_name */ sizeof(ue_PySWidget), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)ue_PySWidget_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc)ue_PySWidget_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SWidget", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySWidget_methods, /* tp_methods */ }; static PyObject * ue_PySWidget_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { ue_PySWidget *self; self = (ue_PySWidget *)type->tp_alloc(type, 0); if (self != NULL) { new(&self->Widget) TSharedRef<SWidget>(SNullWidget::NullWidget); self->weakreflist = nullptr; } return (PyObject *)self; } void ue_python_init_swidget(PyObject *ue_module) { ue_PySWidgetType.tp_new = ue_PySWidget_new; // support for weak references, useful for tests ue_PySWidgetType.tp_weaklistoffset = offsetof(ue_PySWidget, weakreflist); if (PyType_Ready(&ue_PySWidgetType) < 0) return; Py_INCREF(&ue_PySWidgetType); PyModule_AddObject(ue_module, "SWidget", (PyObject *)&ue_PySWidgetType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySWidget.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
3,661
```c++ #include "UEPySHorizontalBox.h" static PyObject *py_ue_shorizontal_box_add_slot(ue_PySHorizontalBox *self, PyObject * args, PyObject *kwargs) { ue_py_slate_cast(SHorizontalBox); int32 retCode = [&]() { ue_py_slate_setup_hack_slot_args(SHorizontalBox, py_SHorizontalBox); ue_py_slate_farguments_float("fill_width", FillWidth); ue_py_slate_farguments_float("max_width", MaxWidth); ue_py_slate_farguments_optional_enum("h_align", HAlign, EHorizontalAlignment); ue_py_slate_farguments_optional_enum("v_align", VAlign, EVerticalAlignment); ue_py_slate_farguments_call("auto_width", AutoWidth); ue_py_slate_farguments_padding("padding", Padding); return 0; }(); if (retCode != 0) { return PyErr_Format(PyExc_Exception, "could not add horizontal slot"); } Py_RETURN_SLATE_SELF; } static PyObject *py_ue_shorizontal_box_num_slots(ue_PySHorizontalBox *self, PyObject * args) { ue_py_slate_cast(SHorizontalBox); return PyLong_FromLong(py_SHorizontalBox->NumSlots()); } static PyMethodDef ue_PySHorizontalBox_methods[] = { #pragma warning(suppress: 4191) { "add_slot", (PyCFunction)py_ue_shorizontal_box_add_slot, METH_VARARGS | METH_KEYWORDS, "" }, { "num_slots", (PyCFunction)py_ue_shorizontal_box_num_slots, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; DECLARE_UE_PY_SLATE_WIDGET(SHorizontalBox); static int ue_py_shorizontal_box_init(ue_PySHorizontalBox *self, PyObject *args, PyObject *kwargs) { ue_py_snew_simple(SHorizontalBox); return 0; } PyNumberMethods ue_PySHorizontalBox_number_methods; static PyObject *ue_py_shorizontal_box_add(ue_PySHorizontalBox *self, PyObject *value) { ue_py_slate_cast(SHorizontalBox); TSharedPtr<SWidget> Child = py_ue_is_swidget<SWidget>(value); if (!Child.IsValid()) { return nullptr; } SHorizontalBox::FSlot &fslot = py_SHorizontalBox->AddSlot(); fslot.AttachWidget(Child.ToSharedRef()); Py_RETURN_SLATE_SELF; } void ue_python_init_shorizontal_box(PyObject *ue_module) { ue_PySHorizontalBoxType.tp_init = (initproc)ue_py_shorizontal_box_init; ue_PySHorizontalBoxType.tp_call = (ternaryfunc)py_ue_shorizontal_box_add_slot; memset(&ue_PySHorizontalBox_number_methods, 0, sizeof(PyNumberMethods)); ue_PySHorizontalBoxType.tp_as_number = &ue_PySHorizontalBox_number_methods; ue_PySHorizontalBox_number_methods.nb_add = (binaryfunc)ue_py_shorizontal_box_add; ue_PySHorizontalBoxType.tp_base = &ue_PySBoxPanelType; if (PyType_Ready(&ue_PySHorizontalBoxType) < 0) return; Py_INCREF(&ue_PySHorizontalBoxType); PyModule_AddObject(ue_module, "SHorizontalBox", (PyObject *)&ue_PySHorizontalBoxType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySHorizontalBox.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
724
```c++ #include "UEPySPythonWidget.h" static PyObject *py_ue_spython_widget_set_active(ue_PySPythonWidget *self, PyObject *args) { ue_py_slate_cast(SPythonWidget); PyObject *py_bool = nullptr; if (!PyArg_ParseTuple(args, "|O:set_active", &py_bool)) { return nullptr; } bool bActive = true; if (py_bool) { if (PyObject_IsTrue(py_bool)) { bActive = true; } else { bActive = false; } } py_SPythonWidget->SetActive(bActive); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_spython_widget_set_content(ue_PySPythonWidget *self, PyObject *args) { ue_py_slate_cast(SPythonWidget); PyObject *py_content; if (!PyArg_ParseTuple(args, "O:set_content", &py_content)) { return NULL; } TSharedPtr<SWidget> Content = py_ue_is_swidget<SWidget>(py_content); if (!Content.IsValid()) { return nullptr; } py_SPythonWidget->SetContent(Content.ToSharedRef()); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_spython_widget_clear_content(ue_PySPythonWidget *self, PyObject *args) { ue_py_slate_cast(SPythonWidget); py_SPythonWidget->ClearContent(); Py_RETURN_NONE; } static PyMethodDef ue_PySPythonWidget_methods[] = { { "set_active", (PyCFunction)py_ue_spython_widget_set_active, METH_VARARGS | METH_KEYWORDS, "" }, { "set_content", (PyCFunction)py_ue_spython_widget_set_content, METH_VARARGS, "" }, { "clear_content", (PyCFunction)py_ue_spython_widget_clear_content, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; PyTypeObject ue_PySPythonWidgetType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SPythonWidget", /* tp_name */ sizeof(ue_PySPythonWidget), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SPythonWidget", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySPythonWidget_methods, /* tp_methods */ }; static int ue_py_spython_widget_init(ue_PySPythonWidget *self, PyObject *args, PyObject *kwargs) { ue_py_snew_simple(SPythonWidget); ue_py_slate_cast(SPythonWidget); py_SPythonWidget->SetPyObject((PyObject *)self); return 0; } void ue_python_init_spython_widget(PyObject *ue_module) { ue_PySPythonWidgetType.tp_base = &ue_PySCompoundWidgetType; ue_PySPythonWidgetType.tp_init = (initproc)ue_py_spython_widget_init; if (PyType_Ready(&ue_PySPythonWidgetType) < 0) return; Py_INCREF(&ue_PySPythonWidgetType); PyModule_AddObject(ue_module, "SPythonWidget", (PyObject *)&ue_PySPythonWidgetType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySPythonWidget.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
884
```c++ #include "UEPySVerticalBox.h" static PyObject *py_ue_svertical_box_add_slot(ue_PySVerticalBox *self, PyObject * args, PyObject *kwargs) { ue_py_slate_cast(SVerticalBox); int32 retCode = [&]() { ue_py_slate_setup_hack_slot_args(SVerticalBox, py_SVerticalBox); ue_py_slate_farguments_float("fill_height", FillHeight); ue_py_slate_farguments_float("max_height", MaxHeight); ue_py_slate_farguments_optional_enum("h_align", HAlign, EHorizontalAlignment); ue_py_slate_farguments_optional_enum("v_align", VAlign, EVerticalAlignment); ue_py_slate_farguments_call("auto_height", AutoHeight); ue_py_slate_farguments_padding("padding", Padding); return 0; }(); if (retCode != 0) { return PyErr_Format(PyExc_Exception, "could not add vertical slot"); } Py_RETURN_SLATE_SELF; } static PyObject *py_ue_svertical_box_num_slots(ue_PySVerticalBox *self, PyObject * args) { ue_py_slate_cast(SVerticalBox); return PyLong_FromLong(py_SVerticalBox->NumSlots()); } static PyMethodDef ue_PySVerticalBox_methods[] = { #pragma warning(suppress: 4191) { "add_slot", (PyCFunction)py_ue_svertical_box_add_slot, METH_VARARGS | METH_KEYWORDS, "" }, { "num_slots", (PyCFunction)py_ue_svertical_box_num_slots, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; DECLARE_UE_PY_SLATE_WIDGET(SVerticalBox); static int ue_py_svertical_box_init(ue_PySVerticalBox *self, PyObject *args, PyObject *kwargs) { ue_py_snew_simple(SVerticalBox); return 0; } PyNumberMethods ue_PySVerticalBox_number_methods; static PyObject *ue_py_svertical_box_add(ue_PySVerticalBox *self, PyObject *value) { ue_py_slate_cast(SVerticalBox); TSharedPtr<SWidget> Child = py_ue_is_swidget<SWidget>(value); if (!Child.IsValid()) { return nullptr; } SVerticalBox::FSlot &fslot = py_SVerticalBox->AddSlot(); fslot.AttachWidget(Child.ToSharedRef()); Py_RETURN_SLATE_SELF; } void ue_python_init_svertical_box(PyObject *ue_module) { ue_PySVerticalBoxType.tp_init = (initproc)ue_py_svertical_box_init; ue_PySVerticalBoxType.tp_call = (ternaryfunc)py_ue_svertical_box_add_slot; memset(&ue_PySVerticalBox_number_methods, 0, sizeof(PyNumberMethods)); ue_PySVerticalBoxType.tp_as_number = &ue_PySVerticalBox_number_methods; ue_PySVerticalBox_number_methods.nb_add = (binaryfunc)ue_py_svertical_box_add; ue_PySVerticalBoxType.tp_base = &ue_PySBoxPanelType; if (PyType_Ready(&ue_PySVerticalBoxType) < 0) return; Py_INCREF(&ue_PySVerticalBoxType); PyModule_AddObject(ue_module, "SVerticalBox", (PyObject *)&ue_PySVerticalBoxType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySVerticalBox.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
724
```c++ #include "UEPySListView.h" static PyMethodDef ue_PySListView_methods[] = { { NULL } /* Sentinel */ }; PyTypeObject ue_PySListViewType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SListView", /* tp_name */ sizeof(ue_PySListView), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SListView", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySListView_methods, /* tp_methods */ }; void ue_python_init_slist_view(PyObject *ue_module) { ue_PySListViewType.tp_base = &ue_PySTableViewBaseType; if (PyType_Ready(&ue_PySListViewType) < 0) return; Py_INCREF(&ue_PySListViewType); PyModule_AddObject(ue_module, "SListView", (PyObject *)&ue_PySListViewType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySListView.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
402
```objective-c #pragma once #include "UEPySCompoundWidget.h" #if WITH_EDITOR #include "Editor/UnrealEd/Public/SEditorViewport.h" extern PyTypeObject ue_PySEditorViewportType; typedef struct { ue_PySCompoundWidget s_compound_widget; /* Type-specific fields go here. */ } ue_PySEditorViewport; void ue_python_init_seditor_viewport(PyObject *); #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySEditorViewport.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
88
```c++ #include "UEPyFMenuBuilder.h" #include "Wrappers/UEPyESlateEnums.h" static PyObject* py_ue_fmenu_builder_begin_section(ue_PyFMenuBuilder* self, PyObject* args) { char* name; char* text; if (!PyArg_ParseTuple(args, "ss:begin_section", &name, &text)) return nullptr; self->menu_builder.BeginSection(name, FText::FromString(UTF8_TO_TCHAR(text))); Py_RETURN_NONE; } static PyObject* py_ue_fmenu_builder_end_section(ue_PyFMenuBuilder* self, PyObject* args) { self->menu_builder.EndSection(); Py_RETURN_NONE; } static PyObject* py_ue_fmenu_builder_make_widget(ue_PyFMenuBuilder* self, PyObject* args) { ue_PySWidget* ret = (ue_PySWidget*)PyObject_New(ue_PySWidget, &ue_PySWidgetType); new (&ret->Widget) TSharedRef<SWidget>(self->menu_builder.MakeWidget()); return (PyObject*)ret; } static PyObject* py_ue_fmenu_builder_add_menu_entry(ue_PyFMenuBuilder* self, PyObject* args) { char* label; char* tooltip; PyObject* py_callable; PyObject* py_obj = nullptr; #if ENGINE_MINOR_VERSION >= 23 int ui_action_type = (int)EUserInterfaceActionType::Button; #else int ui_action_type = EUserInterfaceActionType::Button; #endif if (!PyArg_ParseTuple(args, "ssO|Oi:add_menu_entry", &label, &tooltip, &py_callable, &py_obj, &ui_action_type)) return nullptr; if (!PyCallable_Check(py_callable)) { return PyErr_Format(PyExc_Exception, "argument is not callable"); } FExecuteAction handler; TSharedRef<FPythonSlateDelegate> py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewStaticSlateDelegate(py_callable); if (py_obj) { Py_INCREF(py_obj); handler.BindSP(py_delegate, &FPythonSlateDelegate::ExecuteAction, py_obj); } else { handler.BindSP(py_delegate, &FPythonSlateDelegate::SimpleExecuteAction); } self->menu_builder.AddMenuEntry(FText::FromString(UTF8_TO_TCHAR(label)), FText::FromString(UTF8_TO_TCHAR(tooltip)), FSlateIcon(), FUIAction(handler), NAME_None, #if ENGINE_MINOR_VERSION >= 23 (EUserInterfaceActionType)ui_action_type); #else (EUserInterfaceActionType::Type)ui_action_type); #endif Py_RETURN_NONE; } static PyObject* py_ue_fmenu_builder_add_sub_menu(ue_PyFMenuBuilder* self, PyObject* args) { char* label; char* tooltip; PyObject* py_callable; PyObject* py_bool = nullptr; if (!PyArg_ParseTuple(args, "ssO|O:add_sub_menu", &label, &tooltip, &py_callable, &py_bool)) return nullptr; if (!PyCallable_Check(py_callable)) { return PyErr_Format(PyExc_Exception, "argument is not callable"); } TSharedRef<FPythonSlateDelegate> py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewStaticSlateDelegate(py_callable); FNewMenuDelegate menu_delegate; menu_delegate.BindSP(py_delegate, &FPythonSlateDelegate::SubMenuPyBuilder); self->menu_builder.AddSubMenu(FText::FromString(UTF8_TO_TCHAR(label)), FText::FromString(UTF8_TO_TCHAR(tooltip)), menu_delegate, (py_bool && PyObject_IsTrue(py_bool)) ? true : false); Py_RETURN_NONE; } static PyObject* py_ue_fmenu_builder_add_menu_separator(ue_PyFMenuBuilder* self, PyObject* args) { char* name = nullptr; if (!PyArg_ParseTuple(args, "|s:add_menu_separator", &name)) return nullptr; FName f_name = NAME_None; if (name) f_name = FName(UTF8_TO_TCHAR(name)); self->menu_builder.AddMenuSeparator(f_name); Py_RETURN_NONE; } #if WITH_EDITOR static PyObject* py_ue_fmenu_builder_add_asset_actions(ue_PyFMenuBuilder* self, PyObject* args) { PyObject* py_assets; if (!PyArg_ParseTuple(args, "O:add_asset_actions", &py_assets)) return nullptr; py_assets = PyObject_GetIter(py_assets); if (!py_assets) { return PyErr_Format(PyExc_Exception, "argument is not iterable"); } TArray<UObject*> u_objects; while (PyObject * item = PyIter_Next(py_assets)) { UObject* u_object = ue_py_check_type<UObject>(item); if (u_object) { u_objects.Add(u_object); } } Py_DECREF(py_assets); FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked<FAssetToolsModule>(TEXT("AssetTools")); bool addedSomething = AssetToolsModule.Get().GetAssetActions(u_objects, self->menu_builder, true); if (addedSomething) { Py_RETURN_TRUE; } Py_RETURN_FALSE; } #endif static PyObject* py_ue_fmenu_builder_add_search_widget(ue_PyFMenuBuilder* self, PyObject* args) { self->menu_builder.AddSearchWidget(); Py_RETURN_NONE; } static PyMethodDef ue_PyFMenuBuilder_methods[] = { { "begin_section", (PyCFunction)py_ue_fmenu_builder_begin_section, METH_VARARGS, "" }, { "end_section", (PyCFunction)py_ue_fmenu_builder_end_section, METH_VARARGS, "" }, { "make_widget", (PyCFunction)py_ue_fmenu_builder_make_widget, METH_VARARGS, "" }, { "add_menu_entry", (PyCFunction)py_ue_fmenu_builder_add_menu_entry, METH_VARARGS, "" }, { "add_menu_separator", (PyCFunction)py_ue_fmenu_builder_add_menu_separator, METH_VARARGS, "" }, { "add_search_widget", (PyCFunction)py_ue_fmenu_builder_add_search_widget, METH_VARARGS, "" }, { "add_sub_menu", (PyCFunction)py_ue_fmenu_builder_add_sub_menu, METH_VARARGS, "" }, #if WITH_EDITOR { "add_asset_actions", (PyCFunction)py_ue_fmenu_builder_add_asset_actions, METH_VARARGS, "" }, #endif { NULL } /* Sentinel */ }; static PyObject* ue_PyFMenuBuilder_str(ue_PyFMenuBuilder* self) { return PyUnicode_FromFormat("<unreal_engine.FMenuBuilder '%p'}>", &self->menu_builder); } static void ue_py_fmenu_builder_dealloc(ue_PyFMenuBuilder* self) { #if PY_MAJOR_VERSION < 3 self->ob_type->tp_free((PyObject*)self); #else Py_TYPE(self)->tp_free((PyObject*)self); #endif } static PyTypeObject ue_PyFMenuBuilderType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.FMenuBuilder", /* tp_name */ sizeof(ue_PyFMenuBuilder), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)ue_py_fmenu_builder_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc)ue_PyFMenuBuilder_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ "Unreal Engine FMenuBuilder", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PyFMenuBuilder_methods, /* tp_methods */ }; static int ue_py_fmenu_builder_init(ue_PyFMenuBuilder* self, PyObject* args, PyObject* kwargs) { new(&self->menu_builder) FMenuBuilder(true, nullptr); return 0; } void ue_python_init_fmenu_builder(PyObject* ue_module) { ue_PyFMenuBuilderType.tp_new = PyType_GenericNew; ue_PyFMenuBuilderType.tp_init = (initproc)ue_py_fmenu_builder_init; if (PyType_Ready(&ue_PyFMenuBuilderType) < 0) return; Py_INCREF(&ue_PyFMenuBuilderType); PyModule_AddObject(ue_module, "FMenuBuilder", (PyObject*)& ue_PyFMenuBuilderType); } PyObject* py_ue_new_fmenu_builder(FMenuBuilder menu_builder) { ue_PyFMenuBuilder* ret = (ue_PyFMenuBuilder*)PyObject_New(ue_PyFMenuBuilder, &ue_PyFMenuBuilderType); new(&ret->menu_builder) FMenuBuilder(menu_builder); return (PyObject*)ret; } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFMenuBuilder.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
2,007
```c++ #include "UEPySTableViewBase.h" static PyObject *py_ue_stable_view_base_set_item_height(ue_PySTableViewBase *self, PyObject * args) { ue_py_slate_cast(STableViewBase); float size; if (!PyArg_ParseTuple(args, "f:set_item_height", &size)) { return nullptr; } py_STableViewBase->SetItemHeight(size); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_stable_view_base_set_item_width(ue_PySTableViewBase *self, PyObject * args) { ue_py_slate_cast(STableViewBase); float size; if (!PyArg_ParseTuple(args, "f:set_item_width", &size)) { return nullptr; } py_STableViewBase->SetItemWidth(size); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_stable_view_base_request_list_refresh(ue_PySTableViewBase *self, PyObject * args) { ue_py_slate_cast(STableViewBase); py_STableViewBase->RequestListRefresh(); Py_RETURN_NONE; } static PyMethodDef ue_PySTableViewBase_methods[] = { { "set_item_height", (PyCFunction)py_ue_stable_view_base_set_item_height, METH_VARARGS, "" }, { "set_item_width", (PyCFunction)py_ue_stable_view_base_set_item_width, METH_VARARGS, "" }, { "request_list_refresh", (PyCFunction)py_ue_stable_view_base_request_list_refresh, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; PyTypeObject ue_PySTableViewBaseType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.STableViewBase", /* tp_name */ sizeof(ue_PySTableViewBase), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine STableViewBase", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySTableViewBase_methods, /* tp_methods */ }; void ue_python_init_stable_view_base(PyObject *ue_module) { ue_PySTableViewBaseType.tp_base = &ue_PySCompoundWidgetType; if (PyType_Ready(&ue_PySTableViewBaseType) < 0) return; Py_INCREF(&ue_PySTableViewBaseType); PyModule_AddObject(ue_module, "STableViewBase", (PyObject *)&ue_PySTableViewBaseType); } ue_PySTableViewBase * py_ue_is_stable_view_base(PyObject *obj) { if (!PyObject_IsInstance(obj, (PyObject *)&ue_PySTableViewBaseType)) return nullptr; return (ue_PySTableViewBase *)obj; } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySTableViewBase.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
770
```objective-c #pragma once #include "UEPySListView.h" extern PyTypeObject ue_PySPythonListViewType; class SPythonListView : public SListView<TSharedPtr<struct FPythonItem>> { public: ~SPythonListView() { delete(ItemsSource); } void SetHeaderRow(TSharedPtr<SHeaderRow> InHeaderRowWidget); }; typedef struct { ue_PySListView s_list_view; /* Type-specific fields go here. */ TArray<TSharedPtr<struct FPythonItem>> item_source_list; } ue_PySPythonListView; void ue_python_init_spython_list_view(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySPythonListView.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
129
```c++ #include "UEPyFGeometry.h" static PyObject *py_ue_fgeometry_get_local_size(ue_PyFGeometry *self, PyObject * args) { FVector2D size = self->geometry.GetLocalSize(); return Py_BuildValue("(ff)", size.X, size.Y); } static PyObject *py_ue_fgeometry_get_absolute_position(ue_PyFGeometry *self, PyObject * args) { #if ENGINE_MINOR_VERSION < 17 FVector2D size = self->geometry.AbsolutePosition; #else FVector2D size = self->geometry.GetAbsolutePosition(); #endif return Py_BuildValue("(ff)", size.X, size.Y); } static PyObject *py_ue_fgeometry_absolute_to_local(ue_PyFGeometry *self, PyObject * args) { float x, y; if (!PyArg_ParseTuple(args, "(ff)", &x, &y)) return nullptr; FVector2D absolute(x, y); FVector2D local = self->geometry.AbsoluteToLocal(absolute); return Py_BuildValue((char *)"(ff)", local.X, local.Y); } static PyMethodDef ue_PyFGeometry_methods[] = { { "get_local_size", (PyCFunction)py_ue_fgeometry_get_local_size, METH_VARARGS, "" }, { "get_absolute_position", (PyCFunction)py_ue_fgeometry_get_absolute_position, METH_VARARGS, "" }, { "absolute_to_local", (PyCFunction)py_ue_fgeometry_absolute_to_local, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; static PyObject *ue_PyFGeometry_str(ue_PyFGeometry *self) { return PyUnicode_FromFormat("<unreal_engine.FGeometry '%s'>", TCHAR_TO_UTF8(*self->geometry.ToString())); } static PyTypeObject ue_PyFGeometryType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.FGeometry", /* tp_name */ sizeof(ue_PyFGeometry), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc)ue_PyFGeometry_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ "Unreal Engine FGeometry", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PyFGeometry_methods, /* tp_methods */ }; void ue_python_init_fgeometry(PyObject *ue_module) { ue_PyFGeometryType.tp_new = PyType_GenericNew; if (PyType_Ready(&ue_PyFGeometryType) < 0) return; Py_INCREF(&ue_PyFGeometryType); PyModule_AddObject(ue_module, "FGeometry", (PyObject *)&ue_PyFGeometryType); } ue_PyFGeometry *py_ue_is_fgeometry(PyObject *obj) { if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFGeometryType)) return nullptr; return (ue_PyFGeometry *)obj; } PyObject *py_ue_new_fgeometry(FGeometry geometry) { ue_PyFGeometry *ret = (ue_PyFGeometry *)PyObject_New(ue_PyFGeometry, &ue_PyFGeometryType); ret->geometry = geometry; return (PyObject *)ret; } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFGeometry.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
847
```c++ #include "UEPySPanel.h" static PyMethodDef ue_PySPanel_methods[] = { { NULL } /* Sentinel */ }; PyTypeObject ue_PySPanelType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SPanel", /* tp_name */ sizeof(ue_PySPanel), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SPanel", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySPanel_methods, /* tp_methods */ }; void ue_python_init_spanel(PyObject *ue_module) { ue_PySPanelType.tp_base = &ue_PySWidgetType; if (PyType_Ready(&ue_PySPanelType) < 0) return; Py_INCREF(&ue_PySPanelType); PyModule_AddObject(ue_module, "SPanel", (PyObject *)&ue_PySPanelType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySPanel.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
400
```objective-c #pragma once #include "UnrealEnginePython.h" #include "UEPySLeafWidget.h" #if ENGINE_MINOR_VERSION > 21 #include "Runtime/SlateCore/Public/Widgets/Images/SImage.h" #else #include "Runtime/Slate/Public/Widgets/Images/SImage.h" #endif #include "Runtime/SlateCore/Public/Styling/SlateBrush.h" extern PyTypeObject ue_PySImageType; typedef struct { ue_PySLeafWidget s_leaf_widget; /* Type-specific fields go here. */ FSlateBrush brush; } ue_PySImage; void ue_python_init_simage(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySImage.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
129
```c++ #include "UEPySFilePathPicker.h" #if WITH_EDITOR #if ENGINE_MINOR_VERSION > 13 static PyMethodDef ue_PySFilePathPicker_methods[] = { { NULL } /* Sentinel */ }; DECLARE_UE_PY_SLATE_WIDGET(SFilePathPicker); static int ue_py_sfile_path_picker_init(ue_PySFilePathPicker *self, PyObject *args, PyObject *kwargs) { ue_py_slate_setup_farguments(SFilePathPicker); ue_py_slate_farguments_optional_struct_ptr("browse_button_image", BrowseButtonImage, FSlateBrush); ue_py_slate_farguments_optional_struct_ptr("browse_button_style", BrowseButtonStyle, FButtonStyle); ue_py_slate_farguments_text("browse_button_tool_tip", BrowseButtonToolTip); ue_py_slate_farguments_string("browse_directory", BrowseDirectory); ue_py_slate_farguments_text("browse_title", BrowseTitle); ue_py_slate_farguments_string("file_path", FilePath); ue_py_slate_farguments_string("file_type_filter", FileTypeFilter); ue_py_slate_farguments_struct("font", Font, FSlateFontInfo); ue_py_slate_farguments_bool("is_read_only", IsReadOnly); ue_py_slate_farguments_event("on_path_picked", OnPathPicked, FOnPathPicked, OnStringChanged); ue_py_snew(SFilePathPicker); return 0; } void ue_python_init_sfile_path_picker(PyObject *ue_module) { ue_PySFilePathPickerType.tp_init = (initproc)ue_py_sfile_path_picker_init; ue_PySFilePathPickerType.tp_base = &ue_PySCompoundWidgetType; if (PyType_Ready(&ue_PySFilePathPickerType) < 0) return; Py_INCREF(&ue_PySFilePathPickerType); PyModule_AddObject(ue_module, "SFilePathPicker", (PyObject *)&ue_PySFilePathPickerType); } #endif #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySFilePathPicker.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
416
```c++ #include "UEPySCompoundWidget.h" static PyObject *py_ue_scompound_widget_get_color_and_opacity(ue_PySCompoundWidget *self, PyObject * args) { ue_py_slate_cast(SCompoundWidget); FLinearColor color = py_SCompoundWidget->GetColorAndOpacity(); return py_ue_new_flinearcolor(color); } static PyObject *py_ue_scompound_widget_set_color_and_opacity(ue_PySCompoundWidget *self, PyObject * args) { ue_py_slate_cast(SCompoundWidget); PyObject *py_color; if (!PyArg_ParseTuple(args, "O:set_color_and_opacity", &py_color)) { return nullptr; } ue_PyFLinearColor *py_linear_color = py_ue_is_flinearcolor(py_color); if (!py_linear_color) { return PyErr_Format(PyExc_Exception, "argument is not a FLinearColor"); } py_SCompoundWidget->SetColorAndOpacity(py_linear_color->color); Py_RETURN_SLATE_SELF; } static PyMethodDef ue_PySCompoundWidget_methods[] = { { "get_color_and_opacity", (PyCFunction)py_ue_scompound_widget_get_color_and_opacity, METH_VARARGS, "" }, { "set_color_and_opacity", (PyCFunction)py_ue_scompound_widget_set_color_and_opacity, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; PyTypeObject ue_PySCompoundWidgetType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SCompoundWidget", /* tp_name */ sizeof(ue_PySCompoundWidget), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SCompoundWidget", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySCompoundWidget_methods, /* tp_methods */ }; void ue_python_init_scompound_widget(PyObject *ue_module) { ue_PySCompoundWidgetType.tp_base = &ue_PySWidgetType; if (PyType_Ready(&ue_PySCompoundWidgetType) < 0) return; Py_INCREF(&ue_PySCompoundWidgetType); PyModule_AddObject(ue_module, "SCompoundWidget", (PyObject *)&ue_PySCompoundWidgetType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySCompoundWidget.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
672
```objective-c #pragma once #include "UEPySWidget.h" #include "Runtime/Slate/Public/Widgets/Text/SMultiLineEditableText.h" extern PyTypeObject ue_PySMultiLineEditableTextType; typedef struct { ue_PySWidget s_widget; /* Type-specific fields go here. */ } ue_PySMultiLineEditableText; void ue_python_init_smulti_line_editable_text(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySMultiLineEditableText.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
88
```objective-c #pragma once #include "UEPyModule.h" #include "Runtime/SlateCore/Public/Widgets/DeclarativeSyntaxSupport.h" #if WITH_EDITOR #include "Editor/WorkspaceMenuStructure/Public/WorkspaceMenuStructureModule.h" #include "Editor/WorkspaceMenuStructure/Public/WorkspaceMenuStructure.h" #include "Editor/EditorStyle/Public/EditorStyleSet.h" #include "UnrealEdMisc.h" #endif #include "UEPySlateDelegate.h" #include "UEPySlatePythonItem.h" void ue_python_init_swidget(PyObject *); extern PyTypeObject ue_PySWidgetType; typedef struct ue_PySWidget ue_PySWidget; struct ue_PySWidget { PyObject_HEAD /* Type-specific fields go here. */ TSharedRef<SWidget> Widget; PyObject *weakreflist; }; template<typename T> TSharedPtr<T> py_ue_is_swidget(PyObject *py_obj) { if (!PyObject_IsInstance(py_obj, (PyObject *)&ue_PySWidgetType)) { PyErr_SetString(PyExc_Exception, "object is not an SWidget"); return nullptr; } return StaticCastSharedRef<T>(((ue_PySWidget *)py_obj)->Widget); } PyObject *py_unreal_engine_get_editor_window(PyObject *, PyObject *); PyObject *py_unreal_engine_find_slate_style(PyObject *, PyObject *); PyObject *py_unreal_engine_find_icon_for_class(PyObject *, PyObject *); #if WITH_EDITOR PyObject *py_unreal_engine_add_menu_extension(PyObject *, PyObject *); PyObject *py_unreal_engine_add_menu_bar_extension(PyObject *, PyObject *); PyObject *py_unreal_engine_add_tool_bar_extension(PyObject *, PyObject *); PyObject *py_unreal_engine_create_detail_view(PyObject *, PyObject *, PyObject *); PyObject *py_unreal_engine_create_structure_detail_view(PyObject *, PyObject *, PyObject *); PyObject *py_unreal_engine_create_property_view(PyObject *, PyObject *, PyObject *); PyObject *py_unreal_engine_add_asset_view_context_menu_extension(PyObject * self, PyObject *); #endif PyObject *py_unreal_engine_invoke_tab(PyObject *, PyObject *); PyObject *py_unreal_engine_get_swidget_from_wrapper(PyObject *, PyObject *); PyObject *py_unreal_engine_create_wrapper_from_pyswidget(PyObject *, PyObject *); PyObject *py_unreal_engine_register_nomad_tab_spawner(PyObject *, PyObject *); PyObject *py_unreal_engine_unregister_nomad_tab_spawner(PyObject *, PyObject *); PyObject *py_unreal_engine_open_color_picker(PyObject *, PyObject *, PyObject *); PyObject *py_unreal_engine_destroy_color_picker(PyObject *, PyObject *); PyObject *py_unreal_engine_play_sound(PyObject *, PyObject *); PyObject *ue_py_dict_get_item(PyObject *, const char *); template<typename T> ue_PySWidget *py_ue_new_swidget(TSharedRef<SWidget> s_widget, PyTypeObject *py_type) { ue_PySWidget *ret = (ue_PySWidget *)PyObject_New(T, py_type); new(&ret->Widget) TSharedRef<SWidget>(s_widget); ret->weakreflist = nullptr; return ret; } #define ue_py_snew_base(T, required, arguments) ((ue_PySWidget *)self)->Widget = TSharedRef<T>(MakeTDecl<T>(#T, __FILE__, __LINE__, required) <<= arguments);\ for(TSharedRef<FPythonSlateDelegate> Delegate : DeferredSlateDelegates)\ {\ FUnrealEnginePythonHouseKeeper::Get()->TrackDeferredSlateDelegate(Delegate, ((ue_PySWidget *)self)->Widget);\ } #define ue_py_snew_simple(T) TArray<TSharedRef<FPythonSlateDelegate>> DeferredSlateDelegates;\ ue_py_snew_base(T, RequiredArgs::MakeRequiredArgs(), T::FArguments()) #define ue_py_snew_simple_with_req_args(T, ... ) TArray<TSharedRef<FPythonSlateDelegate>> DeferredSlateDelegates;\ ue_py_snew_base(T, RequiredArgs::MakeRequiredArgs(__VA_ARGS__), T::FArguments()) #define ue_py_snew(T) ue_py_snew_base(T, RequiredArgs::MakeRequiredArgs(), arguments) #define ue_py_snew_with_args(T, args) ue_py_snew_base(T, RequiredArgs::MakeRequiredArgs(args), arguments) ue_PySWidget *ue_py_get_swidget(TSharedRef<SWidget> s_widget); #define ue_py_slate_base_up(_base, _func, _param, _attribute) \ {\ PyObject *value = ue_py_dict_get_item(kwargs, _param);\ if (value) {\ if (PyCallable_Check(value)) {\ _base handler;\ TSharedRef<FPythonSlateDelegate> py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewDeferredSlateDelegate(value);\ handler.Bind(py_delegate, &FPythonSlateDelegate::_func);\ DeferredSlateDelegates.Add(py_delegate);\ arguments._attribute(handler);\ } #define ue_py_slate_base_event_up(_base, _func, _param, _attribute) \ {\ PyObject *value = ue_py_dict_get_item(kwargs, _param);\ if (value) {\ if (PyCallable_Check(value)) {\ _base handler;\ TSharedRef<FPythonSlateDelegate> py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewDeferredSlateDelegate(value);\ handler.BindSP(py_delegate, &FPythonSlateDelegate::_func);\ DeferredSlateDelegates.Add(py_delegate);\ arguments._attribute(handler);\ } #define ue_py_slate_down(_param) else {\ PyErr_SetString(PyExc_TypeError, "unsupported type for attribute " _param); \ return -1;\ }\ }\ } #define ue_py_slate_up(_type, _func, _param, _attribute) ue_py_slate_base_up(TAttribute<_type>, _func, _param, _attribute) #define ue_py_slate_farguments_text(param, attribute) ue_py_slate_up(FText, GetterFText, param, attribute)\ else if (PyUnicodeOrString_Check(value)) {\ arguments.attribute(FText::FromString(UTF8_TO_TCHAR(UEPyUnicode_AsUTF8(value))));\ }\ ue_py_slate_down(param) #define ue_py_slate_farguments_string(param, attribute) ue_py_slate_up(FString, GetterFString, param, attribute)\ else if (PyUnicodeOrString_Check(value)) {\ arguments.attribute(UTF8_TO_TCHAR(UEPyUnicode_AsUTF8(value)));\ }\ ue_py_slate_down(param) #define ue_py_slate_farguments_float(param, attribute) ue_py_slate_up(float, GetterFloat, param, attribute)\ else if (PyNumber_Check(value)) {\ PyObject *py_float = PyNumber_Float(value);\ arguments.attribute(PyFloat_AsDouble(py_float)); \ Py_DECREF(py_float);\ }\ ue_py_slate_down(param) #define ue_py_slate_farguments_tfloat(param, attribute) ue_py_slate_up(TOptional<float>, GetterTFloat, param, attribute)\ else if (PyNumber_Check(value)) {\ PyObject *py_float = PyNumber_Float(value);\ arguments.attribute((TOptional<float>)PyFloat_AsDouble(py_float)); \ Py_DECREF(py_float);\ }\ ue_py_slate_down(param) #define ue_py_slate_farguments_fvector2d(param, attribute) ue_py_slate_up(FVector2D, GetterFVector2D, param, attribute)\ else if (PyTuple_Check(value)) {\ if (PyTuple_Size(value) == 2) {\ PyObject *py_first = PyTuple_GetItem(value, 0);\ PyObject *py_second = PyTuple_GetItem(value, 1);\ if (PyNumber_Check(py_first)) {\ PyObject *py_x = PyNumber_Float(py_first);\ PyObject *py_y = PyNumber_Float(py_second);\ arguments.attribute(FVector2D(PyFloat_AsDouble(py_x), PyFloat_AsDouble(py_y)));\ Py_DECREF(py_x);\ Py_DECREF(py_y);\ }\ }\ }\ ue_py_slate_down(param) #define ue_py_slate_farguments_int(param, attribute) ue_py_slate_up(int, GetterInt, param, attribute)\ else if (PyNumber_Check(value)) {\ PyObject *py_int = PyNumber_Long(value);\ arguments.attribute((int)PyLong_AsLong(py_int)); \ Py_DECREF(py_int);\ }\ ue_py_slate_down(param) #define ue_py_slate_farguments_int32(param, attribute) ue_py_slate_up(int32, GetterInt, param, attribute)\ else if (PyNumber_Check(value)) {\ PyObject *py_int = PyNumber_Long(value);\ arguments.attribute((int32)PyLong_AsLong(py_int)); \ Py_DECREF(py_int);\ }\ ue_py_slate_down(param) #define ue_py_slate_farguments_tint(param, attribute) ue_py_slate_up(TOptional<int32>, GetterIntT<TOptional<int32>>, param, attribute)\ else if (PyNumber_Check(value)) {\ PyObject *py_int = PyNumber_Long(value);\ arguments.attribute((TOptional<int32>)PyLong_AsLong(py_int)); \ Py_DECREF(py_int);\ }\ ue_py_slate_down(param) #define ue_py_slate_farguments_enum(param, attribute, _type) ue_py_slate_up(_type, GetterIntT<_type>, param, attribute)\ else if (PyNumber_Check(value)) {\ PyObject *py_int = PyNumber_Long(value);\ arguments.attribute((_type)PyLong_AsLong(py_int)); \ Py_DECREF(py_int);\ }\ ue_py_slate_down(param) #define ue_py_slate_farguments_flinear_color(param, attribute) ue_py_slate_up(FLinearColor, GetterFLinearColor, param, attribute)\ else if (ue_PyFLinearColor *py_color = py_ue_is_flinearcolor(value)) {\ arguments.attribute(py_color->color); \ }\ ue_py_slate_down(param) #define ue_py_slate_farguments_struct(param, attribute, _type) ue_py_slate_up(_type, GetterStructT<_type>, param, attribute)\ else if (_type *u_struct = ue_py_check_struct<_type>(value)) {\ arguments.attribute((_type)*u_struct); \ }\ ue_py_slate_down(param) #define ue_py_slate_farguments_optional_struct(param, attribute, _type) { PyObject *value = ue_py_dict_get_item(kwargs, param);\ if (value) {\ if (_type *u_struct = ue_py_check_struct<_type>(value)) {\ arguments.attribute((_type)*u_struct); \ }\ else {\ PyErr_SetString(PyExc_TypeError, "unsupported type for attribute " param); \ return -1;\ }\ }\ } #define ue_py_slate_farguments_optional_struct_ptr(param, attribute, _type) { PyObject *value = ue_py_dict_get_item(kwargs, param);\ if (value) {\ if (_type *u_struct = ue_py_check_struct<_type>(value)) {\ Py_INCREF(value);\ arguments.attribute((_type *)u_struct);\ }\ else {\ PyErr_SetString(PyExc_TypeError, "unsupported type for attribute " param); \ return -1;\ }\ }\ } #define ue_py_slate_farguments_optional_uobject(param, attribute, _type) { PyObject *value = ue_py_dict_get_item(kwargs, param);\ if (value) {\ if (_type *u_object = ue_py_check_type<_type>(value)) {\ arguments.attribute((_type *)u_object);\ }\ else {\ PyErr_SetString(PyExc_TypeError, "unsupported type for attribute " param); \ return -1;\ }\ }\ } #define ue_py_slate_farguments_optional_fvector2d(param, attribute) { PyObject *value = ue_py_dict_get_item(kwargs, param);\ if (value) {\ if (PyTuple_Check(value)) {\ if (PyTuple_Size(value) == 2) {\ PyObject *py_first = PyTuple_GetItem(value, 0);\ PyObject *py_second = PyTuple_GetItem(value, 1);\ if (PyNumber_Check(py_first)) {\ PyObject *py_x = PyNumber_Float(py_first);\ PyObject *py_y = PyNumber_Float(py_second);\ arguments.attribute(FVector2D(PyFloat_AsDouble(py_x), PyFloat_AsDouble(py_y)));\ Py_DECREF(py_x);\ Py_DECREF(py_y);\ }\ }\ else {\ PyErr_SetString(PyExc_TypeError, "unsupported type for attribute " param); \ return -1;\ }\ }\ else {\ PyErr_SetString(PyExc_TypeError, "unsupported type for attribute " param); \ return -1;\ }\ }\ } #define ue_py_slate_farguments_optional_enum(param, attribute, _type) { PyObject *value = ue_py_dict_get_item(kwargs, param);\ if (value) {\ if (PyNumber_Check(value)) {\ PyObject *py_int = PyNumber_Long(value);\ arguments.attribute((_type)PyLong_AsLong(py_int));\ Py_DECREF(py_int);\ }\ else {\ PyErr_SetString(PyExc_TypeError, "unsupported type for attribute " param); \ return -1;\ }\ }\ } #define ue_py_slate_farguments_optional_int32(param, attribute) { PyObject *value = ue_py_dict_get_item(kwargs, param);\ if (value) {\ if (PyNumber_Check(value)) {\ PyObject *py_int = PyNumber_Long(value);\ arguments.attribute((int32)PyLong_AsLong(py_int)); \ Py_DECREF(py_int);\ }\ else {\ PyErr_SetString(PyExc_TypeError, "unsupported type for attribute " param); \ return -1;\ }\ }\ } #define ue_py_slate_farguments_optional_float(param, attribute) { PyObject *value = ue_py_dict_get_item(kwargs, param);\ if (value) {\ if (PyNumber_Check(value)) {\ PyObject *py_float = PyNumber_Float(value);\ arguments.attribute(PyFloat_AsDouble(py_float)); \ Py_DECREF(py_float);\ }\ else {\ PyErr_SetString(PyExc_TypeError, "unsupported type for attribute " param); \ return -1;\ }\ }\ } #define ue_py_slate_farguments_optional_foptional_size(param, attribute) { PyObject *value = ue_py_dict_get_item(kwargs, param);\ if (value) {\ if (PyNumber_Check(value)) {\ PyObject *py_float = PyNumber_Float(value);\ arguments.attribute(FOptionalSize(PyFloat_AsDouble(py_float))); \ Py_DECREF(py_float);\ }\ else {\ PyErr_SetString(PyExc_TypeError, "unsupported type for attribute " param); \ return -1;\ }\ }\ } #define ue_py_slate_farguments_optional_string(param, attribute) { PyObject *value = ue_py_dict_get_item(kwargs, param);\ if (PyUnicodeOrString_Check(value)) {\ arguments.attribute(UTF8_TO_TCHAR(UEPyUnicode_AsUTF8(value)));\ }\ } #define ue_py_slate_farguments_optional_text(param, attribute) { PyObject *value = ue_py_dict_get_item(kwargs, param);\ if (value) {\ if (PyUnicodeOrString_Check(value)) {\ arguments.attribute(FText::FromString(UTF8_TO_TCHAR(UEPyUnicode_AsUTF8(value))));\ }\ else {\ PyErr_SetString(PyExc_TypeError, "unsupported type for attribute " param); \ return -1;\ }\ }\ } #define ue_py_slate_farguments_optional_named_slot(param, attribute) { PyObject *value = ue_py_dict_get_item(kwargs, param);\ if (value) {\ TSharedPtr<SWidget> Child = py_ue_is_swidget<SWidget>(value);\ if (Child.IsValid()) {\ arguments.attribute()\ [\ Child.ToSharedRef()\ ];\ }\ else {\ PyErr_SetString(PyExc_TypeError, "unsupported type for attribute " param); \ return -1;\ }\ }\ } #define ue_py_slate_farguments_bool(param, attribute) ue_py_slate_up(bool, GetterBool, param, attribute)\ else if (PyObject_IsTrue(value)) {\ arguments.attribute(true); \ }\ else {\ arguments.attribute(false); \ }\ }\ } #define ue_py_slate_farguments_call(param, attribute) { PyObject *value = ue_py_dict_get_item(kwargs, param);\ if (value && PyObject_IsTrue(value)) {\ arguments.attribute();\ }\ } #define ue_py_slate_farguments_padding(param, attribute) { PyObject *padding = ue_py_dict_get_item(kwargs, param);\ if (padding)\ {\ if (PyTuple_Check(padding))\ {\ FMargin margin;\ if (!PyArg_ParseTuple(padding, "f|fff", &margin.Left, &margin.Top, &margin.Right, &margin.Bottom))\ {\ PyErr_SetString(PyExc_TypeError, "invalid padding value");\ return -1;\ }\ arguments.attribute(margin);\ }\ else if (PyNumber_Check(padding))\ {\ PyObject *py_float = PyNumber_Float(padding); \ arguments.attribute(PyFloat_AsDouble(py_float)); \ Py_DECREF(py_float); \ }\ else if (FMargin *u_struct = ue_py_check_struct<FMargin>(padding))\ {\ arguments.attribute(*u_struct); \ }\ else\ {\ PyErr_SetString(PyExc_TypeError, "invalid padding value"); \ return -1; \ }\ }\ } #define ue_py_slate_farguments_optional_bool(param, attribute) { PyObject *value = ue_py_dict_get_item(kwargs, param);\ if (value) {\ if (PyObject_IsTrue(value)) {\ arguments.attribute(true); \ }\ else {\ arguments.attribute(false); \ }\ }\ } #define ue_py_slate_farguments_event(param, attribute, type, method) ue_py_slate_base_event_up(type, method, param, attribute)\ ue_py_slate_down(param) #define ue_py_slate_setup_farguments(_type) _type::FArguments arguments;\ TArray<TSharedRef<FPythonSlateDelegate>> DeferredSlateDelegates;\ ue_py_slate_farguments_bool("is_enabled", IsEnabled); \ ue_py_slate_farguments_text("tool_tip_text", ToolTipText); \ ue_py_slate_farguments_fvector2d("render_transform_pivot", RenderTransformPivot) #define ue_py_slate_farguments_required_slot(param) { PyObject *value = ue_py_dict_get_item(kwargs, param);\ value = value ? value : PyTuple_GetItem(args, 0);\ if (!value) {PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "you need to specify a widget"); return -1;}\ TSharedPtr<SWidget> Widget = py_ue_is_swidget<SWidget>(value);\ if (Widget.IsValid())\ arguments.AttachWidget(Widget.ToSharedRef());\ else\ {\ PyErr_SetString(PyExc_TypeError, "unsupported type for required slot " param);\ return -1;\ }\ } #define ue_py_slate_setup_hack_slot_args(_type, _swidget_ref) _type::FSlot &arguments = _swidget_ref->AddSlot();\ TArray<TSharedRef<FPythonSlateDelegate>> DeferredSlateDelegates;\ ue_py_slate_farguments_required_slot("widget"); #define ue_py_slate_setup_hack_slot_args_grid(_type, _swidget_ref, column, row, layer) _type::FSlot &arguments = _swidget_ref->AddSlot(column, row, layer);\ TArray<TSharedRef<FPythonSlateDelegate>> DeferredSlateDelegates;\ ue_py_slate_farguments_required_slot("widget"); void ue_python_init_slate(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySlate.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
4,365
```objective-c #pragma once #include "UEPyFInputEvent.h" extern PyTypeObject ue_PyFInputEventType; typedef struct { /* Type-specific fields go here. */ ue_PyFInputEvent f_input; FCharacterEvent character_event; } ue_PyFCharacterEvent; void ue_python_init_fcharacter_event(PyObject *); PyObject *py_ue_new_fcharacter_event(FCharacterEvent); ue_PyFCharacterEvent *py_ue_is_fcharacter_event(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFCharacterEvent.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
98
```objective-c #pragma once #include "UnrealEnginePython.h" #include "UEPySCompoundWidget.h" extern PyTypeObject ue_PySPythonShelfType; typedef struct { ue_PySCompoundWidget s_compound_widget; /* Type-specific fields go here. */ } ue_PySPythonShelf; void ue_python_init_spython_shelf(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySPythonShelf.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
77
```objective-c #pragma once #include "UEPySBorder.h" #include "Runtime/Slate/Public/Widgets/Input/SButton.h" extern PyTypeObject ue_PySButtonType; typedef struct { ue_PySBorder s_border; /* Type-specific fields go here. */ } ue_PySButton; void ue_python_init_sbutton(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySButton.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
71
```objective-c #pragma once #include "UEPySCompoundWidget.h" #if WITH_EDITOR #include "Editor/PropertyEditor/Public/PropertyCustomizationHelpers.h" extern PyTypeObject ue_PySObjectPropertyEntryBoxType; typedef struct { ue_PySCompoundWidget s_compound_widget; /* Type-specific fields go here. */ } ue_PySObjectPropertyEntryBox; void ue_python_init_sobject_property_entry_box(PyObject *); #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySObjectPropertyEntryBox.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
93
```c++ #include "UEPySCanvas.h" static PyObject *py_ue_scanvas_clear_children(ue_PySCanvas *self, PyObject * args) { ue_py_slate_cast(SCanvas); py_SCanvas->ClearChildren(); Py_RETURN_NONE; } static PyObject *py_ue_scanvas_add_slot(ue_PySCanvas *self, PyObject * args, PyObject *kwargs) { ue_py_slate_cast(SCanvas); PyObject *py_content; int h_align = 0; int v_align = 0; PyObject *position = nullptr; PyObject *size = nullptr; char *kwlist[] = { (char *)"widget", (char *)"h_align", (char *)"v_align", (char *)"position", (char *)"size", nullptr }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|iiOO:add_slot", kwlist, &py_content, &h_align, &v_align, &position, &size)) { return NULL; } TSharedPtr<SWidget> child = py_ue_is_swidget<SWidget>(py_content); if (!child.IsValid()) return nullptr; SCanvas::FSlot &fslot = py_SCanvas->AddSlot(); fslot.AttachWidget(child.ToSharedRef()); fslot.HAlign((EHorizontalAlignment)h_align); fslot.VAlign((EVerticalAlignment)v_align); if (position && PyTuple_Check(position)) { if (PyTuple_Size(position) == 2) { PyObject *py_x = PyTuple_GetItem(position, 0); PyObject *py_y = PyTuple_GetItem(position, 1); if (PyNumber_Check(py_x)) { PyObject *py_x_float = PyNumber_Float(py_x); float x = PyFloat_AsDouble(py_x_float); Py_DECREF(py_x_float); PyObject *py_y_float = PyNumber_Float(py_y); float y = PyFloat_AsDouble(py_y_float); Py_DECREF(py_y_float); fslot.Position(FVector2D(x, y)); } } } if (size && PyTuple_Check(size)) { if (PyTuple_Size(size) == 2) { PyObject *py_x = PyTuple_GetItem(size, 0); PyObject *py_y = PyTuple_GetItem(size, 1); if (PyNumber_Check(py_x)) { PyObject *py_x_float = PyNumber_Float(py_x); float x = PyFloat_AsDouble(py_x_float); Py_DECREF(py_x_float); PyObject *py_y_float = PyNumber_Float(py_y); float y = PyFloat_AsDouble(py_y_float); Py_DECREF(py_y_float); fslot.Size(FVector2D(x, y)); } } } Py_RETURN_SLATE_SELF; } static PyMethodDef ue_PySCanvas_methods[] = { #pragma warning(suppress: 4191) { "add_slot", (PyCFunction)py_ue_scanvas_add_slot, METH_VARARGS | METH_KEYWORDS, "" }, { "clear_children", (PyCFunction)py_ue_scanvas_clear_children, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; PyTypeObject ue_PySCanvasType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SCanvas", /* tp_name */ sizeof(ue_PySCanvas), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SCanvas", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySCanvas_methods, /* tp_methods */ }; static int ue_py_scanvas_init(ue_PySCanvas *self, PyObject *args, PyObject *kwargs) { ue_py_snew_simple(SCanvas); return 0; } void ue_python_init_scanvas(PyObject *ue_module) { ue_PySCanvasType.tp_base = &ue_PySPanelType; ue_PySCanvasType.tp_call = (ternaryfunc)py_ue_scanvas_add_slot; ue_PySCanvasType.tp_init = (initproc)ue_py_scanvas_init; if (PyType_Ready(&ue_PySCanvasType) < 0) return; Py_INCREF(&ue_PySCanvasType); PyModule_AddObject(ue_module, "SCanvas", (PyObject *)&ue_PySCanvasType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySCanvas.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
1,146
```c++ #include "UEPySPythonShelf.h" #if WITH_EDITOR #if ENGINE_MINOR_VERSION > 14 #include "Editor/ContentBrowser/Public/ContentBrowserModule.h" #include "Editor/ContentBrowser/Public/IContentBrowserSingleton.h" #include "Editor/ContentBrowser/Private/SAssetPicker.h" static PyMethodDef ue_PySPythonShelf_methods[] = { { NULL } /* Sentinel */ }; PyTypeObject ue_PySPythonShelfType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SPythonShelf", /* tp_name */ sizeof(ue_PySPythonShelf), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SPythonShelf", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySPythonShelf_methods, /* tp_methods */ }; static int ue_py_spython_shelf_init(ue_PySPythonShelf *self, PyObject *args, PyObject *kwargs) { PyObject *py_classes_iterable = nullptr; PyObject *py_collections_iterable = nullptr; PyObject *py_callable_double_clicked = nullptr; PyObject *py_callable_get_context_menu = nullptr; PyObject *py_callable_asset_selected = nullptr; char *kwlist[] = { (char *)"classes", (char *)"collections", (char *)"on_asset_double_clicked", (char *)"on_get_asset_context_menu", (char *)"on_asset_selected", nullptr }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOOOO", kwlist, &py_classes_iterable, &py_collections_iterable, &py_callable_double_clicked, &py_callable_get_context_menu, &py_callable_asset_selected)) { return -1; } if (py_classes_iterable) { py_classes_iterable = PyObject_GetIter(py_classes_iterable); if (!py_classes_iterable) { PyErr_SetString(PyExc_Exception, "argument is not an iterable"); return -1; } } if (py_collections_iterable) { py_collections_iterable = PyObject_GetIter(py_collections_iterable); if (!py_collections_iterable) { PyErr_SetString(PyExc_Exception, "argument is not an iterable"); return -1; } } if (py_callable_double_clicked && !PyCallable_Check(py_callable_double_clicked)) { PyErr_SetString(PyExc_Exception, "argument is not callable"); return -1; } if (py_callable_get_context_menu && !PyCallable_Check(py_callable_get_context_menu)) { PyErr_SetString(PyExc_Exception, "argument is not callable"); return -1; } if (py_callable_asset_selected && !PyCallable_Check(py_callable_asset_selected)) { PyErr_SetString(PyExc_Exception, "argument is not callable"); return -1; } FContentBrowserModule& Module = FModuleManager::Get().LoadModuleChecked<FContentBrowserModule>(TEXT("ContentBrowser")); FAssetPickerConfig asset_picker_config; asset_picker_config.InitialAssetViewType = EAssetViewType::Tile; asset_picker_config.bAllowNullSelection = false; asset_picker_config.bShowBottomToolbar = false; asset_picker_config.bAutohideSearchBar = false; if (py_classes_iterable) { while (PyObject *item = PyIter_Next(py_classes_iterable)) { if (PyUnicodeOrString_Check(item)) { FName class_name = FName(UTF8_TO_TCHAR(UEPyUnicode_AsUTF8(item))); asset_picker_config.Filter.ClassNames.Add(class_name); } } Py_DECREF(py_classes_iterable); } if (py_collections_iterable) { while (PyObject *item = PyIter_Next(py_collections_iterable)) { if (PyUnicodeOrString_Check(item)) { FName collection_name = FName(UTF8_TO_TCHAR(UEPyUnicode_AsUTF8(item))); asset_picker_config.Collections.Add(FCollectionNameType(collection_name, ECollectionShareType::CST_Local)); } } Py_DECREF(py_collections_iterable); } if (py_callable_double_clicked) { FOnAssetDoubleClicked handler; TSharedRef<FPythonSlateDelegate> py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewStaticSlateDelegate(py_callable_double_clicked); handler.BindSP(py_delegate, &FPythonSlateDelegate::OnAssetDoubleClicked); asset_picker_config.OnAssetDoubleClicked = handler; } if (py_callable_get_context_menu) { FOnGetAssetContextMenu handler; TSharedRef<FPythonSlateDelegate> py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewStaticSlateDelegate(py_callable_get_context_menu); handler.BindSP(py_delegate, &FPythonSlateDelegate::OnGetAssetContextMenu); asset_picker_config.OnGetAssetContextMenu = handler; } if (py_callable_asset_selected) { FOnAssetSelected handler; TSharedRef<FPythonSlateDelegate> py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewStaticSlateDelegate(py_callable_asset_selected); handler.BindSP(py_delegate, &FPythonSlateDelegate::OnAssetSelected); asset_picker_config.OnAssetSelected = handler; } new(&self->s_compound_widget.s_widget.Widget) TSharedRef<SWidget>(Module.Get().CreateAssetPicker(asset_picker_config)); return 0; } void ue_python_init_spython_shelf(PyObject *ue_module) { ue_PySPythonShelfType.tp_init = (initproc)ue_py_spython_shelf_init; ue_PySPythonShelfType.tp_base = &ue_PySCompoundWidgetType; if (PyType_Ready(&ue_PySPythonShelfType) < 0) return; Py_INCREF(&ue_PySPythonShelfType); PyModule_AddObject(ue_module, "SPythonShelf", (PyObject *)&ue_PySPythonShelfType); } #endif #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySPythonShelf.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
1,507
```objective-c #pragma once #include "UnrealEnginePython.h" #include "UEPySListView.h" #include "Runtime/Slate/Public/Widgets/Views/STreeView.h" extern PyTypeObject ue_PySTreeViewType; typedef struct { ue_PySListView s_list_view; /* Type-specific fields go here. */ } ue_PySTreeView; void ue_python_init_stree_view(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySTreeView.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
87
```c++ #include "UEPySSplitter.h" static PyObject *py_ue_ssplitter_add_slot(ue_PySSplitter *self, PyObject * args, PyObject *kwargs) { ue_py_slate_cast(SSplitter); PyObject *py_content; int index = -1; float size_value = -1; int sizing_rule = -1; char *kwlist[] = { (char *)"widget", (char *)"index", (char *)"size_value", (char *)"sizing_rule", nullptr }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|ifi:add_slot", kwlist, &py_content, &index, &size_value, &sizing_rule)) { return nullptr; } TSharedPtr<SWidget> Child = py_ue_is_swidget<SWidget>(py_content); if (!Child.IsValid()) { return nullptr; } SSplitter::FSlot &fslot = py_SSplitter->AddSlot(index); if (size_value > -1) { fslot.SizeValue = size_value; } if (sizing_rule > -1) { fslot.SizingRule = (SSplitter::ESizeRule)sizing_rule; } fslot.AttachWidget(Child.ToSharedRef()); Py_RETURN_SLATE_SELF; } static PyMethodDef ue_PySSplitter_methods[] = { #pragma warning(suppress: 4191) { "add_slot", (PyCFunction)py_ue_ssplitter_add_slot, METH_VARARGS | METH_KEYWORDS, "" }, { NULL } /* Sentinel */ }; PyTypeObject ue_PySSplitterType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SSplitter", /* tp_name */ sizeof(ue_PySSplitter), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SSplitter", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySSplitter_methods, /* tp_methods */ }; static int ue_py_ssplitter_init(ue_PySSplitter *self, PyObject *args, PyObject *kwargs) { ue_py_slate_setup_farguments(SSplitter); ue_py_slate_farguments_optional_float("hit_detection_splitter_handle_size", HitDetectionSplitterHandleSize); ue_py_slate_farguments_event("on_splitter_finished_resizing", OnSplitterFinishedResizing, FSimpleDelegate, SimpleExecuteAction); ue_py_slate_farguments_optional_enum("orientation", Orientation, EOrientation); ue_py_slate_farguments_optional_float("physical_splitter_handle_size", PhysicalSplitterHandleSize); ue_py_slate_farguments_optional_enum("resize_mode", ResizeMode, ESplitterResizeMode::Type); ue_py_slate_farguments_optional_struct_ptr("style", Style, FSplitterStyle); ue_py_snew(SSplitter); return 0; } void ue_python_init_ssplitter(PyObject *ue_module) { ue_PySSplitterType.tp_init = (initproc)ue_py_ssplitter_init; ue_PySSplitterType.tp_call = (ternaryfunc)py_ue_ssplitter_add_slot; ue_PySSplitterType.tp_base = &ue_PySPanelType; if (PyType_Ready(&ue_PySSplitterType) < 0) return; Py_INCREF(&ue_PySSplitterType); PyModule_AddObject(ue_module, "SSplitter", (PyObject *)&ue_PySSplitterType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySSplitter.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
957
```objective-c #pragma once #include "UEPySWidget.h" #include "Runtime/SlateCore/Public/Widgets/SLeafWidget.h" extern PyTypeObject ue_PySLeafWidgetType; typedef struct { ue_PySWidget s_widget; /* Type-specific fields go here. */ } ue_PySLeafWidget; void ue_python_init_sleaf_widget(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySLeafWidget.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
76
```objective-c #pragma once #include "UnrealEnginePython.h" #if WITH_EDITOR #include "UEPySCompoundWidget.h" #include "Editor/UnrealEd/Public/GraphEditor.h" extern PyTypeObject ue_PySGraphEditorType; typedef struct { ue_PySCompoundWidget s_compound_widget; /* Type-specific fields go here. */ } ue_PySGraphEditor; void ue_python_init_sgraph_editor(PyObject *); #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySGraphEditor.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
92
```c++ #include "UEPySGraphPanel.h" #if WITH_EDITOR #if ENGINE_MINOR_VERSION > 15 #define sw_graph_panel StaticCastSharedRef<SGraphPanel>(self->s_nodePanel.s_panel.s_widget) /* static PyObject *py_ue_sgraph_panel_add_slot(ue_PySGraphPanel* self, PyObject *args, PyObject *kwargs) { PyObject *py_content; int z_order = -1; int h_align = 0; PyObject *padding = nullptr; int v_align = 0; char *kwlist[] = { (char *)"widget", (char *)"z_order", (char *)"h_align", (char *)"padding", (char *)"v_align", nullptr }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|iiOi:add_slot", kwlist, &py_content, &z_order, &h_align, &padding, &v_align)) { return nullptr; } ue_PySWidget *py_swidget = py_ue_is_swidget(py_content); if (!py_swidget) { return PyErr_Format(PyExc_Exception, "argument is not a SWidget"); } Py_INCREF(py_swidget); self->s_nodePanel.s_panel.s_widget.py_swidget_slots.Add(py_swidget); sw_graph_panel; SOverlay::FOverlaySlot &fslot = sw_graph_panel->//sw_overlay->AddSlot(z_order); fslot.AttachWidget(py_swidget->s_widget->AsShared()); fslot.HAlign((EHorizontalAlignment)h_align); if (padding) { if (PyTuple_Check(padding)) { FMargin margin; if (!PyArg_ParseTuple(padding, "f|fff", &margin.Left, &margin.Top, &margin.Right, &margin.Bottom)) { return PyErr_Format(PyExc_Exception, "invalid padding value"); } fslot.Padding(margin); } else if (PyNumber_Check(padding)) { PyObject *py_float = PyNumber_Float(padding); fslot.Padding(PyFloat_AsDouble(py_float)); Py_DECREF(py_float); } else { return PyErr_Format(PyExc_Exception, "invalid padding value"); } } fslot.VAlign((EVerticalAlignment)v_align); Py_INCREF(self); return (PyObject *)self; } */ static PyMethodDef ue_PySGraphPanel_methods[] = { //{"add_slot", (PyCFunction)py_ue_sgraph_panel_add_slot, METH_VARARGS | METH_KEYWORDS, "" }, { NULL } /* Sentinel */ }; PyTypeObject ue_PySGraphPanelType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SGraphPanel", /* tp_name */ sizeof(ue_PySGraphPanel), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SGraphPanel", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySGraphPanel_methods, /* tp_methods */ }; //why do you need to return an integer? static int ue_py_sgraph_panel_init(ue_PySGraphPanel *self, PyObject *args, PyObject *kwargs) { //so for right now, let's just have this commented out to see if we get any errors //if says we don't have s_nodePanel ue_py_snew_simple(SGraphPanel);//s_nodePanel.s_panel); //ue_py_snew(SGraphPanel, s_nodePanel.s_panel.s_widget); return 0; } void ue_python_init_sgraph_panel(PyObject *ue_module) { //ue_PySGraphPanelType.tp_init = (initproc)ue_py_sgraph_panel_init; //ue_PySGraphPanelType.tp_call = (ternaryfunc)py_ue_sgraph_panel_add_slot; ue_PySGraphPanelType.tp_base = &ue_PySNodePanelType; if (PyType_Ready(&ue_PySGraphPanelType) < 0) return; Py_INCREF(&ue_PySGraphPanelType); PyModule_AddObject(ue_module, "SGraphPanel", (PyObject *)&ue_PySGraphPanelType); } #endif #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySGraphPanel.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
1,098
```objective-c #pragma once #include "UEPySCompoundWidget.h" #include "UnrealEnginePython.h" #include "Runtime/Slate/Public/Widgets/Views/STableRow.h" #include "Runtime/Slate/Public/Widgets/Views/STableViewBase.h" #include "Runtime/Slate/Public/Widgets/Views/SListView.h" extern PyTypeObject ue_PySCompoundWidgetType; extern PyTypeObject ue_PySTableViewBaseType; class SPythonMultiColumnTableRow : public SMultiColumnTableRow<TSharedPtr<FPythonItem>> { public: SLATE_BEGIN_ARGS(SPythonMultiColumnTableRow) {} SLATE_END_ARGS(); void Construct(const FArguments& InArgs, const TSharedRef<STableViewBase>& InOwnerTableView, PyObject *in_py_self) { SetPyObject(in_py_self); SMultiColumnTableRow<TSharedPtr<FPythonItem>>::Construct(FSuperRowType::FArguments(), InOwnerTableView); } TSharedRef<SWidget> GenerateWidgetForColumn(const FName& ColumnName) { FScopePythonGIL gil; if (!PyObject_HasAttrString(self, (char *)"generate_widget_for_column")) return SNullWidget::NullWidget; PyObject *py_callable_generate_widget_for_column = PyObject_GetAttrString(self, (char *)"generate_widget_for_column"); if (!PyCallable_Check(py_callable_generate_widget_for_column)) { UE_LOG(LogPython, Error, TEXT("generate_widget_for_column is not a callable")); return SNullWidget::NullWidget; } PyObject *ret = PyObject_CallFunction(py_callable_generate_widget_for_column, (char *)"s", TCHAR_TO_UTF8(*ColumnName.ToString())); if (!ret) { unreal_engine_py_log_error(); return SNullWidget::NullWidget; } TSharedPtr<SWidget> Widget = py_ue_is_swidget<SWidget>(ret); if (!Widget.IsValid()) { Py_DECREF(ret); UE_LOG(LogPython, Error, TEXT("returned value is not a SWidget")); return SNullWidget::NullWidget; } Py_DECREF(ret); return Widget.ToSharedRef(); } FReply OnMouseButtonDoubleClick(const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent) { FScopePythonGIL gil; if (PyObject_HasAttrString(self, (char *)"on_mouse_button_double_click")) { PyObject *py_callable_on_mouse_button_double_click = PyObject_GetAttrString(self, (char *)"on_mouse_button_double_click"); if (!PyCallable_Check(py_callable_on_mouse_button_double_click)) { UE_LOG(LogPython, Error, TEXT("on_mouse_button_double_click is not a callable")); return FReply::Unhandled(); } PyObject *ret = PyObject_CallFunction(py_callable_on_mouse_button_double_click, (char *)"NN", py_ue_new_fgeometry(InMyGeometry), py_ue_new_fpointer_event(InMouseEvent)); if (!ret) { unreal_engine_py_log_error(); return FReply::Unhandled(); } if (ret == Py_False) { Py_DECREF(ret); return FReply::Unhandled(); } Py_DECREF(ret); return FReply::Handled(); } else { return SPythonMultiColumnTableRow::OnMouseButtonDoubleClick(InMyGeometry, InMouseEvent); } } void SetPyObject(PyObject *py_obj) { self = py_obj; } private: PyObject * self = nullptr; TSharedPtr<FPythonItem> RowPythonObject; }; typedef struct { ue_PySCompoundWidget s_compound_widget; /* Type-specific fields go here. */ } ue_PySPythonMultiColumnTableRow; void ue_python_init_spython_multicolumn_table_row(PyObject *); ue_PySPythonMultiColumnTableRow *py_ue_is_spython_multicolumn_table_row(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySPythonMultiColumnTableRow.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
832
```objective-c #pragma once #include "UEPyFInputEvent.h" extern PyTypeObject ue_PyFInputEventType; typedef struct { /* Type-specific fields go here. */ ue_PyFInputEvent f_input; FPointerEvent pointer; } ue_PyFPointerEvent; void ue_python_init_fpointer_event(PyObject *); PyObject *py_ue_new_fpointer_event(FPointerEvent); ue_PyFPointerEvent *py_ue_is_fpointer_event(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFPointerEvent.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
97
```objective-c #pragma once #include "UnrealEnginePython.h" #include "UEPyFInputEvent.h" extern PyTypeObject ue_PyFInputEventType; typedef struct { /* Type-specific fields go here. */ ue_PyFInputEvent f_input; FKeyEvent key_event; } ue_PyFKeyEvent; void ue_python_init_fkey_event(PyObject *); PyObject *py_ue_new_fkey_event(FKeyEvent); ue_PyFKeyEvent *py_ue_is_fkey_event(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFKeyEvent.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
100
```c++ #include "UEPySPythonEditorViewport.h" #if WITH_EDITOR #include "Components/DirectionalLightComponent.h" #include "Wrappers/UEPyFEditorViewportClient.h" static PyObject *py_ue_spython_editor_viewport_get_world(ue_PySPythonEditorViewport *self, PyObject * args) { ue_py_slate_cast(SPythonEditorViewport); Py_RETURN_UOBJECT(py_SPythonEditorViewport->GetPythonWorld()); } static PyObject *py_ue_spython_editor_viewport_get_editor_viewport_client(ue_PySPythonEditorViewport *self, PyObject * args) { ue_py_slate_cast(SPythonEditorViewport); return py_ue_new_feditor_viewport_client(py_SPythonEditorViewport->GetViewportClient().ToSharedRef()); } static PyObject *py_ue_spython_editor_viewport_set_show_bounds(ue_PySPythonEditorViewport *self, PyObject * args) { ue_py_slate_cast(SPythonEditorViewport); PyObject *py_bool; if (!PyArg_ParseTuple(args, "O:set_show_bounds", &py_bool)) { return NULL; } py_SPythonEditorViewport->GetViewportClient()->SetShowBounds(PyObject_IsTrue(py_bool) ? true : false); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_spython_editor_viewport_set_show_stats(ue_PySPythonEditorViewport *self, PyObject * args) { ue_py_slate_cast(SPythonEditorViewport); PyObject *py_bool; if (!PyArg_ParseTuple(args, "O:set_show_stats", &py_bool)) { return NULL; } py_SPythonEditorViewport->GetViewportClient()->SetShowStats(PyObject_IsTrue(py_bool) ? true : false); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_spython_editor_viewport_set_view_mode(ue_PySPythonEditorViewport *self, PyObject * args) { ue_py_slate_cast(SPythonEditorViewport); int mode; if (!PyArg_ParseTuple(args, "i:set_view_mode", &mode)) { return nullptr; } py_SPythonEditorViewport->GetViewportClient()->SetViewMode((EViewModeIndex)mode); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_spython_editor_viewport_set_exposure_settings(ue_PySPythonEditorViewport *self, PyObject * args) { ue_py_slate_cast(SPythonEditorViewport); PyObject *py_settings; if (!PyArg_ParseTuple(args, "O:set_exposure_settings", &py_settings)) { return nullptr; } FExposureSettings *settings = ue_py_check_struct<FExposureSettings>(py_settings); if (!settings) { return PyErr_Format(PyExc_Exception, "argument is not a FExposureSettings"); } py_SPythonEditorViewport->GetViewportClient()->ExposureSettings = *settings; Py_RETURN_SLATE_SELF; } static PyObject *py_ue_spython_editor_viewport_set_view_location(ue_PySPythonEditorViewport *self, PyObject * args) { ue_py_slate_cast(SPythonEditorViewport); float x = 0, y = 0, z = 0; FVector vec; if (PyTuple_Size(args) == 1) { ue_PyFVector *ue_py_vec = py_ue_is_fvector(PyTuple_GetItem(args, 0)); if (!ue_py_vec) { return PyErr_Format(PyExc_Exception, "argument is not a FVector"); } vec = ue_py_vec->vec; } else { if (!PyArg_ParseTuple(args, "fff", &x, &y, &z)) { return nullptr;; } vec.X = x; vec.Y = y; vec.Z = z; } py_SPythonEditorViewport->GetViewportClient()->SetViewLocation(vec); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_spython_editor_viewport_set_view_rotation(ue_PySPythonEditorViewport *self, PyObject * args) { ue_py_slate_cast(SPythonEditorViewport); float roll = 0, pitch = 0, yaw = 0; FRotator rot; if (PyTuple_Size(args) == 1) { ue_PyFRotator *ue_py_rot = py_ue_is_frotator(PyTuple_GetItem(args, 0)); if (!ue_py_rot) { return PyErr_Format(PyExc_Exception, "argument is not a FRotator"); } rot = ue_py_rot->rot; } else { if (!PyArg_ParseTuple(args, "fff", &roll, &pitch, &yaw)) { return nullptr;; } rot.Roll = roll; rot.Pitch = pitch; rot.Yaw = yaw; } py_SPythonEditorViewport->GetViewportClient()->SetViewRotation(rot); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_spython_editor_viewport_simulate(ue_PySPythonEditorViewport *self, PyObject * args) { ue_py_slate_cast(SPythonEditorViewport); PyObject *py_bool; if (!PyArg_ParseTuple(args, "O:simulate", &py_bool)) { return NULL; } py_SPythonEditorViewport->Simulate(PyObject_IsTrue(py_bool) != 0); Py_RETURN_NONE; } static PyObject *py_ue_spython_editor_viewport_set_light_color(ue_PySPythonEditorViewport *self, PyObject * args) { ue_py_slate_cast(SPythonEditorViewport); PyObject *py_obj; if (!PyArg_ParseTuple(args, "O", &py_obj)) return nullptr; ue_PyFColor *py_fcolor = py_ue_is_fcolor(py_obj); if (!py_fcolor) return PyErr_Format(PyExc_Exception, "argument is not a FColor"); py_SPythonEditorViewport->GetPreviewScene()->SetLightColor(py_fcolor->color); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_spython_editor_viewport_set_light_direction(ue_PySPythonEditorViewport *self, PyObject * args) { ue_py_slate_cast(SPythonEditorViewport); float roll = 0, pitch = 0, yaw = 0; FRotator rot; if (PyTuple_Size(args) == 1) { ue_PyFRotator *ue_py_rot = py_ue_is_frotator(PyTuple_GetItem(args, 0)); if (!ue_py_rot) { return PyErr_Format(PyExc_Exception, "argument is not a FRotator"); } rot = ue_py_rot->rot; } else { if (!PyArg_ParseTuple(args, "fff", &roll, &pitch, &yaw)) { return nullptr;; } rot.Roll = roll; rot.Pitch = pitch; rot.Yaw = yaw; } py_SPythonEditorViewport->GetPreviewScene()->SetLightDirection(rot); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_spython_editor_viewport_set_sky_brightness(ue_PySPythonEditorViewport *self, PyObject * args) { ue_py_slate_cast(SPythonEditorViewport); float brightness; if (!PyArg_ParseTuple(args, "f", &brightness)) return nullptr; py_SPythonEditorViewport->GetPreviewScene()->SetSkyBrightness(brightness); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_spython_editor_viewport_set_light_brightness(ue_PySPythonEditorViewport *self, PyObject * args) { ue_py_slate_cast(SPythonEditorViewport); float brightness; if (!PyArg_ParseTuple(args, "f", &brightness)) return nullptr; py_SPythonEditorViewport->GetPreviewScene()->SetLightBrightness(brightness); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_spython_editor_viewport_get_light(ue_PySPythonEditorViewport *self, PyObject * args) { ue_py_slate_cast(SPythonEditorViewport); UDirectionalLightComponent *light = py_SPythonEditorViewport->GetPreviewScene()->DirectionalLight; Py_RETURN_UOBJECT(light); } static PyMethodDef ue_PySPythonEditorViewport_methods[] = { { "simulate", (PyCFunction)py_ue_spython_editor_viewport_simulate, METH_VARARGS, "" }, { "get_world", (PyCFunction)py_ue_spython_editor_viewport_get_world, METH_VARARGS, "" }, { "get_editor_viewport_client", (PyCFunction)py_ue_spython_editor_viewport_get_editor_viewport_client, METH_VARARGS, "" }, { "set_show_bounds", (PyCFunction)py_ue_spython_editor_viewport_set_show_bounds, METH_VARARGS, "" }, { "set_show_stats", (PyCFunction)py_ue_spython_editor_viewport_set_show_stats, METH_VARARGS, "" }, { "set_view_mode", (PyCFunction)py_ue_spython_editor_viewport_set_view_mode, METH_VARARGS, "" }, { "set_exposure_settings", (PyCFunction)py_ue_spython_editor_viewport_set_exposure_settings, METH_VARARGS, "" }, { "set_view_location", (PyCFunction)py_ue_spython_editor_viewport_set_view_location, METH_VARARGS, "" }, { "set_view_rotation", (PyCFunction)py_ue_spython_editor_viewport_set_view_rotation, METH_VARARGS, "" }, { "set_light_color", (PyCFunction)py_ue_spython_editor_viewport_set_light_color, METH_VARARGS, "" }, { "set_light_direction", (PyCFunction)py_ue_spython_editor_viewport_set_light_direction, METH_VARARGS, "" }, { "set_light_brightness", (PyCFunction)py_ue_spython_editor_viewport_set_light_brightness, METH_VARARGS, "" }, { "set_sky_brightness", (PyCFunction)py_ue_spython_editor_viewport_set_sky_brightness, METH_VARARGS, "" }, { "get_light", (PyCFunction)py_ue_spython_editor_viewport_get_light, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; class FPythonEditorViewportClient : public FEditorViewportClient { public: FPythonEditorViewportClient(FEditorModeTools * InModeTools, FPreviewScene * InPreviewScene, const TWeakPtr<SEditorViewport> & InEditorViewportWidget) : FEditorViewportClient(InModeTools, InPreviewScene, InEditorViewportWidget) { EngineShowFlags.SetSelection(true); EngineShowFlags.SetSelectionOutline(true); bAltPressed = false; SelectedActor = nullptr; } virtual void ProcessClick(FSceneView & InView, HHitProxy* HitProxy, FKey Key, EInputEvent Event, uint32 HitX, uint32 HitY) { if (!HitProxy) { GEditor->SelectNone(true, true, true); SelectedActor = nullptr; return; } if (HitProxy->IsA(HActor::StaticGetType())) { HActor *h_actor = (HActor *)HitProxy; GEditor->SelectNone(true, true, true); GEditor->SelectActor(h_actor->Actor, true, true); SelectedActor = h_actor->Actor; SetWidgetMode(FWidget::WM_Translate); } else if (HitProxy->IsA(HWidgetAxis::StaticGetType())) { // TODO do something ? } else { GEditor->SelectNone(true, true, true); SelectedActor = nullptr; } } virtual FWidget::EWidgetMode GetWidgetMode() const { if (SelectedActor == nullptr) return FWidget::WM_None; return FEditorViewportClient::GetWidgetMode(); } virtual FMatrix GetWidgetCoordSystem() const { if (!SelectedActor) return FMatrix::Identity; return FRotationMatrix(SelectedActor->GetActorTransform().Rotator()); } virtual FVector GetWidgetLocation() const { if (!SelectedActor) return FVector(0, 0, 0); return SelectedActor->GetActorLocation(); } virtual bool InputWidgetDelta(FViewport * InViewport, EAxisList::Type CurrentAxis, FVector & Drag, FRotator & Rot, FVector &Scale) { if (SelectedActor && !bAltPressed) { SelectedActor->AddActorWorldOffset(Drag); SelectedActor->AddActorWorldRotation(Rot); SelectedActor->SetActorScale3D(SelectedActor->GetActorScale3D() + Scale); Invalidate(); return true; } return false; } virtual void TrackingStarted(const FInputEventState & InInpuState, bool bIsDragginWidget, bool bNudge) { bAltPressed = InInpuState.IsAltButtonPressed(); } virtual void ResetCamera() { if (!SelectedActor) return; FocusViewportOnBox(SelectedActor->GetComponentsBoundingBox()); } protected: bool bAltPressed; AActor *SelectedActor; }; UWorld *SPythonEditorViewport::GetPythonWorld() { return GetWorld(); } TSharedRef<FEditorViewportClient> SPythonEditorViewport::MakeEditorViewportClient() { PreviewScene = new FPreviewScene(); TSharedPtr<FEditorViewportClient> client = MakeShareable(new FPythonEditorViewportClient(nullptr, PreviewScene, SharedThis(this))); client->SetRealtime(true); client->SetViewportType(ELevelViewportType::LVT_Perspective); FExposureSettings settings; settings.bFixed = true; #if ENGINE_MINOR_VERSION > 18 settings.FixedEV100 = 0; #else settings.LogOffset = 0; #endif client->ExposureSettings = settings; return client.ToSharedRef(); } TSharedPtr<FExtender> SPythonEditorViewport::GetExtenders() const { TSharedPtr<FExtender> Result(MakeShareable(new FExtender())); return Result; } TSharedRef<SEditorViewport> SPythonEditorViewport::GetViewportWidget() { return SharedThis(this); } TSharedPtr<SWidget> SPythonEditorViewport::MakeViewportToolbar() { return SNew(SCommonEditorViewportToolbarBase, SharedThis(this)); } void SPythonEditorViewport::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) { SEditorViewport::Tick(AllottedGeometry, InCurrentTime, InDeltaTime); if (bSimulate) { GetWorld()->Tick(ELevelTick::LEVELTICK_All, InDeltaTime); } } PyTypeObject ue_PySPythonEditorViewportType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SPythonEditorViewport", /* tp_name */ sizeof(ue_PySPythonEditorViewport), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SPythonEditorViewport", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySPythonEditorViewport_methods, /* tp_methods */ }; static int ue_py_spython_editor_viewport_init(ue_PySPythonEditorViewport *self, PyObject *args, PyObject *kwargs) { ue_py_snew_simple(SPythonEditorViewport); return 0; } void ue_python_init_spython_editor_viewport(PyObject *ue_module) { ue_PySPythonEditorViewportType.tp_init = (initproc)ue_py_spython_editor_viewport_init; ue_PySPythonEditorViewportType.tp_base = &ue_PySEditorViewportType; if (PyType_Ready(&ue_PySPythonEditorViewportType) < 0) return; Py_INCREF(&ue_PySPythonEditorViewportType); PyModule_AddObject(ue_module, "SPythonEditorViewport", (PyObject *)&ue_PySPythonEditorViewportType); } #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySPythonEditorViewport.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
3,610
```c++ #include "UEPySEditorViewport.h" #if WITH_EDITOR static PyObject *py_ue_seditor_viewport_enable_stereo_rendering(ue_PySEditorViewport *self, PyObject * args) { ue_py_slate_cast(SEditorViewport); PyObject *py_bool; if (!PyArg_ParseTuple(args, "O:enable_stereo_rendering", &py_bool)) { return nullptr; } py_SEditorViewport->EnableStereoRendering(PyObject_IsTrue(py_bool) ? true : false); Py_RETURN_SLATE_SELF; } static PyMethodDef ue_PySEditorViewport_methods[] = { { "enable_stereo_rendering", (PyCFunction)py_ue_seditor_viewport_enable_stereo_rendering, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; PyTypeObject ue_PySEditorViewportType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SEditorViewport", /* tp_name */ sizeof(ue_PySEditorViewport), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SEditorViewport", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySEditorViewport_methods, /* tp_methods */ }; void ue_python_init_seditor_viewport(PyObject *ue_module) { ue_PySEditorViewportType.tp_base = &ue_PySCompoundWidgetType; if (PyType_Ready(&ue_PySEditorViewportType) < 0) return; Py_INCREF(&ue_PySEditorViewportType); PyModule_AddObject(ue_module, "SEditorViewport", (PyObject *)&ue_PySEditorViewportType); } #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySEditorViewport.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
555
```c++ #include "UEPyFPointerEvent.h" #include "UEPyFModifierKeysState.h" static PyObject *py_ue_fpointer_event_get_effecting_button(ue_PyFPointerEvent *self, PyObject * args) { FKey key = self->pointer.GetEffectingButton(); return py_ue_new_owned_uscriptstruct(FKey::StaticStruct(), (uint8*)&key); } static PyObject *py_ue_fpointer_event_get_effecting_button_name(ue_PyFPointerEvent *self, PyObject * args) { FKey key = self->pointer.GetEffectingButton(); return PyUnicode_FromString(TCHAR_TO_UTF8(*key.ToString())); } static PyObject *py_ue_fpointer_event_get_wheel_delta(ue_PyFPointerEvent *self, PyObject * args) { float delta = self->pointer.GetWheelDelta(); return PyFloat_FromDouble(delta); } static PyObject *py_ue_fpointer_event_get_cursor_delta(ue_PyFPointerEvent *self, PyObject * args) { FVector2D delta = self->pointer.GetCursorDelta(); return Py_BuildValue((char *)"(ff)", delta.X, delta.Y); } static PyObject *py_ue_fpointer_event_get_screen_space_position(ue_PyFPointerEvent *self, PyObject * args) { FVector2D pos = self->pointer.GetScreenSpacePosition(); return Py_BuildValue((char *)"(ff)", pos.X, pos.Y); } static PyMethodDef ue_PyFPointerEvent_methods[] = { { "get_effecting_button", (PyCFunction)py_ue_fpointer_event_get_effecting_button, METH_VARARGS, "" }, { "get_effecting_button_name", (PyCFunction)py_ue_fpointer_event_get_effecting_button_name, METH_VARARGS, "" }, { "get_wheel_delta", (PyCFunction)py_ue_fpointer_event_get_wheel_delta, METH_VARARGS, "" }, { "get_cursor_delta", (PyCFunction)py_ue_fpointer_event_get_cursor_delta, METH_VARARGS, "" }, { "get_screen_space_position", (PyCFunction)py_ue_fpointer_event_get_screen_space_position, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; static PyObject *ue_PyFPointerEvent_str(ue_PyFPointerEvent *self) { return PyUnicode_FromFormat("<unreal_engine.FPointerEvent '%s'>", TCHAR_TO_UTF8(*self->pointer.ToText().ToString())); } static PyTypeObject ue_PyFPointerEventType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.FPointerEvent", /* tp_name */ sizeof(ue_PyFPointerEvent), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc)ue_PyFPointerEvent_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine FPointerEvent", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PyFPointerEvent_methods, /* tp_methods */ }; static int ue_py_fpointer_event_init(ue_PyFPointerEvent *self, PyObject *args, PyObject *kwargs) { int pointer_index; float ssp_x; float ssp_y; float lssp_x; float lssp_y; char *effecting; float wheel_delta; PyObject *py_modifier = nullptr; if (!PyArg_ParseTuple(args, "i(ff)(ff)s|fO", &pointer_index, &ssp_x, &ssp_y, &lssp_x, &lssp_y, &effecting, &wheel_delta, &py_modifier)) { return -1; } TSet<FKey> keys; keys.Add(FKey(effecting)); FModifierKeysState modifier; if (py_modifier) { ue_PyFModifierKeysState *f_modifier = py_ue_is_fmodifier_keys_state(py_modifier); if (!f_modifier) { PyErr_SetString(PyExc_Exception, "argument is not a FModifierKeysState"); return -1; } modifier = f_modifier->modifier; } FPointerEvent Event(pointer_index, FVector2D(ssp_x, ssp_y), FVector2D(lssp_x, lssp_y), keys, FKey(effecting), wheel_delta, modifier); new(&self->pointer) FPointerEvent(Event); new(&self->f_input.input) FInputEvent(Event); return 0; } void ue_python_init_fpointer_event(PyObject *ue_module) { ue_PyFPointerEventType.tp_base = &ue_PyFInputEventType; ue_PyFPointerEventType.tp_init = (initproc)ue_py_fpointer_event_init; if (PyType_Ready(&ue_PyFPointerEventType) < 0) return; Py_INCREF(&ue_PyFPointerEventType); PyModule_AddObject(ue_module, "FPointerEvent", (PyObject *)&ue_PyFPointerEventType); } PyObject *py_ue_new_fpointer_event(FPointerEvent pointer) { ue_PyFPointerEvent *ret = (ue_PyFPointerEvent *)PyObject_New(ue_PyFPointerEvent, &ue_PyFPointerEventType); new(&ret->pointer) FPointerEvent(pointer); new(&ret->f_input.input) FInputEvent(pointer); return (PyObject *)ret; } ue_PyFPointerEvent *py_ue_is_fpointer_event(PyObject *obj) { if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFPointerEventType)) return nullptr; return (ue_PyFPointerEvent *)obj; } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFPointerEvent.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
1,368
```c++ #include "UEPySButton.h" static PyObject *py_ue_sbutton_is_pressed(ue_PySButton *self, PyObject * args) { ue_py_slate_cast(SButton); if (py_SButton->IsPressed()) { Py_RETURN_TRUE; } Py_RETURN_FALSE; } static PyObject *py_ue_sbutton_bind_on_clicked(ue_PySButton *self, PyObject * args) { ue_py_slate_cast(SButton); PyObject *py_callable; if (!PyArg_ParseTuple(args, "O:bind_on_clicked", &py_callable)) { return nullptr; } if (!PyCallable_Check(py_callable)) { return PyErr_Format(PyExc_Exception, "argument is not callable"); } FOnClicked handler; TSharedRef<FPythonSlateDelegate>py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewSlateDelegate(self->s_border.s_compound_widget.s_widget.Widget, py_callable); py_delegate->SetPyCallable(py_callable); handler.BindSP(py_delegate, &FPythonSlateDelegate::OnClicked); py_SButton->SetOnClicked(handler); Py_RETURN_SLATE_SELF; } static PyMethodDef ue_PySButton_methods[] = { { "is_pressed", (PyCFunction)py_ue_sbutton_is_pressed, METH_VARARGS, "" }, { "bind_on_clicked", (PyCFunction)py_ue_sbutton_bind_on_clicked, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; PyTypeObject ue_PySButtonType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SButton", /* tp_name */ sizeof(ue_PySButton), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SButton", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySButton_methods, /* tp_methods */ }; static int ue_py_sbutton_init(ue_PySButton *self, PyObject *args, PyObject *kwargs) { ue_py_slate_setup_farguments(SButton); ue_py_slate_farguments_struct("button_color_and_opacity", ButtonColorAndOpacity, FSlateColor); ue_py_slate_farguments_optional_enum("click_method", ClickMethod, EButtonClickMethod::Type); ue_py_slate_farguments_struct("content_padding", ContentPadding, FMargin); ue_py_slate_farguments_fvector2d("content_scale", ContentScale); ue_py_slate_farguments_fvector2d("desired_size_scale", DesiredSizeScale); ue_py_slate_farguments_struct("foreground_color", ForegroundColor, FSlateColor); ue_py_slate_farguments_optional_enum("h_align", HAlign, EHorizontalAlignment); ue_py_slate_farguments_optional_struct("hovered_sound_override", HoveredSoundOverride, FSlateSound); ue_py_slate_farguments_optional_bool("is_focusable", IsFocusable); ue_py_slate_farguments_event("on_clicked", OnClicked, FOnClicked, OnClicked); ue_py_slate_farguments_event("on_hovered", OnHovered, FSimpleDelegate, SimpleExecuteAction); ue_py_slate_farguments_event("on_pressed", OnPressed, FSimpleDelegate, SimpleExecuteAction); ue_py_slate_farguments_event("on_released", OnReleased, FSimpleDelegate, SimpleExecuteAction); ue_py_slate_farguments_event("on_unhovered", OnUnhovered, FSimpleDelegate, SimpleExecuteAction); ue_py_slate_farguments_optional_struct("pressed_sound_override", PressedSoundOverride, FSlateSound); ue_py_slate_farguments_optional_enum("press_method", PressMethod, EButtonPressMethod::Type); ue_py_slate_farguments_text("text", Text); ue_py_slate_farguments_optional_enum("text_flow_direction", TextFlowDirection, ETextFlowDirection); ue_py_slate_farguments_optional_enum("text_shaping_method", TextShapingMethod, ETextShapingMethod); ue_py_slate_farguments_optional_struct_ptr("button_style", ButtonStyle, FButtonStyle); ue_py_slate_farguments_optional_struct_ptr("text_style", TextStyle, FTextBlockStyle); ue_py_slate_farguments_optional_enum("touch_method", TouchMethod, EButtonTouchMethod::Type); ue_py_slate_farguments_optional_enum("v_align", VAlign, EVerticalAlignment); ue_py_snew(SButton); return 0; } void ue_python_init_sbutton(PyObject *ue_module) { ue_PySButtonType.tp_init = (initproc)ue_py_sbutton_init; ue_PySButtonType.tp_base = &ue_PySBorderType; if (PyType_Ready(&ue_PySButtonType) < 0) return; Py_INCREF(&ue_PySButtonType); PyModule_AddObject(ue_module, "SButton", (PyObject *)&ue_PySButtonType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySButton.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
1,245
```c++ #include "UEPyFPaintContext.h" #include "UEPyFGeometry.h" static FSlateBrush global_simple_brush; static PyObject *py_ue_fpaint_context_draw_line(ue_PyFPaintContext *self, PyObject * args) { float x1, y1, x2, y2; PyObject *py_linear_color = nullptr; PyObject *py_antialias = nullptr; float thickness = 1.0; if (!PyArg_ParseTuple(args, "(ff)(ff)|OOf:draw_line", &x1, &y1, &x2, &y2, &py_linear_color, &py_antialias, &thickness)) return nullptr; FLinearColor tint = FLinearColor::White; if (py_linear_color) { if (!py_ue_get_flinearcolor(py_linear_color, tint)) { return PyErr_Format(PyExc_Exception, "argument is not a FLinearColor or FColor."); } } FPaintContext context = self->paint_context; context.MaxLayer++; TArray<FVector2D> points; points.Add(FVector2D(x1, y1)); points.Add(FVector2D(x2, y2)); #if ENGINE_MINOR_VERSION >= 17 FSlateDrawElement::MakeLines(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToPaintGeometry(), points, ESlateDrawEffect::None, tint, (py_antialias && !PyObject_IsTrue(py_antialias)), thickness); #else FSlateDrawElement::MakeLines(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToPaintGeometry(), points, context.MyClippingRect, ESlateDrawEffect::None, tint, (py_antialias && !PyObject_IsTrue(py_antialias)), thickness); #endif Py_RETURN_NONE; } static PyObject *py_ue_fpaint_context_draw_box(ue_PyFPaintContext *self, PyObject * args) { float x, y, w, h; PyObject *py_brush = nullptr; PyObject *py_linear_color = nullptr; if (!PyArg_ParseTuple(args, "(ff)(ff)|OO:draw_box", &x, &y, &w, &h, &py_linear_color, &py_brush)) return nullptr; FLinearColor tint = FLinearColor::White; if (py_linear_color) { if (!py_ue_get_flinearcolor(py_linear_color, tint)) { return PyErr_Format(PyExc_Exception, "argument is not a FLinearColor or FColor."); } } FSlateBrush *brush = &global_simple_brush; if (py_brush) { FSlateBrush *custom_brush = ue_py_check_struct<FSlateBrush>(py_brush); if (!custom_brush) return PyErr_Format(PyExc_Exception, "argument is not a FSlateBrush"); brush = custom_brush; } FPaintContext context = self->paint_context; context.MaxLayer++; #if ENGINE_MINOR_VERSION >= 17 FSlateDrawElement::MakeBox(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToPaintGeometry(FVector2D(x, y), FVector2D(w, h)), brush, ESlateDrawEffect::None, tint); #else FSlateDrawElement::MakeBox(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToPaintGeometry(FVector2D(x, y), FVector2D(w, h)), brush, context.MyClippingRect, ESlateDrawEffect::None, tint); #endif Py_RETURN_NONE; } static PyObject *py_ue_fpaint_context_draw_text(ue_PyFPaintContext *self, PyObject * args) { float x, y; char *text; float size = 0; PyObject *py_linear_color = nullptr; PyObject *py_font = nullptr; if (!PyArg_ParseTuple(args, "(ff)s|fOO:draw_text", &x, &y, &text, &size, &py_linear_color, &py_font)) return nullptr; FLinearColor tint = FLinearColor::White; FSlateFontInfo font = FCoreStyle::Get().GetWidgetStyle<FTextBlockStyle>("NormalText").Font; if (py_linear_color) { if (!py_ue_get_flinearcolor(py_linear_color, tint)) { return PyErr_Format(PyExc_Exception, "argument is not a FLinearColor or FColor."); } } if (py_font) { FSlateFontInfo *font_struct = ue_py_check_struct<FSlateFontInfo>(py_font); if (font_struct) { font = *font_struct; } else { return PyErr_Format(PyExc_Exception, "argument is not a SlateFontInfo USTRUCT"); } } if (size <= 0) size = font.Size; font.Size = size; FVector2D position = FVector2D(x, y); FPaintContext context = self->paint_context; context.MaxLayer++; #if ENGINE_MINOR_VERSION >= 17 FSlateDrawElement::MakeText(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToOffsetPaintGeometry(position), FText::FromString(UTF8_TO_TCHAR(text)), font, ESlateDrawEffect::None, tint); #else FSlateDrawElement::MakeText(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToOffsetPaintGeometry(position), FText::FromString(UTF8_TO_TCHAR(text)), font, context.MyClippingRect, ESlateDrawEffect::None, tint); #endif Py_RETURN_NONE; } static PyObject *py_ue_fpaint_context_draw_spline(ue_PyFPaintContext *self, PyObject * args) { float x1, y1, dx1, dy1; float x2, y2, dx2, dy2; PyObject *py_linear_color = nullptr; float thickness = 1.0; if (!PyArg_ParseTuple(args, "(ff)(ff)(ff)(ff)|Of:draw_spline", &x1, &y1, &dx1, &dy1, &x2, &y2, &dx2, &dy2, &py_linear_color, &thickness)) return nullptr; FLinearColor tint = FLinearColor::White; if (py_linear_color) { if (!py_ue_get_flinearcolor(py_linear_color, tint)) { return PyErr_Format(PyExc_Exception, "argument is not a FLinearColor or FColor."); } } FPaintContext context = self->paint_context; context.MaxLayer++; #if ENGINE_MINOR_VERSION >= 17 FSlateDrawElement::MakeSpline(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToPaintGeometry(), FVector2D(x1, y1), FVector2D(dx1, dy1), FVector2D(x2, y2), FVector2D(dx2, dy2), thickness, ESlateDrawEffect::None, tint); #else FSlateDrawElement::MakeSpline(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToPaintGeometry(), FVector2D(x1, y1), FVector2D(dx1, dy1), FVector2D(x2, y2), FVector2D(dx2, dy2), context.MyClippingRect, thickness, ESlateDrawEffect::None, tint); #endif Py_RETURN_NONE; } static PyObject *py_ue_fpaint_context_draw_lines(ue_PyFPaintContext *self, PyObject * args) { PyObject *py_points; PyObject *py_linear_color = nullptr; PyObject *py_antialias = nullptr; float thickness = 1.0; if (!PyArg_ParseTuple(args, "O|OOf:draw_lines", &py_points, &py_linear_color, &py_antialias, &thickness)) return nullptr; TArray<FVector2D> points; PyObject *py_iter = PyObject_GetIter(py_points); if (!py_iter) return PyErr_Format(PyExc_Exception, "argument is not an iterable of tuples"); while (PyObject *py_item = PyIter_Next(py_iter)) { if (!PyTuple_Check(py_item)) { return PyErr_Format(PyExc_Exception, "iterable item is not a tuple"); Py_DECREF(py_iter); } float x, y; if (!PyArg_ParseTuple(py_item, "ff", &x, &y)) { Py_DECREF(py_iter); return nullptr; } points.Add(FVector2D(x, y)); } Py_DECREF(py_iter); FLinearColor tint = FLinearColor::White; if (py_linear_color) { if (!py_ue_get_flinearcolor(py_linear_color, tint)) { return PyErr_Format(PyExc_Exception, "argument is not a FLinearColor or FColor."); } } FPaintContext context = self->paint_context; context.MaxLayer++; #if ENGINE_MINOR_VERSION >= 17 FSlateDrawElement::MakeLines(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToPaintGeometry(), points, ESlateDrawEffect::None, tint, (py_antialias && !PyObject_IsTrue(py_antialias)), thickness); #else FSlateDrawElement::MakeLines(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToPaintGeometry(), points, context.MyClippingRect, ESlateDrawEffect::None, tint, (py_antialias && !PyObject_IsTrue(py_antialias)), thickness); #endif Py_RETURN_NONE; } static PyObject *py_ue_fpaint_context_get_geometry(ue_PyFPaintContext *self, PyObject * args) { return py_ue_new_fgeometry(self->paint_context.AllottedGeometry); } static PyMethodDef ue_PyFPaintContext_methods[] = { { "get_geometry", (PyCFunction)py_ue_fpaint_context_get_geometry, METH_VARARGS, "" }, { "draw_line", (PyCFunction)py_ue_fpaint_context_draw_line, METH_VARARGS, "" }, { "draw_box", (PyCFunction)py_ue_fpaint_context_draw_box, METH_VARARGS, "" }, { "draw_lines", (PyCFunction)py_ue_fpaint_context_draw_lines, METH_VARARGS, "" }, { "draw_spline", (PyCFunction)py_ue_fpaint_context_draw_spline, METH_VARARGS, "" }, { "draw_text", (PyCFunction)py_ue_fpaint_context_draw_text, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; static PyObject *ue_PyFPaintContext_str(ue_PyFPaintContext *self) { return PyUnicode_FromFormat("<unreal_engine.FPaintContext '%s'>", TCHAR_TO_UTF8(*self->paint_context.AllottedGeometry.ToString())); } static PyTypeObject ue_PyFPaintContextType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.FPaintContext", /* tp_name */ sizeof(ue_PyFPaintContext), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc)ue_PyFPaintContext_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ "Unreal Engine FPaintContext", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PyFPaintContext_methods, /* tp_methods */ }; void ue_python_init_fpaint_context(PyObject *ue_module) { ue_PyFPaintContextType.tp_new = PyType_GenericNew; if (PyType_Ready(&ue_PyFPaintContextType) < 0) return; Py_INCREF(&ue_PyFPaintContextType); PyModule_AddObject(ue_module, "FPaintContext", (PyObject *)&ue_PyFPaintContextType); } PyObject *py_ue_new_fpaint_context(FPaintContext paint_context) { ue_PyFPaintContext *ret = (ue_PyFPaintContext *)PyObject_New(ue_PyFPaintContext, &ue_PyFPaintContextType); ret->paint_context = paint_context; return (PyObject *)ret; } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFPaintContext.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
2,755
```objective-c #pragma once #include "UnrealEnginePython.h" #include "UEPySPanel.h" #include "Runtime/SlateCore/Public/Widgets/SBoxPanel.h" extern PyTypeObject ue_PySBoxPanelType; typedef struct { ue_PySPanel s_panel; /* Type-specific fields go here. */ } ue_PySBoxPanel; void ue_python_init_sbox_panel(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySBoxPanel.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
84
```c++ #include "UEPySLeafWidget.h" static PyMethodDef ue_PySLeafWidget_methods[] = { { NULL } /* Sentinel */ }; PyTypeObject ue_PySLeafWidgetType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SLeafWidget", /* tp_name */ sizeof(ue_PySLeafWidget), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SLeafWidget", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySLeafWidget_methods, /* tp_methods */ }; void ue_python_init_sleaf_widget(PyObject *ue_module) { ue_PySLeafWidgetType.tp_base = &ue_PySWidgetType; if (PyType_Ready(&ue_PySLeafWidgetType) < 0) return; Py_INCREF(&ue_PySLeafWidgetType); PyModule_AddObject(ue_module, "SLeafWidget", (PyObject *)&ue_PySLeafWidgetType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySLeafWidget.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
413
```c++ #include "UEPyFSlateStyleSet.h" #include "Runtime/SlateCore/Public/Styling/SlateTypes.h" #include "Runtime/SlateCore/Public/Styling/SlateStyleRegistry.h" #include "Runtime/SlateCore/Public/Sound/SlateSound.h" #include "Runtime/Core/Public/Containers/Map.h" static PyObject *py_ue_fslate_style_set_set_content_root(ue_PyFSlateStyleSet *self, PyObject * args) { char *path; if (!PyArg_ParseTuple(args, "s:set_content_root", &path)) return NULL; self->style_set->SetContentRoot(path); Py_RETURN_NONE; } static PyObject *py_ue_fslate_style_set_register(ue_PyFSlateStyleSet *self, PyObject * args) { if (FSlateStyleRegistry::FindSlateStyle(self->style_set->GetStyleSetName())) { UE_LOG(LogPython, Warning, TEXT("StyleSet already registered")); Py_RETURN_NONE; } FSlateStyleRegistry::RegisterSlateStyle(*self->style_set); Py_RETURN_NONE; } static PyObject *py_ue_fslate_style_set_set(ue_PyFSlateStyleSet *self, PyObject * args) { char *name; PyObject *py_value; if (!PyArg_ParseTuple(args, "sO:set", &name, &py_value)) return NULL; FSlateSound *slate_sound = ue_py_check_struct<FSlateSound>(py_value); if (slate_sound) { self->style_set->Set(FName(name), *slate_sound); Py_RETURN_NONE; } FSlateBrush *slate_brush = ue_py_check_struct<FSlateBrush>(py_value); if (slate_brush) { self->style_set->Set(FName(name), slate_brush); Py_RETURN_NONE; } FSlateColor *slate_color = ue_py_check_struct<FSlateColor>(py_value); if (slate_brush) { self->style_set->Set(FName(name), *slate_color); Py_RETURN_NONE; } FSlateFontInfo *slate_font = ue_py_check_struct<FSlateFontInfo>(py_value); if (slate_font) { self->style_set->Set(FName(name), *slate_font); Py_RETURN_NONE; } ue_PyFLinearColor *py_linear_color = py_ue_is_flinearcolor(py_value); if (py_linear_color) { self->style_set->Set(FName(name), py_linear_color->color); Py_RETURN_NONE; } ue_PyFColor *py_color = py_ue_is_fcolor(py_value); if (py_color) { self->style_set->Set(FName(name), py_color->color); Py_RETURN_NONE; } if (PyNumber_Check(py_value)) { PyObject *py_float = PyNumber_Float(py_value); self->style_set->Set(FName(name), (float)PyFloat_AsDouble(py_float)); Py_DECREF(py_float); Py_RETURN_NONE; } return PyErr_Format(PyExc_ValueError, "unsupported value type"); } namespace { template <typename WidgetStyleType> PyObject* pyGetWidgetStyle(FSlateStyleSet& InStyle, FName PropertyName) { const WidgetStyleType styleWidgetStyle = InStyle.GetWidgetStyle<WidgetStyleType>(PropertyName); return py_ue_new_owned_uscriptstruct(WidgetStyleType::StaticStruct(), (uint8*)&styleWidgetStyle); } } static PyObject *py_ue_fslate_style_set_get(ue_PyFSlateStyleSet *self, PyObject * args) { if (!(self && self->style_set)) return PyErr_Format(PyExc_Exception, "fstyleset is in invalid state"); char *name = nullptr; PyObject *py_type = nullptr; if (!PyArg_ParseTuple(args, "sO:get", &name, &py_type)) return NULL; PyObject *ret = nullptr; if (ue_py_check_struct<FSlateSound>(py_type)) { const FSlateSound& styleSound = self->style_set->GetSound(FName(name)); ret = py_ue_new_owned_uscriptstruct(FSlateSound::StaticStruct(), (uint8*)&styleSound); } else if (ue_py_check_struct<FSlateBrush>(py_type)) { if (const FSlateBrush* styleBrush = self->style_set->GetBrush(FName(name))) { ret = py_ue_new_owned_uscriptstruct(FSlateBrush::StaticStruct(), (uint8*)styleBrush); } } else if (ue_py_check_struct<FSlateColor>(py_type)) { const FSlateColor styleSlateColor = self->style_set->GetSlateColor(FName(name)); ret = py_ue_new_owned_uscriptstruct(FSlateColor::StaticStruct(), (uint8*)&styleSlateColor); } else if (ue_py_check_struct<FSlateFontInfo>(py_type)) { const FSlateFontInfo styleFontInfo = self->style_set->GetFontStyle(FName(name)); ret = py_ue_new_owned_uscriptstruct(FSlateFontInfo::StaticStruct(), (uint8*)&styleFontInfo); } else if (ue_py_check_childstruct<FSlateWidgetStyle>(py_type)) { typedef TFunction<PyObject* (FSlateStyleSet&, FName)> WStyleGetter; typedef TPair<UScriptStruct*, WStyleGetter> WStylePair; #if ENGINE_MINOR_VERSION > 15 static const WStylePair validWidgetStyleUStructList[] = { WStylePair{ FTextBlockStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FTextBlockStyle>(InStyle, InName); }) }, WStylePair{ FButtonStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FButtonStyle>(InStyle, InName); }) }, WStylePair{ FComboButtonStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FComboButtonStyle>(InStyle, InName); }) }, WStylePair{ FComboBoxStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FComboBoxStyle>(InStyle, InName); }) }, WStylePair{ FHyperlinkStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FHyperlinkStyle>(InStyle, InName); }) }, WStylePair{ FEditableTextStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FEditableTextStyle>(InStyle, InName); }) }, WStylePair{ FScrollBarStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FScrollBarStyle>(InStyle, InName); }) }, WStylePair{ FEditableTextBoxStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FEditableTextBoxStyle>(InStyle, InName); }) }, WStylePair{ FInlineEditableTextBlockStyle::StaticStruct(), WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FInlineEditableTextBlockStyle>(InStyle, InName); }) }, WStylePair{ FProgressBarStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FProgressBarStyle>(InStyle, InName); }) }, WStylePair{ FExpandableAreaStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FExpandableAreaStyle>(InStyle, InName); }) }, WStylePair{ FSearchBoxStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FSearchBoxStyle>(InStyle, InName); }) }, WStylePair{ FSliderStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FSliderStyle>(InStyle, InName); }) }, WStylePair{ FVolumeControlStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FVolumeControlStyle>(InStyle, InName); }) }, WStylePair{ FInlineTextImageStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FInlineTextImageStyle>(InStyle, InName); }) }, WStylePair{ FSpinBoxStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FSpinBoxStyle>(InStyle, InName); }) }, WStylePair{ FSplitterStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FSplitterStyle>(InStyle, InName); }) }, WStylePair{ FTableRowStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FTableRowStyle>(InStyle, InName); }) }, WStylePair{ FTableColumnHeaderStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FTableColumnHeaderStyle>(InStyle, InName); }) }, WStylePair{ FHeaderRowStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FHeaderRowStyle>(InStyle, InName); }) }, WStylePair{ FDockTabStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FDockTabStyle>(InStyle, InName); }) }, WStylePair{ FScrollBoxStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FScrollBoxStyle>(InStyle, InName); }) }, WStylePair{ FScrollBorderStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FScrollBorderStyle>(InStyle, InName); }) }, WStylePair{ FWindowStyle::StaticStruct() , WStyleGetter([](FSlateStyleSet& InStyle, FName InName) { return pyGetWidgetStyle<FWindowStyle>(InStyle, InName); }) }, }; for (WStylePair widgetStyleUStruct : validWidgetStyleUStructList) { if (do_ue_py_check_struct(py_type, widgetStyleUStruct.Key)) { ret = widgetStyleUStruct.Value(*self->style_set, FName(name)); break; } } #endif if (!ret) { return PyErr_Format(PyExc_ValueError, "Unsupported FSlateWidgetStyle type. Add it manually."); } } else if (py_ue_is_flinearcolor(py_type)) { ret = py_ue_new_flinearcolor(self->style_set->GetColor(FName(name))); } else if (PyNumber_Check(py_type)) { ret = PyFloat_FromDouble(self->style_set->GetFloat(FName(name))); } else { return PyErr_Format(PyExc_ValueError, "unsupported value type"); } if (!ret) return PyErr_Format(PyExc_Exception, "Retrieved style object is in invalid state"); return ret; } static PyMethodDef ue_PyFSlateStyleSet_methods[] = { { "set_content_root", (PyCFunction)py_ue_fslate_style_set_set_content_root, METH_VARARGS, "" }, { "set", (PyCFunction)py_ue_fslate_style_set_set, METH_VARARGS, "" }, { "get", (PyCFunction)py_ue_fslate_style_set_get, METH_VARARGS, "" }, { "register", (PyCFunction)py_ue_fslate_style_set_register, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; static PyObject *ue_PyFSlateStyleSet_str(ue_PyFSlateStyleSet *self) { return PyUnicode_FromFormat("<unreal_engine.SlateStyleSet {'name': %s}>", PyUnicode_FromString(TCHAR_TO_UTF8(*self->style_set->GetStyleSetName().ToString()))); } static PyTypeObject ue_PyFSlateStyleSetType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.FSlateStyleSet", /* tp_name */ sizeof(ue_PyFSlateStyleSet), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc)ue_PyFSlateStyleSet_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ "Unreal Engine FSlateStyleSet", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PyFSlateStyleSet_methods, /* tp_methods */ }; static int ue_py_fslate_style_set_init(ue_PyFSlateStyleSet *self, PyObject *args, PyObject *kwargs) { char *name; if (!PyArg_ParseTuple(args, "s", &name)) { return -1; } //TODO: roberto: ikrimae- I think this leaks? How is FSlateIcon destroyed ever? self->style_set = new FSlateStyleSet(name); return 0; } ue_PyFSlateStyleSet* py_ue_new_fslate_style_set(FSlateStyleSet* styleSet) { ue_PyFSlateStyleSet *ret = (ue_PyFSlateStyleSet *)PyObject_New(ue_PyFSlateStyleSet, &ue_PyFSlateStyleSetType); ret->style_set = styleSet; return ret; } void ue_python_init_fslate_style_set(PyObject *ue_module) { ue_PyFSlateStyleSetType.tp_new = PyType_GenericNew; ue_PyFSlateStyleSetType.tp_init = (initproc)ue_py_fslate_style_set_init; if (PyType_Ready(&ue_PyFSlateStyleSetType) < 0) return; Py_INCREF(&ue_PyFSlateStyleSetType); PyModule_AddObject(ue_module, "FSlateStyleSet", (PyObject *)&ue_PyFSlateStyleSetType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFSlateStyleSet.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
3,432
```objective-c #pragma once #include "UnrealEnginePython.h" #include "UEPySCompoundWidget.h" #include "Runtime/Slate/Public/Widgets/Layout/SBorder.h" extern PyTypeObject ue_PySBorderType; typedef struct { ue_PySCompoundWidget s_compound_widget; /* Type-specific fields go here. */ } ue_PySBorder; void ue_python_init_sborder(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySBorder.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
84
```objective-c #pragma once #include "UEPyModule.h" #include "UEPySLeafWidget.h" #include "Runtime/Slate/Public/Widgets/Layout/SSpacer.h" extern PyTypeObject ue_PySSpacerType; typedef struct { ue_PySLeafWidget s_leaf_widget; /* Type-specific fields go here. */ } ue_PySSpacer; void ue_python_init_sspacer(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySSpacer.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
86
```c++ #include "UEPySMultiLineEditableText.h" static PyObject *py_ue_smulti_line_editable_text_select_all_text(ue_PySMultiLineEditableText *self, PyObject * args) { ue_py_slate_cast(SMultiLineEditableText); py_SMultiLineEditableText->SelectAllText(); Py_RETURN_NONE; } static PyObject *py_ue_smulti_line_editable_text_clear_selection(ue_PySMultiLineEditableText *self, PyObject * args) { ue_py_slate_cast(SMultiLineEditableText); py_SMultiLineEditableText->ClearSelection(); Py_RETURN_NONE; } static PyObject *py_ue_smulti_line_editable_text_get_selected_text(ue_PySMultiLineEditableText *self, PyObject * args) { ue_py_slate_cast(SMultiLineEditableText); FText text = py_SMultiLineEditableText->GetSelectedText(); return PyUnicode_FromString(TCHAR_TO_UTF8(*text.ToString())); } static PyObject *py_ue_smulti_line_editable_text_get_text(ue_PySMultiLineEditableText *self, PyObject * args) { ue_py_slate_cast(SMultiLineEditableText); FText text = py_SMultiLineEditableText->GetText(); return PyUnicode_FromString(TCHAR_TO_UTF8(*text.ToString())); } static PyObject *py_ue_smulti_line_editable_text_get_plain_text(ue_PySMultiLineEditableText *self, PyObject * args) { ue_py_slate_cast(SMultiLineEditableText); FText text = py_SMultiLineEditableText->GetPlainText(); return PyUnicode_FromString(TCHAR_TO_UTF8(*text.ToString())); } static PyObject *py_ue_smulti_line_editable_text_set_text(ue_PySMultiLineEditableText *self, PyObject * args) { ue_py_slate_cast(SMultiLineEditableText); char *text; if (!PyArg_ParseTuple(args, "s:set_text", &text)) { return NULL; } py_SMultiLineEditableText->SetText(FText::FromString(UTF8_TO_TCHAR(text))); Py_RETURN_SLATE_SELF; } static PyMethodDef ue_PySMultiLineEditableText_methods[] = { { "select_all_text", (PyCFunction)py_ue_smulti_line_editable_text_select_all_text, METH_VARARGS, "" }, { "clear_selection", (PyCFunction)py_ue_smulti_line_editable_text_clear_selection, METH_VARARGS, "" }, { "get_selected_text", (PyCFunction)py_ue_smulti_line_editable_text_get_selected_text, METH_VARARGS, "" }, { "get_text", (PyCFunction)py_ue_smulti_line_editable_text_get_text, METH_VARARGS, "" }, { "set_text", (PyCFunction)py_ue_smulti_line_editable_text_set_text, METH_VARARGS, "" }, { "get_plain_text", (PyCFunction)py_ue_smulti_line_editable_text_get_plain_text, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; PyTypeObject ue_PySMultiLineEditableTextType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SMultiLineEditableText", /* tp_name */ sizeof(ue_PySMultiLineEditableText), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SMultiLineEditableText", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySMultiLineEditableText_methods, /* tp_methods */ }; static int ue_py_smulti_line_editable_text_init(ue_PySMultiLineEditableText *self, PyObject *args, PyObject *kwargs) { ue_py_slate_setup_farguments(SMultiLineEditableText); ue_py_slate_farguments_optional_bool("allow_context_menu", AllowContextMenu); ue_py_slate_farguments_optional_bool("auto_wrap_text", AutoWrapText); ue_py_slate_farguments_optional_bool("is_read_only", IsReadOnly); ue_py_slate_farguments_optional_struct_ptr("text_style", TextStyle, FTextBlockStyle); ue_py_slate_farguments_text("text", Text); ue_py_snew(SMultiLineEditableText); return 0; } void ue_python_init_smulti_line_editable_text(PyObject *ue_module) { ue_PySMultiLineEditableTextType.tp_init = (initproc)ue_py_smulti_line_editable_text_init; ue_PySMultiLineEditableTextType.tp_base = &ue_PySWidgetType; if (PyType_Ready(&ue_PySMultiLineEditableTextType) < 0) return; Py_INCREF(&ue_PySMultiLineEditableTextType); PyModule_AddObject(ue_module, "SMultiLineEditableText", (PyObject *)&ue_PySMultiLineEditableTextType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySMultiLineEditableText.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
1,221
```objective-c #pragma once #include "UnrealEnginePython.h" #if WITH_EDITOR #if ENGINE_MINOR_VERSION > 15 #include "UEPySNodePanel.h" #include "Editor/GraphEditor/Public/SGraphPanel.h" extern PyTypeObject ue_PySGraphPanelType; typedef struct { ue_PySNodePanel s_nodePanel; /* Type-specific fields go here. */ } ue_PySGraphPanel; void ue_python_init_sgraph_panel(PyObject *); #endif #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySGraphPanel.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
101
```c++ #include "UEPySBorder.h" static PyObject *py_ue_sborder_clear_content(ue_PySBorder *self, PyObject * args) { ue_py_slate_cast(SBorder); py_SBorder->ClearContent(); Py_RETURN_NONE; } static PyObject *py_ue_sborder_set_content(ue_PySBorder *self, PyObject * args) { ue_py_slate_cast(SBorder); PyObject *py_content; if (!PyArg_ParseTuple(args, "O:set_content", &py_content)) { return nullptr; } TSharedPtr<SWidget> child = py_ue_is_swidget<SWidget>(py_content); if (!child.IsValid()) return nullptr; py_SBorder->SetContent(child.ToSharedRef()); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_sborder_set_padding(ue_PySBorder *self, PyObject * args) { ue_py_slate_cast(SBorder); PyObject *py_padding; if (!PyArg_ParseTuple(args, "O:set_padding", &py_padding)) { return nullptr; } FMargin *margin = ue_py_check_struct<FMargin>(py_padding); if (!margin) { if (!PyNumber_Check(py_padding)) { return PyErr_Format(PyExc_Exception, "argument is not a FMargin or a number"); } PyObject *py_float = PyNumber_Float(py_padding); FMargin new_margin(PyFloat_AsDouble(py_float)); margin = &new_margin; Py_DECREF(py_float); } py_SBorder->SetPadding(*margin); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_sborder_set_h_align(ue_PySBorder *self, PyObject * args) { ue_py_slate_cast(SBorder); int align; if (!PyArg_ParseTuple(args, "i:set_h_align", &align)) { return nullptr; } py_SBorder->SetHAlign((EHorizontalAlignment)align); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_sborder_set_v_align(ue_PySBorder *self, PyObject * args) { ue_py_slate_cast(SBorder); int align; if (!PyArg_ParseTuple(args, "i:set_v_align", &align)) { return nullptr; } py_SBorder->SetVAlign((EVerticalAlignment)align); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_sborder_set_border_image(ue_PySBorder *self, PyObject * args) { ue_py_slate_cast(SBorder); PyObject *py_brush; if (!PyArg_ParseTuple(args, "O:set_border_image", &py_brush)) { return NULL; } FSlateBrush *brush = ue_py_check_struct<FSlateBrush>(py_brush); if (!brush) return PyErr_Format(PyExc_Exception, "argument is not a FSlateBrush"); py_SBorder->SetBorderImage(brush); Py_RETURN_SLATE_SELF; } static PyMethodDef ue_PySBorder_methods[] = { { "clear_content", (PyCFunction)py_ue_sborder_clear_content, METH_VARARGS, "" }, { "set_content", (PyCFunction)py_ue_sborder_set_content, METH_VARARGS, "" }, { "set_padding", (PyCFunction)py_ue_sborder_set_padding, METH_VARARGS, "" }, { "set_h_align", (PyCFunction)py_ue_sborder_set_h_align, METH_VARARGS, "" }, { "set_v_align", (PyCFunction)py_ue_sborder_set_v_align, METH_VARARGS, "" }, { "set_border_image", (PyCFunction)py_ue_sborder_set_border_image, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; PyTypeObject ue_PySBorderType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SBorder", /* tp_name */ sizeof(ue_PySBorder), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SBorder", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySBorder_methods, /* tp_methods */ }; static int ue_py_sborder_init(ue_PySBorder *self, PyObject *args, PyObject *kwargs) { ue_py_slate_setup_farguments(SBorder); ue_py_slate_farguments_struct("border_background_color", BorderBackgroundColor, FSlateColor); ue_py_slate_farguments_flinear_color("color_and_opacity", ColorAndOpacity); ue_py_slate_farguments_optional_struct_ptr("border_image", BorderImage, FSlateBrush); ue_py_slate_farguments_optional_enum("h_align", HAlign, EHorizontalAlignment); ue_py_slate_farguments_optional_enum("v_align", VAlign, EVerticalAlignment); ue_py_slate_farguments_padding("padding", Padding); ue_py_slate_farguments_struct("foreground_color", ForegroundColor, FSlateColor); ue_py_slate_farguments_fvector2d("content_scale", ContentScale); ue_py_slate_farguments_fvector2d("desired_size_scale", DesiredSizeScale); ue_py_snew(SBorder); return 0; } void ue_python_init_sborder(PyObject *ue_module) { ue_PySBorderType.tp_init = (initproc)ue_py_sborder_init; ue_PySBorderType.tp_call = (ternaryfunc)py_ue_sborder_set_content; ue_PySBorderType.tp_base = &ue_PySCompoundWidgetType; if (PyType_Ready(&ue_PySBorderType) < 0) return; Py_INCREF(&ue_PySBorderType); PyModule_AddObject(ue_module, "SBorder", (PyObject *)&ue_PySBorderType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySBorder.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
1,436
```objective-c #pragma once #include "UEPySEditorViewport.h" #if WITH_EDITOR #include "Editor/UnrealEd/Public/SEditorViewport.h" #include "Editor/UnrealEd/Public/EditorViewportClient.h" #include "Runtime/Engine/Public/PreviewScene.h" #include "Editor/UnrealEd/Public/SCommonEditorViewportToolbarBase.h" #include "Editor/UnrealEd/Public/STransformViewportToolbar.h" #include "EngineUtils.h" extern PyTypeObject ue_PySEditorViewportType; typedef struct { ue_PySEditorViewport s_editor_viewport; /* Type-specific fields go here. */ } ue_PySPythonEditorViewport; void ue_python_init_spython_editor_viewport(PyObject *); class SPythonEditorViewport : public SEditorViewport, public ICommonEditorViewportToolbarInfoProvider { public: UWorld * GetPythonWorld(); virtual void Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime); void Simulate(bool start) { if (start) { if (!bSimulate) { bSimulate = true; GetWorld()->BeginPlay(); } } else { bSimulate = false; } } FPreviewScene * GetPreviewScene() { return PreviewScene; } TSharedPtr<FSceneViewport> GetSceneViewport() { return SceneViewport; } virtual void OnFloatingButtonClicked() override {}; virtual TSharedPtr<FExtender> GetExtenders() const override; virtual TSharedRef<SEditorViewport> GetViewportWidget() override; protected: virtual TSharedRef<FEditorViewportClient> MakeEditorViewportClient() override; virtual TSharedPtr<SWidget> MakeViewportToolbar() override; FPreviewScene *PreviewScene; bool bSimulate; }; #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySPythonEditorViewport.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
385
```objective-c #pragma once #include "UEPySlate.h" #include "Wrappers/UEPyFColor.h" #include "Wrappers/UEPyFLinearColor.h" typedef struct { PyObject_HEAD /* Type-specific fields go here. */ FSlateStyleSet *style_set; } ue_PyFSlateStyleSet; ue_PyFSlateStyleSet* py_ue_new_fslate_style_set(FSlateStyleSet* styleSet); void ue_python_init_fslate_style_set(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFSlateStyleSet.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
108
```c++ #include "UEPySDirectoryPicker.h" #if WITH_EDITOR #if ENGINE_MINOR_VERSION > 13 static PyObject *py_ue_sdirectory_picker_get_directory(ue_PySDirectoryPicker *self, PyObject * args) { ue_py_slate_cast(SDirectoryPicker); FString Directory = py_SDirectoryPicker->GetDirectory(); return PyUnicode_FromString(TCHAR_TO_UTF8(*Directory)); } static PyObject *py_ue_sdirectory_picker_get_file_path(ue_PySDirectoryPicker *self, PyObject * args) { ue_py_slate_cast(SDirectoryPicker); FString FilePath = py_SDirectoryPicker->GetFilePath(); return PyUnicode_FromString(TCHAR_TO_UTF8(*FilePath)); } static PyMethodDef ue_PySDirectoryPicker_methods[] = { { "get_directory", (PyCFunction)py_ue_sdirectory_picker_get_directory, METH_VARARGS, "" }, { "get_file_path", (PyCFunction)py_ue_sdirectory_picker_get_file_path, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; DECLARE_UE_PY_SLATE_WIDGET(SDirectoryPicker); DECLARE_DELEGATE_OneParam(FOnDirectoryChanged, const FString& /*Directory*/); static int ue_py_sdirectory_picker_init(ue_PySDirectoryPicker *self, PyObject *args, PyObject *kwargs) { ue_py_slate_setup_farguments(SDirectoryPicker); ue_py_slate_farguments_optional_text("message", Message); ue_py_slate_farguments_optional_string("directory", Directory); ue_py_slate_farguments_optional_string("file", File); ue_py_slate_farguments_bool("is_enabled", IsEnabled); ue_py_slate_farguments_event("on_directory_changed", OnDirectoryChanged, FOnDirectoryChanged, OnStringChanged); ue_py_snew(SDirectoryPicker); return 0; } void ue_python_init_sdirectory_picker(PyObject *ue_module) { ue_PySDirectoryPickerType.tp_init = (initproc)ue_py_sdirectory_picker_init; ue_PySDirectoryPickerType.tp_base = &ue_PySCompoundWidgetType; if (PyType_Ready(&ue_PySDirectoryPickerType) < 0) return; Py_INCREF(&ue_PySDirectoryPickerType); PyModule_AddObject(ue_module, "SDirectoryPicker", (PyObject *)&ue_PySDirectoryPickerType); } #endif #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySDirectoryPicker.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
502
```c++ #include "UEPySObjectPropertyEntryBox.h" #if WITH_EDITOR static PyMethodDef ue_PySObjectPropertyEntryBox_methods[] = { { NULL } /* Sentinel */ }; DECLARE_UE_PY_SLATE_WIDGET(SObjectPropertyEntryBox); static int ue_py_sobject_property_entry_box_init(ue_PySObjectPropertyEntryBox *self, PyObject *args, PyObject *kwargs) { ue_py_slate_setup_farguments(SObjectPropertyEntryBox); ue_py_slate_farguments_optional_bool("allow_clear", AllowClear); ue_py_slate_farguments_optional_bool("display_browse", DisplayBrowse); ue_py_slate_farguments_optional_bool("display_use_selected", DisplayUseSelected); #if ENGINE_MINOR_VERSION > 13 ue_py_slate_farguments_optional_bool("enable_content_picker", EnableContentPicker); #endif ue_py_slate_farguments_string("object_path", ObjectPath); ue_py_slate_farguments_optional_uobject("allowed_class", AllowedClass, UClass); ue_py_slate_farguments_event("on_object_changed", OnObjectChanged, FOnSetObject, OnAssetChanged); ue_py_slate_farguments_event("on_should_filter_asset", OnShouldFilterAsset, FOnShouldFilterAsset, OnShouldFilterAsset); ue_py_snew(SObjectPropertyEntryBox); return 0; } void ue_python_init_sobject_property_entry_box(PyObject *ue_module) { ue_PySObjectPropertyEntryBoxType.tp_init = (initproc)ue_py_sobject_property_entry_box_init; ue_PySObjectPropertyEntryBoxType.tp_base = &ue_PySCompoundWidgetType; if (PyType_Ready(&ue_PySObjectPropertyEntryBoxType) < 0) return; Py_INCREF(&ue_PySObjectPropertyEntryBoxType); PyModule_AddObject(ue_module, "SObjectPropertyEntryBox", (PyObject *)&ue_PySObjectPropertyEntryBoxType); } #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySObjectPropertyEntryBox.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
415
```c++ #include "UEPySAssetDropTarget.h" #if WITH_EDITOR static PyMethodDef ue_PySAssetDropTarget_methods[] = { { NULL } /* Sentinel */ }; PyTypeObject ue_PySAssetDropTargetType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SAssetDropTarget", /* tp_name */ sizeof(ue_PySAssetDropTarget), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SAssetDropTarget", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySAssetDropTarget_methods, /* tp_methods */ }; static int ue_py_sasset_drop_target_init(ue_PySAssetDropTarget *self, PyObject *args, PyObject *kwargs) { ue_py_slate_setup_farguments(SAssetDropTarget); ue_py_snew(SAssetDropTarget); return 0; } void ue_python_init_sasset_drop_target(PyObject *ue_module) { ue_PySAssetDropTargetType.tp_init = (initproc)ue_py_sasset_drop_target_init; ue_PySAssetDropTargetType.tp_base = &ue_PySCompoundWidgetType; if (PyType_Ready(&ue_PySAssetDropTargetType) < 0) return; Py_INCREF(&ue_PySAssetDropTargetType); PyModule_AddObject(ue_module, "SAssetDropTarget", (PyObject *)&ue_PySAssetDropTargetType); } #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySAssetDropTarget.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
513
```c++ #include "UEPySPythonMultiColumnTableRow.h" #include "UEPySTableViewBase.h" static PyMethodDef ue_PySPythonMultiColumnTableRow_methods[] = { { NULL } /* Sentinel */ }; PyTypeObject ue_PySPythonMultiColumnTableRowType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SPythonMultiColumnTableRow", /* tp_name */ sizeof(ue_PySPythonMultiColumnTableRow), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SPythonMultiColumnTableRow", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySPythonMultiColumnTableRow_methods, /* tp_methods */ }; static int ue_py_spython_multicolumn_table_row_init(ue_PySPythonMultiColumnTableRow *self, PyObject *args, PyObject *kwargs) { PyObject *py_object = nullptr; if (!PyArg_ParseTuple(args, "O", &py_object)) { return -1; } ue_PySTableViewBase* py_owner_table_view_base = py_ue_is_stable_view_base(py_object); if (!py_owner_table_view_base) { PyErr_SetString(PyExc_Exception, "Argument is not a STableViewBase"); return -1; } Py_INCREF(py_owner_table_view_base); ue_py_snew_simple_with_req_args( SPythonMultiColumnTableRow, StaticCastSharedRef<STableViewBase>(py_owner_table_view_base->s_compound_widget.s_widget.Widget), (PyObject *)self); return 0; } void ue_python_init_spython_multicolumn_table_row(PyObject *ue_module) { ue_PySPythonMultiColumnTableRowType.tp_base = &ue_PySCompoundWidgetType; ue_PySPythonMultiColumnTableRowType.tp_init = (initproc)ue_py_spython_multicolumn_table_row_init; if (PyType_Ready(&ue_PySPythonMultiColumnTableRowType) < 0) return; Py_INCREF(&ue_PySPythonMultiColumnTableRowType); PyModule_AddObject(ue_module, "SPythonMultiColumnTableRow", (PyObject *)&ue_PySPythonMultiColumnTableRowType); } ue_PySPythonMultiColumnTableRow *py_ue_is_spython_multicolumn_table_row(PyObject *obj) { if (!PyObject_IsInstance(obj, (PyObject *)&ue_PySPythonMultiColumnTableRowType)) return nullptr; return (ue_PySPythonMultiColumnTableRow *)obj; } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySPythonMultiColumnTableRow.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
726
```c++ #include "UEPyIStructureDetailsView.h" #if WITH_EDITOR #include "Editor/PropertyEditor/Public/PropertyEditorModule.h" #include "UEPySWidget.h" #include "Editor/PropertyEditor/Public/IDetailsView.h" static PyObject *ue_PyIStructureDetailsView_str(ue_PyIStructureDetailsView *self) { #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromFormat("<unreal_engine.%s '%p' (slate ref count: %d, py ref count: %d)>", TCHAR_TO_UTF8(*self->istructure_details_view->GetWidget()->GetTypeAsString()), self->istructure_details_view->GetWidget().Get(), self->istructure_details_view->GetWidget().GetSharedReferenceCount(), self->ob_base.ob_refcnt); #else return PyUnicode_FromFormat("<unreal_engine.%s '%p' (slate ref count: %d)>", TCHAR_TO_UTF8(*self->istructure_details_view->GetWidget()->GetTypeAsString()), self->istructure_details_view->GetWidget().Get(), self->istructure_details_view->GetWidget().GetSharedReferenceCount()); #endif } static PyObject *py_ue_istructure_details_view_set_structure_data(ue_PyIStructureDetailsView *self, PyObject * args, PyObject *kwargs) { PyObject *py_object = nullptr; PyObject *py_force_refresh = nullptr; char *kwlist[] = { (char *)"struct_data", (char *)"force_refresh", nullptr }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:set_structure_data", kwlist, &py_object, &py_force_refresh)) { return nullptr; } ue_PyUScriptStruct *ue_py_struct = py_ue_is_uscriptstruct(py_object); if (!ue_py_struct) { return PyErr_Format(PyExc_Exception, "argument is not a UScriptStruct"); } Py_XDECREF(self->ue_py_struct); self->ue_py_struct = ue_py_struct; Py_INCREF(self->ue_py_struct); TSharedPtr<FStructOnScope> struct_scope = MakeShared<FStructOnScope>(ue_py_struct->u_struct, ue_py_struct->u_struct_ptr); FPropertyEditorModule& PropertyEditorModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor"); self->istructure_details_view->SetStructureData(struct_scope); #if ENGINE_MINOR_VERSION > 17 if (py_force_refresh && PyObject_IsTrue(py_force_refresh)) { self->istructure_details_view->GetDetailsView()->ForceRefresh(); } #endif Py_RETURN_NONE; } static PyObject *py_ue_istructure_details_view_get_widget(ue_PyIStructureDetailsView *self, PyObject * args) { TSharedPtr<SWidget> ret_widget = self->istructure_details_view->GetWidget(); if (!ret_widget.IsValid()) { return PyErr_Format(PyExc_Exception, "unable to create SingleProperty widget"); } return (PyObject *)py_ue_new_swidget<ue_PySWidget>(ret_widget->AsShared(), &ue_PySWidgetType); Py_RETURN_NONE; } static PyMethodDef ue_PyIStructureDetailsView_methods[] = { #pragma warning(suppress: 4191) { "set_structure_data", (PyCFunction)py_ue_istructure_details_view_set_structure_data, METH_VARARGS | METH_KEYWORDS, "" }, { "get_widget", (PyCFunction)py_ue_istructure_details_view_get_widget, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; static void ue_PyIStructureDetailsView_dealloc(ue_PyIStructureDetailsView *self) { #if defined(UEPY_MEMORY_DEBUG) UE_LOG(LogPython, Warning, TEXT("Destroying ue_PyIStructureDetailsView %p mapped to IStructureDetailsView %p"), self, self->istructure_details_view.Get()); #endif Py_DECREF(self->ue_py_struct); Py_TYPE(self)->tp_free((PyObject *)self); } PyTypeObject ue_PyIStructureDetailsViewType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.IStructureDetailsView", /* tp_name */ sizeof(ue_PyIStructureDetailsView), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)ue_PyIStructureDetailsView_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc)ue_PyIStructureDetailsView_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ "Unreal Engine IStructureDetailsView", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PyIStructureDetailsView_methods, /* tp_methods */ }; static int ue_py_istructure_details_view_init(ue_PyIStructureDetailsView *self, PyObject *args, PyObject *kwargs) { PyObject *py_object = nullptr; PyObject *py_allow_search = nullptr; PyObject *py_update_from_selection = nullptr; PyObject *py_lockable = nullptr; char *py_name_area_settings = nullptr; PyObject *py_hide_selection_tip = nullptr; PyObject *py_search_initial_key_focus = nullptr; char *kwlist[] = { (char*)"struct_data", (char *)"allow_search", (char *)"update_from_selection", (char *)"lockable", (char *)"name_area_settings", (char *)"hide_selection_tip", (char *)"search_initial_key_focus", nullptr }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOOOsOO:__init__", kwlist, &py_object, &py_allow_search, &py_update_from_selection, &py_lockable, &py_name_area_settings, &py_hide_selection_tip, &py_search_initial_key_focus)) { return -1; } ue_PyUScriptStruct *ue_py_struct = py_ue_is_uscriptstruct(py_object); if (!ue_py_struct) { PyErr_SetString(PyExc_Exception, "argument is not a UScriptStruct"); return -1; } FDetailsViewArgs view_args; view_args.bAllowSearch = (py_allow_search) ? PyObject_IsTrue(py_allow_search) : view_args.bAllowSearch; view_args.bUpdatesFromSelection = (py_update_from_selection) ? PyObject_IsTrue(py_update_from_selection) : view_args.bUpdatesFromSelection; view_args.bLockable = (py_lockable) ? PyObject_IsTrue(py_lockable) : view_args.bLockable; view_args.bHideSelectionTip = (py_hide_selection_tip) ? PyObject_IsTrue(py_hide_selection_tip) : view_args.bHideSelectionTip; view_args.bSearchInitialKeyFocus = (py_search_initial_key_focus) ? PyObject_IsTrue(py_search_initial_key_focus) : view_args.bSearchInitialKeyFocus; FString name_area_string = py_name_area_settings ? FString(UTF8_TO_TCHAR(py_name_area_settings)) : FString(); view_args.NameAreaSettings = [&name_area_string]() { if (FCString::Stricmp(*name_area_string, TEXT("HideNameArea")) == 0) { return FDetailsViewArgs::ENameAreaSettings::HideNameArea; } else if (FCString::Stricmp(*name_area_string, TEXT("ObjectsUseNameArea")) == 0) { return FDetailsViewArgs::ENameAreaSettings::ObjectsUseNameArea; } else if (FCString::Stricmp(*name_area_string, TEXT("ActorsUseNameArea")) == 0) { return FDetailsViewArgs::ENameAreaSettings::ActorsUseNameArea; } else if (FCString::Stricmp(*name_area_string, TEXT("ComponentsAndActorsUseNameArea")) == 0) { return FDetailsViewArgs::ENameAreaSettings::ComponentsAndActorsUseNameArea; } else { return FDetailsViewArgs::ENameAreaSettings::ActorsUseNameArea; } }(); FStructureDetailsViewArgs struct_view_args; { struct_view_args.bShowObjects = true; struct_view_args.bShowAssets = true; struct_view_args.bShowClasses = true; struct_view_args.bShowInterfaces = true; } new(&self->istructure_details_view) TSharedPtr<IStructureDetailsView>(nullptr); self->ue_py_struct = ue_py_struct; Py_INCREF(self->ue_py_struct); TSharedPtr<FStructOnScope> struct_scope = MakeShared<FStructOnScope>(ue_py_struct->u_struct, ue_py_struct->u_struct_ptr); FPropertyEditorModule& PropertyEditorModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor"); new(&self->istructure_details_view) TSharedRef<IStructureDetailsView>(PropertyEditorModule.CreateStructureDetailView(view_args, struct_view_args, struct_scope)); return 0; } void ue_python_init_istructure_details_view(PyObject *ue_module) { ue_PyIStructureDetailsViewType.tp_new = PyType_GenericNew; ue_PyIStructureDetailsViewType.tp_init = (initproc)ue_py_istructure_details_view_init; ue_PyIStructureDetailsViewType.tp_getattro = PyObject_GenericGetAttr; ue_PyIStructureDetailsViewType.tp_setattro = PyObject_GenericSetAttr; if (PyType_Ready(&ue_PyIStructureDetailsViewType) < 0) return; Py_INCREF(&ue_PyIStructureDetailsViewType); PyModule_AddObject(ue_module, "IStructureDetailsView", (PyObject *)&ue_PyIStructureDetailsViewType); } ue_PyIStructureDetailsView *py_ue_is_istructure_details_view(PyObject *obj) { if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyIStructureDetailsViewType)) return nullptr; return (ue_PyIStructureDetailsView *)obj; } #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyIStructureDetailsView.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
2,317
```objective-c #pragma once #include "UEPySDropTarget.h" #if WITH_EDITOR #include "Editor/EditorWidgets/Public/SAssetDropTarget.h" extern PyTypeObject ue_PySAssetDropTargetType; typedef struct { ue_PySDropTarget s_drop_target; /* Type-specific fields go here. */ } ue_PySAssetDropTarget; void ue_python_init_sasset_drop_target(PyObject *); #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySAssetDropTarget.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
87
```objective-c #pragma once #include "UEPyModule.h" #include "Runtime/Slate/Public/Framework/Docking/TabManager.h" typedef struct { PyObject_HEAD /* Type-specific fields go here. */ TSharedRef<FTabManager> tab_manager; } ue_PyFTabManager; PyObject *py_ue_new_ftab_manager(TSharedRef<FTabManager>); void ue_python_init_ftab_manager(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFTabManager.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
89
```c++ #include "UEPySLevelViewport.h" #if WITH_EDITOR #include "LevelEditor.h" #include "Editor/LevelEditor/Public/ILevelEditor.h" static PyObject *py_ue_slevel_viewport_get_world(ue_PySLevelViewport *self, PyObject * args) { ue_py_slate_cast(SLevelViewport); Py_RETURN_UOBJECT(py_SLevelViewport->GetWorld()); } static PyObject *py_ue_slevel_viewport_set_show_bounds(ue_PySLevelViewport *self, PyObject * args) { ue_py_slate_cast(SLevelViewport); PyObject *py_bool; if (!PyArg_ParseTuple(args, "O:set_show_bounds", &py_bool)) { return nullptr; } py_SLevelViewport->GetViewportClient()->SetShowBounds(PyObject_IsTrue(py_bool) ? true : false); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_slevel_viewport_set_show_stats(ue_PySLevelViewport *self, PyObject * args) { ue_py_slate_cast(SLevelViewport); PyObject *py_bool; if (!PyArg_ParseTuple(args, "O:set_show_stats", &py_bool)) { return nullptr; } py_SLevelViewport->GetViewportClient()->SetShowStats(PyObject_IsTrue(py_bool) ? true : false); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_slevel_viewport_set_view_mode(ue_PySLevelViewport *self, PyObject * args) { ue_py_slate_cast(SLevelViewport); int mode; if (!PyArg_ParseTuple(args, "i:set_view_mode", &mode)) { return nullptr; } py_SLevelViewport->GetViewportClient()->SetViewMode((EViewModeIndex)mode); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_slevel_viewport_set_exposure_settings(ue_PySLevelViewport *self, PyObject * args) { ue_py_slate_cast(SLevelViewport); PyObject *py_settings; if (!PyArg_ParseTuple(args, "O:set_exposure_settings", &py_settings)) { return nullptr; } FExposureSettings *settings = ue_py_check_struct<FExposureSettings>(py_settings); if (!settings) { return PyErr_Format(PyExc_Exception, "argument is not a FExposureSettings"); } py_SLevelViewport->GetViewportClient()->ExposureSettings = *settings; Py_RETURN_SLATE_SELF; } /* PyObject *py_ue_spython_editor_viewport_simulate(ue_PySLevelViewport *self, PyObject * args) { sw_python_editor_viewport->GetViewportClient()->SetIsSimulateInEditorViewport(true); Py_RETURN_NONE; }*/ static PyMethodDef ue_PySLevelViewport_methods[] = { //{ "simulate", (PyCFunction)py_ue_slevel_viewport_simulate, METH_VARARGS, "" }, { "get_world", (PyCFunction)py_ue_slevel_viewport_get_world, METH_VARARGS, "" }, { "set_show_bounds", (PyCFunction)py_ue_slevel_viewport_set_show_bounds, METH_VARARGS, "" }, { "set_show_stats", (PyCFunction)py_ue_slevel_viewport_set_show_stats, METH_VARARGS, "" }, { "set_view_mode", (PyCFunction)py_ue_slevel_viewport_set_view_mode, METH_VARARGS, "" }, { "set_exposure_settings", (PyCFunction)py_ue_slevel_viewport_set_exposure_settings, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; PyTypeObject ue_PySLevelViewportType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SLevelViewport", /* tp_name */ sizeof(ue_PySLevelViewport), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SLevelViewport", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySLevelViewport_methods, /* tp_methods */ }; static int ue_py_slevel_viewport_init(ue_PySLevelViewport *self, PyObject *args, PyObject *kwargs) { FLevelEditorModule &EditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor"); ue_py_slate_setup_farguments(SLevelViewport); arguments.ParentLevelEditor(EditorModule.GetFirstLevelEditor().ToSharedRef()); ue_py_slate_farguments_optional_bool("realtime", Realtime); ue_py_slate_farguments_optional_enum("viewport_type", ViewportType, ELevelViewportType); ue_py_snew(SLevelViewport); ue_py_slate_cast(SLevelViewport); EditorModule.GetFirstLevelEditor()->AddStandaloneLevelViewport(py_SLevelViewport); return 0; } void ue_python_init_slevel_viewport(PyObject *ue_module) { ue_PySLevelViewportType.tp_init = (initproc)ue_py_slevel_viewport_init; ue_PySLevelViewportType.tp_base = &ue_PySEditorViewportType; if (PyType_Ready(&ue_PySLevelViewportType) < 0) return; Py_INCREF(&ue_PySLevelViewportType); PyModule_AddObject(ue_module, "SLevelViewport", (PyObject *)&ue_PySLevelViewportType); } #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySLevelViewport.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
1,319
```objective-c #pragma once #include "UEPySlate.h" #include "Runtime/Slate/Public/Framework/Commands/UIAction.h" #if WITH_EDITOR #include "Developer/AssetTools/Public/AssetToolsModule.h" #include "Developer/AssetTools/Public/IAssetTools.h" #endif #include "Runtime/Slate/Public/Framework/MultiBox/MultiBoxBuilder.h" typedef struct { PyObject_HEAD /* Type-specific fields go here. */ FMenuBuilder menu_builder; } ue_PyFMenuBuilder; void ue_python_init_fmenu_builder(PyObject *); PyObject *py_ue_new_fmenu_builder(FMenuBuilder); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFMenuBuilder.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
126
```c++ #include "UEPySGraphEditor.h" #if WITH_EDITOR #include "Runtime/Engine/Classes/EdGraph/EdGraph.h" static PyMethodDef ue_PySGraphEditor_methods[] = { { NULL } /* Sentinel */ }; PyTypeObject ue_PySGraphEditorType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SGraphEditor", /* tp_name */ sizeof(ue_PySGraphEditor), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SGraphEditor", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySGraphEditor_methods, /* tp_methods */ }; static int ue_py_sgraph_editor_init(ue_PySGraphEditor *self, PyObject *args, PyObject *kwargs) { PyObject *py_graph; if (!PyArg_ParseTuple(args, "O", &py_graph)) { return -1; } UEdGraph *graph = ue_py_check_type<UEdGraph>(py_graph); if (!graph) { PyErr_SetString(PyExc_Exception, "argument is not a EdGraph"); return -1; } ue_py_slate_setup_farguments(SGraphEditor); arguments.GraphToEdit(graph); ue_py_snew(SGraphEditor); return 0; } void ue_python_init_sgraph_editor(PyObject *ue_module) { ue_PySGraphEditorType.tp_init = (initproc)ue_py_sgraph_editor_init; ue_PySGraphEditorType.tp_base = &ue_PySCompoundWidgetType; if (PyType_Ready(&ue_PySGraphEditorType) < 0) return; Py_INCREF(&ue_PySGraphEditorType); PyModule_AddObject(ue_module, "SGraphEditor", (PyObject *)&ue_PySGraphEditorType); } #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySGraphEditor.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
596
```c++ #include "UEPySCheckBox.h" static PyObject *py_ue_scheck_box_is_checked(ue_PySCheckBox *self, PyObject * args) { ue_py_slate_cast(SCheckBox); if (py_SCheckBox->IsChecked()) { Py_RETURN_TRUE; } Py_RETURN_FALSE; } static PyObject *py_ue_scheck_box_set_is_checked(ue_PySCheckBox *self, PyObject * args) { ue_py_slate_cast(SCheckBox); PyObject * py_bool; if (!PyArg_ParseTuple(args, "O:set_is_checked", &py_bool)) { return NULL; } ECheckBoxState CheckedState = PyObject_IsTrue(py_bool) ? ECheckBoxState::Checked : ECheckBoxState::Unchecked; py_SCheckBox->SetIsChecked(TAttribute<ECheckBoxState>(CheckedState)); Py_RETURN_NONE; } static PyObject *py_ue_scheck_box_set_content(ue_PySCheckBox *self, PyObject * args) { ue_py_slate_cast(SCheckBox); PyObject * py_content; if (!PyArg_ParseTuple(args, "O:set_content", &py_content)) { return NULL; } TSharedPtr<SWidget> child = py_ue_is_swidget<SWidget>(py_content); if (!child.IsValid()) { return nullptr; } py_SCheckBox->SetContent(child.ToSharedRef()); Py_RETURN_SLATE_SELF; } static PyMethodDef ue_PySCheckBox_methods[] = { { "is_checked", (PyCFunction)py_ue_scheck_box_is_checked, METH_VARARGS, "" }, { "set_content", (PyCFunction)py_ue_scheck_box_set_content, METH_VARARGS, "" }, { "set_is_checked", (PyCFunction)py_ue_scheck_box_set_is_checked, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; PyTypeObject ue_PySCheckBoxType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SCheckBox", /* tp_name */ sizeof(ue_PySCheckBox), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SCheckBox", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySCheckBox_methods, /* tp_methods */ }; static int ue_py_scheck_box_init(ue_PySCheckBox *self, PyObject *args, PyObject *kwargs) { ue_py_slate_setup_farguments(SCheckBox); ue_py_slate_farguments_struct("border_background_color", BorderBackgroundColor, FSlateColor); ue_py_slate_farguments_struct("foreground_color", ForegroundColor, FSlateColor); ue_py_slate_farguments_enum("is_checked", IsChecked, ECheckBoxState); ue_py_slate_farguments_event("on_check_state_changed", OnCheckStateChanged, FOnCheckStateChanged, CheckBoxChanged); ue_py_slate_farguments_optional_struct_ptr("style", Style, FCheckBoxStyle); ue_py_slate_farguments_optional_enum("type", Type, ESlateCheckBoxType::Type); ue_py_slate_farguments_event("on_check_state_changed", OnCheckStateChanged, FOnCheckStateChanged, CheckBoxChanged); ue_py_slate_farguments_enum("is_checked", IsChecked, ECheckBoxState); ue_py_slate_farguments_optional_enum("h_align", HAlign, EHorizontalAlignment); ue_py_slate_farguments_struct("padding", Padding, FMargin); ue_py_slate_farguments_enum("click_method", ClickMethod, EButtonClickMethod::Type); ue_py_slate_farguments_optional_bool("is_focusable", IsFocusable); ue_py_slate_farguments_optional_struct_ptr("unchecked_image", UncheckedImage, FSlateBrush); ue_py_slate_farguments_optional_struct_ptr("unchecked_hoveredimage", UncheckedHoveredImage, FSlateBrush); ue_py_slate_farguments_optional_struct_ptr("unchecked_pressedimage", UncheckedPressedImage, FSlateBrush); ue_py_slate_farguments_optional_struct_ptr("checked_image", CheckedImage, FSlateBrush); ue_py_slate_farguments_optional_struct_ptr("checked_hoveredimage", CheckedHoveredImage, FSlateBrush); ue_py_slate_farguments_optional_struct_ptr("checked_pressedimage", CheckedPressedImage, FSlateBrush); ue_py_slate_farguments_optional_struct_ptr("undetermined_image", UndeterminedImage, FSlateBrush); ue_py_slate_farguments_optional_struct_ptr("undetermined_hoveredimage", UndeterminedHoveredImage, FSlateBrush); ue_py_slate_farguments_optional_struct_ptr("undetermined_pressedimage", UndeterminedPressedImage, FSlateBrush); ue_py_snew(SCheckBox); return 0; } void ue_python_init_scheck_box(PyObject *ue_module) { ue_PySCheckBoxType.tp_init = (initproc)ue_py_scheck_box_init; ue_PySCheckBoxType.tp_call = (ternaryfunc)py_ue_scheck_box_set_content; ue_PySCheckBoxType.tp_base = &ue_PySCompoundWidgetType; if (PyType_Ready(&ue_PySCheckBoxType) < 0) return; Py_INCREF(&ue_PySCheckBoxType); PyModule_AddObject(ue_module, "SCheckBox", (PyObject *)&ue_PySCheckBoxType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySCheckBox.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
1,334
```objective-c #pragma once #include "UnrealEnginePython.h" #if WITH_EDITOR #include "UEPySPanel.h" #include "Editor/GraphEditor/Public/SNodePanel.h" extern PyTypeObject ue_PySNodePanelType; typedef struct { ue_PySPanel s_panel; /* Type-specific fields go here. */ } ue_PySNodePanel; void ue_python_init_snode_panel(PyObject *); #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySNodePanel.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
87
```c++ #include "UEPySNodePanel.h" #if WITH_EDITOR static PyMethodDef ue_PySNodePanel_methods[] = { { NULL } /* Sentinel */ }; PyTypeObject ue_PySNodePanelType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SNodePanel", /* tp_name */ sizeof(ue_PySNodePanel), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SNode Panel", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySNodePanel_methods, /* tp_methods */ }; void ue_python_init_snode_panel(PyObject *ue_module) { ue_PySNodePanelType.tp_base = &ue_PySPanelType; if (PyType_Ready(&ue_PySNodePanelType) < 0) return; Py_INCREF(&ue_PySNodePanelType); PyModule_AddObject(ue_module, "SNodePanel", (PyObject *)&ue_PySNodePanelType); } #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySNodePanel.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
418
```c++ #include "UEPySGridPanel.h" static PyObject *py_ue_sgrid_panel_clear_children(ue_PySGridPanel *self, PyObject * args) { ue_py_slate_cast(SGridPanel); py_SGridPanel->ClearChildren(); Py_RETURN_NONE; } static PyObject *py_ue_sgrid_panel_add_slot(ue_PySGridPanel *self, PyObject * args, PyObject * kwargs) { ue_py_slate_cast(SGridPanel); PyObject *py_content; int column; int row; int layer = 0; int foobar = 0; PyObject *py_nudge = nullptr; char *kwlist[] = { (char *)"widget", (char *)"column", (char *)"row", (char *)"layer", (char *)"column_span", (char *)"nudge", (char *)"row_span", nullptr }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Oii|iiOi:add_slot", kwlist, &py_content, &column, &row, &layer, &foobar, &py_nudge, &foobar)) { return nullptr; } int32 retCode = [&]() { ue_py_slate_setup_hack_slot_args_grid(SGridPanel, py_SGridPanel, column, row, SGridPanel::Layer(layer)); ue_py_slate_farguments_optional_int32("column_span", ColumnSpan); ue_py_slate_farguments_optional_fvector2d("nudge", Nudge); ue_py_slate_farguments_optional_int32("row_span", RowSpan); return 0; }(); if (retCode != 0) { return PyErr_Format(PyExc_Exception, "could not add GridPanel slot"); } Py_RETURN_SLATE_SELF; } static PyMethodDef ue_PySGridPanel_methods[] = { { "clear_children", (PyCFunction)py_ue_sgrid_panel_clear_children, METH_VARARGS, "" }, #pragma warning(suppress: 4191) { "add_slot", (PyCFunction)py_ue_sgrid_panel_add_slot, METH_VARARGS | METH_KEYWORDS, "" }, { NULL } /* Sentinel */ }; PyTypeObject ue_PySGridPanelType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SGridPanel", /* tp_name */ sizeof(ue_PySGridPanel), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SGridPanel", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySGridPanel_methods, /* tp_methods */ }; static int ue_py_sgrid_panel_init(ue_PySGridPanel *self, PyObject *args, PyObject *kwargs) { ue_py_snew_simple(SGridPanel); return 0; } void ue_python_init_sgrid_panel(PyObject *ue_module) { ue_PySGridPanelType.tp_init = (initproc)ue_py_sgrid_panel_init; ue_PySGridPanelType.tp_call = (ternaryfunc)py_ue_sgrid_panel_add_slot; ue_PySGridPanelType.tp_base = &ue_PySPanelType; if (PyType_Ready(&ue_PySGridPanelType) < 0) return; Py_INCREF(&ue_PySGridPanelType); PyModule_AddObject(ue_module, "SGridPanel", (PyObject *)&ue_PySGridPanelType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySGridPanel.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
930
```c++ #include "UEPyFToolBarBuilder.h" #include "UEPyFSlateIcon.h" #include "Runtime/Slate/Public/Framework/Commands/UIAction.h" static PyObject *py_ue_ftool_bar_builder_begin_section(ue_PyFToolBarBuilder *self, PyObject * args) { char *name; if (!PyArg_ParseTuple(args, "s:begin_section", &name)) return NULL; self->tool_bar_builder.BeginSection(FName(name)); Py_RETURN_NONE; } static PyObject *py_ue_ftool_bar_builder_end_section(ue_PyFToolBarBuilder *self, PyObject * args) { self->tool_bar_builder.EndSection(); Py_RETURN_NONE; } static PyObject *py_ue_ftool_bar_builder_add_tool_bar_button(ue_PyFToolBarBuilder *self, PyObject * args) { char *hook; char *label; char *tooltip; PyObject *py_icon; PyObject *py_callable; PyObject *py_obj = nullptr; if (!PyArg_ParseTuple(args, "sssOO|O:add_tool_bar_button", &hook, &label, &tooltip, &py_icon, &py_callable, &py_obj)) return NULL; ue_PyFSlateIcon *py_slate_icon = py_ue_is_fslate_icon(py_icon); if (!py_slate_icon) { return PyErr_Format(PyExc_Exception, "argument is not a FSlateIcon"); } if (!PyCallable_Check(py_callable)) { return PyErr_Format(PyExc_Exception, "argument is not callable"); } FExecuteAction handler; TSharedRef<FPythonSlateDelegate> py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewStaticSlateDelegate(py_callable); if (py_obj) { Py_INCREF(py_obj); handler.BindSP(py_delegate, &FPythonSlateDelegate::ExecuteAction, py_obj); } else { handler.BindSP(py_delegate, &FPythonSlateDelegate::SimpleExecuteAction); } self->tool_bar_builder.AddToolBarButton(FUIAction(handler), FName(hook), FText::FromString(UTF8_TO_TCHAR(label)), FText::FromString(UTF8_TO_TCHAR(tooltip)), py_slate_icon->icon); Py_RETURN_NONE; } static PyObject *py_ue_ftool_bar_builder_add_separator(ue_PyFToolBarBuilder *self, PyObject * args) { char *hook = nullptr; if (!PyArg_ParseTuple(args, "|s:add_separator", &hook)) return NULL; FName f_name = NAME_None; if (hook) f_name = FName(UTF8_TO_TCHAR(hook)); self->tool_bar_builder.AddSeparator(f_name); Py_RETURN_NONE; } static PyObject *py_ue_ftool_bar_builder_begin_block_group(ue_PyFToolBarBuilder *self, PyObject * args) { self->tool_bar_builder.BeginBlockGroup(); Py_RETURN_NONE; } static PyObject *py_ue_ftool_bar_builder_end_block_group(ue_PyFToolBarBuilder *self, PyObject * args) { self->tool_bar_builder.EndBlockGroup(); Py_RETURN_NONE; } static PyObject *py_ue_ftool_bar_builder_make_widget(ue_PyFToolBarBuilder *self, PyObject * args) { return (PyObject *)py_ue_new_swidget<ue_PySWidget>(self->tool_bar_builder.MakeWidget(), &ue_PySWidgetType); } static PyMethodDef ue_PyFToolBarBuilder_methods[] = { { "begin_section", (PyCFunction)py_ue_ftool_bar_builder_begin_section, METH_VARARGS, "" }, { "end_section", (PyCFunction)py_ue_ftool_bar_builder_end_section, METH_VARARGS, "" }, { "add_tool_bar_button", (PyCFunction)py_ue_ftool_bar_builder_add_tool_bar_button, METH_VARARGS, "" }, { "add_separator", (PyCFunction)py_ue_ftool_bar_builder_add_separator, METH_VARARGS, "" }, { "begin_block_group", (PyCFunction)py_ue_ftool_bar_builder_begin_block_group, METH_VARARGS, "" }, { "end_block_group", (PyCFunction)py_ue_ftool_bar_builder_end_block_group, METH_VARARGS, "" }, { "make_widget", (PyCFunction)py_ue_ftool_bar_builder_make_widget, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; static PyObject *ue_PyFToolBarBuilder_str(ue_PyFToolBarBuilder *self) { return PyUnicode_FromFormat("<unreal_engine.FToolBarBuilder '%p'}>", &self->tool_bar_builder); } static void ue_py_ftool_bar_builder_dealloc(ue_PyFToolBarBuilder *self) { #if PY_MAJOR_VERSION < 3 self->ob_type->tp_free((PyObject*)self); #else Py_TYPE(self)->tp_free((PyObject*)self); #endif } static PyTypeObject ue_PyFToolBarBuilderType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.FToolBarBuilder", /* tp_name */ sizeof(ue_PyFToolBarBuilder), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)ue_py_ftool_bar_builder_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc)ue_PyFToolBarBuilder_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ "Unreal Engine FToolBarBuilder", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PyFToolBarBuilder_methods, /* tp_methods */ }; static int ue_py_ftool_bar_builder_init(ue_PyFToolBarBuilder *self, PyObject *args, PyObject *kwargs) { new(&self->tool_bar_builder) FToolBarBuilder(TSharedPtr<FUICommandList>(), FMultiBoxCustomization::None); return 0; } void ue_python_init_ftool_bar_builder(PyObject *ue_module) { ue_PyFToolBarBuilderType.tp_new = PyType_GenericNew; ue_PyFToolBarBuilderType.tp_init = (initproc)ue_py_ftool_bar_builder_init; if (PyType_Ready(&ue_PyFToolBarBuilderType) < 0) return; Py_INCREF(&ue_PyFToolBarBuilderType); PyModule_AddObject(ue_module, "FToolBarBuilder", (PyObject *)&ue_PyFToolBarBuilderType); } PyObject *py_ue_new_ftool_bar_builder(FToolBarBuilder tool_bar_builder) { ue_PyFToolBarBuilder *ret = (ue_PyFToolBarBuilder *)PyObject_New(ue_PyFToolBarBuilder, &ue_PyFToolBarBuilderType); new(&ret->tool_bar_builder) FToolBarBuilder(tool_bar_builder); return (PyObject *)ret; } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFToolBarBuilder.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
1,568
```c++ #include "UEPySPythonListView.h" #include "UEPySHeaderRow.h" void SPythonListView::SetHeaderRow(TSharedPtr<SHeaderRow> InHeaderRowWidget) { HeaderRow = InHeaderRowWidget; } static PyObject *py_ue_spython_list_view_get_selected_items(ue_PySPythonListView *self, PyObject * args) { ue_py_slate_cast(SPythonListView); PyObject *py_list = PyList_New(0); TArray<TSharedPtr<FPythonItem>> items = py_SPythonListView->GetSelectedItems(); for (auto item : items) { PyList_Append(py_list, item->py_object); } return py_list; } static PyObject *py_ue_spython_list_view_clear_selection(ue_PySPythonListView *self, PyObject * args) { ue_py_slate_cast(SPythonListView); py_SPythonListView->ClearSelection(); Py_RETURN_NONE; } static PyObject *py_ue_spython_list_view_get_num_items_selected(ue_PySPythonListView *self, PyObject * args) { ue_py_slate_cast(SPythonListView); return PyLong_FromLong(py_SPythonListView->GetNumItemsSelected()); } static PyObject *py_ue_spython_list_view_set_header_row(ue_PySPythonListView *self, PyObject * args) { ue_py_slate_cast(SPythonListView); PyObject *py_content; if (!PyArg_ParseTuple(args, "O:set_header_row", &py_content)) { return nullptr; } TSharedPtr<SHeaderRow> HeaderRow = py_ue_is_swidget<SHeaderRow>(py_content); if (!HeaderRow.IsValid()) { return nullptr; } py_SPythonListView->SetHeaderRow(HeaderRow); Py_RETURN_SLATE_SELF; } static PyObject *py_spython_list_view_update_item_source_list(ue_PySPythonListView *self, PyObject * args) { PyObject *values; if (!PyArg_ParseTuple(args, "O:update_item_source_list", &values)) { return NULL; } values = PyObject_GetIter(values); if (!values) { return PyErr_Format(PyExc_Exception, "argument is not an iterable"); } //NOTE: ikrimae: Increment first so we don't decrement and destroy python objects that //we're passing in e.g. if you pass the same item source array into update_items(). //Might not be necessary but I'm not too familiar with python's GC TArray<TSharedPtr<FPythonItem>> tempNewArray; while (PyObject *item = PyIter_Next(values)) { Py_INCREF(item); tempNewArray.Add(TSharedPtr<FPythonItem>(new FPythonItem(item))); } for (TSharedPtr<struct FPythonItem>& item : self->item_source_list) { Py_XDECREF(item->py_object); } self->item_source_list.Empty(); Move<TArray<TSharedPtr<FPythonItem>>>(self->item_source_list, tempNewArray); Py_RETURN_NONE; } static PyMethodDef ue_PySPythonListView_methods[] = { { "get_selected_items", (PyCFunction)py_ue_spython_list_view_get_selected_items, METH_VARARGS, "" }, { "get_num_items_selected", (PyCFunction)py_ue_spython_list_view_get_num_items_selected, METH_VARARGS, "" }, { "clear_selection", (PyCFunction)py_ue_spython_list_view_clear_selection, METH_VARARGS, "" }, { "set_header_row", (PyCFunction)py_ue_spython_list_view_set_header_row, METH_VARARGS, "" }, { "update_item_source_list", (PyCFunction)py_spython_list_view_update_item_source_list, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; static void ue_PySPythonListView_dealloc(ue_PySPythonListView *self) { #if defined(UEPY_MEMORY_DEBUG) UE_LOG(LogPython, Warning, TEXT("Destroying ue_PySPythonListView %p"), self); #endif for (TSharedPtr<struct FPythonItem>& item : self->item_source_list) { Py_XDECREF(item->py_object); } self->item_source_list.Empty(); Py_TYPE(self)->tp_free((PyObject *)self); } PyTypeObject ue_PySPythonListViewType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SPythonListView", /* tp_name */ sizeof(ue_PySPythonListView), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)ue_PySPythonListView_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SPythonListView", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySPythonListView_methods, /* tp_methods */ }; static int ue_py_spython_list_view_init(ue_PySPythonListView *self, PyObject *args, PyObject *kwargs) { ue_py_slate_setup_farguments(SPythonListView); // first of all check for values PyObject *values = ue_py_dict_get_item(kwargs, "list_items_source"); if (!values) { PyErr_SetString(PyExc_Exception, "you must specify list items"); return -1; } values = PyObject_GetIter(values); if (!values) { Py_DECREF(values); return -1; } new(&self->item_source_list) TArray<TSharedPtr<FPythonItem>>(); while (PyObject *item = PyIter_Next(values)) { Py_INCREF(item); self->item_source_list.Add(TSharedPtr<FPythonItem>(new FPythonItem(item))); } arguments.ListItemsSource(&self->item_source_list); { PyObject *value = ue_py_dict_get_item(kwargs, "header_row"); if (value) { if (ue_PySHeaderRow *_py_swidget = py_ue_is_sheader_row(value)) { arguments.HeaderRow(StaticCastSharedRef<SHeaderRow>(((ue_PySWidget *)_py_swidget)->Widget)); } else { PyErr_SetString(PyExc_TypeError, "unsupported type for attribute " "header_row"); return -1; } } } ue_py_slate_farguments_optional_enum("allow_overscroll", AllowOverscroll, EAllowOverscroll); ue_py_slate_farguments_optional_bool("clear_selection_on_click", ClearSelectionOnClick); ue_py_slate_farguments_optional_enum("consume_mouse_wheel", ConsumeMouseWheel, EConsumeMouseWheel); #if ENGINE_MINOR_VERSION > 12 ue_py_slate_farguments_optional_bool("handle_gamepad_events", HandleGamepadEvents); #endif ue_py_slate_farguments_float("item_height", ItemHeight); ue_py_slate_farguments_event("on_generate_row", OnGenerateRow, TSlateDelegates<TSharedPtr<FPythonItem>>::FOnGenerateRow, GenerateRow); ue_py_slate_farguments_event("on_selection_changed", OnSelectionChanged, TSlateDelegates<TSharedPtr<FPythonItem>>::FOnSelectionChanged, OnSelectionChanged); ue_py_slate_farguments_enum("selection_mode", SelectionMode, ESelectionMode::Type); #if ENGINE_MINOR_VERSION > 12 ue_py_slate_farguments_optional_float("wheel_scroll_multiplier", WheelScrollMultiplier); #endif ue_py_snew(SPythonListView); return 0; } void ue_python_init_spython_list_view(PyObject *ue_module) { ue_PySPythonListViewType.tp_init = (initproc)ue_py_spython_list_view_init; ue_PySPythonListViewType.tp_base = &ue_PySListViewType; if (PyType_Ready(&ue_PySPythonListViewType) < 0) return; Py_INCREF(&ue_PySPythonListViewType); PyModule_AddObject(ue_module, "SPythonListView", (PyObject *)&ue_PySPythonListViewType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySPythonListView.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
1,879
```objective-c #pragma once #include "UEPyModule.h" #include "Runtime/SlateCore/Public/Textures/SlateIcon.h" typedef struct { PyObject_HEAD /* Type-specific fields go here. */ FSlateIcon icon; } ue_PyFSlateIcon; void ue_python_init_fslate_icon(PyObject *); ue_PyFSlateIcon *py_ue_new_fslate_icon(const FSlateIcon slate_icon); ue_PyFSlateIcon *py_ue_is_fslate_icon(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFSlateIcon.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
105
```objective-c #pragma once #include "UEPySBorder.h" #include "Runtime/Slate/Public/Widgets/Views/SHeaderRow.h" extern PyTypeObject ue_PySHeaderRowType; typedef struct { ue_PySBorder s_border; /* Type-specific fields go here. */ } ue_PySHeaderRow; void ue_python_init_sheader_row(PyObject *); ue_PySHeaderRow *py_ue_is_sheader_row(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySHeaderRow.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
93
```c++ #include "UEPyFModifierKeysState.h" static PyObject *py_ue_fmodifier_keys_state_are_caps_locked(ue_PyFModifierKeysState *self, PyObject * args) { if (self->modifier.AreCapsLocked()) { Py_RETURN_TRUE; } Py_RETURN_FALSE; } static PyMethodDef ue_PyFModifierKeysState_methods[] = { { "are_caps_locked", (PyCFunction)py_ue_fmodifier_keys_state_are_caps_locked, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; static PyObject *ue_PyFModifierKeysState_str(ue_PyFModifierKeysState *self) { return PyUnicode_FromFormat("<unreal_engine.FModifierKeysState %p>", self); } static PyTypeObject ue_PyFModifierKeysStateType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.FModifierKeysState", /* tp_name */ sizeof(ue_PyFModifierKeysState), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc)ue_PyFModifierKeysState_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine FModifierKeysState", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PyFModifierKeysState_methods, /* tp_methods */ }; static int ue_py_fmodifier_keys_state_init(ue_PyFModifierKeysState *self, PyObject *args, PyObject *kwargs) { static char *kw_names[] = { (char *)"left_shift_down", (char *)"right_shift_down", (char *)"left_control_down", (char *)"right_control_down", (char *)"left_alt_down", (char *)"right_alt_down", (char *)"left_command_down", (char *)"right_command_down", (char *)"are_caps_locked", NULL }; PyObject *py_left_shift_down = nullptr; PyObject *py_right_shift_down = nullptr; PyObject *py_left_control_down = nullptr; PyObject *py_right_control_down = nullptr; PyObject *py_left_alt_down = nullptr; PyObject *py_right_alt_down = nullptr; PyObject *py_left_command_down = nullptr; PyObject *py_right_command_down = nullptr; PyObject *py_are_capse_locked = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOOOOOOOO", kw_names, &py_left_shift_down, &py_right_shift_down, &py_left_control_down, &py_right_control_down, &py_left_alt_down, &py_right_alt_down, &py_left_command_down, &py_right_command_down, &py_are_capse_locked)) { return -1; } bool bInIsLeftShiftDown = (py_left_shift_down && PyObject_IsTrue(py_left_shift_down)); bool bInIsRightShiftDown = (py_right_shift_down && PyObject_IsTrue(py_right_shift_down)); bool bInIsLeftControlDown = (py_left_control_down && PyObject_IsTrue(py_left_control_down)); bool bInIsRightControlDown = (py_right_control_down && PyObject_IsTrue(py_right_control_down)); bool bInIsLeftAltDown = (py_left_alt_down && PyObject_IsTrue(py_left_alt_down)); bool bInIsRightAltDown = (py_right_alt_down && PyObject_IsTrue(py_right_alt_down)); bool bInIsLeftCommandDown = (py_left_command_down && PyObject_IsTrue(py_left_command_down)); bool bInIsRightCommandDown = (py_right_command_down && PyObject_IsTrue(py_right_command_down)); bool bInAreCapsLocked = (py_are_capse_locked && PyObject_IsTrue(py_are_capse_locked)); new(&self->modifier) FModifierKeysState( bInIsLeftShiftDown, bInIsRightShiftDown, bInIsLeftControlDown, bInIsRightControlDown, bInIsLeftAltDown, bInIsRightAltDown, bInIsLeftCommandDown, bInIsRightCommandDown, bInAreCapsLocked); return 0; } void ue_python_init_fmodifier_keys_state(PyObject *ue_module) { ue_PyFModifierKeysStateType.tp_new = PyType_GenericNew; ue_PyFModifierKeysStateType.tp_init = (initproc)ue_py_fmodifier_keys_state_init; if (PyType_Ready(&ue_PyFModifierKeysStateType) < 0) return; Py_INCREF(&ue_PyFModifierKeysStateType); PyModule_AddObject(ue_module, "FModifierKeysState", (PyObject *)&ue_PyFModifierKeysStateType); } PyObject *py_ue_new_fmodifier_keys_state(FModifierKeysState modifier) { ue_PyFModifierKeysState *ret = (ue_PyFModifierKeysState *)PyObject_New(ue_PyFModifierKeysState, &ue_PyFModifierKeysStateType); new(&ret->modifier) FModifierKeysState(modifier); return (PyObject *)ret; } ue_PyFModifierKeysState *py_ue_is_fmodifier_keys_state(PyObject *obj) { if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFModifierKeysStateType)) return nullptr; return (ue_PyFModifierKeysState *)obj; } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFModifierKeysState.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
1,305
```objective-c #pragma once #include "UnrealEnginePython.h" #include "UEPySCompoundWidget.h" #include "Runtime/Slate/Public/Widgets/Input/SCheckBox.h" extern PyTypeObject ue_PySCheckBoxType; typedef struct { ue_PySCompoundWidget s_compound_widget; /* Type-specific fields go here. */ } ue_PySCheckBox; void ue_python_init_scheck_box(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySCheckBox.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
89
```objective-c #pragma once #include "UEPySWidget.h" extern PyTypeObject ue_PySCompoundWidgetType; typedef struct { ue_PySWidget s_widget; /* Type-specific fields go here. */ } ue_PySCompoundWidget; void ue_python_init_scompound_widget(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySCompoundWidget.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
63
```objective-c #pragma once #include "UnrealEnginePython.h" #include "UEPySTableViewBase.h" #include "Runtime/Slate/Public/Widgets/Views/SListView.h" extern PyTypeObject ue_PySListViewType; typedef struct { ue_PySTableViewBase s_table_view_base; /* Type-specific fields go here. */ } ue_PySListView; void ue_python_init_slist_view(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySListView.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
86
```c++ #include "UEPySTextBlock.h" static PyObject *py_ue_stext_block_set_text(ue_PySTextBlock *self, PyObject * args) { ue_py_slate_cast(STextBlock); char *text; if (!PyArg_ParseTuple(args, "s:set_text", &text)) { return nullptr; } py_STextBlock->SetText(FString(UTF8_TO_TCHAR(text))); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_stext_block_set_color_and_opacity(ue_PySTextBlock *self, PyObject * args) { ue_py_slate_cast(STextBlock); PyObject *py_color; if (!PyArg_ParseTuple(args, "O:set_color_and_opacity", &py_color)) { return nullptr; } ue_PyFLinearColor *py_linear_color = py_ue_is_flinearcolor(py_color); if (!py_linear_color) { return PyErr_Format(PyExc_Exception, "argument is not a FLinearColor"); } py_STextBlock->SetColorAndOpacity(py_linear_color->color); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_stext_block_get_text(ue_PySTextBlock *self, PyObject * args) { ue_py_slate_cast(STextBlock); return PyUnicode_FromString(TCHAR_TO_UTF8(*py_STextBlock->GetText().ToString())); } static PyMethodDef ue_PySTextBlock_methods[] = { { "set_color_and_opacity", (PyCFunction)py_ue_stext_block_set_color_and_opacity, METH_VARARGS, "" }, { "set_text", (PyCFunction)py_ue_stext_block_set_text, METH_VARARGS, "" }, { "get_text", (PyCFunction)py_ue_stext_block_get_text, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; DECLARE_UE_PY_SLATE_WIDGET(STextBlock); static int ue_py_stext_block_init(ue_PySTextBlock *self, PyObject *args, PyObject *kwargs) { ue_py_slate_setup_farguments(STextBlock); ue_py_slate_farguments_bool("autowrap_text", AutoWrapText); ue_py_slate_farguments_struct("color_and_opacity", ColorAndOpacity, FSlateColor); ue_py_slate_farguments_struct("font", Font, FSlateFontInfo); ue_py_slate_farguments_flinear_color("highlight_color", HighlightColor); ue_py_slate_farguments_optional_struct_ptr("highlight_shape", HighlightShape, FSlateBrush); ue_py_slate_farguments_text("highlight_text", HighlightText); ue_py_slate_farguments_enum("justification", Justification, ETextJustify::Type); ue_py_slate_farguments_float("line_height_percentage", LineHeightPercentage); ue_py_slate_farguments_struct("margin", Margin, FMargin); ue_py_slate_farguments_float("min_desired_width", MinDesiredWidth); #if ENGINE_MINOR_VERSION >= 23 ue_py_slate_farguments_event("on_double_clicked", OnDoubleClicked, FPointerEventHandler, OnMouseEvent); #else ue_py_slate_farguments_event("on_double_clicked", OnDoubleClicked, FOnClicked, OnClicked); #endif ue_py_slate_farguments_flinear_color("shadow_color_and_opacity", ShadowColorAndOpacity); ue_py_slate_farguments_fvector2d("shadow_offset", ShadowOffset); ue_py_slate_farguments_text("text", Text); ue_py_slate_farguments_optional_enum("text_flow_direction", TextFlowDirection, ETextFlowDirection); ue_py_slate_farguments_optional_enum("text_shaping_method", TextShapingMethod, ETextShapingMethod); ue_py_slate_farguments_optional_struct_ptr("text_style", TextStyle, FTextBlockStyle); ue_py_slate_farguments_enum("wrapping_policy", WrappingPolicy, ETextWrappingPolicy); ue_py_slate_farguments_float("wrap_text_at", WrapTextAt); ue_py_snew(STextBlock); return 0; } void ue_python_init_stext_block(PyObject *ue_module) { ue_PySTextBlockType.tp_init = (initproc)ue_py_stext_block_init; ue_PySTextBlockType.tp_base = &ue_PySLeafWidgetType; if (PyType_Ready(&ue_PySTextBlockType) < 0) return; Py_INCREF(&ue_PySTextBlockType); PyModule_AddObject(ue_module, "STextBlock", (PyObject *)&ue_PySTextBlockType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySTextBlock.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
980
```c++ #include "UEPyFKeyEvent.h" static PyObject *py_ue_fkey_event_get_key(ue_PyFKeyEvent *self, PyObject * args) { FKey key = self->key_event.GetKey(); return py_ue_new_owned_uscriptstruct(FKey::StaticStruct(), (uint8*)&key); } static PyObject *py_ue_fkey_event_get_key_name(ue_PyFKeyEvent *self, PyObject * args) { FKey key = self->key_event.GetKey(); return PyUnicode_FromString(TCHAR_TO_UTF8(*key.ToString())); } static PyMethodDef ue_PyFKeyEvent_methods[] = { { "get_key", (PyCFunction)py_ue_fkey_event_get_key, METH_VARARGS, "" }, { "get_key_name", (PyCFunction)py_ue_fkey_event_get_key_name, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; static PyObject *ue_PyFKeyEvent_str(ue_PyFKeyEvent *self) { return PyUnicode_FromFormat("<unreal_engine.FKeyEvent '%s'>", TCHAR_TO_UTF8(*self->key_event.ToText().ToString())); } static PyTypeObject ue_PyFKeyEventType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.FKeyEvent", /* tp_name */ sizeof(ue_PyFKeyEvent), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc)ue_PyFKeyEvent_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine FKeyEvent", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PyFKeyEvent_methods, /* tp_methods */ }; static int ue_py_fkey_event_init(ue_PyFKeyEvent *self, PyObject *args, PyObject *kwargs) { char *key; if (!PyArg_ParseTuple(args, "s", &key)) { return -1; } FKey InKey(key); // TODO make it configurable FModifierKeysState modifier; // TODO configure repeat FKeyEvent Event(InKey, modifier, 0, false, 0, 0); new(&self->key_event) FKeyEvent(Event); new(&self->f_input.input) FInputEvent(Event); return 0; } void ue_python_init_fkey_event(PyObject *ue_module) { ue_PyFKeyEventType.tp_base = &ue_PyFInputEventType; ue_PyFKeyEventType.tp_init = (initproc)ue_py_fkey_event_init; if (PyType_Ready(&ue_PyFKeyEventType) < 0) return; Py_INCREF(&ue_PyFKeyEventType); PyModule_AddObject(ue_module, "FKeyEvent", (PyObject *)&ue_PyFKeyEventType); } PyObject *py_ue_new_fkey_event(FKeyEvent key_event) { ue_PyFKeyEvent *ret = (ue_PyFKeyEvent *)PyObject_New(ue_PyFKeyEvent, &ue_PyFKeyEventType); new(&ret->key_event) FKeyEvent(key_event); new(&ret->f_input.input) FInputEvent(key_event); return (PyObject *)ret; } ue_PyFKeyEvent *py_ue_is_fkey_event(PyObject *obj) { if (!PyObject_IsInstance(obj, (PyObject *)&ue_PyFKeyEventType)) return nullptr; return (ue_PyFKeyEvent *)obj; } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFKeyEvent.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
894
```objective-c #pragma once #include "PythonSmartDelegate.h" #include "UEPySlatePythonItem.h" #include "Runtime/Slate/Public/Widgets/Views/SHeaderRow.h" #include "Runtime/Slate/Public/Widgets/Docking/SDockTab.h" #include "Runtime/Slate/Public/Widgets/Views/STableRow.h" #include "Runtime/Slate/Public/Framework/MultiBox/MultiBoxExtender.h" #include "AssetData.h" void unreal_engine_py_log_error(); template <typename T> T *ue_py_check_struct(PyObject *); class FPythonSlateDelegate : public FPythonSmartDelegate { public: FReply OnMouseEvent(const FGeometry &geometry, const FPointerEvent &pointer_event); FReply OnClicked(); FReply OnKeyDown(const FGeometry &geometry, const FKeyEvent &key_event); void OnTextChanged(const FText &text); void OnTextCommitted(const FText &text, ETextCommit::Type commit_type); void OnInt32Changed(int32 value); void OnInt32Committed(int32 value, ETextCommit::Type commit_type); void OnFloatChanged(float value); void OnFloatCommitted(float value, ETextCommit::Type commit_type); void OnSort(const EColumnSortPriority::Type SortPriority, const FName& ColumnName, const EColumnSortMode::Type NewSortMode); void OnLinearColorChanged(FLinearColor color); void OnStringChanged(const FString &text); TSharedRef<SDockTab> SpawnPythonTab(const FSpawnTabArgs& args); TSharedRef<ITableRow> GenerateRow(TSharedPtr<FPythonItem> InItem, const TSharedRef<STableViewBase>& OwnerTable); void GetChildren(TSharedPtr<FPythonItem> InItem, TArray<TSharedPtr<FPythonItem>>& OutChildren); #if WITH_EDITOR void OnAssetDoubleClicked(const FAssetData& AssetData); TSharedPtr<SWidget> OnGetAssetContextMenu(const TArray<FAssetData>& SelectedAssets); void OnAssetSelected(const FAssetData& AssetData); TSharedRef<FExtender> OnExtendContentBrowserMenu(const TArray<FAssetData> &SelectedAssets); void MenuPyAssetBuilder(FMenuBuilder &Builder, TArray<FAssetData> SelectedAssets); void OnAssetChanged(const FAssetData &AssetData); bool OnShouldFilterAsset(const FAssetData& AssetData); #endif void OnWindowClosed(const TSharedRef<SWindow> &Window); void SubMenuPyBuilder(FMenuBuilder &Builder); TSharedPtr<SWidget> OnContextMenuOpening(); TSharedRef<SWidget> OnGenerateWidget(TSharedPtr<FPythonItem> py_item); TSharedRef<SWidget> OnGetMenuContent(); void OnSelectionChanged(TSharedPtr<FPythonItem> py_item, ESelectInfo::Type select_type); void SimpleExecuteAction(); void ExecuteAction(PyObject *py_obj); FText GetterFText() const; FString GetterFString() const; float GetterFloat() const; TOptional<float> GetterTFloat() const; int GetterInt() const; bool GetterBool() const; FVector2D GetterFVector2D() const; FLinearColor GetterFLinearColor() const; void CheckBoxChanged(ECheckBoxState state); template<typename T> T GetterIntT() const { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, nullptr); if (!ret) { unreal_engine_py_log_error(); return (T)0; } if (!PyNumber_Check(ret)) { PyErr_SetString(PyExc_ValueError, "returned value is not a number"); Py_DECREF(ret); return (T)0; } PyObject *py_int = PyNumber_Long(ret); int n = PyLong_AsLong(py_int); Py_DECREF(py_int); Py_DECREF(ret); return (T)n; } template<typename T> T GetterStructT() const { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, nullptr); if (!ret) { unreal_engine_py_log_error(); return T(); } T *u_struct = ue_py_check_struct<T>(ret); if (!u_struct) { PyErr_SetString(PyExc_ValueError, "returned value is not a UStruct"); Py_DECREF(ret); return T(); } T u_struct_copy = *u_struct; Py_DECREF(ret); return u_struct_copy; } }; ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySlateDelegate.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
948
```objective-c #pragma once #include "UEPySCompoundWidget.h" #if WITH_EDITOR #if ENGINE_MINOR_VERSION > 13 #include "Developer/DesktopWidgets/Public/Widgets/Input/SDirectoryPicker.h" extern PyTypeObject ue_PySDirectoryPickerType; typedef struct { ue_PySCompoundWidget s_compound_widget; /* Type-specific fields go here. */ } ue_PySDirectoryPicker; void ue_python_init_sdirectory_picker(PyObject *); #endif #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySDirectoryPicker.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
97
```objective-c #pragma once #include "UnrealEnginePython.h" #include "UEPySCompoundWidget.h" #include "Runtime/Slate/Public/Widgets/Views/STableViewBase.h" extern PyTypeObject ue_PySTableViewBaseType; typedef struct { ue_PySCompoundWidget s_compound_widget; /* Type-specific fields go here. */ } ue_PySTableViewBase; void ue_python_init_stable_view_base(PyObject *); ue_PySTableViewBase *py_ue_is_stable_view_base(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySTableViewBase.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
108
```objective-c #pragma once #include "UEPySBoxPanel.h" #include "Runtime/SlateCore/Public/Widgets/SBoxPanel.h" extern PyTypeObject ue_PySVerticalBoxType; typedef struct { ue_PySBoxPanel s_box_panel; /* Type-specific fields go here. */ } ue_PySVerticalBox; void ue_python_init_svertical_box(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySVerticalBox.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
80
```c++ #include "UEPyFTabSpawnerEntry.h" static PyObject *py_ue_ftab_spawner_entry_set_display_name(ue_PyFTabSpawnerEntry *self, PyObject * args) { char *name; if (!PyArg_ParseTuple(args, "s:set_display_name", &name)) return NULL; self->spawner_entry->SetDisplayName(FText::FromString(UTF8_TO_TCHAR(name))); Py_INCREF(self); return (PyObject *)self; } static PyObject *py_ue_ftab_spawner_entry_set_tooltip_text(ue_PyFTabSpawnerEntry *self, PyObject * args) { char *tooltip; if (!PyArg_ParseTuple(args, "s:set_tooltip_text", &tooltip)) return NULL; self->spawner_entry->SetTooltipText(FText::FromString(UTF8_TO_TCHAR(tooltip))); Py_INCREF(self); return (PyObject *)self; } static PyMethodDef ue_PyFTabSpawnerEntry_methods[] = { { "set_display_name", (PyCFunction)py_ue_ftab_spawner_entry_set_display_name, METH_VARARGS, "" }, { "set_tooltip_text", (PyCFunction)py_ue_ftab_spawner_entry_set_tooltip_text, METH_VARARGS, "" }, //{ "set_group", (PyCFunction)py_ue_ftab_spawner_entry_set_group, METH_VARARGS, "" }, //{ "set_icon", (PyCFunction)py_ue_ftab_spawner_entry_set_icon, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; static PyObject *ue_PyFTabSpawnerEntry_str(ue_PyFTabSpawnerEntry *self) { return PyUnicode_FromFormat("<unreal_engine.FTabSpawnerEntry {'name': '%s'}>", TCHAR_TO_UTF8(*self->spawner_entry->GetDisplayName().ToString())); } static PyTypeObject ue_PyFTabSpawnerEntryType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.FTabSpawnerEntry", /* tp_name */ sizeof(ue_PyFTabSpawnerEntry), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc)ue_PyFTabSpawnerEntry_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ "Unreal Engine FTabSpawnerEntry", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PyFTabSpawnerEntry_methods, /* tp_methods */ }; void ue_python_init_ftab_spawner_entry(PyObject *ue_module) { ue_PyFTabSpawnerEntryType.tp_new = PyType_GenericNew; if (PyType_Ready(&ue_PyFTabSpawnerEntryType) < 0) return; Py_INCREF(&ue_PyFTabSpawnerEntryType); PyModule_AddObject(ue_module, "FTabSpawnerEntry", (PyObject *)&ue_PyFTabSpawnerEntryType); } PyObject *py_ue_new_ftab_spawner_entry(FTabSpawnerEntry *spawner_entry) { ue_PyFTabSpawnerEntry *ret = (ue_PyFTabSpawnerEntry *)PyObject_New(ue_PyFTabSpawnerEntry, &ue_PyFTabSpawnerEntryType); ret->spawner_entry = spawner_entry; return (PyObject *)ret; } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFTabSpawnerEntry.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
880
```c++ #include "UEPySlate.h" #if WITH_EDITOR #include "LevelEditor.h" #include "Editor/UnrealEd/Public/Toolkits/AssetEditorToolkit.h" #include "Editor/Persona/Public/PersonaModule.h" #if ENGINE_MINOR_VERSION > 13 #include "Editor/AnimationEditor/Public/IAnimationEditorModule.h" #endif #include "Editor/StaticMeshEditor/Public/StaticMeshEditorModule.h" #include "Editor/PropertyEditor/Public/PropertyEditorModule.h" #include "Editor/PropertyEditor/Public/ISinglePropertyView.h" #include "Editor/PropertyEditor/Public/IDetailsView.h" #include "Editor/ContentBrowser/Public/ContentBrowserModule.h" #endif #include "Runtime/Slate/Public/Framework/Commands/UICommandList.h" #include "Runtime/Slate/Public/Framework/Commands/UICommandInfo.h" #include "Runtime/Slate/Public/Framework/Docking/TabManager.h" #include "Runtime/Slate/Public/Widgets/Views/STableRow.h" #include "Runtime/SlateCore/Public/Styling/SlateIconFinder.h" #include "Runtime/AppFramework/Public/Widgets/Colors/SColorPicker.h" #include "UEPySlate.h" #include "PyNativeWidgetHost.h" #include "Wrappers/UEPyFAssetData.h" #include "Sound/SoundBase.h" #include "UEPySWidget.h" #include "UEPySCompoundWidget.h" #include "UEPySWindow.h" #include "UEPySBorder.h" #include "UEPySButton.h" #include "UEPySLeafWidget.h" #include "UEPySTextBlock.h" #include "UEPySEditableTextBox.h" #include "UEPySMultiLineEditableText.h" #include "UEPySPanel.h" #include "UEPySGridPanel.h" #include "UEPySBoxPanel.h" #include "UEPySHorizontalBox.h" #include "UEPySVerticalBox.h" #include "UEPySViewport.h" #include "UEPySImage.h" #include "UEPySDockTab.h" #include "UEPySTableViewBase.h" #include "UEPySListView.h" #include "UEPySPythonListView.h" #include "UEPySPythonMultiColumnTableRow.h" #include "UEPySTreeView.h" #include "UEPySPythonTreeView.h" #include "UEPySSplitter.h" #include "UEPySHeaderRow.h" #include "UEPySCheckBox.h" #include "UEPySNumericEntryBox.h" #include "UEPySCanvas.h" #include "UEPySSlider.h" #include "UEPySVectorInputBox.h" #include "UEPySRotatorInputBox.h" #include "UEPySPythonComboBox.h" #include "UEPySScrollBox.h" #include "UEPySColorBlock.h" #include "UEPySBox.h" #include "UEPySProgressBar.h" #include "UEPySSpacer.h" #include "UEPySPythonWidget.h" #include "UEPySOverlay.h" #include "UEPyFTabManager.h" #include "UEPyFTabSpawnerEntry.h" #include "UEPyFMenuBuilder.h" #include "UEPyFToolBarBuilder.h" #include "UEPyFSlateIcon.h" #include "UEPyFSlateStyleSet.h" #include "UEPyFGeometry.h" #include "UEPyFPaintContext.h" #include "UEPyFInputEvent.h" #include "UEPyFPointerEvent.h" #include "UEPyFKeyEvent.h" #include "UEPyFCharacterEvent.h" #include "UEPyFModifierKeysState.h" #include "Wrappers/UEPyESlateEnums.h" #if WITH_EDITOR #include "UEPySEditorViewport.h" #include "UEPySLevelViewport.h" #include "UEPySPythonEditorViewport.h" #include "UEPySGraphEditor.h" #include "UEPySPythonShelf.h" #include "UEPySFilePathPicker.h" #include "UEPySDirectoryPicker.h" #include "UEPySDropTarget.h" #include "UEPySAssetDropTarget.h" #include "UEPySObjectPropertyEntryBox.h" #include "UEPyIDetailsView.h" #include "UEPyIStructureDetailsView.h" #include "UEPySNodePanel.h" #include "UEPySGraphPanel.h" #endif #include "Runtime/Core/Public/Misc/Attribute.h" #include "Runtime/Slate/Public/Framework/Application/SlateApplication.h" #include "Runtime/SlateCore/Public/Styling/SlateStyleRegistry.h" #include "Runtime/Slate/Public/Framework/Commands/Commands.h" FReply FPythonSlateDelegate::OnMouseEvent(const FGeometry &geometry, const FPointerEvent &pointer_event) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"NN", py_ue_new_fgeometry(geometry), py_ue_new_fpointer_event(pointer_event)); if (!ret) { unreal_engine_py_log_error(); return FReply::Unhandled(); } if (ret == Py_False) { Py_DECREF(ret); return FReply::Unhandled(); } Py_DECREF(ret); return FReply::Handled(); } FReply FPythonSlateDelegate::OnKeyDown(const FGeometry &geometry, const FKeyEvent &key_event) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"NN", py_ue_new_fgeometry(geometry), py_ue_new_fkey_event(key_event)); if (!ret) { unreal_engine_py_log_error(); return FReply::Unhandled(); } if (ret == Py_False) { Py_DECREF(ret); return FReply::Unhandled(); } Py_DECREF(ret); return FReply::Handled(); } FReply FPythonSlateDelegate::OnClicked() { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, nullptr); if (!ret) { unreal_engine_py_log_error(); return FReply::Unhandled(); } if (ret == Py_False) { Py_DECREF(ret); return FReply::Unhandled(); } Py_DECREF(ret); return FReply::Handled(); } void FPythonSlateDelegate::OnTextChanged(const FText& text) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"s", TCHAR_TO_UTF8(*text.ToString())); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } void FPythonSlateDelegate::OnStringChanged(const FString& text) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"s", TCHAR_TO_UTF8(*text)); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } void FPythonSlateDelegate::OnTextCommitted(const FText& text, ETextCommit::Type commit_type) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"si", TCHAR_TO_UTF8(*text.ToString()), (int)commit_type); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } void FPythonSlateDelegate::OnInt32Changed(int32 value) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"i", value); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } void FPythonSlateDelegate::OnInt32Committed(int32 value, ETextCommit::Type commit_type) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"ii", value, (int)commit_type); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } void FPythonSlateDelegate::OnFloatChanged(float value) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"f", value); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } void FPythonSlateDelegate::OnLinearColorChanged(FLinearColor color) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", py_ue_new_flinearcolor(color)); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } void FPythonSlateDelegate::OnWindowClosed(const TSharedRef<SWindow> &Window) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", py_ue_new_swidget<ue_PySWindow>(StaticCastSharedRef<SWidget>(Window), &ue_PySWindowType)); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } void FPythonSlateDelegate::OnFloatCommitted(float value, ETextCommit::Type commit_type) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"fi", value, (int)commit_type); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } void FPythonSlateDelegate::OnSort(const EColumnSortPriority::Type SortPriority, const FName& ColumnName, const EColumnSortMode::Type NewSortMode) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"isi", (int)SortPriority, TCHAR_TO_UTF8(*ColumnName.ToString()), (int)NewSortMode); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } void FPythonSlateDelegate::CheckBoxChanged(ECheckBoxState state) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"i", (int)state); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } #if WITH_EDITOR void FPythonSlateDelegate::OnAssetDoubleClicked(const FAssetData& AssetData) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", py_ue_new_fassetdata(AssetData)); if (!ret) { unreal_engine_py_log_error(); } Py_XDECREF(ret); } void FPythonSlateDelegate::OnAssetSelected(const FAssetData& AssetData) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", py_ue_new_fassetdata(AssetData)); if (!ret) { unreal_engine_py_log_error(); } Py_XDECREF(ret); } void FPythonSlateDelegate::OnAssetChanged(const FAssetData& AssetData) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", py_ue_new_fassetdata(AssetData)); if (!ret) { unreal_engine_py_log_error(); } Py_XDECREF(ret); } bool FPythonSlateDelegate::OnShouldFilterAsset(const FAssetData& AssetData) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", py_ue_new_fassetdata(AssetData)); if (!ret) { unreal_engine_py_log_error(); return false; } bool bValue = PyObject_IsTrue(ret) ? true : false; Py_DECREF(ret); return bValue; } TSharedPtr<SWidget> FPythonSlateDelegate::OnGetAssetContextMenu(const TArray<FAssetData>& SelectedAssets) { FScopePythonGIL gil; PyObject *py_list = PyList_New(0); for (FAssetData asset : SelectedAssets) { PyList_Append(py_list, py_ue_new_fassetdata(asset)); } PyObject *ret = PyObject_CallFunction(py_callable, (char *)"O", py_list); Py_DECREF(py_list); if (!ret) { unreal_engine_py_log_error(); return nullptr; } TSharedPtr<SWidget> Widget = py_ue_is_swidget<SWidget>(ret); if (!Widget.IsValid()) { Py_DECREF(ret); PyErr_Clear(); UE_LOG(LogPython, Error, TEXT("returned value is not a SWidget")); return nullptr; } TSharedRef<SWidget> RefWidget = Widget.ToSharedRef(); Py_DECREF(ret); return RefWidget; } void FPythonSlateDelegate::MenuPyAssetBuilder(FMenuBuilder &Builder, TArray<FAssetData> SelectedAssets) { FScopePythonGIL gil; PyObject *py_list = PyList_New(0); for (FAssetData asset : SelectedAssets) { PyList_Append(py_list, py_ue_new_fassetdata(asset)); } PyObject *ret = PyObject_CallFunction(py_callable, (char *)"NO", py_ue_new_fmenu_builder(Builder), py_list); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } TSharedRef<FExtender> FPythonSlateDelegate::OnExtendContentBrowserMenu(const TArray<FAssetData>& SelectedAssets) { TSharedRef<FExtender> Extender(new FExtender()); Extender->AddMenuExtension((char *)"GetAssetActions", EExtensionHook::After, nullptr, FMenuExtensionDelegate::CreateSP(this, &FPythonSlateDelegate::MenuPyAssetBuilder, SelectedAssets)); return Extender; } #endif void FPythonSlateDelegate::SubMenuPyBuilder(FMenuBuilder &Builder) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", py_ue_new_fmenu_builder(Builder)); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } TSharedRef<SWidget> FPythonSlateDelegate::OnGenerateWidget(TSharedPtr<FPythonItem> py_item) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"O", py_item.Get()->py_object); if (!ret) { unreal_engine_py_log_error(); return SNullWidget::NullWidget; } TSharedPtr<SWidget> Widget = py_ue_is_swidget<SWidget>(ret); if (!Widget.IsValid()) { Py_DECREF(ret); UE_LOG(LogPython, Error, TEXT("returned value is not a SWidget")); PyErr_Clear(); return SNullWidget::NullWidget; } TSharedRef<SWidget> RefWidget = Widget.ToSharedRef(); Py_DECREF(ret); return RefWidget; } TSharedRef<SWidget> FPythonSlateDelegate::OnGetMenuContent() { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)""); if (!ret) { unreal_engine_py_log_error(); return SNullWidget::NullWidget; } TSharedPtr<SWidget> Widget = py_ue_is_swidget<SWidget>(ret); if (!Widget.IsValid()) { Py_DECREF(ret); PyErr_Clear(); UE_LOG(LogPython, Error, TEXT("returned value is not a SWidget")); return SNullWidget::NullWidget; } TSharedRef<SWidget> RefWidget = Widget.ToSharedRef(); Py_DECREF(ret); return RefWidget; } void FPythonSlateDelegate::OnSelectionChanged(TSharedPtr<FPythonItem> py_item, ESelectInfo::Type select_type) { if (!py_item.IsValid()) { return; } FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"Oi", py_item.Get()->py_object, (int)select_type); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } TSharedPtr<SWidget> FPythonSlateDelegate::OnContextMenuOpening() { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, nullptr); if (!ret) { unreal_engine_py_log_error(); return nullptr; } TSharedPtr<SWidget> Widget = py_ue_is_swidget<SWidget>(ret); if (!Widget.IsValid()) { Py_DECREF(ret); PyErr_Clear(); UE_LOG(LogPython, Error, TEXT("returned value is not a SWidget")); return nullptr; } TSharedRef<SWidget> RefWidget = Widget.ToSharedRef(); Py_DECREF(ret); return RefWidget; } void FPythonSlateDelegate::SimpleExecuteAction() { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, nullptr); if (!ret) { unreal_engine_py_log_error(); } Py_XDECREF(ret); } void FPythonSlateDelegate::ExecuteAction(PyObject *py_obj) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"O", py_obj); if (!ret) { unreal_engine_py_log_error(); } Py_XDECREF(ret); } FText FPythonSlateDelegate::GetterFText() const { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, nullptr); if (!ret) { unreal_engine_py_log_error(); return FText(); } PyObject *str = PyObject_Str(ret); if (!str) { unreal_engine_py_log_error(); Py_DECREF(ret); return FText(); } FText text = FText::FromString(UEPyUnicode_AsUTF8(str)); Py_DECREF(str); Py_DECREF(ret); return text; } FString FPythonSlateDelegate::GetterFString() const { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, nullptr); if (!ret) { unreal_engine_py_log_error(); return FString(); } PyObject *str = PyObject_Str(ret); if (!str) { unreal_engine_py_log_error(); Py_DECREF(ret); return FString(); } FString fstr = UTF8_TO_TCHAR(UEPyUnicode_AsUTF8(str)); Py_DECREF(str); Py_DECREF(ret); return fstr; } float FPythonSlateDelegate::GetterFloat() const { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, nullptr); if (!ret) { unreal_engine_py_log_error(); return 0; } if (!PyNumber_Check(ret)) { PyErr_SetString(PyExc_ValueError, "returned value is not a number"); Py_DECREF(ret); return 0; } PyObject *py_float = PyNumber_Float(ret); float n = PyFloat_AsDouble(py_float); Py_DECREF(py_float); Py_DECREF(ret); return n; } TOptional<float> FPythonSlateDelegate::GetterTFloat() const { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, nullptr); if (!ret) { unreal_engine_py_log_error(); return 0; } if (!PyNumber_Check(ret)) { PyErr_SetString(PyExc_ValueError, "returned value is not a number"); Py_DECREF(ret); return 0; } PyObject *py_float = PyNumber_Float(ret); float n = PyFloat_AsDouble(py_float); Py_DECREF(py_float); Py_DECREF(ret); return n; } int FPythonSlateDelegate::GetterInt() const { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, nullptr); if (!ret) { unreal_engine_py_log_error(); return 0; } if (!PyNumber_Check(ret)) { PyErr_SetString(PyExc_ValueError, "returned value is not a number"); Py_DECREF(ret); return 0; } PyObject *py_int = PyNumber_Long(ret); int n = PyLong_AsLong(py_int); Py_DECREF(py_int); Py_DECREF(ret); return n; } bool FPythonSlateDelegate::GetterBool() const { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, nullptr); if (!ret) { unreal_engine_py_log_error(); return 0; } if (PyObject_IsTrue(ret)) { Py_DECREF(ret); return true; } Py_DECREF(ret); return false; } FVector2D FPythonSlateDelegate::GetterFVector2D() const { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, nullptr); if (!ret) { unreal_engine_py_log_error(); return FVector2D(); } if (!PyTuple_Check(ret)) { Py_DECREF(ret); PyErr_SetString(PyExc_ValueError, "returned value is not a tuple"); return FVector2D(); } if (PyTuple_Size(ret) != 2) { Py_DECREF(ret); PyErr_SetString(PyExc_ValueError, "returned value is not a 2 items tuple"); return FVector2D(); } PyObject *first_item = PyTuple_GetItem(ret, 0); if (!PyNumber_Check(first_item)) { Py_DECREF(ret); PyErr_SetString(PyExc_ValueError, "tuple does not contain numbers"); return FVector2D(); } PyObject *py_x = PyNumber_Float(first_item); float x = (float)PyFloat_AsDouble(py_x); Py_DECREF(py_x); PyObject *py_y = PyNumber_Float(PyTuple_GetItem(ret, 1)); float y = (float)PyFloat_AsDouble(py_y); Py_DECREF(py_y); Py_DECREF(ret); return FVector2D(x, y); } FLinearColor FPythonSlateDelegate::GetterFLinearColor() const { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, nullptr); if (!ret) { unreal_engine_py_log_error(); return FLinearColor(); } ue_PyFLinearColor *py_color = py_ue_is_flinearcolor(ret); if (!py_color) { Py_DECREF(ret); PyErr_SetString(PyExc_ValueError, "returned value is not a FLinearColor"); return FLinearColor(); } FLinearColor color = py_color->color; Py_DECREF(ret); return color; } TSharedRef<SDockTab> FPythonSlateDelegate::SpawnPythonTab(const FSpawnTabArgs &args) { FScopePythonGIL gil; TSharedRef<SDockTab> dock_tab = SNew(SDockTab).TabRole(ETabRole::NomadTab); PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", ue_py_get_swidget(dock_tab)); if (!ret) { unreal_engine_py_log_error(); } else { Py_DECREF(ret); } return dock_tab; } TSharedRef<ITableRow> FPythonSlateDelegate::GenerateRow(TSharedPtr<FPythonItem> InItem, const TSharedRef<STableViewBase>& OwnerTable) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char*)"O", InItem.Get()->py_object); if (!ret) { unreal_engine_py_log_error(); return SNew(STableRow<TSharedPtr<FPythonItem>>, OwnerTable); } if (ue_PySPythonMultiColumnTableRow *spython_multicolumn_table_row = py_ue_is_spython_multicolumn_table_row(ret)) { return StaticCastSharedRef<SPythonMultiColumnTableRow>(spython_multicolumn_table_row->s_compound_widget.s_widget.Widget->AsShared()); } TSharedPtr<SWidget> Widget = py_ue_is_swidget<SWidget>(ret); Py_DECREF(ret); if (Widget.IsValid()) { return SNew(STableRow<TSharedPtr<FPythonItem>>, OwnerTable).Content()[Widget.ToSharedRef()]; } PyErr_Clear(); UE_LOG(LogPython, Error, TEXT("python callable did not return a SWidget")); return SNew(STableRow<TSharedPtr<FPythonItem>>, OwnerTable); } void FPythonSlateDelegate::GetChildren(TSharedPtr<FPythonItem> InItem, TArray<TSharedPtr<FPythonItem>>& OutChildren) { PyObject *ret = PyObject_CallFunction(py_callable, (char*)"O", InItem.Get()->py_object); if (!ret) { unreal_engine_py_log_error(); return; } PyObject *py_iterable = PyObject_GetIter(ret); if (!py_iterable || !PyIter_Check(py_iterable)) { UE_LOG(LogPython, Error, TEXT("returned value is not iterable")); Py_XDECREF(py_iterable); Py_DECREF(ret); return; } while (PyObject *item = PyIter_Next(py_iterable)) { Py_INCREF(item); OutChildren.Add(TSharedPtr<FPythonItem>(new FPythonItem(item))); } Py_DECREF(py_iterable); Py_DECREF(ret); } ue_PySWidget *ue_py_get_swidget(TSharedRef<SWidget> s_widget) { ue_PySWidget *ret = nullptr; if (s_widget->GetType().Compare(FName("SWindow")) == 0) { return py_ue_new_swidget<ue_PySWindow>(s_widget, &ue_PySWindowType); } if (s_widget->GetType().Compare(FName("SDockTab")) == 0) { return py_ue_new_swidget<ue_PySDockTab>(s_widget, &ue_PySDockTabType); } else { return py_ue_new_swidget<ue_PySWidget>(s_widget, &ue_PySWidgetType); } } void ue_python_init_slate(PyObject *module) { ue_python_init_swidget(module); ue_python_init_scompound_widget(module); ue_python_init_swindow(module); ue_python_init_sborder(module); ue_python_init_sbutton(module); ue_python_init_sleaf_widget(module); ue_python_init_stext_block(module); ue_python_init_seditable_text_box(module); ue_python_init_smulti_line_editable_text(module); ue_python_init_spanel(module); ue_python_init_sgrid_panel(module); ue_python_init_sbox_panel(module); ue_python_init_shorizontal_box(module); ue_python_init_svertical_box(module); ue_python_init_sviewport(module); ue_python_init_simage(module); ue_python_init_sdock_tab(module); ue_python_init_stable_view_base(module); ue_python_init_slist_view(module); ue_python_init_spython_list_view(module); ue_python_init_spython_multicolumn_table_row(module); ue_python_init_stree_view(module); ue_python_init_spython_tree_view(module); ue_python_init_ssplitter(module); ue_python_init_sheader_row(module); ue_python_init_scheck_box(module); ue_python_init_snumeric_entry_box(module); ue_python_init_scanvas(module); ue_python_init_sslider(module); ue_python_init_svector_input_box(module); ue_python_init_srotator_input_box(module); ue_python_init_spython_combo_box(module); ue_python_init_sscroll_box(module); ue_python_init_scolor_block(module); ue_python_init_sbox(module); ue_python_init_sprogress_bar(module); ue_python_init_sspacer(module); ue_python_init_spython_widget(module); ue_python_init_soverlay(module); #if WITH_EDITOR ue_python_init_snode_panel(module); #if ENGINE_MINOR_VERSION > 15 ue_python_init_sgraph_panel(module); #endif ue_python_init_idetails_view(module); ue_python_init_istructure_details_view(module); ue_python_init_seditor_viewport(module); ue_python_init_slevel_viewport(module); ue_python_init_spython_editor_viewport(module); ue_python_init_sgraph_editor(module); #if ENGINE_MINOR_VERSION > 14 ue_python_init_spython_shelf(module); #if ENGINE_MINOR_VERSION > 13 ue_python_init_sfile_path_picker(module); ue_python_init_sdirectory_picker(module); #endif #endif ue_python_init_sdrop_target(module); ue_python_init_sasset_drop_target(module); ue_python_init_sobject_property_entry_box(module); #endif ue_python_init_ftab_manager(module); ue_python_init_ftab_spawner_entry(module); ue_python_init_fmenu_builder(module); ue_python_init_fslate_style_set(module); ue_python_init_ftool_bar_builder(module); ue_python_init_fslate_icon(module); ue_python_init_fgeometry(module); ue_python_init_fpaint_context(module); ue_python_init_finput_event(module); ue_python_init_fpointer_event(module); ue_python_init_fkey_event(module); ue_python_init_fcharacter_event(module); ue_python_init_fmodifier_keys_state(module); ue_python_init_eslate_enums(module); } PyObject *ue_py_dict_get_item(PyObject *dict, const char *key) { if (dict == nullptr) return nullptr; return PyDict_GetItemString(dict, key); } PyObject *py_unreal_engine_get_editor_window(PyObject *self, PyObject *args) { if (!FGlobalTabmanager::Get()->GetRootWindow().IsValid()) { return PyErr_Format(PyExc_Exception, "no RootWindow found"); } return (PyObject *)ue_py_get_swidget(FGlobalTabmanager::Get()->GetRootWindow().ToSharedRef()); } PyObject *py_unreal_engine_find_slate_style(PyObject *self, PyObject *args) { char *name = nullptr; if (!PyArg_ParseTuple(args, "s:find_slate_style", &name)) return nullptr; ISlateStyle const* const foundStyleSet = FSlateStyleRegistry::FindSlateStyle(FName(name)); if (!foundStyleSet) { UE_LOG(LogPython, Warning, TEXT("Could not find SlateStyle")); Py_RETURN_NONE; } ue_PyFSlateStyleSet *ret = py_ue_new_fslate_style_set(static_cast<FSlateStyleSet*>(const_cast<ISlateStyle*>(foundStyleSet))); return (PyObject *)ret; } PyObject *py_unreal_engine_find_icon_for_class(PyObject *self, PyObject *args) { PyObject* py_class = nullptr; char *name = nullptr; if (!PyArg_ParseTuple(args, "O|s:find_icon_for_class", &py_class, &name)) return nullptr; UClass *u_class = ue_py_check_type<UClass>(py_class); if (!u_class) return PyErr_Format(PyExc_Exception, "argument is not a UClass object"); FSlateIcon foundIcon = FSlateIconFinder::FindIconForClass(u_class, FName(UTF8_TO_TCHAR(name))); ue_PyFSlateIcon *ret = py_ue_new_fslate_icon(foundIcon); return (PyObject *)ret; } // slate commands tool class class FPythonSlateCommands : public TCommands<FPythonSlateCommands> { public: FPythonSlateCommands() : TCommands<FPythonSlateCommands>(TEXT("UnrealEnginePython"), NSLOCTEXT("Contexts", "UnrealEnginePython", "UnrealEnginePython"), NAME_None, "EditorStyle") { } void Setup(char *command_name, PyObject *py_object) { py_callable = py_object; Py_INCREF(py_callable); name = FString(command_name); } // TCommands<> interface virtual void RegisterCommands() override { commands = MakeShareable(new FUICommandList); #if ENGINE_MINOR_VERSION >= 23 MakeUICommand_InternalUseOnly(this, command, nullptr, *name, *name, TCHAR_TO_UTF8(*name), *name, *name, EUserInterfaceActionType::Button, FInputGesture()); #else UI_COMMAND_Function(this, command, nullptr, *name, *name, TCHAR_TO_UTF8(*name), *name, *name, EUserInterfaceActionType::Button, FInputGesture()); #endif commands->MapAction(command, FExecuteAction::CreateRaw(this, &FPythonSlateCommands::Callback), FCanExecuteAction()); } void Callback() { FScopePythonGIL gil; PyObject *ret = PyObject_CallObject(py_callable, nullptr); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } void MenuBuilder(FMenuBuilder &Builder) { Builder.AddMenuEntry(command); } void MenuPyBuilder(FMenuBuilder &Builder) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", py_ue_new_fmenu_builder(Builder)); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } void MenuBarBuilder(FMenuBarBuilder &Builder) { FText label = FText::FromString(name); Builder.AddPullDownMenu(label, label, FNewMenuDelegate::CreateRaw(this, &FPythonSlateCommands::MenuPyBuilder)); } void ToolBarBuilder(FToolBarBuilder &Builder) { FScopePythonGIL gil; PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", py_ue_new_ftool_bar_builder(Builder)); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } TSharedPtr<FUICommandList> GetCommands() { return commands; } private: TSharedPtr<FUICommandList> commands; TSharedPtr<FUICommandInfo> command; PyObject *py_callable; FString name; }; #if WITH_EDITOR PyObject *py_unreal_engine_create_detail_view(PyObject *self, PyObject * args, PyObject *kwargs) { PyObject *py_object; PyObject *py_allow_search = nullptr; PyObject *py_update_from_selection = nullptr; PyObject *py_lockable = nullptr; char *py_name_area_settings = nullptr; PyObject *py_hide_selection_tip = nullptr; PyObject *py_search_initial_key_focus = nullptr; char *kwlist[] = { (char *)"uobject", (char *)"allow_search", (char *)"update_from_selection", (char *)"lockable", (char *)"name_area_settings", (char *)"hide_selection_tip", (char *)"search_initial_key_focus", nullptr }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOOOsOO:create_detail_view", kwlist, &py_object, &py_allow_search, &py_update_from_selection, &py_lockable, &py_name_area_settings, &py_hide_selection_tip, &py_search_initial_key_focus)) { return nullptr; } FPropertyEditorModule& PropertyEditorModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor"); FDetailsViewArgs view_args; view_args.bAllowSearch = (py_allow_search) ? PyObject_IsTrue(py_allow_search) : view_args.bAllowSearch; view_args.bUpdatesFromSelection = (py_update_from_selection) ? PyObject_IsTrue(py_update_from_selection) : view_args.bUpdatesFromSelection; view_args.bLockable = (py_lockable) ? PyObject_IsTrue(py_lockable) : view_args.bLockable; view_args.bHideSelectionTip = (py_hide_selection_tip) ? PyObject_IsTrue(py_hide_selection_tip) : view_args.bHideSelectionTip; view_args.bSearchInitialKeyFocus = (py_search_initial_key_focus) ? PyObject_IsTrue(py_search_initial_key_focus) : view_args.bSearchInitialKeyFocus; FString name_area_string = py_name_area_settings ? FString(UTF8_TO_TCHAR(py_name_area_settings)) : FString(); view_args.NameAreaSettings = [&name_area_string]() { if (FCString::Stricmp(*name_area_string, TEXT("HideNameArea")) == 0) { return FDetailsViewArgs::ENameAreaSettings::HideNameArea; } else if (FCString::Stricmp(*name_area_string, TEXT("ObjectsUseNameArea")) == 0) { return FDetailsViewArgs::ENameAreaSettings::ObjectsUseNameArea; } else if (FCString::Stricmp(*name_area_string, TEXT("ActorsUseNameArea")) == 0) { return FDetailsViewArgs::ENameAreaSettings::ActorsUseNameArea; } else if (FCString::Stricmp(*name_area_string, TEXT("ComponentsAndActorsUseNameArea")) == 0) { return FDetailsViewArgs::ENameAreaSettings::ComponentsAndActorsUseNameArea; } else { return FDetailsViewArgs::ENameAreaSettings::ActorsUseNameArea; } }(); TSharedPtr<IDetailsView> view = PropertyEditorModule.CreateDetailView(view_args); if (UObject *u_object = ue_py_check_type<UObject>(py_object)) { view->SetObject(u_object); } extern PyTypeObject ue_PyIDetailsViewType; return (PyObject *)py_ue_new_swidget<ue_PyIDetailsView>(view->AsShared(), &ue_PyIDetailsViewType); } PyObject *py_unreal_engine_create_structure_detail_view(PyObject *self, PyObject * args, PyObject *kwargs) { PyObject *py_object = nullptr; PyObject *py_allow_search = nullptr; PyObject *py_update_from_selection = nullptr; PyObject *py_lockable = nullptr; char *py_name_area_settings = nullptr; PyObject *py_hide_selection_tip = nullptr; PyObject *py_search_initial_key_focus = nullptr; char *kwlist[] = { (char*)"struct_data", (char *)"allow_search", (char *)"update_from_selection", (char *)"lockable", (char *)"name_area_settings", (char *)"hide_selection_tip", (char *)"search_initial_key_focus", nullptr }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOOOsOO:create_structure_detail_view", kwlist, &py_object, &py_allow_search, &py_update_from_selection, &py_lockable, &py_name_area_settings, &py_hide_selection_tip, &py_search_initial_key_focus)) { return nullptr; } if (py_object && !py_ue_is_uscriptstruct(py_object)) { return PyErr_Format(PyExc_Exception, "argument is not a UScriptStruct"); } FDetailsViewArgs view_args; view_args.bAllowSearch = (py_allow_search) ? PyObject_IsTrue(py_allow_search) : view_args.bAllowSearch; view_args.bUpdatesFromSelection = (py_update_from_selection) ? PyObject_IsTrue(py_update_from_selection) : view_args.bUpdatesFromSelection; view_args.bLockable = (py_lockable) ? PyObject_IsTrue(py_lockable) : view_args.bLockable; view_args.bHideSelectionTip = (py_hide_selection_tip) ? PyObject_IsTrue(py_hide_selection_tip) : view_args.bHideSelectionTip; view_args.bSearchInitialKeyFocus = (py_search_initial_key_focus) ? PyObject_IsTrue(py_search_initial_key_focus) : view_args.bSearchInitialKeyFocus; FString name_area_string = py_name_area_settings ? FString(UTF8_TO_TCHAR(py_name_area_settings)) : FString(); view_args.NameAreaSettings = [&name_area_string]() { if (FCString::Stricmp(*name_area_string, TEXT("HideNameArea")) == 0) { return FDetailsViewArgs::ENameAreaSettings::HideNameArea; } else if (FCString::Stricmp(*name_area_string, TEXT("ObjectsUseNameArea")) == 0) { return FDetailsViewArgs::ENameAreaSettings::ObjectsUseNameArea; } else if (FCString::Stricmp(*name_area_string, TEXT("ActorsUseNameArea")) == 0) { return FDetailsViewArgs::ENameAreaSettings::ActorsUseNameArea; } else if (FCString::Stricmp(*name_area_string, TEXT("ComponentsAndActorsUseNameArea")) == 0) { return FDetailsViewArgs::ENameAreaSettings::ComponentsAndActorsUseNameArea; } else { return FDetailsViewArgs::ENameAreaSettings::ActorsUseNameArea; } }(); FStructureDetailsViewArgs struct_view_args; { struct_view_args.bShowObjects = true; struct_view_args.bShowAssets = true; struct_view_args.bShowClasses = true; struct_view_args.bShowInterfaces = true; } extern PyTypeObject ue_PyIStructureDetailsViewType; ue_PyIStructureDetailsView *ret = (ue_PyIStructureDetailsView *)PyObject_New(ue_PyIStructureDetailsView, &ue_PyIStructureDetailsViewType); new(&ret->istructure_details_view) TSharedPtr<IStructureDetailsView>(nullptr); ret->ue_py_struct = nullptr; TSharedPtr<FStructOnScope> struct_scope; if (ue_PyUScriptStruct *ue_py_struct = py_ue_is_uscriptstruct(py_object)) { Py_INCREF(ue_py_struct); ret->ue_py_struct = ue_py_struct; struct_scope = MakeShared<FStructOnScope>(ue_py_struct->u_struct, ue_py_struct->u_struct_ptr); } FPropertyEditorModule& PropertyEditorModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor"); ret->istructure_details_view = PropertyEditorModule.CreateStructureDetailView(view_args, struct_view_args, struct_scope); return (PyObject *)ret; } PyObject *py_unreal_engine_create_property_view(PyObject *self, PyObject * args, PyObject *kwargs) { PyObject *py_object; char *name; char *name_override = nullptr; char *kwlist[] = { (char*)"uobject", (char *)"name", (char *)"name_override", nullptr }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Os|s:create_property_view", kwlist, &py_object, &name, &name_override)) { return nullptr; } UObject *u_object = ue_py_check_type<UObject>(py_object); if (!u_object) { return PyErr_Format(PyExc_Exception, "argument is not a UObject"); } FPropertyEditorModule& PropertyEditorModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor"); FSinglePropertyParams params; if (name_override) params.NameOverride = FText::FromString(UTF8_TO_TCHAR(name_override)); auto view_widget = PropertyEditorModule.CreateSingleProperty(u_object, FName(name), params); if (!view_widget.IsValid()) return PyErr_Format(PyExc_Exception, "unable to create SingleProperty widget"); return (PyObject *)py_ue_new_swidget<ue_PySWidget>(view_widget->AsShared(), &ue_PySWidgetType); } PyObject *py_unreal_engine_add_menu_extension(PyObject * self, PyObject * args) { char *command_name; PyObject *py_callable; char *hook = (char *)"WindowLayout"; char *module = (char*)"LevelEditor"; if (!PyArg_ParseTuple(args, "sO|ss:add_menu_extension", &command_name, &py_callable, &hook, &module)) { return NULL; } if (!FModuleManager::Get().ModuleExists(UTF8_TO_TCHAR(module))) return PyErr_Format(PyExc_Exception, "module %s does not exist", module); // unfortunately we need to manually check for module names :( IHasMenuExtensibility *menu_extension_interface = nullptr; if (!strcmp(module, (char *)"LevelEditor")) { FLevelEditorModule &Module = FModuleManager::LoadModuleChecked<FLevelEditorModule>(module); menu_extension_interface = (IHasMenuExtensibility *)&Module; } else if (!strcmp(module, (char *)"Persona")) { FPersonaModule &Module = FModuleManager::LoadModuleChecked<FPersonaModule>(module); menu_extension_interface = (IHasMenuExtensibility *)&Module; } #if ENGINE_MINOR_VERSION > 13 else if (!strcmp(module, (char *)"AnimationEditor")) { IAnimationEditorModule &Module = FModuleManager::LoadModuleChecked<IAnimationEditorModule>(module); menu_extension_interface = (IHasMenuExtensibility *)&Module; } #endif else if (!strcmp(module, (char *)"StaticMeshEditor")) { IStaticMeshEditorModule &Module = FModuleManager::LoadModuleChecked<IStaticMeshEditorModule>(module); menu_extension_interface = (IHasMenuExtensibility *)&Module; } if (!menu_extension_interface) return PyErr_Format(PyExc_Exception, "module %s is not supported", module); if (!PyCallable_Check(py_callable)) return PyErr_Format(PyExc_Exception, "argument is not callable"); TSharedRef<FPythonSlateCommands> *commands = new TSharedRef<FPythonSlateCommands>(new FPythonSlateCommands()); commands->Get().Setup(command_name, py_callable); commands->Get().RegisterCommands(); TSharedRef<FExtender> extender = MakeShareable(new FExtender()); extender->AddMenuExtension(hook, EExtensionHook::After, commands->Get().GetCommands(), FMenuExtensionDelegate::CreateRaw(&commands->Get(), &FPythonSlateCommands::MenuBuilder)); menu_extension_interface->GetMenuExtensibilityManager()->AddExtender(extender); Py_RETURN_NONE; } PyObject *py_unreal_engine_add_menu_bar_extension(PyObject * self, PyObject * args) { char *command_name; PyObject *py_callable; char *hook = (char *)"Help"; if (!PyArg_ParseTuple(args, "sO|s:add_menu_bar_extension", &command_name, &py_callable, &hook)) { return NULL; } FLevelEditorModule &ExtensibleModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor"); if (!PyCallable_Check(py_callable)) return PyErr_Format(PyExc_Exception, "argument is not callable"); TSharedRef<FPythonSlateCommands> *commands = new TSharedRef<FPythonSlateCommands>(new FPythonSlateCommands()); commands->Get().Setup(command_name, py_callable); commands->Get().RegisterCommands(); TSharedRef<FExtender> extender = MakeShareable(new FExtender()); extender->AddMenuBarExtension(hook, EExtensionHook::After, commands->Get().GetCommands(), FMenuBarExtensionDelegate::CreateRaw(&commands->Get(), &FPythonSlateCommands::MenuBarBuilder)); ExtensibleModule.GetMenuExtensibilityManager()->AddExtender(extender); Py_RETURN_NONE; } PyObject *py_unreal_engine_add_tool_bar_extension(PyObject * self, PyObject * args) { char *command_name; PyObject *py_callable; char *hook = (char *)"Settings"; if (!PyArg_ParseTuple(args, "sO|s:add_tool_bar_extension", &command_name, &py_callable, &hook)) { return NULL; } FLevelEditorModule &ExtensibleModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor"); if (!PyCallable_Check(py_callable)) return PyErr_Format(PyExc_Exception, "argument is not callable"); TSharedRef<FPythonSlateCommands> *commands = new TSharedRef<FPythonSlateCommands>(new FPythonSlateCommands()); commands->Get().Setup(command_name, py_callable); commands->Get().RegisterCommands(); TSharedRef<FExtender> extender = MakeShareable(new FExtender()); extender->AddToolBarExtension(hook, EExtensionHook::After, commands->Get().GetCommands(), FToolBarExtensionDelegate::CreateRaw(&commands->Get(), &FPythonSlateCommands::ToolBarBuilder)); ExtensibleModule.GetToolBarExtensibilityManager()->AddExtender(extender); Py_INCREF(Py_None); return Py_None; } PyObject *py_unreal_engine_add_asset_view_context_menu_extension(PyObject * self, PyObject * args) { PyObject *py_callable; if (!PyArg_ParseTuple(args, "O:add_asset_view_context_menu_extension", &py_callable)) { return NULL; } if (!PyCallable_Check(py_callable)) return PyErr_Format(PyExc_Exception, "argument is not callable"); FContentBrowserModule &ContentBrowser = FModuleManager::LoadModuleChecked<FContentBrowserModule>("ContentBrowser"); TArray<FContentBrowserMenuExtender_SelectedAssets> &Extenders = ContentBrowser.GetAllAssetViewContextMenuExtenders(); FContentBrowserMenuExtender_SelectedAssets handler; TSharedRef<FPythonSlateDelegate> py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewStaticSlateDelegate(py_callable); handler.BindSP(py_delegate, &FPythonSlateDelegate::OnExtendContentBrowserMenu); Extenders.Add(handler); Py_RETURN_NONE; } #endif PyObject *py_unreal_engine_register_nomad_tab_spawner(PyObject * self, PyObject * args) { char *name; PyObject *py_callable; PyObject *py_icon = nullptr; if (!PyArg_ParseTuple(args, "sO|O:register_nomad_tab_spawner", &name, &py_callable, &py_icon)) { return NULL; } if (!PyCallable_Check(py_callable)) return PyErr_Format(PyExc_Exception, "argument is not callable"); FOnSpawnTab spawn_tab; TSharedRef<FPythonSlateDelegate> py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewStaticSlateDelegate(py_callable); spawn_tab.BindSP(py_delegate, &FPythonSlateDelegate::SpawnPythonTab); FName TabName = FName(UTF8_TO_TCHAR(name)); // avoid crash if re-registering the same tab FGlobalTabmanager::Get()->UnregisterNomadTabSpawner(TabName); FSlateIcon Icon = FSlateIcon(); if (py_icon) { ue_PyFSlateIcon *slate_icon = py_ue_is_fslate_icon(py_icon); if (!slate_icon) { return PyErr_Format(PyExc_Exception, "argument is not a FSlateIcon"); } Icon = slate_icon->icon; } FTabSpawnerEntry *SpawnerEntry = &FGlobalTabmanager::Get()->RegisterNomadTabSpawner(TabName, spawn_tab) .SetDisplayName(FText::FromString((TabName).ToString())) .SetTooltipText(FText::FromString((TabName).ToString())) .SetIcon(Icon) // TODO: more generic way to set the group #if WITH_EDITOR .SetGroup(WorkspaceMenu::GetMenuStructure().GetDeveloperToolsMiscCategory()) #endif ; PyObject *ret = py_ue_new_ftab_spawner_entry(SpawnerEntry); Py_INCREF(ret); return ret; } PyObject *py_unreal_engine_unregister_nomad_tab_spawner(PyObject * self, PyObject * args) { char *name; if (!PyArg_ParseTuple(args, "s:unregister_nomad_tab_spawner", &name)) { return NULL; } FGlobalTabmanager::Get()->UnregisterNomadTabSpawner(UTF8_TO_TCHAR(name)); Py_INCREF(Py_None); return Py_None; } PyObject *py_unreal_engine_invoke_tab(PyObject * self, PyObject * args) { char *name; if (!PyArg_ParseTuple(args, "s:invoke_tab", &name)) { return NULL; } FGlobalTabmanager::Get()->InvokeTab(FTabId(FName(UTF8_TO_TCHAR(name)))); Py_INCREF(Py_None); return Py_None; } PyObject * py_unreal_engine_get_swidget_from_wrapper(PyObject *self, PyObject *args) { PyObject *py_object; if (!PyArg_ParseTuple(args, "O:get_swidget_from_wrapper", &py_object)) { return NULL; } FPythonSWidgetWrapper *py_swidget_wrapper = ue_py_check_struct<FPythonSWidgetWrapper>(py_object); if (!py_swidget_wrapper) return PyErr_Format(PyExc_Exception, "argument is not a FPythonSWidgetWrapper"); if (!py_swidget_wrapper->Widget.IsValid()) return PyErr_Format(PyExc_Exception, "wrapper contained invalid SWidget!"); return (PyObject *)py_ue_new_swidget<ue_PySWidget>(py_swidget_wrapper->Widget->AsShared(), &ue_PySWidgetType); } PyObject * py_unreal_engine_create_wrapper_from_pyswidget(PyObject *self, PyObject *args) { PyObject *py_object; if (!PyArg_ParseTuple(args, "O:create_wrapper_from_pyswidget", &py_object)) { return NULL; } TSharedPtr<SWidget> Widget = py_ue_is_swidget<SWidget>(py_object); if (!Widget.IsValid()) { return nullptr; } FPythonSWidgetWrapper py_swidget_wrapper; py_swidget_wrapper.Widget = Widget; return py_ue_new_owned_uscriptstruct(FPythonSWidgetWrapper::StaticStruct(), (uint8 *)&py_swidget_wrapper); } PyObject *py_unreal_engine_open_color_picker(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject *py_callable = nullptr; char *kwlist[] = { (char *)"on_color_committed", nullptr }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:open_color_picker", kwlist, &py_callable)) { return nullptr; } if (!PyCallable_Check(py_callable)) { return PyErr_Format(PyExc_Exception, "on_color_committed must be a callable"); } TSharedRef<FPythonSlateDelegate> py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewStaticSlateDelegate(py_callable); FColorPickerArgs color_args; color_args.OnColorCommitted.BindSP(py_delegate, &FPythonSlateDelegate::OnLinearColorChanged); if (OpenColorPicker(color_args)) { Py_RETURN_TRUE; } Py_RETURN_FALSE; } PyObject *py_unreal_engine_destroy_color_picker(PyObject *self, PyObject * args) { DestroyColorPicker(); Py_RETURN_NONE; } PyObject *py_unreal_engine_play_sound(PyObject *self, PyObject * args) { PyObject *py_sound; int user_index; if (!PyArg_ParseTuple(args, "O|i:play_sound", &py_sound, &user_index)) { return nullptr; } FSlateSound *sound = ue_py_check_struct<FSlateSound>(py_sound); if (!sound) { USoundBase *u_sound = ue_py_check_type<USoundBase>(py_sound); if (u_sound) { FSlateSound slate_sound = FSlateSound(); slate_sound.SetResourceObject(u_sound); sound = &slate_sound; } } if (!sound) { return PyErr_Format(PyExc_Exception, "argument is not a FSlateColor or a USoundBase"); } FSlateApplication::Get().PlaySound(*sound, user_index); Py_RETURN_NONE; } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySlate.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
11,774
```objective-c #pragma once #include "UnrealEnginePython.h" struct FPythonItem { PyObject *py_object = nullptr; FPythonItem(PyObject *item) { py_object = item; } }; ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySlatePythonItem.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
46
```c++ #include "UEPySNumericEntryBox.h" static PyMethodDef ue_PySNumericEntryBox_methods[] = { { NULL } /* Sentinel */ }; PyTypeObject ue_PySNumericEntryBoxType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SNumericEntryBox", /* tp_name */ sizeof(ue_PySNumericEntryBox), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SNumericEntryBox", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySNumericEntryBox_methods, /* tp_methods */ }; static int ue_py_snumeric_entry_box_init(ue_PySNumericEntryBox *self, PyObject *args, PyObject *kwargs) { PyObject *py_numeric_type = ue_py_dict_get_item(kwargs, "numeric_type"); if (py_numeric_type && PyLong_Check(py_numeric_type)) { ue_py_slate_setup_farguments(SNumericEntryBox<int32>); ue_py_slate_farguments_optional_bool("allow_spin", AllowSpin); ue_py_slate_farguments_optional_struct("border_background_color", BorderBackgroundColor, FSlateColor); ue_py_slate_farguments_optional_struct("border_foreground_color", BorderForegroundColor, FSlateColor); ue_py_slate_farguments_int("delta", Delta); ue_py_slate_farguments_optional_struct_ptr("editable_text_box_style", EditableTextBoxStyle, FEditableTextBoxStyle); ue_py_slate_farguments_struct("font", Font, FSlateFontInfo); ue_py_slate_farguments_optional_struct("label_padding", LabelPadding, FMargin); ue_py_slate_farguments_optional_enum("label_v_align", LabelVAlign, EVerticalAlignment); ue_py_slate_farguments_tint("max_slider_value", MaxSliderValue); ue_py_slate_farguments_tint("max_value", MaxValue); ue_py_slate_farguments_float("min_desired_value_width", MinDesiredValueWidth); ue_py_slate_farguments_tint("min_slider_value", MinSliderValue); ue_py_slate_farguments_tint("min_value", MinValue); ue_py_slate_farguments_struct("override_text_margin", OverrideTextMargin, FMargin); ue_py_slate_farguments_float("slider_exponent", SliderExponent); ue_py_slate_farguments_optional_text("undetermined_string", UndeterminedString); ue_py_slate_farguments_tint("value", Value); ue_py_slate_farguments_event("on_begin_slider_movement", OnBeginSliderMovement, FSimpleDelegate, SimpleExecuteAction); ue_py_slate_farguments_event("on_end_slider_movement", OnEndSliderMovement, FOnInt32ValueChanged, OnInt32Changed); ue_py_slate_farguments_event("on_value_changed", OnValueChanged, FOnInt32ValueChanged, OnInt32Changed); ue_py_slate_farguments_event("on_value_committed", OnValueCommitted, FOnInt32ValueCommitted, OnInt32Committed); ue_py_snew(SNumericEntryBox<int32>); } else { ue_py_slate_setup_farguments(SNumericEntryBox<float>); ue_py_slate_farguments_optional_bool("allow_spin", AllowSpin); ue_py_slate_farguments_optional_struct("border_background_color", BorderBackgroundColor, FSlateColor); ue_py_slate_farguments_optional_struct("border_foreground_color", BorderForegroundColor, FSlateColor); ue_py_slate_farguments_float("delta", Delta); ue_py_slate_farguments_optional_struct_ptr("editable_text_box_style", EditableTextBoxStyle, FEditableTextBoxStyle); ue_py_slate_farguments_struct("font", Font, FSlateFontInfo); ue_py_slate_farguments_optional_struct("label_padding", LabelPadding, FMargin); ue_py_slate_farguments_optional_enum("label_v_align", LabelVAlign, EVerticalAlignment); ue_py_slate_farguments_tfloat("max_slider_value", MaxSliderValue); ue_py_slate_farguments_tfloat("max_value", MaxValue); ue_py_slate_farguments_float("min_desired_value_width", MinDesiredValueWidth); ue_py_slate_farguments_tfloat("min_slider_value", MinSliderValue); ue_py_slate_farguments_tfloat("min_value", MinValue); ue_py_slate_farguments_struct("override_text_margin", OverrideTextMargin, FMargin); ue_py_slate_farguments_float("slider_exponent", SliderExponent); ue_py_slate_farguments_optional_text("undetermined_string", UndeterminedString); ue_py_slate_farguments_tfloat("value", Value); ue_py_slate_farguments_event("on_begin_slider_movement", OnBeginSliderMovement, FSimpleDelegate, SimpleExecuteAction); ue_py_slate_farguments_event("on_end_slider_movement", OnEndSliderMovement, FOnFloatValueChanged, OnFloatChanged); ue_py_slate_farguments_event("on_value_changed", OnValueChanged, FOnFloatValueChanged, OnFloatChanged); ue_py_slate_farguments_event("on_value_committed", OnValueCommitted, FOnFloatValueCommitted, OnFloatCommitted); ue_py_snew(SNumericEntryBox<float>); } return 0; } void ue_python_init_snumeric_entry_box(PyObject *ue_module) { ue_PySNumericEntryBoxType.tp_init = (initproc)ue_py_snumeric_entry_box_init; ue_PySNumericEntryBoxType.tp_base = &ue_PySCompoundWidgetType; if (PyType_Ready(&ue_PySNumericEntryBoxType) < 0) return; Py_INCREF(&ue_PySNumericEntryBoxType); PyModule_AddObject(ue_module, "SNumericEntryBox", (PyObject *)&ue_PySNumericEntryBoxType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySNumericEntryBox.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
1,484
```c++ #include "UEPySColorBlock.h" static PyMethodDef ue_PySColorBlock_methods[] = { { NULL } /* Sentinel */ }; PyTypeObject ue_PySColorBlockType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SColorBlock", /* tp_name */ sizeof(ue_PySColorBlock), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SColorBlock", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySColorBlock_methods, /* tp_methods */ }; static int ue_py_scolor_block_init(ue_PySColorBlock *self, PyObject *args, PyObject *kwargs) { ue_py_slate_setup_farguments(SColorBlock); ue_py_slate_farguments_flinear_color("color", Color); ue_py_slate_farguments_bool("color_is_hsv", ColorIsHSV); ue_py_slate_farguments_bool("ignore_alpha", IgnoreAlpha); ue_py_slate_farguments_event("on_mouse_button_down", OnMouseButtonDown, FPointerEventHandler, OnMouseEvent); ue_py_slate_farguments_bool("show_background_for_alpha", ShowBackgroundForAlpha); ue_py_slate_farguments_fvector2d("size", Size); ue_py_slate_farguments_bool("use_srgb", UseSRGB); ue_py_snew(SColorBlock); return 0; } void ue_python_init_scolor_block(PyObject *ue_module) { ue_PySColorBlockType.tp_init = (initproc)ue_py_scolor_block_init; ue_PySColorBlockType.tp_base = &ue_PySLeafWidgetType; if (PyType_Ready(&ue_PySColorBlockType) < 0) return; Py_INCREF(&ue_PySColorBlockType); PyModule_AddObject(ue_module, "SColorBlock", (PyObject *)&ue_PySColorBlockType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySColorBlock.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
614
```c++ #include "UEPySSpacer.h" static PyMethodDef ue_PySSpacer_methods[] = { { NULL } /* Sentinel */ }; PyTypeObject ue_PySSpacerType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SSpacer", /* tp_name */ sizeof(ue_PySSpacer), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SSpacer", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySSpacer_methods, /* tp_methods */ }; static int ue_py_sspacer_init(ue_PySSpacer *self, PyObject *args, PyObject *kwargs) { ue_py_slate_setup_farguments(SSpacer); ue_py_slate_farguments_fvector2d("size", Size); ue_py_snew(SSpacer); return 0; } void ue_python_init_sspacer(PyObject *ue_module) { ue_PySSpacerType.tp_init = (initproc)ue_py_sspacer_init; ue_PySSpacerType.tp_base = &ue_PySLeafWidgetType; if (PyType_Ready(&ue_PySSpacerType) < 0) return; Py_INCREF(&ue_PySSpacerType); PyModule_AddObject(ue_module, "SSpacer", (PyObject *)&ue_PySSpacerType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySSpacer.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
499
```c++ #include "UEPySHeaderRow.h" static PyObject *py_ue_sheader_row_add_column(ue_PySHeaderRow *self, PyObject *args, PyObject *kwargs) { ue_py_slate_cast(SHeaderRow); int32 retCode = [&]() { ue_py_slate_setup_farguments(SHeaderRow::FColumn); // first of all check for values PyObject *py_columnid = ue_py_dict_get_item(kwargs, "column_id"); if (!py_columnid) { PyErr_SetString(PyExc_TypeError, "you must specify the column_id"); return -1; } ue_py_slate_farguments_optional_string("column_id", ColumnId); ue_py_slate_farguments_text("default_label", DefaultLabel); ue_py_slate_farguments_text("default_tooltip", DefaultTooltip); ue_py_slate_farguments_optional_enum("h_align_header", HAlignHeader, EHorizontalAlignment); ue_py_slate_farguments_optional_enum("v_align_header", VAlignHeader, EVerticalAlignment); ue_py_slate_farguments_float("fill_width", FillWidth); ue_py_slate_farguments_optional_float("fixed_width", FixedWidth); ue_py_slate_farguments_float("manual_width", ManualWidth); ue_py_slate_farguments_optional_named_slot("header_content", HeaderContent); ue_py_slate_farguments_optional_struct("header_content_padding", HeaderContentPadding, FMargin); ue_py_slate_farguments_optional_named_slot("menu_content", MenuContent); ue_py_slate_farguments_optional_enum("h_align_cell", HAlignCell, EHorizontalAlignment); ue_py_slate_farguments_optional_enum("v_align_cell", VAlignCell, EVerticalAlignment); ue_py_slate_farguments_enum("sort_mode", SortMode, EColumnSortMode::Type); ue_py_slate_farguments_enum("sort_priority", SortPriority, EColumnSortPriority::Type); ue_py_slate_farguments_event("on_sort", OnSort, FOnSortModeChanged, OnSort); ue_py_slate_farguments_bool("should_generate_widget", ShouldGenerateWidget); //sw_header_row->AddColumn( // SHeaderRow::Column(FName(UTF8_TO_TCHAR(column_id))) // .DefaultLabel(FText::FromString(UTF8_TO_TCHAR(default_label))) // .DefaultTooltip(FText::FromString(UTF8_TO_TCHAR(default_tooltip))) // .FixedWidth(fixed_width) // .HAlignCell((EHorizontalAlignment)cell_h_align) // .VAlignCell((EVerticalAlignment)cell_v_align) //); py_SHeaderRow->AddColumn(arguments); return 0; }(); if (retCode != 0) { return PyErr_Format(PyExc_Exception, "could not add column slot"); } Py_RETURN_SLATE_SELF; } static PyMethodDef ue_PySHeaderRow_methods[] = { #pragma warning(suppress: 4191) { "add_column", (PyCFunction)py_ue_sheader_row_add_column, METH_VARARGS | METH_KEYWORDS, "" }, { NULL } /* Sentinel */ }; PyTypeObject ue_PySHeaderRowType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SHeaderRow", /* tp_name */ sizeof(ue_PySHeaderRow), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SHeaderRow", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySHeaderRow_methods, /* tp_methods */ }; static int ue_py_sheader_row_init(ue_PySHeaderRow *self, PyObject *args, PyObject *kwargs) { ue_py_snew_simple(SHeaderRow); return 0; } void ue_python_init_sheader_row(PyObject *ue_module) { ue_PySHeaderRowType.tp_init = (initproc)ue_py_sheader_row_init; ue_PySHeaderRowType.tp_call = (ternaryfunc)py_ue_sheader_row_add_column; ue_PySHeaderRowType.tp_base = &ue_PySBorderType; if (PyType_Ready(&ue_PySHeaderRowType) < 0) return; Py_INCREF(&ue_PySHeaderRowType); PyModule_AddObject(ue_module, "SHeaderRow", (PyObject *)&ue_PySHeaderRowType); } ue_PySHeaderRow * py_ue_is_sheader_row(PyObject *obj) { if (!PyObject_IsInstance(obj, (PyObject *)&ue_PySHeaderRowType)) return nullptr; return (ue_PySHeaderRow *)obj; } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySHeaderRow.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
1,226
```objective-c #pragma once #include "UEPySPanel.h" #include "Runtime/Slate/Public/Widgets/Layout/SSplitter.h" extern PyTypeObject ue_PySSplitterType; typedef struct { ue_PySPanel s_panel; /* Type-specific fields go here. */ } ue_PySSplitter; void ue_python_init_ssplitter(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySSplitter.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
78
```c++ #include "UEPySOverlay.h" static PyObject *py_ue_soverlay_add_slot(ue_PySOverlay *self, PyObject * args, PyObject *kwargs) { ue_py_slate_cast(SOverlay); PyObject *py_content; int z_order = -1; int h_align = 0; PyObject *padding = nullptr; int v_align = 0; char *kwlist[] = { (char *)"widget", (char *)"z_order", (char *)"h_align", (char *)"padding", (char *)"v_align", nullptr }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|iiOi:add_slot", kwlist, &py_content, &z_order, &h_align, &padding, &v_align)) { return nullptr; } TSharedPtr<SWidget> Child = py_ue_is_swidget<SWidget>(py_content); if (!Child.IsValid()) return nullptr; SOverlay::FOverlaySlot &fslot = py_SOverlay->AddSlot(z_order); fslot.AttachWidget(Child.ToSharedRef()); fslot.HAlign((EHorizontalAlignment)h_align); if (padding) { if (PyTuple_Check(padding)) { FMargin margin; if (!PyArg_ParseTuple(padding, "f|fff", &margin.Left, &margin.Top, &margin.Right, &margin.Bottom)) { return PyErr_Format(PyExc_Exception, "invalid padding value"); } fslot.Padding(margin); } else if (PyNumber_Check(padding)) { PyObject *py_float = PyNumber_Float(padding); fslot.Padding(PyFloat_AsDouble(py_float)); Py_DECREF(py_float); } else { return PyErr_Format(PyExc_Exception, "invalid padding value"); } } fslot.VAlign((EVerticalAlignment)v_align); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_soverlay_get_num_widgets(ue_PySOverlay *self, PyObject * args) { ue_py_slate_cast(SOverlay); return PyLong_FromLong(py_SOverlay->GetNumWidgets()); } static PyMethodDef ue_PySOverlay_methods[] = { #pragma warning(suppress: 4191) { "add_slot", (PyCFunction)py_ue_soverlay_add_slot, METH_VARARGS | METH_KEYWORDS, "" }, { "get_num_widgets", (PyCFunction)py_ue_soverlay_get_num_widgets, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; PyTypeObject ue_PySOverlayType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.SOverlay", /* tp_name */ sizeof(ue_PySOverlay), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine SOverlay", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySOverlay_methods, /* tp_methods */ }; static int ue_py_soverlay_init(ue_PySOverlay *self, PyObject *args, PyObject *kwargs) { ue_py_snew_simple(SOverlay); return 0; } void ue_python_init_soverlay(PyObject *ue_module) { ue_PySOverlayType.tp_init = (initproc)ue_py_soverlay_init; ue_PySOverlayType.tp_call = (ternaryfunc)py_ue_soverlay_add_slot; ue_PySOverlayType.tp_base = &ue_PySPanelType; if (PyType_Ready(&ue_PySOverlayType) < 0) return; Py_INCREF(&ue_PySOverlayType); PyModule_AddObject(ue_module, "SOverlay", (PyObject *)&ue_PySOverlayType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySOverlay.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
999
```objective-c #pragma once #include "UnrealEnginePython.h" #include "UEPySPanel.h" #include "Runtime/Slate/Public/Widgets/Layout/SBox.h" extern PyTypeObject ue_PySBoxType; typedef struct { ue_PySPanel s_panel; /* Type-specific fields go here. */ } ue_PySBox; void ue_python_init_sbox(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySBox.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
80
```c++ #include "UEPySTreeView.h" static PyObject *py_ue_stree_view_request_tree_refresh(ue_PySTreeView *self, PyObject * args) { ue_py_slate_cast_named(STreeView<TSharedPtr<void>>, py_STreeView); py_STreeView->RequestTreeRefresh(); Py_RETURN_NONE; } static PyObject *py_ue_stree_view_clear_expanded_items(ue_PySTreeView *self, PyObject * args) { ue_py_slate_cast_named(STreeView<TSharedPtr<void>>, py_STreeView); py_STreeView->ClearExpandedItems(); Py_RETURN_NONE; } static PyMethodDef ue_PySTreeView_methods[] = { { "request_tree_refresh", (PyCFunction)py_ue_stree_view_request_tree_refresh, METH_VARARGS, "" }, { "clear_expanded_items", (PyCFunction)py_ue_stree_view_clear_expanded_items, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; PyTypeObject ue_PySTreeViewType = { PyVarObject_HEAD_INIT(NULL, 0) "unreal_engine.STreeView", /* tp_name */ sizeof(ue_PySTreeView), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Unreal Engine STreeView", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ ue_PySTreeView_methods, /* tp_methods */ }; void ue_python_init_stree_view(PyObject *ue_module) { ue_PySTreeViewType.tp_base = &ue_PySListViewType; if (PyType_Ready(&ue_PySTreeViewType) < 0) return; Py_INCREF(&ue_PySTreeViewType); PyModule_AddObject(ue_module, "STreeView", (PyObject *)&ue_PySTreeViewType); } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySTreeView.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
590
```objective-c #pragma once #include "UnrealEnginePython.h" #include "UEPySCompoundWidget.h" #include "Runtime/Slate/Public/Widgets/Layout/SScrollBox.h" extern PyTypeObject ue_PySScrollBoxType; typedef struct { ue_PySCompoundWidget s_compound_widget; /* Type-specific fields go here. */ } ue_PySScrollBox; void ue_python_init_sscroll_box(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySScrollBox.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
89
```objective-c #pragma once #include "UEPySCompoundWidget.h" #include "Runtime/UMG/Public/Blueprint/UserWidget.h" extern PyTypeObject ue_PySPythonWidgetType; class SPythonWidget : public SCompoundWidget { public: SLATE_BEGIN_ARGS(SPythonWidget) { } SLATE_END_ARGS(); void Construct(const FArguments& Args) { } virtual bool SupportsKeyboardFocus() const override { return true; } virtual FReply OnKeyChar(const FGeometry & MyGeometry, const FCharacterEvent & InCharacterEvent) override { FScopePythonGIL gil; if (!PyObject_HasAttrString(self, (char *)"on_key_char")) return FReply::Unhandled(); PyObject *py_callable_on_key_char = PyObject_GetAttrString(self, (char *)"on_key_char"); if (!PyCallable_Check(py_callable_on_key_char)) { UE_LOG(LogPython, Error, TEXT("on_key_char is not a callable")); return FReply::Unhandled(); } PyObject *ret = PyObject_CallFunction(py_callable_on_key_char, (char *)"NN", py_ue_new_fgeometry(MyGeometry), py_ue_new_fcharacter_event(InCharacterEvent)); if (!ret) { unreal_engine_py_log_error(); return FReply::Unhandled(); } if (ret == Py_False) { Py_DECREF(ret); return FReply::Unhandled(); } Py_DECREF(ret); return FReply::Handled(); } virtual FReply OnKeyDown(const FGeometry & MyGeometry, const FKeyEvent & InKeyEvent) override { FScopePythonGIL gil; if (!PyObject_HasAttrString(self, (char *)"on_key_down")) return FReply::Unhandled(); PyObject *py_callable_on_key_down = PyObject_GetAttrString(self, (char *)"on_key_down"); if (!PyCallable_Check(py_callable_on_key_down)) { UE_LOG(LogPython, Error, TEXT("on_key_down is not a callable")); return FReply::Unhandled(); } PyObject *ret = PyObject_CallFunction(py_callable_on_key_down, (char *)"NN", py_ue_new_fgeometry(MyGeometry), py_ue_new_fkey_event(InKeyEvent)); if (!ret) { unreal_engine_py_log_error(); return FReply::Unhandled(); } if (ret == Py_False) { Py_DECREF(ret); return FReply::Unhandled(); } Py_DECREF(ret); return FReply::Handled(); } virtual FReply OnMouseMove(const FGeometry & MyGeometry, const FPointerEvent & MyEvent) override { FScopePythonGIL gil; if (!PyObject_HasAttrString(self, (char *)"on_mouse_move")) return FReply::Unhandled(); PyObject *py_callable_on_mouse_move = PyObject_GetAttrString(self, (char *)"on_mouse_move"); if (!PyCallable_Check(py_callable_on_mouse_move)) { UE_LOG(LogPython, Error, TEXT("on_mouse_move is not a callable")); return FReply::Unhandled(); } PyObject *ret = PyObject_CallFunction(py_callable_on_mouse_move, (char *)"NN", py_ue_new_fgeometry(MyGeometry), py_ue_new_fpointer_event(MyEvent)); if (!ret) { unreal_engine_py_log_error(); return FReply::Unhandled(); } if (ret == Py_False) { Py_DECREF(ret); return FReply::Unhandled(); } Py_DECREF(ret); return FReply::Handled(); } virtual FReply OnMouseWheel(const FGeometry & MyGeometry, const FPointerEvent & MyEvent) override { FScopePythonGIL gil; if (!PyObject_HasAttrString(self, (char *)"on_mouse_wheel")) return FReply::Unhandled(); PyObject *py_callable_on_mouse_wheel = PyObject_GetAttrString(self, (char *)"on_mouse_wheel"); if (!PyCallable_Check(py_callable_on_mouse_wheel)) { UE_LOG(LogPython, Error, TEXT("on_mouse_wheel is not a callable")); return FReply::Unhandled(); } PyObject *ret = PyObject_CallFunction(py_callable_on_mouse_wheel, (char *)"NN", py_ue_new_fgeometry(MyGeometry), py_ue_new_fpointer_event(MyEvent)); if (!ret) { unreal_engine_py_log_error(); return FReply::Unhandled(); } if (ret == Py_False) { Py_DECREF(ret); return FReply::Unhandled(); } Py_DECREF(ret); return FReply::Handled(); } virtual FReply OnMouseButtonDown(const FGeometry & MyGeometry, const FPointerEvent & MyEvent) override { FScopePythonGIL gil; if (!PyObject_HasAttrString(self, (char *)"on_mouse_button_down")) return FReply::Unhandled(); PyObject *py_callable_on_mouse_button_down = PyObject_GetAttrString(self, (char *)"on_mouse_button_down"); if (!PyCallable_Check(py_callable_on_mouse_button_down)) { UE_LOG(LogPython, Error, TEXT("on_mouse_button_down is not a callable")); return FReply::Unhandled(); } PyObject *ret = PyObject_CallFunction(py_callable_on_mouse_button_down, (char *)"NN", py_ue_new_fgeometry(MyGeometry), py_ue_new_fpointer_event(MyEvent)); if (!ret) { unreal_engine_py_log_error(); return FReply::Unhandled(); } if (ret == Py_False) { Py_DECREF(ret); return FReply::Unhandled(); } Py_DECREF(ret); return FReply::Handled(); } virtual FReply OnMouseButtonUp(const FGeometry & MyGeometry, const FPointerEvent & MyEvent) override { FScopePythonGIL gil; if (!PyObject_HasAttrString(self, (char *)"on_mouse_button_up")) return FReply::Unhandled(); PyObject *py_callable_on_mouse_button_up = PyObject_GetAttrString(self, (char *)"on_mouse_button_up"); if (!PyCallable_Check(py_callable_on_mouse_button_up)) { UE_LOG(LogPython, Error, TEXT("on_mouse_button_up is not a callable")); return FReply::Unhandled(); } PyObject *ret = PyObject_CallFunction(py_callable_on_mouse_button_up, (char *)"NN", py_ue_new_fgeometry(MyGeometry), py_ue_new_fpointer_event(MyEvent)); if (!ret) { unreal_engine_py_log_error(); return FReply::Unhandled(); } if (ret == Py_False) { Py_DECREF(ret); return FReply::Unhandled(); } Py_DECREF(ret); return FReply::Handled(); } virtual int32 OnPaint(const FPaintArgs & Args, const FGeometry & AllottedGeometry, const FSlateRect & MyClippingRect, FSlateWindowElementList & OutDrawElements, int32 LayerId, const FWidgetStyle & InWidgetStyle, bool bParentEnabled) const override { int32 MaxLayer = SCompoundWidget::OnPaint(Args, AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled); FScopePythonGIL gil; if (!PyObject_HasAttrString(self, (char *)"paint")) return MaxLayer; PyObject *py_callable_paint = PyObject_GetAttrString(self, (char *)"paint"); if (!PyCallable_Check(py_callable_paint)) { UE_LOG(LogPython, Error, TEXT("paint is not a callable")); return MaxLayer; } FPaintContext context(AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled); PyObject *ret = PyObject_CallFunction(py_callable_paint, (char *)"N", py_ue_new_fpaint_context(context)); if (!ret) { unreal_engine_py_log_error(); return MaxLayer; } Py_DECREF(ret); return MaxLayer + 1; } virtual void Tick(const FGeometry & AllottedGeometry, const double InCurrentTime, const float InDeltaTime) override { FScopePythonGIL gil; if (!PyObject_HasAttrString(self, (char *)"tick")) return; PyObject *py_callable_tick = PyObject_GetAttrString(self, (char *)"tick"); if (!PyCallable_Check(py_callable_tick)) { UE_LOG(LogPython, Error, TEXT("tick is not a callable")); return; } PyObject *ret = PyObject_CallFunction(py_callable_tick, (char *)"Nff", py_ue_new_fgeometry(AllottedGeometry), InCurrentTime, InDeltaTime); if (!ret) { unreal_engine_py_log_error(); return; } Py_DECREF(ret); } void SetPyObject(PyObject *py_obj) { Py_XDECREF(self); Py_INCREF(py_obj); self = py_obj; } void SetActive(bool bActive) { if (bActive && !ActiveTimerHandle.IsValid()) { ActiveTimerHandle = RegisterActiveTimer(0.f, FWidgetActiveTimerDelegate::CreateSP(this, &SPythonWidget::EnsureTick)); } else if (!bActive && ActiveTimerHandle.IsValid()) { UnRegisterActiveTimer(ActiveTimerHandle.Pin().ToSharedRef()); } } void SetContent(TSharedRef<SWidget> InContent) { ChildSlot [ InContent ]; } void ClearContent() { ChildSlot.DetachWidget(); } protected: PyObject * self; TWeakPtr<FActiveTimerHandle> ActiveTimerHandle; EActiveTimerReturnType EnsureTick(double InCurrentTime, float InDeltaTime) { return EActiveTimerReturnType::Continue; } }; typedef struct { ue_PySCompoundWidget s_compound_widget; /* Type-specific fields go here. */ } ue_PySPythonWidget; void ue_python_init_spython_widget(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySPythonWidget.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
2,220
```objective-c #pragma once #include "UEPySCompoundWidget.h" #include "Runtime/Slate/Public/Widgets/Input/SNumericEntryBox.h" extern PyTypeObject ue_PySNumericEntryBoxType; typedef struct { ue_PySCompoundWidget s_compound_widget; /* Type-specific fields go here. */ } ue_PySNumericEntryBox; void ue_python_init_snumeric_entry_box(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySNumericEntryBox.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
85
```c++ #include "UEPySWindow.h" #if WITH_EDITOR #include "Editor/MainFrame/Public/Interfaces/IMainFrameModule.h" #endif #if PLATFORM_WINDOWS #include "Windows/AllowWindowsPlatformTypes.h" #endif #include "Runtime/Slate/Public/Framework/Application/SlateApplication.h" static PyObject *py_ue_swindow_set_title(ue_PySWindow *self, PyObject * args) { ue_py_slate_cast(SWindow); char *title; if (!PyArg_ParseTuple(args, "s:set_title", &title)) { return nullptr; } py_SWindow->SetTitle(FText::FromString(UTF8_TO_TCHAR(title))); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_swindow_get_title(ue_PySWindow *self, PyObject * args) { ue_py_slate_cast(SWindow); const char *title = TCHAR_TO_UTF8(*py_SWindow->GetTitle().ToString()); return PyUnicode_FromString(title); } static PyObject *py_ue_swindow_resize(ue_PySWindow *self, PyObject * args) { ue_py_slate_cast(SWindow); int width; int height; if (!PyArg_ParseTuple(args, "ii:resize", &width, &height)) { return NULL; } py_SWindow->Resize(FVector2D(width, height)); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_swindow_minimize(ue_PySWindow *self, PyObject * args) { ue_py_slate_cast(SWindow); py_SWindow->Minimize(); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_swindow_set_content(ue_PySWindow *self, PyObject * args) { ue_py_slate_cast(SWindow); PyObject *py_content; if (!PyArg_ParseTuple(args, "O:set_content", &py_content)) { return nullptr; } TSharedPtr<SWidget> Content = py_ue_is_swidget<SWidget>(py_content); if (!Content.IsValid()) { return nullptr; } py_SWindow->SetContent(Content.ToSharedRef()); Py_RETURN_SLATE_SELF; } static PyObject *py_ue_swindow_set_sizing_rule(ue_PySWindow *self, PyObject * args) { ue_py_slate_cast(SWindow); int rule; if (!PyArg_ParseTuple(args, "i:set_sizing_rule", &rule)) { return nullptr; } #if ENGINE_MINOR_VERSION > 15 py_SWindow->SetSizingRule((ESizingRule)rule); #else py_SWindow->SetSizingRule((ESizingRule::Type)rule); #endif Py_RETURN_SLATE_SELF; } static PyObject *py_ue_swindow_get_handle(ue_PySWindow *self, PyObject * args) { ue_py_slate_cast(SWindow); return PyLong_FromLongLong((long long)py_SWindow->GetNativeWindow()->GetOSWindowHandle()); } static PyObject *py_ue_swindow_set_as_owner(ue_PySWindow *self, PyObject * args) { ue_py_slate_cast(SWindow); long long window_ptr; if (!PyArg_ParseTuple(args, "L:set_as_owner", &window_ptr)) { return nullptr; } void *whnd = py_SWindow->GetNativeWindow()->GetOSWindowHandle(); #if PLATFORM_WINDOWS SetWindowLongPtr((HWND)window_ptr, GWLP_HWNDPARENT, (LONG_PTR)whnd); #endif Py_RETURN_NONE; } static PyObject *py_ue_swindow_request_destroy(ue_PySWindow *self, PyObject * args) { ue_py_slate_cast(SWindow); py_SWindow->RequestDestroyWindow(); Py_RETURN_NONE; } static PyObject *py_ue_swindow_bring_to_front(ue_PySWindow *self, PyObject * args) { ue_py_slate_cast(SWindow); PyObject *py_force = nullptr; if (!PyArg_ParseTuple(args, "|O:set_as_owner", &py_force)) { return nullptr; } bool bForce = false; if (py_force && PyObject_IsTrue(py_force)) bForce = true; py_SWindow->BringToFront(bForce); Py_RETURN_NONE; } #if WITH_EDITOR static PyObject *py_ue_swindow_add_modal(ue_PySWindow *self, PyObject * args) { ue_py_slate_cast(SWindow); TSharedPtr<SWindow> parent_window; if (FModuleManager::Get().IsModuleLoaded("MainFrame")) { parent_window = FModuleManager::LoadModuleChecked<IMainFrameModule>("MainFrame").GetParentWindow(); } Py_BEGIN_ALLOW_THREADS; FSlateApplication::Get().AddModalWindow(StaticCastSharedRef<SWindow>(py_SWindow->AsShared()), parent_window, false); Py_END_ALLOW_THREADS; Py_RETURN_NONE; } #endif static PyObject *py_ue_swindow_add_child(ue_PySWindow *self, PyObject * args) { ue_py_slate_cast(SWindow); PyObject *py_obj; if (!PyArg_ParseTuple(args, "O:add_child", &py_obj)) { return NULL; } ue_PySWindow *py_swindow_child = py_ue_is_swindow(py_obj); if (!py_swindow_child) { return PyErr_Format(PyExc_Exception, "argument is not a SWindow"); } FSlateApplication::Get().AddWindowAsNativeChild( StaticCastSharedRef<SWindow>(py_swindow_child->s_compound_widget.s_widget.Widget), py_SWindow); Py_RETURN_NONE; } static PyObject *py_ue_swindow_get_child_windows(ue_PySWindow *self, PyObject * args) { ue_py_slate_cast(SWindow); TArray<TSharedRef<SWindow>>& ChildWindows = py_SWindow->GetChildWindows(); PyObject *py_list = PyList_New(0); for (TSharedRef<SWindow> ChildWindow : ChildWindows) { PyList_Append(py_list, (PyObject *)py_ue_new_swindow(ChildWindow)); } return py_list; } static PyMethodDef ue_PySWindow_methods[] = { { "get_child_windows", (PyCFunction)py_ue_swindow_get_child_windows, METH_VARARGS, "" }, { "set_title", (PyCFunction)py_ue_swindow_set_title, METH_VARARGS, "" }, { "get_title", (PyCFunction)py_ue_swindow_get_title, METH_VARARGS, "" }, { "set_sizing_rule", (PyCFunction)py_ue_swindow_set_sizing_rule, METH_VARARGS, "" }, { "minimize", (PyCFunction)py_ue_swindow_minimize, METH_VARARGS, "" }, { "resize", (PyCFunction)py_ue_swindow_resize, METH_VARARGS, "" }, { "set_client_size", (PyCFunction)py_ue_swindow_resize, METH_VARARGS, "" }, { "set_content", (PyCFunction)py_ue_swindow_set_content, METH_VARARGS, "" }, { "get_handle", (PyCFunction)py_ue_swindow_get_handle, METH_VARARGS, "" }, { "set_as_owner", (PyCFunction)py_ue_swindow_set_as_owner, METH_VARARGS, "" }, { "request_destroy", (PyCFunction)py_ue_swindow_request_destroy, METH_VARARGS, "" }, { "bring_to_front", (PyCFunction)py_ue_swindow_bring_to_front, METH_VARARGS, "" }, #if WITH_EDITOR { "add_modal", (PyCFunction)py_ue_swindow_add_modal, METH_VARARGS, "" }, #endif { "add_child", (PyCFunction)py_ue_swindow_add_child, METH_VARARGS, "" }, { NULL } /* Sentinel */ }; DECLARE_UE_PY_SLATE_WIDGET(SWindow); static int ue_py_swindow_init(ue_PySWindow *self, PyObject *args, PyObject *kwargs) { ue_py_slate_setup_farguments(SWindow); #if ENGINE_MINOR_VERSION > 15 ue_py_slate_farguments_optional_enum("activation_policy", ActivationPolicy, EWindowActivationPolicy); #else ue_py_slate_farguments_optional_bool("activate_when_first_shown", ActivateWhenFirstShown); #endif #if ENGINE_MINOR_VERSION > 15 ue_py_slate_farguments_optional_enum("auto_center", AutoCenter, EAutoCenter); #else ue_py_slate_farguments_optional_enum("auto_center", AutoCenter, EAutoCenter::Type); #endif ue_py_slate_farguments_optional_bool("drag_anywhere", bDragAnywhere); ue_py_slate_farguments_optional_fvector2d("client_size", ClientSize); ue_py_slate_farguments_optional_bool("create_title_bar", CreateTitleBar); ue_py_slate_farguments_optional_bool("focus_when_first_shown", FocusWhenFirstShown); ue_py_slate_farguments_optional_bool("has_close_button", HasCloseButton); ue_py_slate_farguments_optional_float("initial_opacity", InitialOpacity); ue_py_slate_farguments_optional_bool("is_initially_maximized", IsInitiallyMaximized); ue_py_slate_farguments_optional_bool("is_initially_minimized", IsInitiallyMinimized); ue_py_slate_farguments_optional_bool("is_popup_window", IsPopupWindow); ue_py_slate_farguments_optional_bool("is_topmost_window", IsTopmostWindow); ue_py_slate_farguments_optional_struct("layout_border", LayoutBorder, FMargin); ue_py_slate_farguments_optional_float("max_height", MaxHeight); ue_py_slate_farguments_optional_float("max_width", MaxWidth); ue_py_slate_farguments_optional_float("min_height", MinHeight); ue_py_slate_farguments_optional_float("min_width", MinWidth); ue_py_slate_farguments_optional_bool("sane_window_placement", SaneWindowPlacement); ue_py_slate_farguments_optional_fvector2d("screen_position", ScreenPosition); #if ENGINE_MINOR_VERSION > 12 ue_py_slate_farguments_optional_bool("should_preserve_aspect_ratio", ShouldPreserveAspectRatio); #endif #if ENGINE_MINOR_VERSION > 15 ue_py_slate_farguments_optional_enum("sizing_rule", SizingRule, ESizingRule); #else ue_py_slate_farguments_optional_enum("sizing_rule", SizingRule, ESizingRule::Type); #endif ue_py_slate_farguments_optional_struct_ptr("style", Style, FWindowStyle); ue_py_slate_farguments_optional_bool("supports_maximize", SupportsMaximize); ue_py_slate_farguments_text("title", Title); ue_py_slate_farguments_optional_enum("type", Type, EWindowType); ue_py_slate_farguments_optional_bool("use_os_window_border", UseOSWindowBorder); ue_py_slate_farguments_optional_struct("user_resize_border", UserResizeBorder, FMargin); ue_py_snew(SWindow); ue_py_slate_cast(SWindow); #if WITH_EDITOR // is it a modal window ? PyObject *is_modal = ue_py_dict_get_item(kwargs, "modal"); if (is_modal && PyObject_IsTrue(is_modal)) { return 0; } #endif PyObject *on_closed = ue_py_dict_get_item(kwargs, "on_closed"); if (on_closed && PyCallable_Check(on_closed)) { FOnWindowClosed handler; TSharedRef<FPythonSlateDelegate> py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewSlateDelegate(self->s_compound_widget.s_widget.Widget, on_closed); handler.BindSP(py_delegate, &FPythonSlateDelegate::OnWindowClosed); py_SWindow->SetOnWindowClosed(handler); } // is it a child ? PyObject *is_child = ue_py_dict_get_item(kwargs, "child"); if (!(is_child && PyObject_IsTrue(is_child))) { FSlateApplication::Get().AddWindow(py_SWindow, true); } return 0; } PyNumberMethods ue_PySWindow_number_methods; static PyObject *ue_py_swindow_lshift(ue_PySWindow *self, PyObject *value) { ue_py_slate_cast(SWindow); TSharedPtr<SWidget> Content = py_ue_is_swidget<SWidget>(value); if (!Content.IsValid()) { return nullptr; } py_SWindow->SetContent(Content.ToSharedRef()); Py_RETURN_SLATE_SELF; } void ue_python_init_swindow(PyObject *ue_module) { ue_PySWindowType.tp_init = (initproc)ue_py_swindow_init; ue_PySWindowType.tp_call = (ternaryfunc)py_ue_swindow_set_content; memset(&ue_PySWindow_number_methods, 0, sizeof(PyNumberMethods)); ue_PySWindowType.tp_as_number = &ue_PySWindow_number_methods; ue_PySWindow_number_methods.nb_lshift = (binaryfunc)ue_py_swindow_lshift; ue_PySWindowType.tp_base = &ue_PySCompoundWidgetType; if (PyType_Ready(&ue_PySWindowType) < 0) return; Py_INCREF(&ue_PySWindowType); PyModule_AddObject(ue_module, "SWindow", (PyObject *)&ue_PySWindowType); } ue_PySWindow *py_ue_is_swindow(PyObject *obj) { if (!PyObject_IsInstance(obj, (PyObject *)&ue_PySWindowType)) return nullptr; return (ue_PySWindow *)obj; } ue_PySWindow *py_ue_new_swindow(TSharedRef<SWindow> s_window) { ue_PySWindow *ret = (ue_PySWindow *)PyObject_New(ue_PySWindow, &ue_PySWindowType); new(&ret->s_compound_widget.s_widget.Widget) TSharedRef<SWindow>(s_window); ret->s_compound_widget.s_widget.weakreflist = nullptr; return ret; } ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySWindow.cpp
c++
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
2,981
```objective-c #pragma once #include "UEPySlate.h" #include "Runtime/Slate/Public/Framework/MultiBox/MultiBoxBuilder.h" typedef struct { PyObject_HEAD /* Type-specific fields go here. */ FToolBarBuilder tool_bar_builder; } ue_PyFToolBarBuilder; void ue_python_init_ftool_bar_builder(PyObject *); PyObject *py_ue_new_ftool_bar_builder(FToolBarBuilder); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyFToolBarBuilder.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
85
```objective-c #pragma once #include "UEPySCompoundWidget.h" #if WITH_EDITOR #if ENGINE_MINOR_VERSION > 13 #include "Developer/DesktopWidgets/Public/Widgets/Input/SFilePathPicker.h" extern PyTypeObject ue_PySFilePathPickerType; typedef struct { ue_PySCompoundWidget s_compound_widget; /* Type-specific fields go here. */ } ue_PySFilePathPicker; void ue_python_init_sfile_path_picker(PyObject *); #endif #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySFilePathPicker.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
97
```objective-c #pragma once #include "UEPySLeafWidget.h" #include "Runtime/Slate/Public/Widgets/Input/SSlider.h" extern PyTypeObject ue_PySSliderType; typedef struct { ue_PySLeafWidget s_leaf_widget; /* Type-specific fields go here. */ } ue_PySSlider; void ue_python_init_sslider(PyObject *); ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPySSlider.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
77
```objective-c #pragma once #include "UEPyModule.h" #if WITH_EDITOR #include "IStructureDetailsView.h" typedef struct { PyObject_HEAD /* Type-specific fields go here. */ TSharedRef<IStructureDetailsView> istructure_details_view; ue_PyUScriptStruct *ue_py_struct; } ue_PyIStructureDetailsView; void ue_python_init_istructure_details_view(PyObject *); ue_PyIStructureDetailsView * py_ue_is_istructure_details_view(PyObject *obj); #endif ```
/content/code_sandbox/Source/UnrealEnginePython/Private/Slate/UEPyIStructureDetailsView.h
objective-c
2016-08-07T05:00:51
2024-08-14T06:32:20
UnrealEnginePython
20tab/UnrealEnginePython
2,715
121