Skip to content

hypermodule/CUE4Parse

 
 

Repository files navigation

CUE4Parse - An Unreal Engine Archives & Packages Parsing Library in C#

NuGet Activity


Description:

CUE4Parse is a parsing library designed specifically for extracting data from archives and packages generated by Unreal Engine 4 and 5. It provides extensive support for parsing and processing native data classes such as UObject, UTexture2D, UAnimSequence, UStaticMesh, and many more. It also offers abstraction layers that enable developers to customize and type their own package formats, to allow them to work with packages that may have unique requirements or structures.

While primarily used and maintained by the FModel team for their various projects, contributions to the library are always welcome, particularly in the areas of memory efficiency, and execution time.

Quickstart:

Installation

Add the NuGet package to your project:

dotnet add package CUE4Parse

Alternatively, you can clone the repository and include it in your project as a reference:

git clone https://github.com/FabianFG/CUE4Parse.git --recursive

Example

var provider = new DefaultFileProvider(ARCHIVE_DIRECTORY_HERE, SearchOption.TopDirectoryOnly, true, new VersionContainer(EGame.GAME_UE4_27));
provider.Initialize(); // will scan the archive directory for supported file extensions

var allObjects = provider.LoadAllObjects(PACKAGE_PATH_HERE); // {GAME}/Content/Folder1/Folder2/PackageName.uasset
var fullJson = JsonConvert.SerializeObject(allExports, Formatting.Indented);

var obj = provider.LoadObject(OBJECT_PATH_HERE); // {GAME}/Content/Folder1/Folder2/PackageName.ObjectName
var objJson = JsonConvert.SerializeObject(objectExport, Formatting.Indented);

switch (obj)
{
    case UTexture2D texture:
    {
        var bitmap = texture.Decode(ETexturePlatform.DesktopMobile);
        ...
    }
    case USoundWave:
    {
        objectExport.Decode(true, out var audioFormat, out var data);
        ...
    }
    case UStaticMesh:
    case USkeletalMesh:
    case UAnimSequence:
    {
        var toSave = new Exporter(objectExport, EXPORT_OPTIONS_HERE);
        var success = toSave.TryWriteToDir(SAVE_DIRECTORY_INFO_HERE, out var label, out var savedFilePath);
        ...
    }
    default:
    {
        ...
    }
}

Further detailed documentation is available in the wiki

License:

CUE4Parse is licensed under Apache License 2.0, and licenses of third-party libraries used are listed here.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.2%
  • Other 0.8%