Maps local bone indices used within a mesh (CDspMeshFile) to the global bone identifiers defined in the skeleton (CSkSkeleton). This acts as a lookup table for skinning.
Purpose: Links the vertex weights (which refer to a small, mesh-specific set of bones) to the full skeleton's bone hierarchy. Essential for correct skinning deformation. 🦴
Where it appears: Present in all model types (AnimatedUnit, StaticObjectCollision, StaticObjectNoCollision, AnimatedObjectNoCollision, AnimatedObjectCollision). Appears early in the WriteOrder.
Engine impact: Directly used by the skinning system to apply bone transformations to vertices.
Blender Workflow: This block is created automatically by the exporter (create_cdsp_joint_map in drs_utility.py) when exporting a skinned mesh.
How it works: When exporting, the tool gathers all unique bones that influence each mesh piece. It creates a compact list (JointGroup.joints) containing only the global IDs of those specific bones.
Vertex Weights: The skinning data (CSkSkinInfo or MeshData revision 12) stores local indices (0, 1, 2...) referring to this JointGroup.joints list. The game engine uses this map to find the correct global bone ID from the local index during animation.
Root Reference (root_ref): The exporter tracks which local index corresponds to the root bone (ID 0) and stores this information internally (mesh_bone_data["root_ref"]) to correctly update vertex weights that might reference the root bone implicitly. Artists don't need to manage this directly. ✅