1
$\begingroup$

i need to do some calculations which only work in Rest pose. So i tried to do:

pose_position = arm.data.pose_position
arm.data.pose_position='REST'    

# Do some calculations on the mesh objects bound to the armature

arm.data.pose_position=pose_position

But this simple idea does not work.

However, when i select Rest Position from the Blender User Interface before i call my script, then the script creates correct results. So the question is what does pressing the Rest Position Button in addition and how can i do that from Python as well?

$\endgroup$
4
  • $\begingroup$ This may be something to do with needing a scene update before being able to access updated locations. See stackoverflow.com/questions/13840418/… $\endgroup$ Commented Jan 31, 2015 at 16:58
  • $\begingroup$ What is "arm" refering/pointing to? $\endgroup$
    – Humilton
    Commented Jan 31, 2015 at 18:15
  • $\begingroup$ @Ray Mairlot: scene update does not help here (i tried that) $\endgroup$
    – Gaia Clary
    Commented Feb 5, 2015 at 11:58
  • $\begingroup$ @Naioai Studios: arm is the Armature object to which the meshes are bound which are used in the "some calculations" part. $\endgroup$
    – Gaia Clary
    Commented Feb 5, 2015 at 12:00

1 Answer 1

1
$\begingroup$

You don't need to switch pose_position, because tail, head, matrix and so on are not affected by keyframed poses if you access the Armature data (Object.data.bones[#]).

If you access the pose data however (Object.pose.bones[#]), the properties will change based on the current frame.

$\endgroup$
5
  • $\begingroup$ But i am not calculating anything on the armature. I am calculating data on the meshes which are bound to the armature (i.e. i generate Shape keys). $\endgroup$
    – Gaia Clary
    Commented Feb 2, 2015 at 20:16
  • $\begingroup$ So you are after the unaltered, undeformed mesh data? Or the meshes with everything applied except armature deformation? How is the mesh bound to the armature, using vertex weights? $\endgroup$
    – CodeManX
    Commented Feb 3, 2015 at 1:16
  • $\begingroup$ yes, i need to get the mesh in rest pose and yes it uses vertex weighting. $\endgroup$
    – Gaia Clary
    Commented Feb 3, 2015 at 20:56
  • $\begingroup$ The mesh data is not changed in any way by a deforming armature. There's no need to change it to the rest position. Select the armature and go to edit mode to see how the data is stored - there is no deformation and no pose. The pose data is stored elsewhere, and the mesh deformation is calculated on-the-fly. To get the deformed mesh, you need to apply the modifier, e.g. via Object.to_mesh(scene, True, 'PREVIEW'). $\endgroup$
    – CodeManX
    Commented Feb 4, 2015 at 10:59
  • $\begingroup$ yes, i indeed use Object.toMesh() as you propose. Actually my question was not about how to calculate something. It was more about why "setting the armature manually to Rest Pose, then calling my script" gives different results compared to "setting the armature to rest pose by script then calling my script". $\endgroup$
    – Gaia Clary
    Commented Feb 5, 2015 at 11:54

You must log in to answer this question.

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