3
$\begingroup$

I am exporting meshes attached to bones. For each mesh I have transform matrix that is used to position mesh relative to bone. This relative matrix is calculated using:

obj.parent.data.bones[obj.parent_bone].matrix_local.inverted() * obj.matrix_local

When I export with armature in rest position I get correct results.

correct positions

If I switch to pose position in blender and export, I get wrong results

wrong positions

I think that problem is obj.matrix_local which is based on current bone position. How can I force rest position, or use other method to calculate object's transform relative to bone.

armature.data.pose_position = 'REST' doesn't work from script, but looks like it works from console.

$\endgroup$
1
  • $\begingroup$ I think that the problem is that an armature has 3 modes : Pose, Object and Edit. So What do you mean with putting it in rest mode? how can I proceed ? blender v2.78(a) $\endgroup$
    – user42646
    Commented Jul 18, 2017 at 17:27

1 Answer 1

2
$\begingroup$

I got armature.data.pose_position change to work After changing to REST I had to call context.scene.update() and it calculates positions in rest pose. I change it once to pose when exporting keyframes and it is working as well.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .