Hi, I'm new to Python scripting and need some help getting started

(Mardok45) #1

I’m making my own file format for Bone Animation and need some help getting the script up and running. I tried looking for a good reference manual, but the one in Blender doesn’t work. I know I stumbled onto a Java-like reference manual but I forgot where I found it :frowning:

Anyway, the way this script is going to work is that I need a way to pass a mesh and it’s armature to the function, easy enough:

mesh = NMesh.GetRaw(“Name of Mesh”)
armature = Armature.Get(“Name of Armature”)

Now, I need a way to go through the Vertex Groups of the mesh and I need a way to select the bone, along with its current rotation that goes with the Vertex Group too. Does anyone know of a way to get the mesh’s Vertex Group? Could it possibly be:

vg = mesh.GetVertexGroup()
for currentVG in vg
for vertex in currentVG
printf("%f, %f, %f", vertex.verts[0], vertex.verts[1], vertex.verts[2])
printf("%s, %f…", armature.Bone(currentVG.name), armature.Bone(currentVG.name).getRotation())

I know I’m asking for a lot, but if someone could at least point me to a reference manual, it would be appreciated and I’ll be sure to bookmark it this time.


(Gwenouille) #2

Have you tried this link ?


(Cosimo_0) #3

I think NMesh is deprecated in favor of Mesh(I hope is not the other way round)


(Atom) #4

You can always look at some of the scripts that come with Blender as well.


(chipmasque) #5

A note about using the API reference and using existing scripts as reference – some of the methods listed/used may be deprecated in favor of ones yet to be fully documented. Same for some other API components (as mentioned above re: NMesh). Check the console frequently for notifications of this while doing your scripting.