Skip to content

Commit 319059a

Browse files
authored
Merge pull request HBat11233#1 from davidjo/building4.25
Building4.25
2 parents 4b5da5b + 1a8cd3e commit 319059a

Some content is hidden

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

53 files changed

+4159
-211
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Once the plugin is installed and enabled, you get access to the 'PythonConsole'
4040

4141
All of the exposed engine features are under the 'unreal_engine' virtual module (it is completely coded in c into the plugin, so do not expect to run 'import unreal_engine' from a standard python shell)
4242

43-
The minimal supported Unreal Engine version is 4.12, while the latest is 4.23
43+
The minimal supported Unreal Engine version is 4.12, while the latest is 4.24
4444

4545
We support official python.org releases as well as IntelPython and Anaconda distributions.
4646

Source/PythonAutomation/PythonAutomation.Build.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ public PythonAutomation(TargetInfo Target)
1313
{
1414
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
1515
string enableUnityBuild = System.Environment.GetEnvironmentVariable("UEP_ENABLE_UNITY_BUILD");
16-
bFasterWithoutUnity = string.IsNullOrEmpty(enableUnityBuild);
17-
16+
bUseUnity = string.IsNullOrEmpty(enableUnityBuild);
1817
PrivateIncludePaths.AddRange(
1918
new string[] {
2019
"PythonConsole/Private",

Source/PythonConsole/PythonConsole.Build.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public PythonConsole(TargetInfo Target)
1313
{
1414
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
1515
string enableUnityBuild = System.Environment.GetEnvironmentVariable("UEP_ENABLE_UNITY_BUILD");
16-
bFasterWithoutUnity = string.IsNullOrEmpty(enableUnityBuild);
16+
bUseUnity = string.IsNullOrEmpty(enableUnityBuild);
1717

1818
PrivateIncludePaths.AddRange(
1919
new string[] {

Source/PythonEditor/Private/PythonEditor.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
#include "PythonEditorStyle.h"
88
#include "PythonProjectEditor.h"
99
#include "PythonProject.h"
10+
#if ENGINE_MINOR_VERSION >= 24
11+
#include "Subsystems/AssetEditorSubsystem.h"
12+
#endif
1013
#include "Runtime/Slate/Public/Framework/MultiBox/MultiBoxBuilder.h"
1114

1215
static const FName PythonEditorTabName( TEXT( "PythonEditor" ) );
@@ -90,4 +93,4 @@ class FPythonEditor : public IModuleInterface
9093

9194
IMPLEMENT_MODULE( FPythonEditor, PythonEditor )
9295

93-
#undef LOCTEXT_NAMESPACE
96+
#undef LOCTEXT_NAMESPACE

Source/PythonEditor/Private/PythonProjectEditor.cpp

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

33
#include "PythonProjectEditor.h"
4+
5+
#if ENGINE_MINOR_VERSION >= 24
6+
#include "Subsystems/AssetEditorSubsystem.h"
7+
8+
// #include "UnrealEd.h"
9+
#endif
10+
411
#include "SPythonEditor.h"
512
#include "SPythonProjectEditor.h"
613
#include "Runtime/Slate/Public/Widgets/Docking/SDockTab.h"
@@ -13,6 +20,8 @@
1320
#include "PythonProjectEditorCommands.h"
1421
#include "Runtime/Core/Public/HAL/PlatformFilemanager.h"
1522
#include "Runtime/Core/Public/Misc/MessageDialog.h"
23+
24+
1625
#define LOCTEXT_NAMESPACE "PythonEditor"
1726

1827
TWeakPtr<FPythonProjectEditor> FPythonProjectEditor::PythonEditor;
@@ -209,7 +218,13 @@ void FPythonProjectEditor::RegisterToolbarTab(const TSharedRef<class FTabManager
209218

210219
void FPythonProjectEditor::InitPythonEditor(const EToolkitMode::Type Mode, const TSharedPtr< class IToolkitHost >& InitToolkitHost, class UPythonProject* PythonProject)
211220
{
221+
#if ENGINE_MINOR_VERSION >= 24
222+
// UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
223+
// GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->CloseOtherEditors(PythonProject, this);
224+
GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->CloseOtherEditors(PythonProject, this);
225+
#else
212226
FAssetEditorManager::Get().CloseOtherEditors(PythonProject, this);
227+
#endif
213228
PythonProjectBeingEdited = PythonProject;
214229

215230
TSharedPtr<FPythonProjectEditor> ThisPtr(SharedThis(this));

Source/PythonEditor/Private/PythonProjectEditorCommands.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ FPythonProjectEditorCommands::FPythonProjectEditorCommands()
1414

1515
void FPythonProjectEditorCommands::RegisterCommands()
1616
{
17+
#if ENGINE_MINOR_VERSION >= 25
18+
UI_COMMAND(New, "New", "New Python Script.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control, EKeys::N));
19+
UI_COMMAND(NewDirectory, "New Directory", "New Directory.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control | EModifierKey::Shift, EKeys::N));
20+
UI_COMMAND(Delete, "Delete", "Delete Python Script.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control, EKeys::D));
21+
22+
UI_COMMAND(Save, "Save", "Save the currently active document.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control, EKeys::S));
23+
UI_COMMAND(SaveAll, "Save All", "Save all open documents.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control | EModifierKey::Shift, EKeys::S));
24+
UI_COMMAND(Execute, "Execute", "Execute Current Python File.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control, EKeys::Enter));
25+
#if PLATFORM_MAC
26+
UI_COMMAND(ExecuteInMainThread, "Execute In Main Thread", "Execute Current Python File in the Main Thread.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control | EModifierKey::Shift, EKeys::Enter));
27+
#endif
28+
UI_COMMAND(PEP8ize, "PEP8-ize", "Enforce PEP8 to the current code.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control | EModifierKey::Shift, EKeys::P));
29+
#else
1730
UI_COMMAND(New, "New", "New Python Script.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control, EKeys::N));
1831
UI_COMMAND(NewDirectory, "New Directory", "New Directory.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control | EModifierKey::Shift, EKeys::N));
1932
UI_COMMAND(Delete, "Delete", "Delete Python Script.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control, EKeys::D));
@@ -25,6 +38,7 @@ void FPythonProjectEditorCommands::RegisterCommands()
2538
UI_COMMAND(ExecuteInMainThread, "Execute In Main Thread", "Execute Current Python File in the Main Thread.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control | EModifierKey::Shift, EKeys::Enter));
2639
#endif
2740
UI_COMMAND(PEP8ize, "PEP8-ize", "Enforce PEP8 to the current code.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control | EModifierKey::Shift, EKeys::P));
41+
#endif
2842

2943
}
3044

Source/PythonEditor/PythonEditor.Build.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public PythonEditor(TargetInfo Target)
1313

1414
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
1515
string enableUnityBuild = System.Environment.GetEnvironmentVariable("UEP_ENABLE_UNITY_BUILD");
16-
bFasterWithoutUnity = string.IsNullOrEmpty(enableUnityBuild);
16+
bUseUnity = string.IsNullOrEmpty(enableUnityBuild);
1717

1818
PrivateIncludePaths.AddRange(
1919
new string[] {
@@ -32,11 +32,13 @@ public PythonEditor(TargetInfo Target)
3232
"UnrealEd",
3333
"EditorStyle",
3434
"PropertyEditor",
35+
"ContentBrowser",
3536
"Kismet", // for FWorkflowCentricApplication
3637
"InputCore",
3738
"DirectoryWatcher",
3839
"LevelEditor",
3940
"Projects",
41+
"Engine",
4042
"UnrealEnginePython"
4143
}
4244
);

Source/UnrealEnginePython/Private/Blueprint/UEPyEdGraph.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ PyObject *py_ue_graph_add_node(ue_PyUObject * self, PyObject * args)
316316
{
317317
return PyErr_Format(PyExc_Exception, "argument is not a child of UEdGraphNode");
318318
}
319+
EXTRA_UE_LOG(LogPython, Warning, TEXT("add_node: Casting to class %s"), *u_class->GetName());
319320
node = NewObject<UEdGraphNode>(graph, u_class);
320321
node->PostLoad();
321322
}
@@ -328,6 +329,7 @@ PyObject *py_ue_graph_add_node(ue_PyUObject * self, PyObject * args)
328329

329330
node->Rename(*node->GetName(), graph);
330331
}
332+
EXTRA_UE_LOG(LogPython, Warning, TEXT("add_node: renaming node"));
331333
}
332334

333335
if (!node)
@@ -337,8 +339,10 @@ PyObject *py_ue_graph_add_node(ue_PyUObject * self, PyObject * args)
337339
node->CreateNewGuid();
338340
node->PostPlacedNewNode();
339341
node->SetFlags(RF_Transactional);
342+
EXTRA_UE_LOG(LogPython, Warning, TEXT("add_node: allocate pins current pins num %d"), node->Pins.Num());
340343
if (node->Pins.Num() == 0)
341344
{
345+
EXTRA_UE_LOG(LogPython, Warning, TEXT("add_node: allocating pins"));
342346
node->AllocateDefaultPins();
343347
}
344348
node->NodePosX = x;
@@ -527,6 +531,8 @@ PyObject *py_ue_graph_add_node_dynamic_cast(ue_PyUObject * self, PyObject * args
527531
if(!u_class)
528532
return PyErr_Format(PyExc_Exception, "argument is not a UClass");
529533

534+
EXTRA_UE_LOG(LogPython, Warning, TEXT("add_node_dynamic_cast: Casting to class %s %p"), *u_class->GetName(), (void *)u_class);
535+
530536
UK2Node_DynamicCast *node = NewObject<UK2Node_DynamicCast>(graph);
531537
node->TargetType = u_class;
532538
#if ENGINE_MINOR_VERSION > 15
@@ -555,6 +561,8 @@ PyObject *py_ue_graph_add_node_dynamic_cast(ue_PyUObject * self, PyObject * args
555561
FBlueprintEditorUtils::MarkBlueprintAsStructurallyModified(bp);
556562
}
557563

564+
EXTRA_UE_LOG(LogPython, Warning, TEXT("add_node_dynamic_cast: targettype is %p"), (void *)(node->TargetType));
565+
558566
Py_RETURN_UOBJECT(node);
559567
}
560568

@@ -654,6 +662,32 @@ PyObject *py_ue_node_find_pin(ue_PyUObject * self, PyObject * args)
654662
return py_ue_new_edgraphpin(pin);
655663
}
656664

665+
PyObject *py_ue_node_set_purity(ue_PyUObject * self, PyObject * args)
666+
{
667+
ue_py_check(self);
668+
669+
PyObject *py_bool = nullptr;
670+
if (!PyArg_ParseTuple(args, "O:set_purity", &py_bool))
671+
{
672+
return nullptr;
673+
}
674+
675+
UK2Node_DynamicCast *node = ue_py_check_type<UK2Node_DynamicCast>(self);
676+
if (!node)
677+
return PyErr_Format(PyExc_Exception, "uobject is not a K2Node_DynamicCast");
678+
679+
if (PyObject_IsTrue(py_bool))
680+
{
681+
node->SetPurity(true);
682+
}
683+
else
684+
{
685+
node->SetPurity(false);
686+
}
687+
688+
Py_RETURN_NONE;
689+
}
690+
657691
PyObject *py_ue_node_function_entry_set_pure(ue_PyUObject * self, PyObject * args)
658692
{
659693

Source/UnrealEnginePython/Private/Blueprint/UEPyEdGraph.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ PyObject *py_ue_node_create_pin(ue_PyUObject *, PyObject *);
2828
PyObject *py_ue_node_pin_type_changed(ue_PyUObject *, PyObject *);
2929
PyObject *py_ue_node_pin_default_value_changed(ue_PyUObject *, PyObject *);
3030

31+
PyObject *py_ue_node_set_purity(ue_PyUObject *, PyObject *);
32+
3133
PyObject *py_ue_node_function_entry_set_pure(ue_PyUObject *, PyObject *);
3234

3335
PyObject *py_ue_node_get_title(ue_PyUObject *, PyObject *);

Source/UnrealEnginePython/Private/Blueprint/UEPyEdGraphPin.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,15 @@ static int py_ue_edgraphpin_set_sub_category(ue_PyEdGraphPin *self, PyObject *va
253253
return -1;
254254
}
255255

256+
static PyObject *py_ue_edgraphpin_get_direction(ue_PyEdGraphPin *self, void *closure)
257+
{
258+
uint8 direction = self->pin->Direction;
259+
return PyLong_FromLong((long)direction);
260+
}
261+
256262
static PyGetSetDef ue_PyEdGraphPin_getseters[] = {
257263
{ (char*)"name", (getter)py_ue_edgraphpin_get_name, NULL, (char *)"", NULL },
264+
{ (char*)"direction", (getter)py_ue_edgraphpin_get_direction, NULL, (char *)"", NULL },
258265
{ (char*)"category", (getter)py_ue_edgraphpin_get_category, (setter)py_ue_edgraphpin_set_category, (char *)"", NULL },
259266
{ (char*)"sub_category", (getter)py_ue_edgraphpin_get_sub_category, (setter)py_ue_edgraphpin_set_sub_category, (char *)"", NULL },
260267
{ (char*)"default_value", (getter)py_ue_edgraphpin_get_default_value, (setter)py_ue_edgraphpin_set_default_value, (char *)"", NULL },

0 commit comments

Comments
 (0)