diff --git a/Source/Editor/Cooker/GameCooker.cpp b/Source/Editor/Cooker/GameCooker.cpp index 580a2b5ea..01d09bfbf 100644 --- a/Source/Editor/Cooker/GameCooker.cpp +++ b/Source/Editor/Cooker/GameCooker.cpp @@ -106,6 +106,9 @@ using namespace GameCookerImpl; Delegate GameCooker::OnEvent; Delegate GameCooker::OnProgress; +Action GameCooker::DeployFiles; +Action GameCooker::PostProcessFiles; +Action GameCooker::PackageFiles; Delegate&> GameCooker::OnCollectAssets; const Char* ToString(const BuildPlatform platform) diff --git a/Source/Editor/Cooker/GameCooker.h b/Source/Editor/Cooker/GameCooker.h index 71d97a8a3..981151c63 100644 --- a/Source/Editor/Cooker/GameCooker.h +++ b/Source/Editor/Cooker/GameCooker.h @@ -10,17 +10,15 @@ /// API_CLASS(Static, Namespace="FlaxEditor") class FLAXENGINE_API GameCooker { -DECLARE_SCRIPTING_TYPE_NO_SPAWN(GameCooker); + DECLARE_SCRIPTING_TYPE_NO_SPAWN(GameCooker); friend CookingData; public: - /// /// Single build step. /// class FLAXENGINE_API BuildStep { public: - /// /// Finalizes an instance of the class. /// @@ -52,7 +50,6 @@ public: }; public: - /// /// Gets the current build data. Valid only during active build process. /// @@ -124,6 +121,21 @@ public: /// static Delegate OnProgress; + /// + /// Occurs when game files and data is deployed. + /// + API_EVENT() static Action DeployFiles; + + /// + /// Occurs when game files and data are deployed and can be post-processed. + /// + API_EVENT() static Action PostProcessFiles; + + /// + /// Occurs when game files and data are ready to be packaged. Called only if game is about to packaged, otherwise this step is skipped. + /// + API_EVENT() static Action PackageFiles; + /// /// Occurs when building collects assets to cook. /// diff --git a/Source/Editor/Cooker/Platform/Android/AndroidPlatformTools.cpp b/Source/Editor/Cooker/Platform/Android/AndroidPlatformTools.cpp index 0823c9e67..11e437d0a 100644 --- a/Source/Editor/Cooker/Platform/Android/AndroidPlatformTools.cpp +++ b/Source/Editor/Cooker/Platform/Android/AndroidPlatformTools.cpp @@ -5,6 +5,8 @@ #include "AndroidPlatformTools.h" #include "Editor/Editor.h" #include "Editor/ProjectInfo.h" +#include "Editor/Cooker/GameCooker.h" +#include "Editor/Utilities/EditorUtilities.h" #include "Engine/Platform/File.h" #include "Engine/Platform/FileSystem.h" #include "Engine/Platform/Android/AndroidPlatformSettings.h" @@ -12,7 +14,6 @@ #include "Engine/Graphics/Textures/TextureData.h" #include "Engine/Core/Config/GameSettings.h" #include "Engine/Core/Config/BuildSettings.h" -#include "Editor/Utilities/EditorUtilities.h" #include "Engine/Content/Content.h" #include "Engine/Content/JsonAsset.h" @@ -276,6 +277,7 @@ bool AndroidPlatformTools::OnPostProcess(CookingData& data) { return false; } + GameCooker::PackageFiles(); // Validate environment variables Dictionary envVars; diff --git a/Source/Editor/Cooker/Platform/Mac/MacPlatformTools.cpp b/Source/Editor/Cooker/Platform/Mac/MacPlatformTools.cpp index b6f9bada4..2abd30372 100644 --- a/Source/Editor/Cooker/Platform/Mac/MacPlatformTools.cpp +++ b/Source/Editor/Cooker/Platform/Mac/MacPlatformTools.cpp @@ -215,11 +215,12 @@ bool MacPlatformTools::OnPostProcess(CookingData& data) // TODO: sign binaries // TODO: expose event to inject custom post-processing before app packaging (eg. third-party plugins) - + // Package application const auto buildSettings = BuildSettings::Get(); if (buildSettings->SkipPackaging) return false; + GameCooker::PackageFiles(); LOG(Info, "Building app package..."); const String dmgPath = data.OriginalOutputPath / appName + TEXT(".dmg"); const String dmgCommand = String::Format(TEXT("hdiutil create {0}.dmg -volname {0} -fs HFS+ -srcfolder {0}.app"), appName); diff --git a/Source/Editor/Cooker/Steps/DeployDataStep.cpp b/Source/Editor/Cooker/Steps/DeployDataStep.cpp index f640f7a7a..4e511b0ac 100644 --- a/Source/Editor/Cooker/Steps/DeployDataStep.cpp +++ b/Source/Editor/Cooker/Steps/DeployDataStep.cpp @@ -46,6 +46,7 @@ bool DeployDataStep::Perform(CookingData& data) // Deploy engine data for the target platform if (data.Tools->OnDeployBinaries(data)) return true; + GameCooker::DeployFiles(); // Register engine in-build assets data.AddRootEngineAsset(TEXT("Shaders/AtmospherePreCompute")); diff --git a/Source/Editor/Cooker/Steps/PostProcessStep.cpp b/Source/Editor/Cooker/Steps/PostProcessStep.cpp index a2a81a76e..68556f0cc 100644 --- a/Source/Editor/Cooker/Steps/PostProcessStep.cpp +++ b/Source/Editor/Cooker/Steps/PostProcessStep.cpp @@ -5,5 +5,6 @@ bool PostProcessStep::Perform(CookingData& data) { + GameCooker::PostProcessFiles(); return data.Tools->OnPostProcess(data); }