Crate uasset

source ·
Expand description

githubcrates-iodocs-rs

The Rust uasset Library

uasset is a pure Rust implementation of the Unreal Engine .uasset file format. It gives you direct access to fields & values in the uasset format, and is intended to allow you to build tools outside of the Unreal Editor to work with uassets.

Usage

To use uasset, first add this to your Cargo.toml:

[dependencies]
uasset = "^0.2"

Then import AssetHeader into your program:

use uasset::AssetHeader;

Finally, parse a file using AssetHeader::new.

Example

let file = File::open(path)?;
let package = AssetHeader::new(&file)?;
for import in package.package_import_iter() {
    println!("Import: {}", import);
}

Crate features

  • commandline-tool - Allows the building of a uasset command line tool that can be used to inspect specific assets.

Structs

  • A table of contents for a uasset loaded from disk, containing all the shared package summary information. This roughly maps to FPackageFileSummary in Engine/Source/Runtime/CoreUObject/Public/UObject/PackageFileSummary.h, except we load some of the indirectly referenced data (i.e. names, imports, exports).
  • Iterator over the imported packages in a given AssetHeader
  • Error when attempting to resolve an index
  • A reference to a name in the AssetHeader::names name table. You can use AssetHeader::resolve_name to get a human-readable string from a NameReference. It only makes sense to compare NameReferences from the same AssetHeader.
  • A reference to an object in another package. Typically accessed through AssetHeader::package_import_iter, but you can also manually resolve the NameReferences. (C++ name: FObjectImport)
  • Represents the metadata about a thumbnail for an asset, stored behind [AssetHeader::thumbnail_table_offsets] (see ThumbnailTools::LoadThumbnailsFromPackageInternal)

Enums

  • The format of an asset’s custom versions, derived from legacy_version (see FCustomVersionContainer::Serialize)
  • Errors from parsing an asset
  • A reference to either an import or an export in the asset.
  • Maps to EUnrealEngineObjectUE4Version in Engine/Source/Runtime/Core/Public/UObject/ObjectVersion.h – this tracks the various versions to the core serialized object format.
  • Maps to EUnrealEngineObjectUE5Version in Engine/Source/Runtime/Core/Public/UObject/ObjectVersion.h – this tracks the various versions to the core serialized object format.
  • Maps to EPackageFlags in Engine/Source/Runtime/CoreUObject/Public/UObject/ObjectMacros.h. The UnusedN entries exist for completeness, presumably those entries were used in the past.

Type Aliases

  • Results from parsing a uasset