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

Building4.25 #850

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open

Building4.25 #850

wants to merge 31 commits into from

Conversation

davidjo
Copy link

@davidjo davidjo commented Jul 7, 2020

This is my attempt at getting UnrealEnginePython to work on 4.25 running under Ubuntu Linux 20.04.
This is based off PR #845 but is highly modified.
It builds on both 4.18 and 4.25.
It runs all tests (after modification by PR #715 otherwise that test failed on both 4.18 and 4.25).
I have tested a few examples for blueprints which I have used previously but modifications were needed to the examples to run under 4.25 - those modified versions added to examples.
It needs much more extensive testing as its likely Ive missed some fixups.

F0x06 and others added 27 commits June 15, 2020 14:04
FRotator arguments order should be pitch, yaw, roll instead of roll, pitch, yaw
Fixed and Removed all Errors and Warnings.
Tested a few python scripts, ran editor for long time. Seems to be okay.
Fixed Version Number
…ill builds on 4.18.

Builds on 4.18 and 4.25 (only versions tested).
…ion in python.

This was used to get the blueprint node creation example scripts to work in 4.25.
…ion modules on debian/ubuntu eg ctypes/unittest.

This may make it impossible to load Epics python and UnrealEnginePython together.
…till builds on 4.18.

Builds on 4.18 and 4.25 (only versions tested).
Currently builds (4.18 and 4.25) and some examples seem to run OK.
This requires some changes to the example scripts.
Started from Support4.25 pull req but now highly modified.
Without this fails with x86_64-linux-gnu/python3.8/pyconfig.h file not found.
Need to create Include directory in Source/UnrealEnginePython which contains
an x86_64-linux-gnu directory containing symbolic link to /usr/include/x86_64-linux-gnu/pythonx.x
where x.x is appropriate python version.
Directly including /usr/include/x86_64-linux-gnu/pythonx.x in linuxKnownIncludesPaths does not work.
This reverts commit 7a21ace.

In case wish to re-add these debug prints at some point.
This involves some code moving which will be executed at different times.
Builds but not really tested.
May NOT be a complete set of changes required as just tested these examples.
@k1lly
Copy link

k1lly commented Jul 13, 2020

Thanks for your work @davidjo
Can you help fixing build issue for Windows?
File: UnrealEnginePython\Source\UnrealEnginePython\Private\UEPyModule.cpp
Compilation Errors:

UnrealEnginePython/Source/UnrealEnginePython/Private/UEPyModule.cpp(3126): error C2065: 'UK2Node_DynamicCast': undeclared identifier
UnrealEnginePython/Source/UnrealEnginePython/Private/UEPyModule.cpp(3126): error C2065: 'node': undeclared identifier
UnrealEnginePython/Source/UnrealEnginePython/Private/UEPyModule.cpp(3126): error C2065: 'UK2Node_DynamicCast': undeclared identifier
UnrealEnginePython/Source/UnrealEnginePython/Private/UEPyModule.cpp(3126): error C2059: syntax error: ')'

Line 3126, causing compilation error:
UK2Node_DynamicCast* node = (UK2Node_DynamicCast*)buffer;

If you simply comment out this line, the plugin compiles, but doesn't work as expected: during the packaging for Windows process the plugin causes errors and build fails.

Edit:
Even with the line 3126 commented out in the plugin source, attempting to package project for Windows 64-bit with pixel streaming plugin enabled gives the following errors:

[PROJECT_DIRECTORY]/Plugins/UnrealEnginePython/Source/UnrealEnginePython/Private/UObject/UEPyMaterial.cpp(247): error C2039: 'GetStaticSwitchParameterValue': is not a member of 'UMaterialInstance'
C:\Program Files\Epic Games\UE_4.25\Engine\Intermediate\Build\Win64\UE4\Inc\Engine\MaterialInstanceDynamic.generated.h(11): note: see declaration of 'UMaterialInstance'
[PROJECT_DIRECTORY]/Plugins/UnrealEnginePython/Source/UnrealEnginePython/Private/UObject/UEPyObject.cpp(680): error C2039: 'CanModify': is not a member of 'UObject'
C:\Program Files\Epic Games\UE_4.25\Engine\Intermediate\Build\Win64\UE4\Inc\AIModule\AIBlueprintHelperLibrary.generated.h(19): note: see declaration of 'UObject'
[PROJECT_DIRECTORY]/Plugins/UnrealEnginePython/Source/UnrealEnginePython/Private/UObject/UEPyProperty.cpp(157): error C2039: 'SetMetaData': is not a member of 'FProperty'
C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\CoreUObject\Public\UObject/PropertyAccessUtil.h(12): note: see declaration of 'FProperty'
[PROJECT_DIRECTORY]/Plugins/UnrealEnginePython/Source/UnrealEnginePython/Private/UObject/UEPyProperty.cpp(183): error C2039: 'GetMetaData': is not a member of 'FProperty'
C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\CoreUObject\Public\UObject/PropertyAccessUtil.h(12): note: see declaration of 'FProperty'
[PROJECT_DIRECTORY]/Plugins/UnrealEnginePython/Source/UnrealEnginePython/Private/UObject/UEPyProperty.cpp(207): error C2039: 'HasMetaData': is not a member of 'FProperty'
C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\CoreUObject\Public\UObject/PropertyAccessUtil.h(12): note: see declaration of 'FProperty'

@davidjo
Copy link
Author

davidjo commented Jul 16, 2020

Sorry - forgot to add the following ifdef which I think should fix this

#ifdef EXTRA_DEBUG_CODE
                                EXTRA_UE_LOG(LogPython, Warning, TEXT("Convert Prop 3a is uclass %s"), *ue_obj->ue_object->GetName());
                                UK2Node_DynamicCast* node = (UK2Node_DynamicCast*)buffer;
                                EXTRA_UE_LOG(LogPython, Warning, TEXT("Setting attr  targetype is %p"), (void *)(node->TargetType));
#endif

@davidjo
Copy link
Author

davidjo commented Jul 16, 2020

But it wont fix the other errors.
What exact version of Unreal Engine is this for??

…inner, py_ue_get_key_prop and py_ue_get_value_prop to use them.
@Andygmb
Copy link

Andygmb commented Jul 23, 2020

@k1lly did you manage to get it packaged and working on windows for 4.25.1?

@k1lly
Copy link

k1lly commented Jul 23, 2020

@k1lly did you manage to get it packaged and working on windows for 4.25.1?

I did, but it required commenting out all the code execution inside the functions ive mentioned in my 1st log here, and returning constants. The plugin builds, packages and works inside a project, but its a hack, not a solution. Having almost zero knowledge of the plugin internals, I'd wait for a proper fix from PR's author.

@Andygmb
Copy link

Andygmb commented Jul 23, 2020

@k1lly did you manage to get it packaged and working on windows for 4.25.1?

I did, but it required commenting out all the code execution inside the functions ive mentioned in my 1st log here, and returning constants. The plugin builds, packages and works inside a project, but its a hack, not a solution. Having almost zero knowledge of the plugin internals, I'd wait for a proper fix from PR's author.

Fair enough. Hopefully we can get a basic-functioning version packaged up soon from OP.

@davidjo
Copy link
Author

davidjo commented Jul 23, 2020

So Ive just added what looks like a reasonable fixup - it builds but what Im doing doesnt seem to test this feature and Im only really working with the Editor ie this is totally untested.

@k1lly
Copy link

k1lly commented Jul 24, 2020

So Ive just added what looks like a reasonable fixup - it builds but what Im doing doesnt seem to test this feature and Im only really working with the Editor ie this is totally untested.

I've tested: the plugin both builds and packages without throwing errors, thank you!

@wartheking
Copy link

4.25.1 crash when running sequencer_scripting.py!!

@davidjo
Copy link
Author

davidjo commented Jul 26, 2020

Yes - I am also getting a crash - at least after fixing the python syntax error plus adding the Mannequin to the project.
Have you run sequencer_scripting.py successfully with prior versions of the Engine?
If so what versions?

@wartheking
Copy link

Yes - I am also getting a crash - at least after fixing the python syntax error plus adding the Mannequin to the project.
Have you run sequencer_scripting.py successfully with prior versions of the Engine?
If so what versions?

it also crash in engine version 4.22 with plugin's official version 4.22.so it have been a problem for a long time.

@wartheking
Copy link

Yes - I am also getting a crash - at least after fixing the python syntax error plus adding the Mannequin to the project.
Have you run sequencer_scripting.py successfully with prior versions of the Engine?
If so what versions?

Yes - I am also getting a crash - at least after fixing the python syntax error plus adding the Mannequin to the project.
Have you run sequencer_scripting.py successfully with prior versions of the Engine?
If so what versions?

it also crash in engine version 4.22 with plugin's official version 4.22.so it have been a problem for a long time.

can you help us to slove this problem? I am a Technical Artist,yours plugins is wonderful and this task is very important to me

@davidjo
Copy link
Author

davidjo commented Jul 27, 2020

It didnt exactly inspire confidence when first error is a trivial python syntax error. I am running 4.18 and 4.21 (in addition to 4.25) so will try these and see what happens. However, its not an area of the Engine Ive used at all and the error seems to be occurring deep inside the Engine core so if cant get some form of working script in some version not sure can fix it. Have you used any form of sequencer script in any version that worked? According to the source code somebody sponsered them to add the sequencer API functionality so Im assuming at some point it worked.

@davidjo
Copy link
Author

davidjo commented Jul 27, 2020

Well Ive confirmed that it seems to work in 4.21 - doesnt crash and get a sequencer window. However, the 4.22 release notes suggest Epic made a lot of changes to the Sequencer so this is likely the cause. This is likely to take some time.

@wartheking
Copy link

Well Ive confirmed that it seems to work in 4.21 - doesnt crash and get a sequencer window. However, the 4.22 release notes suggest Epic made a lot of changes to the Sequencer so this is likely the cause. This is likely to take some time.

Good news!I have a try in 4.21 however i isn't support the ray-tracing.So i 'd like to work your plugin in 4.25.hope that i can help you but i know a little about engine source.best wish to you and have a good luck! :)

@wartheking
Copy link

Well Ive confirmed that it seems to work in 4.21 - doesnt crash and get a sequencer window. However, the 4.22 release notes suggest Epic made a lot of changes to the Sequencer so this is likely the cause. This is likely to take some time.

Good news!I have a try in 4.21 however i isn't support the ray-tracing.So i 'd like to work your plugin in 4.25.hope that i can help you but i know a little about engine source.best wish to you and have a good luck! :)

i commented the code"sequencer_add_actor(camera)" found that the program run successfully without crash in 4.25. it seem to be the source of this problem.

@davidjo
Copy link
Author

davidjo commented Jul 29, 2020

Ive pinned down the issue - it seems to be an infinite recursion loop in 4.22 in specific code added in 4.22.
Im suspecting its something to do with the camera initialization - just creating a plain camera object in python may not setup enough in 4.22 - theres is a CreateCamera function so not clear why this wasnt used. Ill try and see how to replicate the camera addition manually in the 4.22 editor to get the end result of 4.21.

@davidjo
Copy link
Author

davidjo commented Jul 31, 2020

I have updated my repo master with fixups for 4.25 (among others) sequencer - sequencer_scripting425.py runs without crashing and looks the same as the 4.21 version.

@avivazran
Copy link

avivazran commented Aug 13, 2020

Build passed successfully on 4.25.3 but when trying to run the engine the following exception occurs.

Unhandled exception at 0x00007FFA2201DB9E (ucrtbase.dll) in UE4Editor.exe: Fatal program exit requested.
image

Any fix for this?

@davidjo
Copy link
Author

davidjo commented Aug 15, 2020

Probably cant help with this - I dont do Windows - Im guessing whatver IDE this is the lower left is some form of stack trace and the top source is where fault occurring - however I dont see a proper stack trace as I would in Linux - but it currently looks like its in the # if PLATFORM_WINDOWS block which is fairly obviously some Windows specific initialization code - but this has nothing to do with Property changes. So question is when did it last work for you - that section was last updated Dec 2018 (fileno to _fileno) so its been there a while - could of course be something has changed in the Engine - but _setmode/_fileno/stdin etc are very basic c++ io functions. What python version are you using? From the comments above the _setmode calls its trying to fix something the python initialization code changed - but maybe newer pythons dont do this - or maybe Unreal has modified stdin etc. which causes this to fail. Could try commenting those 3 lines and seeing what happens.

@mr-maul
Copy link

mr-maul commented Aug 16, 2020

I'm trying to pack test project (Windows 10, UE 4.25) and have a python VM at runtime. I built plugin from source as described in README. Everything is ok in Editor, but i get the following error during build procedure:

UATHelper: Packaging (Windows (64-bit)): ERROR: Unable to instantiate module 'UnrealEd': Unable to instantiate UnrealEd module for non-editor targets.
UATHelper: Packaging (Windows (64-bit)): (referenced via Target -> UnrealEnginePython.Build.cs -> Sequencer.Build.cs)
PackagingResults: Error: Unable to instantiate module 'UnrealEd': Unable to instantiate UnrealEd module for non-editor targets.

How can I fix this?

@davidjo
Copy link
Author

davidjo commented Aug 18, 2020

Try this version of the build tool file - I was having problems getting the sequencer to compile and link properly and I now realize I added some sequencer stuff (apparently editor only) to the package and editor building - moved into the editor building only section and it seems to build OK in the editor.
UnrealEnginePython.Build.cs.txt

Well apparently you cant upload .cs files - added .txt so you need to rename it back to UnrealEnginePython.Build.cs.

@avivazran
Copy link

Well I'm happy to say IT WORKED!

Now all that's left is to hope it'll run python scripts in the packaged project (on runtime).
I've packaged successfully but without any python script. just the plugin enabled.

Will it run the scripts after packaging?

@avivazran
Copy link

@davidjo so I've to package a project with the plugin and it worked!!

Now, I've been trying all day to embbed a python runtime distribution in the packaged version but the instructions in the original repo are really bad.

Have you managed to do so?
I've copied an embbedable python distribution to the plugin binaries and managed to build and run inside the editor but when but after packaging the exe just closes.

@davidjo
Copy link
Author

davidjo commented Aug 18, 2020

Sorry - packaging is not something Ive needed to do yet.
Ill add the new build tool version to main repo now it looks as tho it works so far.

@mr-maul
Copy link

mr-maul commented Aug 18, 2020

Thanks for this fix, now project can be packaged at least. I've tried new build with system-wide python (specified in "pythonHome") , not embedded. Game is running but scripts don't work. I hope that we can make it work after time anyway.

@avivazran
Copy link

@mr-maul Have you added your Content/Scripts folder to additional dependencies in your project packaging settings?
I've tested your scenario and it worked for me

@avivazran
Copy link

avivazran commented Aug 19, 2020

@avivazran @davidjo Also, If any of you is able to successfully package a project witn an embedded python distribution please write how you did it.

I've managed to package successfully and run the exe on my pc but when moving to another pc with no python installed on it, the exe crashes without any message.

my project build.cs:

using System;
using System.IO;
using UnrealBuildTool;

public class SoundSinulatorSteam : ModuleRules
{

	public SoundSinulatorSteam(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
	
		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", });
		PrivateDependencyModuleNames.Add("SteamAudio");
		PrivateDependencyModuleNames.Add("SteamAudio");
		//PublicDelayLoadDLLs.Add("python36.dll");
		//PublicDelayLoadDLLs.Add("embree3.dll");
		//PublicDelayLoadDLLs.Add("tbb.dll");

		PrivateDependencyModuleNames.AddRange(new string[] {});
		PublicIncludePaths.AddRange(new string[] { "C:/Projects/SoundSinulatorSteam/Plugins/UnrealEnginePython/Binaries/Win64/include" });
		PublicAdditionalLibraries.Add("C:/Projects/SoundSinulatorSteam/Plugins/UnrealEnginePython/Binaries/Win64/libs/python36.lib");
		RuntimeDependencies.Add(Path.Combine("$(BinaryOutputDir)", "python36.dll"), "C:/Projects/SoundSinulatorSteam/Plugins/UnrealEnginePython/Binaries/Win64/python36.dll");
		
		
		PublicIncludePaths.AddRange(new string[] { "C:/Projects/SoundSinulatorSteam/ThirdParty/embree-3.11.0.x64.vc14.windows/include" });
		PublicAdditionalLibraries.Add("C:/Projects/SoundSinulatorSteam/ThirdParty/embree-3.11.0.x64.vc14.windows/lib/embree3.lib");
		PublicAdditionalLibraries.Add("C:/Projects/SoundSinulatorSteam/ThirdParty/embree-3.11.0.x64.vc14.windows/lib/tbb.lib");
		RuntimeDependencies.Add(Path.Combine("$(BinaryOutputDir)", "embree3.dll"), "C:/Projects/SoundSinulatorSteam/ThirdParty/embree-3.11.0.x64.vc14.windows/bin/embree3.dll");
		RuntimeDependencies.Add(Path.Combine("$(BinaryOutputDir)", "tbb.dll"), "C:/Projects/SoundSinulatorSteam/ThirdParty/embree-3.11.0.x64.vc14.windows/bin/tbb.dll");
		RuntimeDependencies.Add(Path.Combine("$(BinaryOutputDir)", "msvcp140.dll"), "C:/Projects/SoundSinulatorSteam/ThirdParty/embree-3.11.0.x64.vc14.windows/bin/msvcp140.dll");
		RuntimeDependencies.Add(Path.Combine("$(BinaryOutputDir)", "glfw3.dll"), "C:/Projects/SoundSinulatorSteam/ThirdParty/embree-3.11.0.x64.vc14.windows/bin/glfw3.dll");
		

		
		// Uncomment if you are using Slate UI
		// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
		
		// Uncomment if you are using online features
		// PrivateDependencyModuleNames.Add("OnlineSubsystem");

		// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
	}
}

@mr-maul
Copy link

mr-maul commented Aug 19, 2020

@mr-maul Have you added your Content/Scripts folder to additional dependencies in your project packaging settings?
I've tested your scenario and it worked for me

Oh, I didn't add this folder. Can you clarify please how certainly should it be included? Should it be in "PublicAdditionalLibraries" of MyProject.Build.cs? I suppose no, but besides that there are only "PublicAdditionalFrameworks", "AdditionalBundleResources" , "AdditionalPropertiesForReceipt".

Also there is mentioned: "If you want to package your project (it is required only if you need to have a python VM at runtime, read: your game logic is programmed in python) ensure the Content/Scripts/ue_site.py file is in your project (it can be empty).". Is it still actual?

@avivazran
Copy link

@mr-maul
image

@mr-maul
Copy link

mr-maul commented Aug 19, 2020

@avivazran
Thanks, got it. What about embedded vm, did you try to set "RelativeHome" and place python somewhere in Content directory? (My attempt to perform this trick was failed but maybe it can be a way)

@shdwdln
Copy link

shdwdln commented Aug 31, 2020

@davidjo Hey thanks for your support with keeping this going (and everyone on this thread for that matter!).
@k1lly Can you tell me how you are setting this up from start to finish?
I assume you are creating a new project, then adding a new blank plugin, and then launching the solution for that in VS?
Then are you adding the source that is downloaded here into those respective folders.

I am building the code and I am currently getting this error:
1>C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\CoreUObject\Public\UObject/Script.h(372): error C2079: 'FScriptInstrumentationSignal' uses undefined struct 'COREUOBJECT_API'

I am not sure why this is happening because all the include libraries are present for the solution.
Any thoughts where I am going wrong here?

Do you have any builds for 4.25.3 you could share also? Or even share your solution etc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants