Vertex transform (object -> world)

During the past few weeks I’ve been writing a bunch of Python code to do various things, and somewhere I think I read about a function in Blender’s Python API that would properly transform an object’s vert into world coords. The benefit was it was implemented in C/C++ and therefore faster than rolling your own in Python.

However, in looking at the NMesh/NMVert/Object API I don’t see anything like this with 2.36.

Perhaps this was mentioned as either a future feature or a wishlist item somewhere? Anybody know anything about this?

perhaps you were confused by NMesh.getRaw and getRawFromObject which will return deformed [as in armature and lattice deformation] meshes

to get the verticies in world space it looks like you have to convert them yourself.

Perhaps so. I did try getRawFromObject() on my simple test mesh, and the data is the same. Which makes sense, since the mesh isn’t subsurfed, latticed, nor an armature.

Thanks for the suggestion, though!

In blender 2.37, use the current testing built version :

#From api2_2x cvs doc
# This script outputs deformed meshes worldspace vertex locations
 # for a selected object
 import Blender
 from Blender import NMesh, Object
     
 ob = Object.GetSelected()[0] # Get the first selected object
 me = NMesh.GetRawFromObject(ob) # Get the objects deformed mesh data
 me.transform(ob.matrix)
   
 for v in me.verts:
       print 'worldspace vert', v.co

Much thanks for the link, jms. That is exactly what I stumbled across the other day but I couldn’t remember where. It was a case of Web Page Overload.