[Bf-python] FaceNormals

models at paposo.com models at paposo.com
Thu Oct 16 06:19:13 CEST 2003


I got tired of looking at the keystuff and was looking at the forums over at
elysiun.  It looks like a few people were worried about accessing a face
normal. How about this:

//NMesh.c
float fNormal[3];

static PyObject *NMFace_getattr(PyObject *self, char *name)
{
     BPy_NMFace *mf = (BPy_NMFace *)self;
.....

 if(strcmp(name, "no") == 0)
{
    CalcNormFloat( mf->v[0].co, mf->v[1].co, mf->v[2].co, fNormal)
        return newVectorObject(fNormal, 3)

.....
     return Py_FindMethod(NMFace_methods, (PyObject*)self, name);
}

//NMesh.h
typedef struct {
....
 float normal                //new
} BPy_NMFace; /* an NMesh face */

That way you could just do:
myNormal = myFace.no

I haven't tested this yet but the concept is pretty simple. You would just
return the normal for face just like any other variable




More information about the Bf-python mailing list