Ho to align object transform to parent bone

Hello Blender community!

I have a problem with getting my meshes to align with bones. I have a very simple armature and a low poly character that comes in a bunch of pieces. I don’t want to soft bind the character to the armature but rather just parent the pieces to the respective bones. I have managed setup the parent relationship, but blender seems to treat this as the meshes being parented to the armature and then in addition having some kind of constraint to move with the respective bone. But this means that the transform of my mesh is now relative to the armature root, not the specific bone. Zeroing out the transform of the mesh moves and rotates it to the armature root instead of the bone, which is what I wanted. Blender draws lines form the object pivot to the bone, so it obviously has the information it needs to perform the operation I want, it just doesn’t let me do it :confused:

Any help or pointers on this are greatly appreciated. Thanks in advance.

Hey, Welcome to BA
Not sure how you went about this, so I will just give you a little 101. Before you parent any parts, make sure you ‘Apply’ any rotation and scale to your mesh objects. Next, prob the most time consuming part, you have to align your bones to your parts in ‘EDIT’ mode. That is going to be select an edge loop or some vertex central to the part(edit mode) snap 3D cursor to it - select bone head or tail snap it to 3D cursor(edit mode) and just keep repeating until finished, turn on ‘Bone Axis Display’ so you can see your axis, very important to keep this consistent and relevant. Then select a bone in Pose mode > select the part you want to parent > SHIFT + SELECT the bone again (pose mode) and CTRL + P = Bone. Just keep repeating till your finished. You can test each part after you parent them just to make sure.

Thanks for your quick reply!
If I undestood you correctly, I want to do the opposite of your solution. I want to align the meshes to the bones. My idea was that after parenting, the mesh should be in the coordinate space of the bone. In theory I should just be able to zero out the transform and it would align to the bone. What I would like is something like the ‘Parent (Without Inverse)’ option that you get when parenting an object to another object. But when using that on a bone (even when parenting to the bone in pose mode) Blender always uses the armature root as the reference point for the transform.

1 Like

I figured it out.

This code gets me close enough to what I want when first selecting the object and then selecting the bone in pose mode:

bpy.context.selected_objects[1].matrix_world = bpy.context.selected_objects[0].matrix_world @ bpy.context.selected_pose_bones[0].matrix

Hey inferno, is there a way to run this command on the mesh’s origins only (without moving meshes), or did your workflow account for that?

I’ve got a rig and set of meshes modeled in place, parented to their correct bones. I would like to have the mesh transforms be 0’d out relative to their parent bone. Something similar to freezing a child’s transforms in Maya.

Sorry to necro the thread, but your use case is the closest thing I’ve found to mine!

Thanks for your time

UPDATE:
Blender 3.2.1 introduced a new parenting mode that does almost everything needed. The only quirk being that a bone’s origin is considered its tail, not head. Probably an easy to solve issue, but I’ve left a post here that outlines it: Bone origins at head?