Imported video game model file has unexpected bone-to-vertex-group associations

Hello,

I’m writing an importer for model files ripped from a video game. I found vertex group data and bone data in the model file and figured out that vertex groups are linked to bones by an ID number. However, when I import all of this into Blender, the armature doesn’t work the way it should, because each vertex group is associated with the parent of the bone that it should be associated with. For example, when I move the upper arm bone, the upper arm doesn’t move, but the forearm, hand, and fingers do. See the attached screenshots:




I don’t think this is just an off-by-one error, because the model file uses explicit ID numbers that link vertex groups and bones. Also, an off-by-one error would cause weirder problems, like bones in one finger being associated with vertex groups in a different finger, and that’s not the case.

Also, the terminal bones in the fingers, feet, and hair don’t go all the way to the end of the mesh like I’d expect them to. (But there are other bones that are used as anchors for pieces of armor, which do seem to end in the right place.) Plus, to get each bone to be in the right initial location, I had to build the armature with a loop like this:

  1. Set head location to tail location of parent bone.
  2. Set tail location to [head location] + [accumulated rotation value from parent bone] * [translation vector stored with the bone].
  3. Set accumulated rotation for this bone equal to [parent’s accumulated rotation value] * [rotation value stored with this bone].

So, everything about the bones suggests that any rotation on the bone is meant to be applied to children of the bone, but not the bone itself. Is this just a different, common way bones can work? If so, is there a way to set up Blender to work this way?

Or is it more likely that I’m just misinterpreting the bone data somehow?

Thanks in advance!