Hi!
I want to use blender mesh data’s an other application. I export some datas. If I use scale, rotate and don’t apply size/rotation the mesh’s coords are bad.
How do I calculate “real” coords?
Is there are funtions?
example: size
realx = x * size.x
realy = y * size.y
realz = z * size.z
It’s ok, but circuitous, for all data (vertex, normals) and rotate… bah
Another idea:
How do I call in python:
ApplyChanges
Undo
I think so, I call ApplyChanges before export mesh’s data, and Undo after export. It isn’t elegant, perhaps works.
Hmm, I don’t know if there is a python function that transforms object coordinates to python coordinates, but even if there isn’t one you should be able to retrieve the transform matrices for all transformations on the mesh, combine them to a single matrix by multiplying them and then just apply the final transform matrix to your vertices. There’s several documents about matrix transforms for 3d operations, just google ‘matrix 3d’ or ‘matrix transform’, once you pruned out movie related results you should have plenty of documentation.
#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