Skip to content

Commit 3e301d3

Browse files
author
Roberto De Ioris
committed
reorganized code to allow non-editor builds
1 parent 996ac43 commit 3e301d3

File tree

8 files changed

+30
-17
lines changed

8 files changed

+30
-17
lines changed

Source/UnrealEnginePython/Public/PyFbxFactory.cpp renamed to Source/PythonConsole/Public/PyFbxFactory.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#include "UnrealEnginePythonPrivatePCH.h"
1+
#include "PythonConsolePrivatePCH.h"
22

3-
#if WITH_EDITOR
43
#include "PyFbxFactory.h"
54

65
UPyFbxFactory::UPyFbxFactory(const FObjectInitializer& ObjectInitializer)
@@ -16,5 +15,3 @@ bool UPyFbxFactory::ConfigureProperties() {
1615

1716
return true;
1817
}
19-
20-
#endif

Source/UnrealEnginePython/Public/PyFbxFactory.h renamed to Source/PythonConsole/Public/PyFbxFactory.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#pragma once
22

3-
#if WITH_EDITOR
4-
53
#include "UnrealEd.h"
64

75
#include "PyFbxFactory.generated.h"
@@ -19,4 +17,3 @@ class UPyFbxFactory : public UFbxFactory
1917

2018
};
2119

22-
#endif

Source/PythonConsole/PythonConsole.Build.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ protected string PythonHome
1818

1919
public PythonConsole(TargetInfo Target)
2020
{
21-
PrivateDependencyModuleNames.AddRange(
21+
PrivateIncludePaths.AddRange(
22+
new string[] {
23+
"PythonConsole/Private",
24+
// ... add other private include paths required here ...
25+
}
26+
);
27+
28+
PrivateDependencyModuleNames.AddRange(
2229
new string[] {
2330
"Core",
2431
"CoreUObject", // @todo Mac: for some reason it's needed to link in debug on Mac

Source/UnrealEnginePython/Private/UEPyEditor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#include "UnrealEnginePythonPrivatePCH.h"
2-
31
#if WITH_EDITOR
42

3+
#include "UnrealEnginePythonPrivatePCH.h"
4+
55
#include "Developer/AssetTools/Public/AssetToolsModule.h"
66
#include "Editor/UnrealEd/Classes/Factories/Factory.h"
77
#include "Runtime/AssetRegistry/Public/AssetRegistryModule.h"

Source/UnrealEnginePython/Private/UEPyModule.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,16 @@ static PyMethodDef unreal_engine_methods[] = {
8282
{ "get_selected_assets", py_unreal_engine_get_selected_assets, METH_VARARGS, "" },
8383
{ "get_assets_by_class", py_unreal_engine_get_assets_by_class, METH_VARARGS, "" },
8484
{ "create_blueprint", py_unreal_engine_create_blueprint, METH_VARARGS, "" },
85+
{ "message_dialog_open", py_unreal_engine_message_dialog_open, METH_VARARGS, "" },
86+
{ "set_fbx_import_option", py_unreal_engine_set_fbx_import_option, METH_VARARGS, "" },
8587
#endif
8688

8789
{ "new_object", py_unreal_engine_new_object, METH_VARARGS, "" },
8890

8991

9092
{ "new_class", py_unreal_engine_new_class, METH_VARARGS, "" },
9193

92-
{ "message_dialog_open", py_unreal_engine_message_dialog_open, METH_VARARGS, "" },
9394

94-
{ "set_fbx_import_option", py_unreal_engine_set_fbx_import_option, METH_VARARGS, "" },
9595

9696
{ NULL, NULL },
9797
};
@@ -285,7 +285,9 @@ static PyMethodDef ue_PyUObject_methods[] = {
285285

286286
// Sequencer
287287
{ "sequencer_tracks", (PyCFunction)py_ue_sequencer_tracks, METH_VARARGS, "" },
288+
#if WITH_EDITOR
288289
{ "sequencer_folders", (PyCFunction)py_ue_sequencer_folders, METH_VARARGS, "" },
290+
#endif
289291
{ "sequencer_sections", (PyCFunction)py_ue_sequencer_sections, METH_VARARGS, "" },
290292

291293
{ "add_function", (PyCFunction)py_ue_add_function, METH_VARARGS, "" },
@@ -1015,12 +1017,20 @@ static void py_ue_destroy_params(UFunction *u_function, uint8 *buffer) {
10151017
PyObject *py_ue_ufunction_call(UFunction *u_function, UObject *u_obj, PyObject *args, int argn, PyObject *kwargs) {
10161018

10171019
uint8 *buffer = (uint8 *)FMemory_Alloca(u_function->ParmsSize);
1020+
FMemory::Memzero(buffer, u_function->ParmsSize);
10181021

10191022
// initialize args
10201023
TFieldIterator<UProperty> IArgs(u_function);
10211024
for (; IArgs && (IArgs->PropertyFlags & CPF_Parm); ++IArgs) {
10221025
UProperty *prop = *IArgs;
10231026
prop->InitializeValue_InContainer(buffer);
1027+
#if WITH_EDITOR
1028+
FString default_key = FString("CPP_Default_") + prop->GetName();
1029+
FString default_key_value = u_function->GetMetaData(FName(*default_key));
1030+
if (!default_key_value.IsEmpty()) {
1031+
prop->ImportText(*default_key_value, prop->ContainerPtrToValuePtr<uint8>(buffer), PPF_Localized, NULL);
1032+
}
1033+
#endif
10241034
}
10251035

10261036
Py_ssize_t tuple_len = PyTuple_Size(args);

Source/UnrealEnginePython/Private/UEPySequencer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ PyObject *py_ue_sequencer_tracks(ue_PyUObject *self, PyObject * args) {
3636
return py_tracks;
3737
}
3838

39+
#if WITH_EDITOR
3940
PyObject *py_ue_sequencer_folders(ue_PyUObject *self, PyObject * args) {
4041

4142
ue_py_check(self);
@@ -68,6 +69,7 @@ PyObject *py_ue_sequencer_folders(ue_PyUObject *self, PyObject * args) {
6869

6970
return py_folders;
7071
}
72+
#endif
7173

7274
PyObject *py_ue_sequencer_sections(ue_PyUObject *self, PyObject * args) {
7375

Source/UnrealEnginePython/Private/UEPySequencer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@
55
#include "UnrealEnginePython.h"
66

77
PyObject *py_ue_sequencer_tracks(ue_PyUObject *, PyObject *);
8+
#if WITH_EDITOR
89
PyObject *py_ue_sequencer_folders(ue_PyUObject *, PyObject *);
10+
#endif
911
PyObject *py_ue_sequencer_sections(ue_PyUObject *, PyObject *);

Source/UnrealEnginePython/UnrealEnginePython.Build.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public UnrealEnginePython(TargetInfo Target)
5555
"Slate",
5656
"SlateCore",
5757
"MovieScene",
58-
"LevelSequence"
58+
"LevelSequence",
59+
"UnrealEd"
5960
// ... add private dependencies that you statically link with here ...
6061
}
6162
);
@@ -71,10 +72,7 @@ public UnrealEnginePython(TargetInfo Target)
7172

7273
if (UEBuildConfiguration.bBuildEditor)
7374
{
74-
PrivateDependencyModuleNames.AddRange(new string[]
75-
{
76-
"UnrealEd"
77-
});
75+
PrivateDependencyModuleNames.AddRange(new string[]{});
7876
}
7977

8078
if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))

0 commit comments

Comments
 (0)