Constants

valvemdl.constants.MDL_VERSIONS = [44, 45, 46, 47, 48]

The versions of the mdl format this library has been verified against. Team Fortress 2 ships all five of these. Support is evidence driven: a version lands here once it has been read from real files, not because the SDK mentions it.

valvemdl.constants.STUDIO_VERSION = 48

The version studiomdl in the Source SDK 2013 tree emits (STUDIO_VERSION in public/studio.h).

valvemdl.constants.MDL_ID = b'IDST'

Magic number of an mdl file (IDSTUDIOHEADER).

valvemdl.constants.ANI_ID = b'IDAG'

Magic number of an ani file (IDSTUDIOANIMGROUPHEADER).

valvemdl.constants.VVD_ID = b'IDSV'

Magic number of a vvd file (MODEL_VERTEX_FILE_ID).

valvemdl.constants.VVD_VERSION = 4

MODEL_VERTEX_FILE_VERSION in public/studio.h.

valvemdl.constants.VTX_VERSION = 7

OPTIMIZED_MODEL_FILE_VERSION in public/optimize.h.

valvemdl.constants.VTX_EXTENSIONS = ['.dx90.vtx', '.dx80.vtx', '.sw.vtx']

The vtx flavours studiomdl emits, in the order the engine prefers them. Team Fortress 2 loads dx90.

valvemdl.constants.STUDIO_ANIM_RAWPOS = 1

a Vector48 follows

valvemdl.constants.STUDIO_ANIM_RAWROT = 2

a Quaternion48 follows

valvemdl.constants.STUDIO_ANIM_ANIMPOS = 4

an mstudioanim_valueptr_t follows

valvemdl.constants.STUDIO_ANIM_ANIMROT = 8

an mstudioanim_valueptr_t follows

valvemdl.constants.STUDIO_ANIM_DELTA = 16

no payload; the values are additive

valvemdl.constants.STUDIO_ANIM_RAWROT2 = 32

a Quaternion64 follows

valvemdl.constants.STUDIO_ANIM_MASK = 63

Every bit the six flags above account for. No node in Team Fortress 2 uses anything outside it.

valvemdl.constants.STUDIO_ANIM_TERMINATOR_BONE = 255

The bone value that ends an mstudioanim_t list. bone_setup.cpp walks nodes with while (panim && panim->bone < 255), so a node naming bone 255 is a terminator rather than a bone. An animation that moves nothing is written as exactly one such node.

valvemdl.constants.SIZEOF_QUATERNION48 = 6

mathlib/compressed_vector.h

valvemdl.constants.SIZEOF_QUATERNION64 = 8

mathlib/compressed_vector.h

valvemdl.constants.SIZEOF_VECTOR48 = 6

mathlib/compressed_vector.h

valvemdl.constants.MAX_NUM_LODS = 8

public/studio.h

valvemdl.constants.MAX_NUM_BONES_PER_VERT = 3

public/studio.h

valvemdl.constants.MAXSTUDIOBONES = 128

public/studio.h

valvemdl.constants.MAXSTUDIOSKINS = 32

public/studio.h