Bones¶
The skeleton.
mstudiobone_tis reached fromstudiohdr_t.boneindex, one per bone, and almost everything else in the format refers back to it: hitboxes, attachments, meshes and animations all name bones by index into this array.The tree is implicit. There is no child list; each bone carries a
parentindex instead, and-1marks a root. Parents always precede their children, which is what lets the engine build world transforms in a single forward pass.The compression scales live here, not on the animation.
posscaleandrotscaleare the per-axis multipliers used to decode the compressed animation values inmstudioanim_t. A bone’s animated position isvalue * posscale[axis], offset fromposunless the animation is a delta. Read an animation without its bones and the numbers mean nothing.Procedural bones. When
proctypeis non-zero,procindexpoints at one of four different structures –mstudioaxisinterpbone_t,mstudioquatinterpbone_t,mstudioaimatbone_tormstudiojigglebone_t– and the engine computes the bone at runtime rather than reading it from an animation.procindex == 0means none. Note thatSTUDIO_PROC_AIMATBONEandSTUDIO_PROC_AIMATATTACHare two different proctypes sharing one structure, differing only in whataimrefers to.physicsbone is not an offset, despite
studiobyteswap.cpptagging itDEFINE_INDEX. It is an index into the physics model’s bone list. The datadesc is wrong here in the same way it is wrong aboutm_nBoneFlexDriverCount.mstudiolinearbone_t is the same skeleton again, transposed. Reached from
studiohdr2_t, it is a struct of arrays holding whatmstudiobone_tholds as an array of structs – every bone’sposin one run, everyquatin the next, and so on. The engine walks it when it wants one field of every bone and would rather not stride 216 bytes to get each one. It is redundant data: a writer must keep it in step with the bones or the engine will animate from one and draw from the other.mstudiosrcbonetransform_t records how a bone was transformed at compile time, so studiomdl can map animations authored against a different skeleton onto this one. mstudioboneflexdriver_t is the reverse of a flex: a bone driving a flex controller, so that a jaw bone can move a face.
- struct valvemdl.structs.bone.mstudiojigglebone_t¶
- struct valvemdl.structs.bone.mstudioaimatbone_t¶
- struct valvemdl.structs.bone.mstudioquatinterpbone_t¶
-
-
triggerindex
(<parsed from long>¶int) offset to an array of
mstudioquatinterpinfo_t
-
triggerindex
- struct valvemdl.structs.bone.mstudioquatinterpinfo_t¶
-
-
trigger
(¶Quaternion) angle to match
-
quat
(¶Quaternion) new angle
-
trigger
- struct valvemdl.structs.bone.mstudioaxisinterpbone_t¶
-
-
quat
(¶Quaternion[6])
-
quat
- struct valvemdl.structs.bone.mstudiobonecontroller_t¶
- struct valvemdl.structs.bone.mstudioboneflexdriver_t¶
-
m_nBoneIndex
(<parsed from long>¶int) the bone doing the driving; not an offset, despite the datadesc
-
m_nControlIndex
(<parsed from long>¶int) offset to an array of
mstudioboneflexdrivercontrol_t; an offset, despite the datadesc calling it a float
-
m_nBoneIndex
- struct valvemdl.structs.bone.mstudioboneflexdrivercontrol_t¶
- struct valvemdl.structs.bone.mstudiosrcbonetransform_t¶
- struct valvemdl.structs.bone.mstudiolinearbone_t¶
- struct valvemdl.structs.bone.mstudiobone_t¶
-
-
bonecontroller
(<parsed from long>¶int[6]) index into
studiohdr_tbone controllers per axis, -1 for none
-
quat
(¶Quaternion) default orientation
-
rot
(¶RadianEuler) default orientation again, as euler angles
-
qAlignment
(¶Quaternion)
-
flags
(<parsed from unsigned long>¶int) Represents a flags Enum 0x1 BONE_PHYSICALLY_SIMULATED 0x2 BONE_PHYSICS_PROCEDURAL 0x3 BONE_ALWAYS_PROCEDURAL 0x4 BONE_SCREEN_ALIGN_SPHERE 0x5 BONE_SCREEN_ALIGN_CYLINDER 0x9 BONE_USED_BY_HITBOX 0xa BONE_USED_BY_ATTACHMENT 0xb BONE_USED_BY_VERTEX_LOD0 0xc BONE_USED_BY_VERTEX_LOD1 0xd BONE_USED_BY_VERTEX_LOD2 0xe BONE_USED_BY_VERTEX_LOD3 0xf BONE_USED_BY_VERTEX_LOD4 0x10 BONE_USED_BY_VERTEX_LOD5 0x11 BONE_USED_BY_VERTEX_LOD6 0x12 BONE_USED_BY_VERTEX_LOD7 0x13 BONE_USED_BY_BONE_MERGE 0x15 BONE_FIXED_ALIGNMENT 0x16 BONE_HAS_SAVEFRAME_POS 0x17 BONE_HAS_SAVEFRAME_ROT
-
bonecontroller