Table of Contents

Class M2

Namespace
WoWLib.Formats.M2
Assembly
WoWLib.dll

A whole model, abstract over the client version — the MD20 body with its satellite files (.skin, .anim) baked in. Construct the concrete version with M2.for_version(expansion), then read()/write(); the per-version M2* classes are subclasses. See https://wowdev.wiki/M2.

public class M2 : FileEntity, IDisposable
Inheritance
M2
Implements
Derived
Inherited Members

Constructors

M2()

public M2()

M2(M2)

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

public M2(M2 other)

Parameters

other M2

Properties

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 M2Root Root { get; set; }

Property Value

M2Root

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()

ForVersion(ClientVersion)

A fresh M2 for an exact client version — the only axis that can name a Classic client, whose files follow the engine its build was cut on rather than its 1.15 / 4.4 version number.

public static M2 ForVersion(ClientVersion version)

Parameters

version ClientVersion

Returns

M2

ForVersion(Expansion)

A fresh M2 for the given era, as the family base — the dynamic twin of the typed Era factories.

public static M2 ForVersion(Expansion era)

Parameters

era Expansion

Returns

M2

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
key FileKey

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

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
key FileKey