Custom Normals in Blender's DNA

Hello! Not sure if this question belongs here… since its more a programming question, so sorry beforehand

I am reading .blend files in C++ with a serializer alla gamekit/assimp
I have this DNA generated from a 2.76 blender file version:
http://pastebin.com/798DDGVC
And I am reading mi vertices from the Mesh > MVert and there I have the position coordinates and normals (float co[3] and short no[3])
But those normals are for the smooth shaded version of the mesh…
But in blender I am able to edit normals in many ways like Auto Smooth, Normal Edit Modifier, and the awesome Blend4Web addon.
The question is where are those normals saved in the DNA???
I believe is somewhere around those “CustomData” (vdata, edata, fdata, etc) in the Mesh struct… but I can’t find them.

Any blender developer in the house that can point me in the right direction?
Many thanks in advance!! :smiley:

It is Mesh > MLoop :evilgrin:

duplicated

Thanks, I am actually reading the normals from the MLoop, but from the mloop I get the vertex index and then I read the vertex data from mvert, my code goes like this:



    Blender::MVert *mvert = bMesh->mvert;
    Blender::MPoly *mpoly = bMesh->mpoly;
    Blender::MLoop *mloop = bMesh->mloop;
    Blender::MLoopUV *muvs[8] = {0, 0, 0, 0, 0, 0, 0, 0};


    for (int fi = 0; fi < bMesh->totpoly; fi++)
    {
        const Blender::MPoly& curpoly = mpoly[fi];


        //skip if face is not a triangle || quad
        if (curpoly.totloop<3)
            continue;


        const Blender::MLoop& v0 = mloop[curpoly.loopstart];
        const Blender::MLoop& v1 = mloop[curpoly.loopstart+1];
        const Blender::MLoop& v2 = mloop[curpoly.loopstart+2];


        vpak[0] = mvert[v0.v];
        vpak[1] = mvert[v1.v];
        vpak[2] = mvert[v2.v];


        for(int i=0; i<3; i++){


            //Coordinates
            myVertex[i].co.x = vpak[i].co[0];
            myVertex[i].co.y = vpak[i].co[1];
            myVertex[i].co.z = vpak[i].co[2];


            //HERE I HAVE "SMOOTHED" NORMALS
            //Normals
            myVertex[i].no.x = vpak[i].no[0]/32767.f;
            myVertex[i].no.y = vpak[i].no[1]/32767.f;
            myVertex[i].no.z = vpak[i].no[2]/32767.f;


            //uvs
            for(int j=0; j<uvSetCount; j++){
                const Blender::MLoopUV& uv1 = muvs[j][curpoly.loopstart+i];
                myVertex[i].uv[j].x = uv1.uv[0];
                myVertex[i].uv[j].y = uv1.uv[1];
            }


        }


    }

The problem is that in blender each vertex seems to have one index, so it can hold just one normal, that’s why I think that data must be somewhere else :S

One thing I noticed is that when I press the “Add Custom Split Normals Data” button in the object Data tab, then in see that bMesh->ldata.totlayer increases by 1, but I tried casting bMesh->ldata.layers[bMesh->ldata.totlayer-1].data to mloop and many others but I can’t find it =(

many thanks!