Skip to content

Commit 75f03b2

Browse files
author
Roberto De Ioris
committed
added editor_command_build() and editor_command_build_lighting(), #83
1 parent 80e8eb1 commit 75f03b2

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

Source/UnrealEnginePython/Private/UEPyEditor.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
#include "Runtime/AssetRegistry/Public/AssetRegistryModule.h"
88
#include "Kismet2/KismetEditorUtilities.h"
99
#include "Editor/ContentBrowser/Public/ContentBrowserModule.h"
10+
1011
#include "UnrealEd.h"
1112
#include "FbxMeshUtils.h"
1213
#include "Kismet2/BlueprintEditorUtils.h"
14+
#include "Editor/LevelEditor/Public/LevelEditorActions.h"
1315

1416

1517
PyObject *py_unreal_engine_get_editor_world(PyObject * self, PyObject * args) {
@@ -49,6 +51,28 @@ PyObject *py_unreal_engine_editor_get_selected_actors(PyObject * self, PyObject
4951
return actors;
5052
}
5153

54+
PyObject *py_unreal_engine_editor_command_build(PyObject * self, PyObject * args) {
55+
56+
if (!GEditor)
57+
return PyErr_Format(PyExc_Exception, "no GEditor found");
58+
59+
FLevelEditorActionCallbacks::Build_Execute();
60+
61+
Py_INCREF(Py_None);
62+
return Py_None;
63+
}
64+
65+
PyObject *py_unreal_engine_editor_command_build_lighting(PyObject * self, PyObject * args) {
66+
67+
if (!GEditor)
68+
return PyErr_Format(PyExc_Exception, "no GEditor found");
69+
70+
FLevelEditorActionCallbacks::BuildLightingOnly_Execute();
71+
Py_INCREF(Py_None);
72+
return Py_None;
73+
}
74+
75+
5276
PyObject *py_unreal_engine_editor_deselect_actors(PyObject * self, PyObject * args) {
5377

5478
if (!GEditor)

Source/UnrealEnginePython/Private/UEPyEditor.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ PyObject *py_unreal_engine_blueprint_add_new_timeline(PyObject *, PyObject *);
3232
PyObject *py_unreal_engine_editor_play(PyObject *, PyObject *);
3333
PyObject *py_unreal_engine_editor_on_asset_post_import(PyObject *, PyObject *);
3434

35+
PyObject *py_unreal_engine_editor_command_build(PyObject *, PyObject *);
36+
PyObject *py_unreal_engine_editor_command_build_lighting(PyObject *, PyObject *);
37+
3538
// efeng additional functions
3639
PyObject *py_unreal_engine_create_material_instance( PyObject *, PyObject * );
3740

Source/UnrealEnginePython/Private/UEPyModule.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ static PyMethodDef unreal_engine_methods[] = {
139139
{ "get_assets", py_unreal_engine_get_assets, METH_VARARGS, "" },
140140
{ "get_selected_assets", py_unreal_engine_get_selected_assets, METH_VARARGS, "" },
141141
{ "get_assets_by_class", py_unreal_engine_get_assets_by_class, METH_VARARGS, "" },
142+
143+
{ "editor_command_build", py_unreal_engine_editor_command_build, METH_VARARGS, "" },
144+
{ "editor_command_build_lighting", py_unreal_engine_editor_command_build_lighting, METH_VARARGS, "" },
142145
#pragma warning(suppress: 4191)
143146
{ "get_assets_by_filter", (PyCFunction)py_unreal_engine_get_assets_by_filter, METH_VARARGS | METH_KEYWORDS, "" },
144147
{ "create_blueprint", py_unreal_engine_create_blueprint, METH_VARARGS, "" },

Source/UnrealEnginePython/UnrealEnginePython.Build.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public UnrealEnginePython(TargetInfo Target)
7575
{
7676
PrivateDependencyModuleNames.AddRange(new string[]{
7777
"UnrealEd",
78+
"LevelEditor"
7879
});
7980
}
8081

0 commit comments

Comments
 (0)