Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit e48a472

Browse files
committed
Merge branch 'master' of https://github.com/20tab/UnrealEnginePython into 20tab-master
2 parents 049b801 + da04e62 commit e48a472

File tree

272 files changed

+51018
-102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

272 files changed

+51018
-102
lines changed

README.md

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The currently supported Unreal Engine versions are 4.12, 4.13, 4.14, 4.15, 4.16,
4040

4141
We support official python.org releases as well as IntelPython and Anaconda distributions.
4242

43-
Note: this plugin has nothing to do with the experimental 'PythonScriptPlugin' included in Unreal Engine >= 4.19. We aim at full integration with engine and editor (included the Slate api), as well as support for the vast majority of python features like asyncio, coroutines, generators, threads and third party modules.
43+
Note: this plugin has nothing to do with the experimental 'PythonScriptPlugin' included in Unreal Engine >= 4.19. We aim at full integration with engine and editor (included the Slate api, check here: https://github.com/20tab/UnrealEnginePython/blob/master/docs/Slate_API.md), as well as support for the vast majority of python features like asyncio, coroutines, generators, threads and third party modules.
4444

4545
# Binary installation on Windows (64 bit)
4646

@@ -171,9 +171,14 @@ Just remove the .so files in Plugins/UnrealEnginePython/Binaries/Linux and pull
171171

172172
At the next run the build procedure wil be started again.
173173

174+
Android Deployment
175+
------------------
176+
177+
Check https://github.com/20tab/UnrealEnginePython/blob/master/docs/Android.md
178+
174179
# Installation on other platforms
175180

176-
Currently only Windows, MacOSX and Linux are supported. We are investigating Android support too via the kivy project.
181+
Currently only Windows, MacOSX, Linux and Android are supported.
177182

178183
# Using Python with Unreal Engine (finally)
179184

@@ -432,6 +437,27 @@ vec = self.uobject.GetActorLocation()
432437

433438
Reflection based functions are those in camelcase (or with the first capital letter). Native functions instead follow the python style, with lower case, underscore-as-separator function names.
434439

440+
Note that, in editor builds, when you change the property of an archetype (included ClassDefaultObject) via __setattr__ all of the archtype instances will be updated too.
441+
442+
To be more clear:
443+
444+
```python
445+
your_blueprint.GeneratedClass.get_cdo().CharacterMovement.MaxWalkSpeed = 600.0
446+
```
447+
448+
is a super shortcut for:
449+
450+
```python
451+
your_blueprint.GeneratedClass.get_cdo().CharacterMovement.pre_edit_change('MaxWalkSpeed')
452+
your_blueprint.GeneratedClass.get_cdo().CharacterMovement.set_property('MaxWalkSpeed', 600.0)
453+
your_blueprint.GeneratedClass.get_cdo().CharacterMovement.post_edit_change_property('MaxWalkSpeed')
454+
for instance in your_blueprint.GeneratedClass.get_cdo().CharacterMovement.get_archetype_instances():
455+
instance.pre_edit_change('MaxWalkSpeed')
456+
instance.set_property('MaxWalkSpeed', 600.0)
457+
instance.post_edit_change_property('MaxWalkSpeed')
458+
```
459+
460+
435461
The automagic UClass, UStruct and UEnums mappers
436462
------------------------------------------------
437463

@@ -479,8 +505,6 @@ if is_hitting_something:
479505
ue.log(hit_result)
480506
```
481507

482-
Remember that structs are passed by value (not by ref like UObject's), so a dedicated unreal_engine.UScriptStruct python class is exposed.
483-
484508
To create a new struct instance you can do:
485509

486510
```python
@@ -501,29 +525,6 @@ To access the fields of a struct just call the fields() method.
501525

502526
A good example of struct usage is available here: https://github.com/20tab/UnrealEnginePython/blob/master/docs/Settings.md
503527

504-
As structs are passed by value, you need to pay attention when manipulating structs fields that are structs by themselves:
505-
506-
```python
507-
from unreal_engine.structs import TerrificStruct, DumbStruct
508-
509-
ts = TerrificStruct()
510-
ts.dumb = DumbStruct(Foo=17, Bar=22)
511-
512-
# will not modify the original DumbStruct but a copy of it !!!
513-
ts.dumb.Foo = 22
514-
```
515-
516-
You can eventually force structs to be passed by ref (extremely dangerous as the internal C pointer could be a dangling one) using the ref() function:
517-
518-
```python
519-
from unreal_engine.structs import TerrificStruct, DumbStruct
520-
521-
ts = TerrificStruct()
522-
ts.dumb = DumbStruct(Foo=17, Bar=22)
523-
524-
# ref() will return a pointer to a struct
525-
ts.ref().dumb.foo().Foo = 22
526-
```
527528

528529
More details here: https://github.com/20tab/UnrealEnginePython/blob/master/docs/MemoryManagement.md
529530

@@ -691,6 +692,7 @@ The following parameters are supported:
691692
* `RelativeAdditionalModulesPath`: like AdditionalModulesPath, but the path is relative to the /Content directory
692693
* `ZipPath`: allow to specify a .zip file that is added to sys.path
693694
* `RelativeZipPath`: like ZipPath, but the path is relative to the /Content directory
695+
* `ImportModules: comma/space/semicolon separated list of modules to import on startup (after ue_site)
694696

695697
Example:
696698

@@ -947,9 +949,9 @@ We try to do our best to "protect" the user, but you can effectively crash UE fr
947949
Contacts and Commercial Support
948950
-------------------------------
949951

950-
If you want to contact us (for help, support, sponsorship), drop a mail to info at 20tab.com or follow @unbit on twitter
952+
If you need commercial support for UnrealEnginePython just drop a mail to info at 20tab.com
951953

952-
We offer commercial support for both UnrealEngine and UnrealEnginePython, again drop a mail to info at 20tab.com for more infos
954+
Follow @unbit on twitter for news about the project
953955

954956
Special Thanks
955957
--------------

Source/PythonConsole/Private/PythonConsoleModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "SPythonLog.h"
66
#include "TabManager.h"
77
#include "Editor/WorkspaceMenuStructure/Public/WorkspaceMenuStructureModule.h"
8-
#include "SDockTab.h"
8+
#include "Runtime/Slate/Public/Widgets/Docking/SDockTab.h"
99
#include "Editor/WorkspaceMenuStructure/Public/WorkspaceMenuStructure.h"
1010

1111
IMPLEMENT_MODULE( FPythonConsoleModule, PythonConsole );

Source/PythonConsole/Private/SPythonConsole.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#pragma once
44

5-
#include "SlateCore.h"
5+
#include "Runtime/SlateCore/Public/SlateCore.h"
66
#include "EditorStyle.h"
77
#include "PythonConsoleModule.h"
88

Source/PythonConsole/Private/SPythonLog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
22

33
#include "SPythonLog.h"
4-
#include "SScrollBorder.h"
4+
#include "Runtime/Slate/Public/Widgets/Layout/SScrollBorder.h"
55
#include "GameFramework/GameMode.h"
66
#include "Engine/LocalPlayer.h"
77
#include "GameFramework/GameState.h"
8-
#include "SSearchBox.h"
8+
#include "Runtime/Slate/Public/Widgets/Input/SSearchBox.h"
99
#include "Runtime/Launch/Resources/Version.h"
1010
#include "Runtime/Slate/Public/Framework/Text/SlateTextLayout.h"
1111
#include "Editor/EditorStyle/Public/Classes/EditorStyleSettings.h"

Source/PythonConsole/Private/SPythonLog.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
22

33
#pragma once
4-
#include "BaseTextLayoutMarshaller.h"
5-
#include "TextFilterExpressionEvaluator.h"
6-
#include "SlateCore.h"
4+
#include "Runtime/Slate/Public/Framework/Text/BaseTextLayoutMarshaller.h"
5+
#include "Runtime/Core/Public/Misc/TextFilterExpressionEvaluator.h"
6+
#include "Runtime/SlateCore/Public/SlateCore.h"
77
#include "UnrealEnginePython.h"
88
#include "Runtime/Slate/Public/Widgets/Input/SMultiLineEditableTextBox.h"
99
#include "Runtime/Slate/Public/Widgets/Input/SEditableTextBox.h"

Source/PythonConsole/Public/PythonConsoleModule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#pragma once
44

5-
#include "SlateBasics.h"
5+
#include "Runtime/Slate/Public/SlateBasics.h"
66

77
/** Style of the debug console */
88
namespace EPythonConsoleStyle

Source/PythonEditor/Private/PYRichTextSyntaxHighlighterTextLayoutMarshaller.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
#include "Runtime/SlateCore/Public/Styling/SlateTypes.h"
55
#include "PythonSyntaxTokenizer.h"
6-
#include "PlainTextLayoutMarshaller.h"
7-
#include "ITextDecorator.h"
6+
#include "Runtime/Slate/Public/Framework/Text/PlainTextLayoutMarshaller.h"
7+
#include "Runtime/Slate/Public/Framework/Text/ITextDecorator.h"
88
#include "PythonEditorStyle.h"
99

1010

Source/PythonEditor/Private/PythonEditor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
22

3-
#include "ModuleManager.h"
3+
#include "Runtime/Core/Public/Modules/ModuleManager.h"
44
#include "AssetToolsModule.h"
5-
#include "AssetEditorToolkit.h"
5+
#include "Editor/UnrealEd/Public/Toolkits/AssetEditorToolkit.h"
66
#include "LevelEditor.h"
77
#include "PythonEditorStyle.h"
88
#include "PythonProjectEditor.h"

Source/PythonEditor/Private/PythonEditorStyle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#pragma once
44

5-
#include "SlateStyle.h"
5+
#include "Runtime/SlateCore/Public/Styling/SlateStyle.h"
66

77
class FPythonEditorStyle
88
{

Source/PythonEditor/Private/PythonProjectEditor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "PythonProjectEditor.h"
44
#include "SPythonEditor.h"
55
#include "SPythonProjectEditor.h"
6-
#include "SDockTab.h"
6+
#include "Runtime/Slate/Public/Widgets/Docking/SDockTab.h"
77
#include "PythonProjectEditorToolbar.h"
88
#include "Editor/Kismet/Public/WorkflowOrientedApp/WorkflowUObjectDocuments.h"
99
#include "Editor/Kismet/Public/WorkflowOrientedApp/ApplicationMode.h"

Source/PythonEditor/Private/PythonProjectEditor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#pragma once
44

5-
#include "WorkflowCentricApplication.h"
5+
#include "Editor/Kismet/Public/WorkflowOrientedApp/WorkflowCentricApplication.h"
66
#include "Editor/Kismet/Public/WorkflowOrientedApp/WorkflowTabManager.h"
77
#include "Runtime/Launch/Resources/Version.h"
88

Source/PythonEditor/Private/PythonProjectEditorCommands.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#pragma once
44

5-
#include "Commands.h"
5+
#include "Runtime/Slate/Public/Framework/Commands/Commands.h"
66

77
class FPythonProjectEditorCommands : public TCommands<FPythonProjectEditorCommands>
88
{

Source/PythonEditor/Private/PythonSyntaxTokenizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
22

33
#include "PythonSyntaxTokenizer.h"
4-
#include "BreakIterator.h"
4+
#include "Runtime/Core/Public/Internationalization/BreakIterator.h"
55

66
TSharedRef< FPythonSyntaxTokenizer > FPythonSyntaxTokenizer::Create(TArray<FRule> InRules)
77
{

Source/PythonEditor/Private/SProjectViewItem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
22

33
#include "SProjectViewItem.h"
4-
#include "SInlineEditableTextBlock.h"
5-
#include "BreakIterator.h"
4+
#include "Runtime/Slate/Public/Widgets/Text/SInlineEditableTextBlock.h"
5+
#include "Runtime/Core/Public/Internationalization/BreakIterator.h"
66
#include "PythonEditorStyle.h"
77

88
#define LOCTEXT_NAMESPACE "ProjectViewItem"

Source/PythonEditor/Private/SPythonEditableText.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#pragma once
44

5-
#include "SMultiLineEditableText.h"
5+
#include "Runtime/Slate/Public/Widgets/Text/SMultiLineEditableText.h"
66

77
class SPythonEditableText : public SMultiLineEditableText
88
{

Source/PythonEditor/Private/SPythonEditor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
22

33
#include "SPythonEditor.h"
4-
#include "SMultiLineEditableText.h"
4+
#include "Runtime/Slate/Public/Widgets/Text/SMultiLineEditableText.h"
55
#include "PYRichTextSyntaxHighlighterTextLayoutMarshaller.h"
66
#include "SPythonEditableText.h"
77
#include "Runtime/Core/Public/Misc/FileHelper.h"

Source/PythonEditor/Private/SPythonProjectEditor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "SPythonProjectEditor.h"
44
#include "SProjectViewItem.h"
55
#include "DirectoryScanner.h"
6-
#include "SThrobber.h"
6+
#include "Runtime/Slate/Public/Widgets/Images/SThrobber.h"
77
#include "PythonEditorStyle.h"
88
#include "PythonProjectEditor.h"
99
#include "PythonProject.h"

Source/PythonEditor/Private/WhiteSpaceTextRun.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#pragma once
44

5-
#include "SlateTextRun.h"
5+
#include "Runtime/Slate/Public/Framework/Text/SlateTextRun.h"
66

77
class FWhiteSpaceTextRun : public FSlateTextRun
88
{

Source/UnrealEnginePython/Private/Fbx/UEPyFbxIOSettings.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33

44
#if WITH_EDITOR
55

6+
#if PLATFORM_LINUX
7+
#if defined(__clang__)
8+
#pragma clang diagnostic ignored "-Wnull-dereference"
9+
#endif
10+
#endif
11+
612
#include <fbxsdk.h>
713

814
struct ue_PyFbxIOSettings

Source/UnrealEnginePython/Private/Fbx/UEPyFbxImporter.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33

44
#if WITH_EDITOR
55

6+
#if PLATFORM_LINUX
7+
#if defined(__clang__)
8+
#pragma clang diagnostic ignored "-Wnull-dereference"
9+
#endif
10+
#endif
11+
612
#include <fbxsdk.h>
713

814
struct ue_PyFbxImporter

Source/UnrealEnginePython/Private/Fbx/UEPyFbxManager.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33

44
#if WITH_EDITOR
55

6+
#if PLATFORM_LINUX
7+
#if defined(__clang__)
8+
#pragma clang diagnostic ignored "-Wnull-dereference"
9+
#endif
10+
#endif
11+
12+
613
#include <fbxsdk.h>
714

815
struct ue_PyFbxManager

Source/UnrealEnginePython/Private/Fbx/UEPyFbxMesh.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
#if WITH_EDITOR
55
#if ENGINE_MINOR_VERSION > 12
66

7+
#if PLATFORM_LINUX
8+
#if defined(__clang__)
9+
#pragma clang diagnostic ignored "-Wnull-dereference"
10+
#endif
11+
#endif
12+
713
#include <fbxsdk.h>
814

915
struct ue_PyFbxMesh

Source/UnrealEnginePython/Private/Fbx/UEPyFbxNode.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33

44
#if WITH_EDITOR
55
#if ENGINE_MINOR_VERSION > 12
6+
7+
#if PLATFORM_LINUX
8+
#if defined(__clang__)
9+
#pragma clang diagnostic ignored "-Wnull-dereference"
10+
#endif
11+
#endif
12+
613
#include <fbxsdk.h>
714

815
struct ue_PyFbxNode
@@ -20,4 +27,4 @@ PyObject *py_ue_new_fbx_node(FbxNode *);
2027
ue_PyFbxNode *py_ue_is_fbx_node(PyObject *);
2128

2229
#endif
23-
#endif
30+
#endif

Source/UnrealEnginePython/Private/Fbx/UEPyFbxObject.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33

44
#if WITH_EDITOR
55

6+
7+
#if PLATFORM_LINUX
8+
#if defined(__clang__)
9+
#pragma clang diagnostic ignored "-Wnull-dereference"
10+
#endif
11+
#endif
12+
613
#include <fbxsdk.h>
714

815
struct ue_PyFbxObject {

Source/UnrealEnginePython/Private/Fbx/UEPyFbxPose.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33

44
#if WITH_EDITOR
55

6+
#if PLATFORM_LINUX
7+
#if defined(__clang__)
8+
#pragma clang diagnostic ignored "-Wnull-dereference"
9+
#endif
10+
#endif
11+
612
#include <fbxsdk.h>
713

814
struct ue_PyFbxPose

Source/UnrealEnginePython/Private/Fbx/UEPyFbxProperty.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33

44
#if WITH_EDITOR
55

6+
#if PLATFORM_LINUX
7+
#if defined(__clang__)
8+
#pragma clang diagnostic ignored "-Wnull-dereference"
9+
#endif
10+
#endif
11+
612
#include <fbxsdk.h>
713

814
struct ue_PyFbxProperty {

0 commit comments

Comments
 (0)