44 lines
1.7 KiB
C++
44 lines
1.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "LuaBundle/LuaBundleArchive.h"
|
|
|
|
struct UNREALLUADEMOEDITOR_API FLuaBundlePackResult
|
|
{
|
|
bool bSuccess = false;
|
|
int32 ScriptCount = 0;
|
|
int32 ArchiveByteSize = 0;
|
|
bool bEncrypted = false;
|
|
FString OutputPath;
|
|
FString ErrorMessage;
|
|
};
|
|
|
|
/**
|
|
* Editor-only packer that collects external Lua scripts (Script/lua and optionally
|
|
* Plugins/UnLua/Content/Script) into a single FLuaBundleArchive and writes it to either
|
|
* a UE DataAsset (ULuaBundleAsset) for cooked builds or a standalone binary file.
|
|
*/
|
|
class UNREALLUADEMOEDITOR_API FLuaBundlePacker
|
|
{
|
|
public:
|
|
/** Collects all .lua source files according to ULuaScriptSettings. */
|
|
static bool CollectLuaSources(TArray<FLuaBundleSourceItem>& OutItems, FString& OutError);
|
|
|
|
/** Packs external Lua scripts into the default ULuaBundleAsset configured in ULuaScriptSettings. */
|
|
static bool PackToDefaultAsset(FLuaBundlePackResult& OutResult, TOptional<bool> bEncryptOverride = {});
|
|
|
|
/** Packs external Lua scripts into a specific UE asset soft object path (e.g. /Game/Generated/DA_LuaBundle.DA_LuaBundle). */
|
|
static bool PackToAsset(const FSoftObjectPath& TargetAssetPath, FLuaBundlePackResult& OutResult, TOptional<bool> bEncryptOverride = {});
|
|
|
|
/** Packs external Lua scripts into a standalone binary archive file (useful for CI/hot-update pipelines). */
|
|
static bool PackToStandaloneFile(const FString& OutputFilePath, FLuaBundlePackResult& OutResult, TOptional<bool> bEncryptOverride = {});
|
|
|
|
private:
|
|
static void CollectDirectoryLuaFiles(
|
|
const FString& RootDir,
|
|
TMap<FString, FLuaBundleSourceItem>& InOutItemsByLowerPath,
|
|
bool bAllowOverwrite);
|
|
};
|