Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 4.27 & 5.0.0 #880

Open
wants to merge 66 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
3562108
Importing the python libs from https://github.com/pybee/Python-Apple-…
cyberbibby Oct 24, 2018
a5b7298
Modify the code to support building iOS.
cyberbibby Oct 24, 2018
e82d70a
Fix the low mistake.
cyberbibby Oct 25, 2018
8d95561
Fix the xcode's compile errors.
Oct 27, 2018
7e72604
Setting the python search path, and then the app launch success.
Oct 31, 2018
03c08c0
Using the stdlib.zip in Lib, copy
Nov 7, 2018
f330041
Merge branch 'master' of github.com/20tab/UnrealEnginePython into Add…
Nov 8, 2018
1766e02
Merge remote-tracking branch 'github/master' into Add-support-for-iOS
Nov 13, 2018
0eb1a2d
Fix the warnings from vs.
Nov 13, 2018
f8e0a91
FRotator arguments order should be `pitch` `yaw` `roll` instead of `r…
F0x06 May 3, 2019
bfdea2a
Merge pull request #718 from F0x06/frotator-args-fix
Jun 15, 2020
3ff694e
Added define for FRotator argument order if really want original Unre…
Jun 15, 2020
7114954
Updated to Unreal Engine 4.24.2
SaxonRah Feb 16, 2020
eb84e8c
Update README.md
SaxonRah Feb 16, 2020
607132e
Patched up differences from following merge into my master.
May 6, 2020
d0b0a72
Remove hosts-per-state.py from Source - does not seem appropriate place.
Jun 25, 2020
fca0597
Removed the IAssetTools.h - it failed to build with 4.25 and commente…
Jun 28, 2020
e3ebc3a
Wrapped some 4.24 updates with appropriate ENGINE_MINOR_VERSION so st…
Jun 28, 2020
ed3499c
More non-FProperty updates from Support4.25 pull request patched in.
Jun 28, 2020
5c96b51
Non-FProperty updates I needed to build on 4.25.
Jun 28, 2020
d957ca0
Additional function wraps added while debugging blueprint node creati…
Jun 28, 2020
e23c956
Added keyword arguments for Outer and Name for UObject instance creat…
Jun 28, 2020
f52a2c1
Missed non-FProperty update from Support4.25 pull request patched in.
Jun 28, 2020
350998c
Major update for 4.25 so can load system python shared library extens…
Jul 4, 2020
b76e101
More wraps of 4.24 updates with appropriate ENGINE_MINOR_VERSION so s…
Jul 4, 2020
4a7a3f4
Updated to use FProperty/FFieldClass instead of UProperty.
Jun 29, 2020
98e31d1
Added debug prints under define EXTRA_UE_LOG control.
Jun 29, 2020
7f9b917
Added python3.8 for Linux as that is default for Ubuntu 20.04.
Jun 29, 2020
21b4ddc
Fixup for building on Ubuntu 20.04.
Jun 29, 2020
2ccfe75
Changed to original order by default for FRotator arguments so doesnt…
Jun 30, 2020
7a21ace
Added debug prints for property conversion from or to python.
Jul 4, 2020
482355c
Revert "Added debug prints for property conversion from or to python."
Jul 4, 2020
c0a0089
More updates to fix 4.25 deprecations.
Jul 5, 2020
584f78f
Possible fixup for PlayInEditor 4.25 changes.
Jul 5, 2020
1ce237e
Fix the blueprint variable unit test.
jonlm May 1, 2019
c686eb1
Added new versions of some examples to work in 4.25.
Jul 5, 2020
9da24f4
Correct debug code - added EXTRA_DEBUG_CODE ifdef wrap.
Jul 17, 2020
06ef4b3
Added pragmas to convert -Wshadow from errors to warnings for Fbx mod…
Jul 17, 2020
d04c3af
Wrapped more editor only functions with WITH_EDITOR to allow package …
Jul 20, 2020
1a8cd3e
Created new type check functions for FProperty and updated py_ue_get_…
Jul 22, 2020
319059a
Merge pull request #1 from davidjo/building4.25
crazytuzi Apr 21, 2022
4ad30a9
Support UE4.27
crazytuzi Apr 22, 2022
9b55bfb
Support UE5.0.0-preview-1
crazytuzi Apr 23, 2022
31d55a8
Support UE5.0.0
crazytuzi Apr 23, 2022
d1c7a89
setlocale
crazytuzi Apr 25, 2022
4b48a8b
Extend Property
crazytuzi Apr 26, 2022
a7ec270
Disable PythonScriptPlugin
crazytuzi Apr 26, 2022
0495906
Merge branch 'Add-support-for-iOS' of https://github.com/cyberbibby/U…
Apr 26, 2022
db422b1
Merge pull request #3 from crazytuzi/cyberbibby-Add-support-for-iOS
crazytuzi Apr 26, 2022
b8e9b74
Fix merge error
crazytuzi Apr 26, 2022
3451257
Fix FUnrealEnginePythonModule::RunFile in IOS
crazytuzi Apr 27, 2022
27ae881
Mac Path
crazytuzi Apr 28, 2022
06cbce6
Win64 Path
crazytuzi Apr 28, 2022
f2de7ff
PythonScripts
crazytuzi Apr 28, 2022
98769b7
Add support for Android
crazytuzi May 4, 2022
fc9f0c8
Merge branch 'CustomPath'
crazytuzi May 4, 2022
c73edaa
Merge pull request #5 from crazytuzi/master
crazytuzi May 4, 2022
5d30e7d
Scripts
crazytuzi May 4, 2022
6076431
Add lfs track
crazytuzi May 5, 2022
c869e88
IOS Library Path
crazytuzi May 5, 2022
b0732f4
Merge pull request #6 from crazytuzi/CustomPath
crazytuzi May 5, 2022
f9ec5fe
Add arm64-v8a so
crazytuzi May 5, 2022
2d0444c
Merge pull request #7 from crazytuzi/CustomPath
crazytuzi May 5, 2022
a838319
Add IOS lib
crazytuzi May 6, 2022
58cb5e8
Win64 DependencyModule
crazytuzi May 9, 2022
c35f849
Add site-packages
crazytuzi May 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ios/Python/libPython.a filter=lfs diff=lfs merge=lfs -text
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ __pycache__/
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
Expand All @@ -15,7 +14,6 @@ dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Once the plugin is installed and enabled, you get access to the 'PythonConsole'

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)

The minimal supported Unreal Engine version is 4.12, while the latest is 4.23
The minimal supported Unreal Engine version is 4.12, while the latest is 4.24

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

Expand Down
2 changes: 1 addition & 1 deletion Source/PythonAutomation/Public/PythonAutomationModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#pragma once

#include "CoreMinimal.h"
#if ENGINE_MAJOR_VERSION==4 && ENGINE_MINOR_VERSION>=22
#if ENGINE_MAJOR_VERSION == 5 || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION >= 22)
#include "Modules/ModuleInterface.h"
#else
#include "ModuleInterface.h"
Expand Down
3 changes: 1 addition & 2 deletions Source/PythonAutomation/PythonAutomation.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public PythonAutomation(TargetInfo Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
string enableUnityBuild = System.Environment.GetEnvironmentVariable("UEP_ENABLE_UNITY_BUILD");
bFasterWithoutUnity = string.IsNullOrEmpty(enableUnityBuild);

bUseUnity = string.IsNullOrEmpty(enableUnityBuild);
PrivateIncludePaths.AddRange(
new string[] {
"PythonConsole/Private",
Expand Down
2 changes: 1 addition & 1 deletion Source/PythonConsole/Private/PyFbxFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void UPyFbxFactory::PostInitProperties() {

UObject * UPyFbxFactory::FactoryCreateFile(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, const FString& Filename, const TCHAR* Parms, FFeedbackContext* Warn, bool& bOutOperationCanceled)
{
#if ENGINE_MINOR_VERSION >= 20
#if ENGINE_MAJOR_VERSION == 5 || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION >= 20)
if (ImportUI->MeshTypeToImport == FBXIT_MAX)
{
if (!DetectImportType(UFactory::CurrentFilename))
Expand Down
2 changes: 2 additions & 0 deletions Source/PythonConsole/Private/PythonConsoleModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ static TSharedPtr<FPythonLogHistory> PythonLogHistory;
TSharedRef<SDockTab> SpawnPythonLog( const FSpawnTabArgs& Args )
{
return SNew(SDockTab)
#if ENGINE_MAJOR_VERSION == 4
.Icon(FEditorStyle::GetBrush("Log.TabIcon"))
#endif
.TabRole( ETabRole::NomadTab )
.Label( NSLOCTEXT("PythonConsole", "TabTitle", "Python Console") )
[
Expand Down
2 changes: 1 addition & 1 deletion Source/PythonConsole/Private/SPythonLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ FPythonLogTextLayoutMarshaller::FPythonLogTextLayoutMarshaller(TArray< TSharedPt
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
void SPythonLog::Construct(const FArguments& InArgs)
{
#if ENGINE_MINOR_VERSION < 18
#if !(ENGINE_MAJOR_VERSION == 5 || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION >= 18))
MessagesTextMarshaller = FPythonLogTextLayoutMarshaller::Create(MoveTemp(InArgs._Messages));
#else
MessagesTextMarshaller = FPythonLogTextLayoutMarshaller::Create(InArgs._Messages);
Expand Down
2 changes: 1 addition & 1 deletion Source/PythonConsole/PythonConsole.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public PythonConsole(TargetInfo Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
string enableUnityBuild = System.Environment.GetEnvironmentVariable("UEP_ENABLE_UNITY_BUILD");
bFasterWithoutUnity = string.IsNullOrEmpty(enableUnityBuild);
bUseUnity = string.IsNullOrEmpty(enableUnityBuild);

PrivateIncludePaths.AddRange(
new string[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ void FPYRichTextSyntaxHighlighterTextLayoutMarshaller::ParseTokens(const FString
FRunInfo RunInfo(TEXT("SyntaxHighlight.PY.Normal"));
FTextBlockStyle TextBlockStyle = SyntaxTextStyle.NormalTextStyle;

#if ENGINE_MINOR_VERSION >= 18
#if ENGINE_MAJOR_VERSION == 5 || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION >= 18)
const bool bIsWhitespace = FString(TokenText).TrimEnd().IsEmpty();
#else
const bool bIsWhitespace = FString(TokenText).TrimTrailing().IsEmpty();
Expand Down
5 changes: 4 additions & 1 deletion Source/PythonEditor/Private/PythonEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#include "PythonEditorStyle.h"
#include "PythonProjectEditor.h"
#include "PythonProject.h"
#if ENGINE_MAJOR_VERSION == 5 || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION >= 24)
#include "Subsystems/AssetEditorSubsystem.h"
#endif
#include "Runtime/Slate/Public/Framework/MultiBox/MultiBoxBuilder.h"

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

IMPLEMENT_MODULE( FPythonEditor, PythonEditor )

#undef LOCTEXT_NAMESPACE
#undef LOCTEXT_NAMESPACE
22 changes: 22 additions & 0 deletions Source/PythonEditor/Private/PythonProjectEditor.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.

#include "PythonProjectEditor.h"

#if ENGINE_MAJOR_VERSION == 5 || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION >= 24)
#include "Subsystems/AssetEditorSubsystem.h"

// #include "UnrealEd.h"
#endif

#include "SPythonEditor.h"
#include "SPythonProjectEditor.h"
#include "Runtime/Slate/Public/Widgets/Docking/SDockTab.h"
#include "PythonProjectEditorToolbar.h"
#if ENGINE_MAJOR_VERSION == 5
#include "WorkflowOrientedApp/WorkflowUObjectDocuments.h"
#include "WorkflowOrientedApp/ApplicationMode.h"
#else
#include "Editor/Kismet/Public/WorkflowOrientedApp/WorkflowUObjectDocuments.h"
#include "Editor/Kismet/Public/WorkflowOrientedApp/ApplicationMode.h"
#endif
#include "PythonProjectItem.h"
#include "PythonEditorStyle.h"
#include "PythonProject.h"
#include "PythonProjectEditorCommands.h"
#include "Runtime/Core/Public/HAL/PlatformFilemanager.h"
#include "Runtime/Core/Public/Misc/MessageDialog.h"


#define LOCTEXT_NAMESPACE "PythonEditor"

TWeakPtr<FPythonProjectEditor> FPythonProjectEditor::PythonEditor;
Expand Down Expand Up @@ -153,7 +167,9 @@ FBasicPythonEditorMode::FBasicPythonEditorMode(TSharedPtr<class FPythonProjectEd
FTabManager::NewStack()
->SetSizeCoefficient(0.1f)
->SetHideTabWell(true)
#if ENGINE_MAJOR_VERSION == 4
->AddTab(InPythonEditor->GetToolbarTabId(), ETabState::OpenedTab)
#endif
)
->Split
(
Expand Down Expand Up @@ -209,7 +225,13 @@ void FPythonProjectEditor::RegisterToolbarTab(const TSharedRef<class FTabManager

void FPythonProjectEditor::InitPythonEditor(const EToolkitMode::Type Mode, const TSharedPtr< class IToolkitHost >& InitToolkitHost, class UPythonProject* PythonProject)
{
#if ENGINE_MAJOR_VERSION == 5 || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION >= 24)
// UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
// GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->CloseOtherEditors(PythonProject, this);
GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->CloseOtherEditors(PythonProject, this);
#else
FAssetEditorManager::Get().CloseOtherEditors(PythonProject, this);
#endif
PythonProjectBeingEdited = PythonProject;

TSharedPtr<FPythonProjectEditor> ThisPtr(SharedThis(this));
Expand Down
14 changes: 13 additions & 1 deletion Source/PythonEditor/Private/PythonProjectEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,27 @@

#pragma once

#if ENGINE_MAJOR_VERSION == 5
#include "WorkflowOrientedApp/WorkflowCentricApplication.h"
#include "WorkflowOrientedApp/WorkflowTabManager.h"
#else
#include "Editor/Kismet/Public/WorkflowOrientedApp/WorkflowCentricApplication.h"
#include "Editor/Kismet/Public/WorkflowOrientedApp/WorkflowTabManager.h"
#endif
#include "Runtime/Launch/Resources/Version.h"

class FPythonProjectEditor : public FWorkflowCentricApplication, public FGCObject
{
public:
FPythonProjectEditor();

// FGCObject interface
virtual FString GetReferencerName() const override
{
return TEXT("FPythonProjectEditor");
}
// End of FGCObject interface

// IToolkit interface
virtual void RegisterTabSpawners(const TSharedRef<class FTabManager>& TabManager) override;
// End of IToolkit interface
Expand Down Expand Up @@ -112,7 +124,7 @@ class FPythonProjectEditor : public FWorkflowCentricApplication, public FGCObjec
static TWeakPtr<FPythonProjectEditor> PythonEditor;

virtual bool CanSaveAsset() const override { return false; }
#if ENGINE_MINOR_VERSION > 17
#if ENGINE_MAJOR_VERSION == 5 || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 17)
virtual bool CanFindInContentBrowser() const override { return false; }
#endif
};
14 changes: 14 additions & 0 deletions Source/PythonEditor/Private/PythonProjectEditorCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ FPythonProjectEditorCommands::FPythonProjectEditorCommands()

void FPythonProjectEditorCommands::RegisterCommands()
{
#if ENGINE_MAJOR_VERSION == 5 || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION >= 25)
UI_COMMAND(New, "New", "New Python Script.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control, EKeys::N));
UI_COMMAND(NewDirectory, "New Directory", "New Directory.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control | EModifierKey::Shift, EKeys::N));
UI_COMMAND(Delete, "Delete", "Delete Python Script.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control, EKeys::D));

UI_COMMAND(Save, "Save", "Save the currently active document.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control, EKeys::S));
UI_COMMAND(SaveAll, "Save All", "Save all open documents.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control | EModifierKey::Shift, EKeys::S));
UI_COMMAND(Execute, "Execute", "Execute Current Python File.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control, EKeys::Enter));
#if PLATFORM_MAC
UI_COMMAND(ExecuteInMainThread, "Execute In Main Thread", "Execute Current Python File in the Main Thread.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control | EModifierKey::Shift, EKeys::Enter));
#endif
UI_COMMAND(PEP8ize, "PEP8-ize", "Enforce PEP8 to the current code.", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control | EModifierKey::Shift, EKeys::P));
#else
UI_COMMAND(New, "New", "New Python Script.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control, EKeys::N));
UI_COMMAND(NewDirectory, "New Directory", "New Directory.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control | EModifierKey::Shift, EKeys::N));
UI_COMMAND(Delete, "Delete", "Delete Python Script.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control, EKeys::D));
Expand All @@ -25,6 +38,7 @@ void FPythonProjectEditorCommands::RegisterCommands()
UI_COMMAND(ExecuteInMainThread, "Execute In Main Thread", "Execute Current Python File in the Main Thread.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control | EModifierKey::Shift, EKeys::Enter));
#endif
UI_COMMAND(PEP8ize, "PEP8-ize", "Enforce PEP8 to the current code.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control | EModifierKey::Shift, EKeys::P));
#endif

}

Expand Down
4 changes: 3 additions & 1 deletion Source/PythonEditor/PythonEditor.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public PythonEditor(TargetInfo Target)

PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
string enableUnityBuild = System.Environment.GetEnvironmentVariable("UEP_ENABLE_UNITY_BUILD");
bFasterWithoutUnity = string.IsNullOrEmpty(enableUnityBuild);
bUseUnity = string.IsNullOrEmpty(enableUnityBuild);

PrivateIncludePaths.AddRange(
new string[] {
Expand All @@ -32,11 +32,13 @@ public PythonEditor(TargetInfo Target)
"UnrealEd",
"EditorStyle",
"PropertyEditor",
"ContentBrowser",
"Kismet", // for FWorkflowCentricApplication
"InputCore",
"DirectoryWatcher",
"LevelEditor",
"Projects",
"Engine",
"UnrealEnginePython"
}
);
Expand Down
36 changes: 35 additions & 1 deletion Source/UnrealEnginePython/Private/Blueprint/UEPyEdGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ PyObject *py_ue_graph_add_node(ue_PyUObject * self, PyObject * args)
{
return PyErr_Format(PyExc_Exception, "argument is not a child of UEdGraphNode");
}
EXTRA_UE_LOG(LogPython, Warning, TEXT("add_node: Casting to class %s"), *u_class->GetName());
node = NewObject<UEdGraphNode>(graph, u_class);
node->PostLoad();
}
Expand All @@ -328,6 +329,7 @@ PyObject *py_ue_graph_add_node(ue_PyUObject * self, PyObject * args)

node->Rename(*node->GetName(), graph);
}
EXTRA_UE_LOG(LogPython, Warning, TEXT("add_node: renaming node"));
}

if (!node)
Expand All @@ -337,8 +339,10 @@ PyObject *py_ue_graph_add_node(ue_PyUObject * self, PyObject * args)
node->CreateNewGuid();
node->PostPlacedNewNode();
node->SetFlags(RF_Transactional);
EXTRA_UE_LOG(LogPython, Warning, TEXT("add_node: allocate pins current pins num %d"), node->Pins.Num());
if (node->Pins.Num() == 0)
{
EXTRA_UE_LOG(LogPython, Warning, TEXT("add_node: allocating pins"));
node->AllocateDefaultPins();
}
node->NodePosX = x;
Expand Down Expand Up @@ -527,9 +531,11 @@ PyObject *py_ue_graph_add_node_dynamic_cast(ue_PyUObject * self, PyObject * args
if(!u_class)
return PyErr_Format(PyExc_Exception, "argument is not a UClass");

EXTRA_UE_LOG(LogPython, Warning, TEXT("add_node_dynamic_cast: Casting to class %s %p"), *u_class->GetName(), (void *)u_class);

UK2Node_DynamicCast *node = NewObject<UK2Node_DynamicCast>(graph);
node->TargetType = u_class;
#if ENGINE_MINOR_VERSION > 15
#if ENGINE_MAJOR_VERSION == 5 || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 15)
node->SetPurity(false);
#endif
node->AllocateDefaultPins();
Expand All @@ -555,6 +561,8 @@ PyObject *py_ue_graph_add_node_dynamic_cast(ue_PyUObject * self, PyObject * args
FBlueprintEditorUtils::MarkBlueprintAsStructurallyModified(bp);
}

EXTRA_UE_LOG(LogPython, Warning, TEXT("add_node_dynamic_cast: targettype is %p"), (void *)(node->TargetType));

Py_RETURN_UOBJECT(node);
}

Expand Down Expand Up @@ -654,6 +662,32 @@ PyObject *py_ue_node_find_pin(ue_PyUObject * self, PyObject * args)
return py_ue_new_edgraphpin(pin);
}

PyObject *py_ue_node_set_purity(ue_PyUObject * self, PyObject * args)
{
ue_py_check(self);

PyObject *py_bool = nullptr;
if (!PyArg_ParseTuple(args, "O:set_purity", &py_bool))
{
return nullptr;
}

UK2Node_DynamicCast *node = ue_py_check_type<UK2Node_DynamicCast>(self);
if (!node)
return PyErr_Format(PyExc_Exception, "uobject is not a K2Node_DynamicCast");

if (PyObject_IsTrue(py_bool))
{
node->SetPurity(true);
}
else
{
node->SetPurity(false);
}

Py_RETURN_NONE;
}

PyObject *py_ue_node_function_entry_set_pure(ue_PyUObject * self, PyObject * args)
{

Expand Down
2 changes: 2 additions & 0 deletions Source/UnrealEnginePython/Private/Blueprint/UEPyEdGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ PyObject *py_ue_node_create_pin(ue_PyUObject *, PyObject *);
PyObject *py_ue_node_pin_type_changed(ue_PyUObject *, PyObject *);
PyObject *py_ue_node_pin_default_value_changed(ue_PyUObject *, PyObject *);

PyObject *py_ue_node_set_purity(ue_PyUObject *, PyObject *);

PyObject *py_ue_node_function_entry_set_pure(ue_PyUObject *, PyObject *);

PyObject *py_ue_node_get_title(ue_PyUObject *, PyObject *);
Expand Down
Loading