I have just spent the better part of my day trying many different examples in an attempt to simply parent an object to a bone without the object moving (aka keep_transform). But no matter what I try it always offsets:
object.parent = armature object.parent_bone = bone #object now in weird position object.parent_type = 'BONE'
I also tried this as suggested here:
object.parent = armature object.parent_bone = bone bpy.context.active_pose_bone bpy.ops.object.parent_set(type='BONE', keep_transform=True)
But get error "Error: No active bone"
I notice the object I am parenting to the bone in the armature is always moving to the bone's tail when I need it to be positioned at the head.
Is there anything I can do to programmatically affix the object to the bone's head? Any help her would be most encouraging, I just keep hitting walls with this.
One idea I had was to just offset the object by the head/tail delta, but because blender allows parenting-in-place I figured I should stick to convention.