pafuhana1213 / KawaiiPhysics

KawaiiPhysics : Simple fake Physics for UnrealEngine4 & 5
MIT License
1.92k stars 287 forks source link

Fix compilation in packaged build mode #105

Closed mateuszwojt closed 9 months ago

mateuszwojt commented 1 year ago

Adding missing includes for the proper register of the KawaiiPhysics module and AnimNode (missingENGINE_MAJOR_VERSION macro).

pafuhana1213 commented 1 year ago

Hi @mateuszwojt !

Thank you for your pull request! It seems great fix, but I can't occur this error while packaging. would you please tell me how to repro it?

thanks

mateuszwojt commented 1 year ago

Hi @pafuhana1213

When I'm building the vanilla version of the plugin with UAT, it gives me the following errors:

[1/1] Compile [x64] Module.KawaiiPhysics.cpp
C:\dev\unreal\thirdparty\KawaiiPhysics\build\platform-windows\unreal-5.3\KawaiiPhysics\HostProject\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\AnimNode_KawaiiPhysics.cpp(208): error C4668: 'ENGINE_MAJOR_VERSION' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
C:\dev\unreal\thirdparty\KawaiiPhysics\build\platform-windows\unreal-5.3\KawaiiPhysics\HostProject\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\AnimNode_KawaiiPhysics.cpp(211): error C2039: 'GetRefPoseCompactArray': is not a member of 'FBoneContainer'
D:\Unreal\5.3.0-release\Engine\Source\Runtime\Engine\Classes\Animation\AnimInstance.h(48): note: see declaration of 'FBoneContainer'
C:\dev\unreal\thirdparty\KawaiiPhysics\build\platform-windows\unreal-5.3\KawaiiPhysics\HostProject\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\AnimNode_KawaiiPhysics.cpp(211): error C2660: 'FAnimNode_KawaiiPhysics::CalcBoneLength': function does not take 1 arguments
C:\dev\unreal\thirdparty\KawaiiPhysics\build\platform-windows\unreal-5.3\KawaiiPhysics\HostProject\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Public\AnimNode_KawaiiPhysics.h(451): note: see declaration of 'FAnimNode_KawaiiPhysics::CalcBoneLength'
C:\dev\unreal\thirdparty\KawaiiPhysics\build\platform-windows\unreal-5.3\KawaiiPhysics\HostProject\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\AnimNode_KawaiiPhysics.cpp(211): note: while trying to match the argument list '(FKawaiiPhysicsModifyBone)'
C:\dev\unreal\thirdparty\KawaiiPhysics\build\platform-windows\unreal-5.3\KawaiiPhysics\HostProject\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\AnimNode_KawaiiPhysics.cpp(611): error C2027: use of undefined type 'FSceneInterface'
D:\Unreal\5.3.0-release\Engine\Source\Runtime\Engine\Classes\Components\ActorComponent.h(99): note: see declaration of 'FSceneInterface'
C:\dev\unreal\thirdparty\KawaiiPhysics\build\platform-windows\unreal-5.3\KawaiiPhysics\HostProject\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\KawaiiPhysics.cpp(20): error C2061: syntax error: identifier 'KawaiiPhysics'
C:\dev\unreal\thirdparty\KawaiiPhysics\build\platform-windows\unreal-5.3\KawaiiPhysics\HostProject\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\KawaiiPhysicsLibrary.cpp(8): error C2143: syntax error: missing ';' before '<class-head>'
C:\dev\unreal\thirdparty\KawaiiPhysics\build\platform-windows\unreal-5.3\KawaiiPhysics\HostProject\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\KawaiiPhysicsLibrary.cpp(8): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
pafuhana1213 commented 1 year ago

Hi @mateuszwojt Sorry for my late response. Thanks for your error, but I can't repro it. Would you please share more detail info? ( e.g., BP only or C++? Windows or Mac? what version of UE? ...)

Thanks

mateuszwojt commented 12 months ago

@pafuhana1213 this is happening on Windows with UE5.3, but the issue was present when we were building on 5.2 as well.

The command I'm running that yields the errors is:

RunUAT.bat BuildPlugin -plugin=C:\dev\unreal\thirdparty\KawaiiPhysics\KawaiiPhysics.uplugin -package=C:\dev\unreal\thirdparty\KawaiiPhysics\build\platform-windows\unreal-5.3\KawaiiPhysics -rocket -targetplatforms=Win64 -VS2022
Vaei commented 10 months ago

I packaged without any error for Win64 on 5.3.2. But the executable would not run: Plugin 'KawaiiPhysics' failed to load because module 'KawaiiPhysics' could not be found. Please ensure the plugin is properly installed, otherwise consider disabling the plugin for this project.

So I tried packaging the plugin using the command for unreal marketplace plugins which tends to catch build errors a lot better than packaging a project. I got the same errors posted by the previous user

I applied the same fixes from the commit referenced by this pull request. And the issues were resolved, it packaged as a plugin and the packaged project executed correctly. These changes are 100% needed.

Using the marketplace build command should be standard testing procedure even for github plugins, for this reason :)

pafuhana1213 commented 9 months ago

Hi guys! Sorry for my late reply and check. Thanks to @mateuszwojt , I succeeded to repro this issue. So I've accepted your pull request now.

I appreciate your help!