GetRawFromObject(object.name)

Hi all,

I’m still stuck on getting the translation / rotation of meshes animated through an armature (meshes are parented to armature, so there is no mesh deformation).

After doing a lot of research in forums and discussion in #blender I managed to get the armature animated while the script is running. This ex. shows how:

import Blender

currentFrame = 1
Blender.Set('curframe',currentFrame)

while currentFrame < 50
    Blender.Window.RedrawAll()
    objname = Blender.Object.getSelected()[0].name
    msh = Blender.NMesh.GetRawFromObject(objname)
    print msh.verts[0].co
    currentFrame += 1
    Blender.Set('curframe',currentFrame)

The problem is, that print ver.co always prints the same position though I can see the object (mesh) move in the 3d window while the script runs through.

This is what I have tried:

  • object.getMatrix(): Matrix doesn’t get updated
  • object.getEuler() and getLocation(): don’t get updated
  • Blender.NMesh.GetRawFromObject(objname): not updated
  • Blender.NMesh.GetRaw(objname): not updated

So I think I’m doing something wrong… missing some update, refresh or whatever comman…

Suggestions welcome :wink:

Regards,
Christoph

import Blender

currentFrame = 1
Blender.Set('curframe',currentFrame)

while currentFrame < 50:
    Blender.Window.RedrawAll()
    objname = Blender.Object.getSelected()[0].name
    msh = Blender.NMesh.GetRawFromObject(objname)
    print msh.verts[0].co
    currentFrame += 1
    Blender.Set('curframe',currentFrame) 

Tested on blender 2.35 , results:
[0.0000, 0.0000, -0.8785]
[0.0005, -0.0006, -0.8781]
[0.0021, -0.0024, -0.8772]
[0.0045, -0.0051, -0.8759]
[0.0077, -0.0087, -0.8742]
[0.0117, -0.0129, -0.8724]
[0.0164, -0.0178, -0.8705]
[0.0217, -0.0233, -0.8688]
[0.0276, -0.0290, -0.8673]
[0.0340, -0.0351, -0.8662]
[0.0407, -0.0413, -0.8654]
[0.0478, -0.0475, -0.8652]
[0.0549, -0.0535, -0.8655]
[0.0619, -0.0593, -0.8662]
[0.0687, -0.0646, -0.8674]
[0.0751, -0.0695, -0.8688]
[0.0808, -0.0736, -0.8705]
[0.0857, -0.0771, -0.8721]
[0.0894, -0.0797, -0.8734]
[0.0919, -0.0814, -0.8744]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]
[0.0928, -0.0820, -0.8748]