|
34 | 34 | #include "Wrappers/UEPyFAssetData.h" |
35 | 35 | #include "Wrappers/UEPyFEditorViewportClient.h" |
36 | 36 | #include "Wrappers/UEPyIAssetEditorInstance.h" |
| 37 | +#include "Editor/MainFrame/Public/Interfaces/IMainFrameModule.h" |
37 | 38 |
|
38 | 39 | #include "UEPyIPlugin.h" |
39 | 40 |
|
@@ -1753,9 +1754,29 @@ PyObject *py_unreal_engine_editor_on_asset_post_import(PyObject * self, PyObject |
1753 | 1754 | if (!PyCallable_Check(py_callable)) |
1754 | 1755 | return PyErr_Format(PyExc_Exception, "object is not a callable"); |
1755 | 1756 |
|
1756 | | - TSharedRef<FPythonSmartDelegate> py_delegate = MakeShareable(new FPythonSmartDelegate); |
| 1757 | + // will brutally leak |
| 1758 | + FPythonSmartDelegate *py_delegate = new FPythonSmartDelegate(); |
1757 | 1759 | py_delegate->SetPyCallable(py_callable); |
1758 | | - FEditorDelegates::OnAssetPostImport.AddSP(py_delegate, &FPythonSmartDelegate::PyFOnAssetPostImport); |
| 1760 | + FEditorDelegates::OnAssetPostImport.AddRaw(py_delegate, &FPythonSmartDelegate::PyFOnAssetPostImport); |
| 1761 | + Py_RETURN_NONE; |
| 1762 | +} |
| 1763 | + |
| 1764 | +PyObject *py_unreal_engine_on_main_frame_creation_finished(PyObject * self, PyObject * args) |
| 1765 | +{ |
| 1766 | + PyObject *py_callable; |
| 1767 | + if (!PyArg_ParseTuple(args, "O:on_main_frame_creation_finished", &py_callable)) |
| 1768 | + { |
| 1769 | + return NULL; |
| 1770 | + } |
| 1771 | + |
| 1772 | + if (!PyCallable_Check(py_callable)) |
| 1773 | + return PyErr_Format(PyExc_Exception, "object is not a callable"); |
| 1774 | + |
| 1775 | + // will brutally leak |
| 1776 | + FPythonSmartDelegate *py_delegate = new FPythonSmartDelegate(); |
| 1777 | + py_delegate->SetPyCallable(py_callable); |
| 1778 | + IMainFrameModule& MainFrameModule = FModuleManager::LoadModuleChecked<IMainFrameModule>(TEXT("MainFrame")); |
| 1779 | + MainFrameModule.OnMainFrameCreationFinished().AddRaw(py_delegate, &FPythonSmartDelegate::PyFOnMainFrameCreationFinished); |
1759 | 1780 | Py_RETURN_NONE; |
1760 | 1781 | } |
1761 | 1782 |
|
@@ -1929,7 +1950,7 @@ PyObject *py_unreal_engine_add_level_to_world(PyObject *self, PyObject * args) |
1929 | 1950 | if (py_bool && PyObject_IsTrue(py_bool)) |
1930 | 1951 | { |
1931 | 1952 | streaming_mode_class = ULevelStreamingAlwaysLoaded::StaticClass(); |
1932 | | -} |
| 1953 | + } |
1933 | 1954 |
|
1934 | 1955 | #if ENGINE_MINOR_VERSION >= 17 |
1935 | 1956 | ULevelStreaming *level_streaming = EditorLevelUtils::AddLevelToWorld(u_world, UTF8_TO_TCHAR(name), streaming_mode_class); |
|
0 commit comments