[Bf-python] nmesh,Transform update

Willian Padovani Germano wgermano at ig.com.br
Sat Mar 19 17:36:15 CET 2005


Campbell Barton wrote:

> Hi, this should fix the normal transformation.

Hi Campbell.  Today I woke up realizing my error (was adding the 4th
column to the matrix x vec op., but affine vectors have 0 for their 4th
component, unlike points.  I checked emails soon after that to see if
anyone had spotted the mistake -- you're fast : ).  Btw, about your
code: nice cast -- (float ( * )[4])*matrix -- for the Mat4Invert call,
it fixes those pesky warnings here.

I just had to update yesterday's code a little, so I didn't commit your
newer patch, but I tried it to compare the results, because:

1) use nmesh.transform
2) print normals
3) enter edit mode (normals are updated by blender)
4) print normals

shows that 2) and 4) are slightly different (equal up to 3 decimal
places).  The small precision loss may not be important, though, unless
someone needs more.  Blender itself stores normals as shorts and uses a
multiply to "cast" floats to shorts and vice-versa, that may be the main
cause.

As far as I checked, the code is fine.  Please excuse me and report if 
there are still problems.

-- 
Willian




More information about the Bf-python mailing list