[Bf-python] FaceNormals
Michel Selten
michel.s at home.nl
Thu Oct 16 22:31:48 CEST 2003
Hi,
I don't see any problem with adding this to the NMesh module. Except for
one thing; The naming of the attribute should be 'normal', not 'no'.
With regards,
Michel
On Thu, 2003-10-16 at 06:19, models at paposo.com wrote:
> 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