[Bf-committers] Python Armatures

Jordi Rovira i Bonet bf-committers@blender.org
Tue, 22 Apr 2003 16:15:21 +0200

Hello everybody,

    I'm new to the list. I've been "grepping" the word python through it 
as this is my temporary concern. I started playing with Blender to make 
an exporter for a game engine (neoengine) and crashed with the 
already-famous lack of Armature-related bindings. So i thought i finally 
found the excuse i needed to go into blender's code and that's what i did.
    I've started implementing a wrapper for Armature and Bone which only 
allows you to read some data from this objects. I've been working with 
the main CVS branch and used the 2.25 Blender Python API. After a post 
on the forum, i've been told to discuss this here, as python bindings 
are being reworked. I've worked very "mechanically" until now, adapting 
pieces wrapping other classes to wrap Armature, so i've done some things 
blindly. The modifications are far from being of any use yet, despite 
things like the following work:

import Blender

def PrintBone(bone):

  print "   Bone name : %s" % bone

  for child in bone.children:


armature = Blender.Armature.GetRaw("TestArm")

print "Armature name : %s" % armature.name

print " number of root bones : %d " % len(armature.bones) 

for bone in armature.bones:


resulting in thing like:

Armature name : TestArm

 number of root bones : 1

   Bone name : [Bone - name<Bone>, head<0.000000, 0.000000, 0.000000>, tail<0.081950,8.933691,0.000000>, roll<3.928223>]

   Bone name : [Bone - name<Bone.001>, head<0.000000, 0.000000, 0.000000>, tail<-6.084369,2.075242,0.000000>, roll<3.928223>]

   Bone name : [Bone - name<Bone.002>, head<0.000000, 0.000000, 0.000000>, tail<-5.761865,2.058556,0.000000>, roll<3.928223>]

    Reading the thread "tackling python" i've been updated about it. Now 
i understand the experimental coditional compilation flags around the 
code,  and also, that freezer thing.
    Two questions follow:
       - was anyone already working on this?
       - should i work on the future Python API instead of the current 
one, if i go one with armature wrapping?