Skip to content

Commit b8f4f23

Browse files
author
Roberto De Ioris
committed
first round of pch removal [2]
1 parent e5c23b8 commit b8f4f23

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
#pragma once
2+
3+
4+
#include "SlateBasics.h"
5+
#include "SlateExtras.h"
6+
7+
#include "PythonSmartDelegate.h"
8+
9+
struct FPythonItem;
10+
11+
12+
class FPythonSlateDelegate : public FPythonSmartDelegate
13+
{
14+
15+
public:
16+
FReply OnMouseEvent(const FGeometry &geometry, const FPointerEvent &pointer_event);
17+
FReply OnClicked();
18+
19+
FReply OnKeyDown(const FGeometry &geometry, const FKeyEvent &key_event);
20+
void OnTextChanged(const FText &text);
21+
void OnTextCommitted(const FText &text, ETextCommit::Type commit_type);
22+
void OnInt32Changed(int32 value);
23+
void OnInt32Committed(int32 value, ETextCommit::Type commit_type);
24+
void OnFloatChanged(float value);
25+
void OnFloatCommitted(float value, ETextCommit::Type commit_type);
26+
void OnSort(const EColumnSortPriority::Type SortPriority, const FName& ColumnName, const EColumnSortMode::Type NewSortMode);
27+
28+
void OnLinearColorChanged(FLinearColor color);
29+
30+
void OnStringChanged(const FString &text);
31+
32+
TSharedRef<SDockTab> SpawnPythonTab(const FSpawnTabArgs& args);
33+
34+
TSharedRef<ITableRow> GenerateRow(TSharedPtr<FPythonItem> InItem, const TSharedRef<STableViewBase>& OwnerTable);
35+
void GetChildren(TSharedPtr<FPythonItem> InItem, TArray<TSharedPtr<FPythonItem>>& OutChildren);
36+
37+
#if WITH_EDITOR
38+
void OnAssetDoubleClicked(const FAssetData& AssetData);
39+
TSharedPtr<SWidget> OnGetAssetContextMenu(const TArray<FAssetData>& SelectedAssets);
40+
void OnAssetSelected(const FAssetData& AssetData);
41+
TSharedRef<FExtender> OnExtendContentBrowserMenu(const TArray<FAssetData> &SelectedAssets);
42+
void MenuPyAssetBuilder(FMenuBuilder &Builder, TArray<FAssetData> SelectedAssets);
43+
void OnAssetChanged(const FAssetData &AssetData);
44+
bool OnShouldFilterAsset(const FAssetData& AssetData);
45+
#endif
46+
47+
void OnWindowClosed(const TSharedRef<SWindow> &Window);
48+
49+
TSharedPtr<SWidget> OnContextMenuOpening();
50+
TSharedRef<SWidget> OnGenerateWidget(TSharedPtr<FPythonItem> py_item);
51+
TSharedRef<SWidget> OnGetMenuContent();
52+
void OnSelectionChanged(TSharedPtr<FPythonItem> py_item, ESelectInfo::Type select_type);
53+
54+
void SimpleExecuteAction();
55+
void ExecuteAction(PyObject *py_obj);
56+
57+
FText GetterFText() const;
58+
FString GetterFString() const;
59+
float GetterFloat() const;
60+
TOptional<float> GetterTFloat() const;
61+
int GetterInt() const;
62+
bool GetterBool() const;
63+
64+
FVector2D GetterFVector2D() const;
65+
FLinearColor GetterFLinearColor() const;
66+
void CheckBoxChanged(ECheckBoxState state);
67+
68+
69+
template<typename T> T GetterIntT() const
70+
{
71+
FScopePythonGIL gil;
72+
73+
PyObject *ret = PyObject_CallFunction(py_callable, nullptr);
74+
if (!ret)
75+
{
76+
unreal_engine_py_log_error();
77+
return (T)0;
78+
}
79+
if (!PyNumber_Check(ret))
80+
{
81+
PyErr_SetString(PyExc_ValueError, "returned value is not a number");
82+
Py_DECREF(ret);
83+
return (T)0;
84+
}
85+
86+
PyObject *py_int = PyNumber_Long(ret);
87+
int n = PyLong_AsLong(py_int);
88+
Py_DECREF(py_int);
89+
Py_DECREF(ret);
90+
return (T)n;
91+
}
92+
93+
template<typename T> T GetterStructT() const
94+
{
95+
FScopePythonGIL gil;
96+
97+
PyObject *ret = PyObject_CallFunction(py_callable, nullptr);
98+
if (!ret)
99+
{
100+
unreal_engine_py_log_error();
101+
return T();
102+
}
103+
104+
T *u_struct = ue_py_check_struct<T>(ret);
105+
if (!u_struct)
106+
{
107+
PyErr_SetString(PyExc_ValueError, "returned value is not a UStruct");
108+
Py_DECREF(ret);
109+
return T();
110+
}
111+
112+
T u_struct_copy = *u_struct;
113+
Py_DECREF(ret);
114+
return u_struct_copy;
115+
}
116+
};
117+
118+

0 commit comments

Comments
 (0)