Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit b37ca1b

Browse files
author
Eugene Feinberg
committed
Add not-so-nice dependency on UE4Orchestrator and implement load from pak
1 parent baec6d8 commit b37ca1b

File tree

5 files changed

+78
-44
lines changed

5 files changed

+78
-44
lines changed

Source/UnrealEnginePython/Private/UEPyEngine.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
#include "Kismet/KismetSystemLibrary.h"
66
#include "Kismet/KismetMathLibrary.h"
77

8+
9+
#include "Runtime/PakFile/Public/IPlatformFilePak.h"
810
#include "Developer/DesktopPlatform/Public/IDesktopPlatform.h"
911
#include "Developer/DesktopPlatform/Public/DesktopPlatformModule.h"
1012
#if WITH_EDITOR
1113
#include "PackageTools.h"
1214
#endif
1315

16+
#include "UE4Orchestrator.h"
17+
#include "Private/UE4OrchestratorPrivate.h"
18+
1419
#if ENGINE_MINOR_VERSION >= 18
1520
#include "HAL/PlatformApplicationMisc.h"
1621
#endif
@@ -432,6 +437,27 @@ PyObject *py_unreal_engine_load_object(PyObject * self, PyObject * args)
432437

433438
}
434439

440+
PyObject *py_unreal_engine_load_object_with_pak(PyObject * self, PyObject * args)
441+
{
442+
PyObject *ret;
443+
444+
PyObject *obj;
445+
char *str;
446+
447+
if (!PyArg_ParseTuple(args, "s:path_to_asset", &str))
448+
{
449+
return NULL;
450+
}
451+
452+
FString Path(str);
453+
454+
auto ue4orch = FModuleManager::GetModuleChecked< FUE4OrchestratorPlugin>("UE4Orchestrator");
455+
ue4orch.LoadObject(Path);
456+
457+
458+
Py_RETURN_NONE;
459+
}
460+
435461
PyObject *py_unreal_engine_string_to_guid(PyObject * self, PyObject * args)
436462
{
437463
char *str;
@@ -1266,4 +1292,4 @@ PyObject *py_unreal_engine_clipboard_paste(PyObject * self, PyObject * args)
12661292
FGenericPlatformMisc::ClipboardPaste(clipboard);
12671293
#endif
12681294
return PyUnicode_FromString(TCHAR_TO_UTF8(*clipboard));
1269-
}
1295+
}

Source/UnrealEnginePython/Private/UEPyModule.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#endif
4949

5050

51+
5152
#include "PythonDelegate.h"
5253
#include "PythonFunction.h"
5354
#include "PythonClass.h"
@@ -195,6 +196,7 @@ static PyMethodDef unreal_engine_methods[] = {
195196

196197
{ "find_object", py_unreal_engine_find_object, METH_VARARGS, "" },
197198
{ "load_object", py_unreal_engine_load_object, METH_VARARGS, "" },
199+
{ "load_object_with_pak", py_unreal_engine_load_object_with_pak, METH_VARARGS, "" },
198200

199201
{ "load_package", py_unreal_engine_load_package, METH_VARARGS, "" },
200202
#if WITH_EDITOR

Source/UnrealEnginePython/Private/UnrealEnginePythonPrivatePCH.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787

8888
#include "PythonHouseKeeper.h"
8989

90-
9190
#define ue_py_check(py_u) if (!FUnrealEnginePythonHouseKeeper::Get()->IsValidPyUObject(py_u))\
9291
return PyErr_Format(PyExc_Exception, "PyUObject is in invalid state")
9392

Source/UnrealEnginePython/UnrealEnginePython.Build.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class UnrealEnginePython : ModuleRules
2626
private string[] linuxKnownIncludesPaths =
2727
{
2828
"/usr/local/include/python2.7",
29-
"/usr/include/python2.7",
29+
"/usr/include/python2.7",
3030
"/usr/local/include/python3.6",
3131
"/usr/local/include/python3.6m",
3232
"/usr/local/include/python3.5",
@@ -41,9 +41,9 @@ public class UnrealEnginePython : ModuleRules
4141
private string[] linuxKnownLibsPaths =
4242
{
4343
"/usr/lib/libpython2.7.so",
44-
"/usr/lib/x86_64-linux-gnu/libpython2.7.so",
44+
"/usr/lib/x86_64-linux-gnu/libpython2.7.so",
4545
"/usr/local/lib/x86_64-linux-gnu/libpython2.7.so",
46-
"/usr/local/lib/libpython3.6.so",
46+
"/usr/local/lib/libpython3.6.so",
4747
"/usr/local/lib/libpython3.6m.so",
4848
"/usr/local/lib/x86_64-linux-gnu/libpython3.6.so",
4949
"/usr/local/lib/x86_64-linux-gnu/libpython3.6m.so",
@@ -64,7 +64,7 @@ public class UnrealEnginePython : ModuleRules
6464

6565
private string[] macKnownPaths =
6666
{
67-
"/Library/Frameworks/Python.framework/Versions/2.7",
67+
"/Library/Frameworks/Python.framework/Versions/2.7",
6868
"/Library/Frameworks/Python.framework/Versions/3.6",
6969
"/Library/Frameworks/Python.framework/Versions/3.5",
7070
"/System/Library/Frameworks/Python.framework/Versions/2.7",
@@ -101,7 +101,7 @@ public UnrealEnginePython(TargetInfo Target)
101101
{
102102
"Core",
103103
"Sockets",
104-
"Networking"
104+
"Networking",
105105
// ... add other public dependencies that you statically link with here ...
106106
}
107107
);
@@ -126,6 +126,8 @@ public UnrealEnginePython(TargetInfo Target)
126126
"MovieSceneCapture",
127127
"Landscape",
128128
"Foliage",
129+
"PakFile",
130+
"UE4Orchestrator",
129131
// ... add private dependencies that you statically link with here ...
130132
}
131133
);
@@ -179,7 +181,8 @@ public UnrealEnginePython(TargetInfo Target)
179181
"Persona",
180182
"PropertyEditor",
181183
"LandscapeEditor",
182-
"MaterialEditor"
184+
"MaterialEditor",
185+
"UE4Orchestrator",
183186
});
184187
}
185188

UnrealEnginePython.uplugin

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,44 @@
11
{
2-
"FileVersion": 3,
3-
"Version": 1,
4-
"VersionName": "1.0",
5-
"FriendlyName": "UnrealEnginePython",
6-
"Description": "Embed a Python VM in your project",
7-
"Category": "Scripting Languages",
8-
"CreatedBy": "Roberto De Ioris",
9-
"CreatedByURL": "",
10-
"DocsURL": "",
11-
"MarketplaceURL": "",
12-
"SupportURL": "",
13-
"EnabledByDefault": true,
14-
"CanContainContent": true,
15-
"IsBetaVersion": true,
16-
"Installed": false,
17-
"Modules": [
18-
{
19-
"Name": "UnrealEnginePython",
20-
"Type": "Runtime",
21-
"LoadingPhase": "Default"
22-
},
2+
"FileVersion": 3,
3+
"Version": 1,
4+
"VersionName": "1.0",
5+
"FriendlyName": "UnrealEnginePython",
6+
"Description": "Embed a Python VM in your project",
7+
"Category": "Scripting Languages",
8+
"CreatedBy": "Roberto De Ioris",
9+
"CreatedByURL": "",
10+
"DocsURL": "",
11+
"MarketplaceURL": "",
12+
"SupportURL": "",
13+
"EnabledByDefault": true,
14+
"CanContainContent": true,
15+
"IsBetaVersion": true,
16+
"Installed": false,
17+
"Modules": [
2318
{
24-
"Name": "PythonConsole",
25-
"Type": "Editor",
26-
"LoadingPhase": "PostDefault"
27-
},
19+
"Name": "UnrealEnginePython",
20+
"Type": "Runtime",
21+
"LoadingPhase": "Default"
22+
},
2823
{
29-
"Name" : "PythonEditor",
30-
"Type" : "Editor",
31-
"LoadingPhase": "PostDefault"
32-
}
33-
],
34-
"Plugins": [
35-
{
36-
"Name": "LevelSequenceEditor",
37-
"Enabled": true
24+
"Name": "PythonConsole",
25+
"Type": "Editor",
26+
"LoadingPhase": "PostDefault"
27+
},
28+
{
29+
"Name" : "PythonEditor",
30+
"Type" : "Editor",
31+
"LoadingPhase": "PostDefault"
32+
}
33+
],
34+
"Plugins": [
35+
{
36+
"Name": "LevelSequenceEditor",
37+
"Enabled": true
38+
},
39+
{
40+
"Name": "UE4Orchestrator",
41+
"Enabled": true
42+
}
43+
]
3844
}
39-
]
40-
}

0 commit comments

Comments
 (0)