Table of Contents

Class M2Bfa

Namespace
WoWLib.Formats.M2
Assembly
WoWLib.dll

A whole model for one client version: the MD20 body with skins and external sequence data baked in. A written model is canonical-layout and re-reads equal (no byte-perfect guarantee for offset formats). See https://wowdev.wiki/M2.

public class M2Bfa : M2, IDisposable
Inheritance
M2Bfa
Implements
Inherited Members

Constructors

M2Bfa()

public M2Bfa()

M2Bfa(M2Bfa)

Copy-construct: a deep copy of other (the C++ copy constructor).

public M2Bfa(M2Bfa other)

Parameters

other M2Bfa

Properties

BoneFiles

The .bone facial-pose files (BFID; the skeleton's when skel-based), in variant order.

public Vector<BoneFile> BoneFiles { get; }

Property Value

Vector<BoneFile>

Chunks

The chunked .m2 stream (Legion+): the satellite chunks (FileDataIDs, extended particles, parent overrides) plus preserved unknown chunks. The MD21 transport blob inside is TRANSIENT: read() decodes it into root and drops the bytes; write() re-encodes root into the stream and refreshes the FileDataID chunks.

public M2ChunkedFileBfa Chunks { get; set; }

Property Value

M2ChunkedFileBfa

LodSkins

The LOD-band skins (the SFID entries beyond num_skin_profiles), in band order.

public Vector<SkinCataPlus> LodSkins { get; }

Property Value

Vector<SkinCataPlus>

Phys

The referenced .phys file bytes (PFID), baked in verbatim — structured physics is a follow-up milestone. Inline physics (PFDC) stays a chunk on the stream.

public ChunkBlob Phys { get; set; }

Property Value

ChunkBlob

Root

The MD20 body — the model's root, uniform across every era (pre-Legion it IS the file; Legion+ it is the decoded MD21 image, whose transport blob chunks drops after read).

public M2RootLegionPlus Root { get; set; }

Property Value

M2RootLegionPlus

Skel

The shared skeleton (SKID), fully baked in — bones, attachments, sequences and the parent link. Engaged exactly when the chunk stream carries a skeleton FileDataID; skeletons are shared between models, so edit with care or write the .skel standalone.

public SkeletonLegionPlus Skel { get; set; }

Property Value

SkeletonLegionPlus

Skins

The model's LOD views, in view order ("{model}0N.skin" files, WotLK+). The source of truth for the view count: write() stamps the body's num_skin_profiles layout field from this vector's length.

public Vector<SkinCataPlus> Skins { get; }

Property Value

Vector<SkinCataPlus>

Methods

Dispose()

Release the native object now. Optional: the finalizer releases it on collection anyway - dispose (or using) when you want native memory back promptly.

public override void Dispose()

EnsureValid()

Validate and raise on the first error instead of returning a report — the assert-style face of validate().

public void EnsureValid()

Read(FileSystem, FileKey)

Load the model and all its satellite files from a client filesystem, replacing this entity's contents.

public void Read(FileSystem fs, FileKey key)

Parameters

fs FileSystem

the filesystem gateway

key FileKey

the .m2 file identity (path and/or FileDataID)

Validate()

Check the logical integrity contracts this model must satisfy to LOAD in the client — across the body AND every skin — which write() deliberately never enforces. Call it before writing when you want to know the model will load. A model read from a client and left unmodified reports no errors; warnings mark states real client files ship.

public ValidationReport Validate()

Returns

ValidationReport

every violated contract, each with its member path ("root..." / "skins[i]...")

Write(FileSystem, FileKey)

Serialize and store the model and every satellite file through the filesystem's project overlay; satellite names derive from the key, which must resolve to a path.

public void Write(FileSystem fs, FileKey key)

Parameters

fs FileSystem

the filesystem gateway

key FileKey

the .m2 file identity; must resolve to a path