[Bf-python] NMesh Q

models at paposo.com models at paposo.com
Fri Sep 5 16:50:38 CEST 2003


IC <o><o>
The sequnence methods cause the object to be treated as a list or tuple,
while the others are callbacks from the object's definition regarding
getting and setting attributes. I think this should be put in some
documentation somewhere; i.e. on how to get/set things. For example the
python documentation give you all the methods that are used by a class but
maybe a portion regarding setting and retrieving data elements from
verts/faces/etc. {xycoord = vert[0:2] for example}

One thing im confused by is in the python vert:
NMVert_getattr callback contains:
     else if (strcmp(name, "no") == 0)
           return newVectorObject(mv->no, 3);
o.k. i get that - but,
NMVert_setattr callback contains no reference to 'co' or 'no' yet if i do
this:
    vertex.no[1] = 3
    print vertex.no
it gives me the right answer.  I don't really understand why if it's not
defined anywhere in the vert structure............

Also, if found a weird bug looking at the verts/normals if you do this:
"""
import Blender
vs = Blender.NMesh.Vert()
vs.co[0] = 1.0
vs.co[1] = 2.0
vs.co[2] = 3.0
vs.no[0] = 1.5
vs.no[1] = 2.5
vs.no[2] = 3.5
print vs.no
print vs.co
""""
you get:
[1.5,2.5,3.5,0.0]
[1.0,2.0,3.0,1.5]

This is probably just because the way they are stored in memory at a
float[3] maybe.  I think (but not) sure that the last coordinate is used by
opengl for rendering purpose as part of the 4x4 matrix..  Anyway kinda
weird.

Maybe you could call it PyMesh!




More information about the Bf-python mailing list