3636#include " Wrappers/UEPyIAssetEditorInstance.h"
3737#include " Editor/MainFrame/Public/Interfaces/IMainFrameModule.h"
3838
39+ #include " Runtime/Core/Public/HAL/ThreadHeartBeat.h"
40+
3941#include " UEPyIPlugin.h"
4042
4143PyObject *py_unreal_engine_editor_play_in_viewport (PyObject * self, PyObject * args)
@@ -541,6 +543,35 @@ PyObject *py_unreal_engine_get_asset(PyObject * self, PyObject * args)
541543 Py_RETURN_UOBJECT (asset.GetAsset ());
542544}
543545
546+ PyObject *py_unreal_engine_is_loading_assets (PyObject * self, PyObject * args)
547+ {
548+ if (!GEditor)
549+ return PyErr_Format (PyExc_Exception, " no GEditor found" );
550+
551+ FAssetRegistryModule& AssetRegistryModule = FModuleManager::GetModuleChecked<FAssetRegistryModule>(" AssetRegistry" );
552+ if (AssetRegistryModule.Get ().IsLoadingAssets ())
553+ Py_RETURN_TRUE;
554+ Py_RETURN_FALSE;
555+ }
556+
557+ PyObject *py_unreal_engine_wait_for_assets (PyObject * self, PyObject * args)
558+ {
559+ if (!GEditor)
560+ return PyErr_Format (PyExc_Exception, " no GEditor found" );
561+
562+ FAssetRegistryModule& AssetRegistryModule = FModuleManager::GetModuleChecked<FAssetRegistryModule>(" AssetRegistry" );
563+ while (AssetRegistryModule.Get ().IsLoadingAssets ())
564+ {
565+ Py_BEGIN_ALLOW_THREADS;
566+ AssetRegistryModule.Get ().Tick (-1 .0f );
567+ FThreadHeartBeat::Get ().HeartBeat ();
568+ FPlatformProcess::SleepNoStats (0 .0001f );
569+ Py_END_ALLOW_THREADS;
570+ }
571+
572+ Py_RETURN_NONE;
573+ }
574+
544575PyObject *py_unreal_engine_find_asset (PyObject * self, PyObject * args)
545576{
546577 char *path;
@@ -1938,7 +1969,7 @@ PyObject *py_unreal_engine_add_level_to_world(PyObject *self, PyObject * args)
19381969 if (!PyArg_ParseTuple (args, " Os|O:add_level_to_world" , &py_world, &name, &py_bool))
19391970 {
19401971 return NULL ;
1941- }
1972+ }
19421973
19431974 UWorld *u_world = ue_py_check_type<UWorld>(py_world);
19441975 if (!u_world)
@@ -1955,7 +1986,7 @@ PyObject *py_unreal_engine_add_level_to_world(PyObject *self, PyObject * args)
19551986 streaming_mode_class = ULevelStreamingAlwaysLoaded::StaticClass ();
19561987 }
19571988
1958-
1989+
19591990
19601991#if ENGINE_MINOR_VERSION >= 17
19611992 ULevelStreaming *level_streaming = EditorLevelUtils::AddLevelToWorld (u_world, UTF8_TO_TCHAR (name), streaming_mode_class);
@@ -1972,7 +2003,7 @@ PyObject *py_unreal_engine_add_level_to_world(PyObject *self, PyObject * args)
19722003#endif
19732004
19742005 Py_RETURN_UOBJECT (level_streaming);
1975- }
2006+ }
19762007
19772008PyObject *py_unreal_engine_move_selected_actors_to_level (PyObject *self, PyObject * args)
19782009{
@@ -2477,7 +2508,7 @@ PyObject *py_unreal_engine_export_assets(PyObject * self, PyObject * args)
24772508 if (!py_iter)
24782509 {
24792510 return PyErr_Format (PyExc_Exception, " argument is not an iterable of UObject" );
2480- }
2511+ }
24812512
24822513 while (PyObject *py_item = PyIter_Next (py_iter))
24832514 {
0 commit comments