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$
  • $\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 Jul 18 '17 at 17:27
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$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.