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

Commit ddf8bfc

Browse files
committed
Merge branch 'refs/heads/pr/4' into update-4.17
# Conflicts: # .gitignore # Source/PythonConsole/PythonConsole.Build.cs # Source/PythonEditor/PythonEditor.Build.cs # Source/UnrealEnginePython/Private/UEPyModule.cpp # Source/UnrealEnginePython/Private/UnrealEnginePython.cpp # Source/UnrealEnginePython/Public/PythonComponent.h # Source/UnrealEnginePython/UnrealEnginePython.Build.cs
2 parents 76a93c2 + 34bbe25 commit ddf8bfc

File tree

377 files changed

+25831
-1569
lines changed

Some content is hidden

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

377 files changed

+25831
-1569
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,7 @@ ENV/
9191
Binaries/
9292

9393
#don't update this file again
94-
Content/Scripts/upyconfig.json
94+
Content/Scripts/upyconfig.json
95+
python35/
96+
python27/
97+
*.un~

CONTRIBUTORS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Roberto De Ioris (maintainer and developer, 20Tab)
2+
Ikrima Elhassan (developer and sponsor, Kite & Lightning)
13
Tony Barbieri
24
Huey Park
35
Eric Feng
6+

README.md

Lines changed: 64 additions & 263 deletions
Large diffs are not rendered by default.

Resources/Icon128.png

-3.43 KB
Loading
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include "PythonConsolePrivatePCH.h"
2+
3+
#include "PythonScriptFactory.h"
4+
#include "PythonScript.h"
5+
6+
UPythonScriptFactory::UPythonScriptFactory(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) {
7+
8+
Formats.Add(FString("py;Python Script"));
9+
10+
bCreateNew = false;
11+
bEditAfterNew = true;
12+
13+
bEditorImport = true;
14+
15+
SupportedClass = UPythonScript::StaticClass();
16+
}
17+
18+
UObject* UPythonScriptFactory::FactoryCreateFile(UClass * Class, UObject *InParent, FName InName, EObjectFlags Flags, const FString& Filename, const TCHAR* Parms, FFeedbackContext *Warn, bool& bOutOperationCanceled) {
19+
UPythonScript *NewAsset = NewObject<UPythonScript>(InParent, Class, InName, Flags);
20+
21+
NewAsset->ScriptPath = Filename;
22+
23+
bOutOperationCanceled = false;
24+
return NewAsset;
25+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#pragma once
2+
3+
#include "UnrealEd.h"
4+
#include "PyFactory.generated.h"
5+
6+
UCLASS()
7+
class UPyFactory : public UFactory
8+
{
9+
GENERATED_BODY()
10+
11+
public:
12+
13+
virtual UObject* FactoryCreateFile(UClass * Class, UObject *InParent, FName InName, EObjectFlags Flags, const FString& Filename, const TCHAR* Parms, FFeedbackContext *Warn, bool& bOutOperationCanceled) override {
14+
return PyFactoryCreateFile(Class, InParent, InName.ToString(), Filename);
15+
}
16+
17+
virtual UObject* FactoryCreateNew(UClass * Class, UObject *InParent, FName InName, EObjectFlags Flags, UObject *Context, FFeedbackContext *Warn) override {
18+
return PyFactoryCreateNew(Class, InParent, InName.ToString());
19+
}
20+
21+
virtual UClass* ResolveSupportedClass() override {
22+
if (SupportedClass)
23+
return SupportedClass;
24+
return PyResolveSupportedClass();
25+
}
26+
27+
virtual FText GetDisplayName() const override {
28+
if (!PyDisplayName.IsEmpty()) {
29+
return FText::FromString(PyDisplayName);
30+
}
31+
return FText::FromString(GetClass()->GetName().Replace(UTF8_TO_TCHAR("Factory"), UTF8_TO_TCHAR("")));
32+
}
33+
34+
virtual FText GetToolTip() const override {
35+
if (!PyToolTip.IsEmpty()) {
36+
return FText::FromString(PyToolTip);
37+
}
38+
return GetDisplayName();
39+
}
40+
41+
UFUNCTION(BlueprintImplementableEvent)
42+
UObject* PyFactoryCreateFile(class UClass * Class, UObject *InParent, const FString & InName, const FString & Filename);
43+
44+
UFUNCTION(BlueprintImplementableEvent)
45+
UObject* PyFactoryCreateNew(class UClass * Class, UObject *InParent, const FString & InName);
46+
47+
UFUNCTION(BlueprintImplementableEvent)
48+
UClass* PyResolveSupportedClass();
49+
50+
UPROPERTY(BlueprintReadWrite, Category = "PyFactory")
51+
FString PyDisplayName;
52+
53+
UPROPERTY(BlueprintReadWrite, Category = "PyFactory")
54+
FString PyToolTip;
55+
56+
};
57+
58+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#pragma once
2+
3+
#include "UnrealEd.h"
4+
#include "PythonScriptFactory.generated.h"
5+
6+
UCLASS()
7+
class UPythonScriptFactory : public UFactory
8+
{
9+
GENERATED_UCLASS_BODY()
10+
11+
public:
12+
virtual UObject* FactoryCreateFile(UClass * Class, UObject *InParent, FName InName, EObjectFlags Flags, const FString& Filename, const TCHAR* Parms, FFeedbackContext *Warn, bool& bOutOperationCanceled) override;
13+
};
14+
15+

Source/PythonConsole/PythonConsole.Build.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55

66
public class PythonConsole : ModuleRules
77
{
8-
9-
8+
#if WITH_FORWARDED_MODULE_RULES_CTOR
109
public PythonConsole(ReadOnlyTargetRules Target) : base(Target)
11-
{
10+
#else
11+
public PythonConsole(TargetInfo Target)
12+
#endif
13+
{
1214
PrivateIncludePaths.AddRange(
1315
new string[] {
1416
"PythonConsole/Private",
@@ -17,19 +19,19 @@ public PythonConsole(ReadOnlyTargetRules Target) : base(Target)
1719
);
1820

1921
PrivateDependencyModuleNames.AddRange(
20-
new string[] {
21-
"Core",
22-
"CoreUObject", // @todo Mac: for some reason it's needed to link in debug on Mac
22+
new string[] {
23+
"Core",
24+
"CoreUObject", // @todo Mac: for some reason it's needed to link in debug on Mac
2325
"Engine",
2426
"InputCore",
25-
"UnrealEd",
26-
"Slate",
27-
"SlateCore",
27+
"UnrealEd",
28+
"Slate",
29+
"SlateCore",
2830
"EditorStyle",
2931
"TargetPlatform",
3032
"UnrealEnginePython"
3133
}
32-
);
34+
);
3335

3436
}
3537
}

Source/PythonEditor/Private/PYRichTextSyntaxHighlighterTextLayoutMarshaller.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ const TCHAR* BuiltInKeywords[] =
229229
TEXT("__le__"),
230230
TEXT("__eq__"),
231231
TEXT("__call__"),
232+
TEXT("with"),
233+
TEXT("async"),
234+
TEXT("await"),
232235
};
233236

234237

Source/PythonEditor/Private/PythonProject.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
UPythonProject::UPythonProject(const FObjectInitializer& ObjectInitializer)
77
: Super(ObjectInitializer)
88
{
9-
Path = FPaths::GameContentDir() / TEXT("Scripts");
10-
if (!FPaths::DirectoryExists(Path)) {
11-
IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
12-
PlatformFile.CreateDirectory(*Path);
13-
}
9+
FUnrealEnginePythonModule &PythonModule = FModuleManager::GetModuleChecked<FUnrealEnginePythonModule>("UnrealEnginePython");
10+
Path = PythonModule.ScriptsPath;
1411
}

0 commit comments

Comments
 (0)