[Bf-python] Transforming a mesh C-, amazing speed increase of exporters.

Campbell J Barton cbarton at metavr.com
Sat Feb 5 20:12:05 CET 2005


Hi, I just added some functionality that I find very usefull
it allows you to transform an NMesh by any 4x4 matrix
Syntax is
mesh.transform(matrix)

Mabe mesh.applyMatrix() would be nicer?

I benchmarked the transformation, with impressive results- Both gave the same
output of course.
Transforming with mesh.transform(matrix)
  Seconds: 0.0844249725342
Transforming with Mathutils VecMultiMat, resizing the vert to a 4d vec, all in a
for loop per vert. ..(Previously the best way???)
  Seconds:   3.55111908913


eg- Could be used this way.

ob = Object.GetSelected()[0]
me = ob.getData()
me.transform(ob.getMatrix())
for v in m.verts:
  print v.co


- A common problem with exporting mesh objects is that you need to pass the
verts through its object matrix.
Having this function should speed up blender exporting to other renderer engines
/ file formats a lot.

- Cam-- 
Campbell J Barton

133 Hope Street
Geelong West, Victoria 3218 Australia

URL:    http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: nmesh_tx.txt
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20050206/1cad0938/attachment.txt>


More information about the Bf-python mailing list