fix compile errors for previous merge
authorCampbell Barton <ideasman42@gmail.com>
Thu, 10 Nov 2011 03:40:02 +0000 (03:40 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 10 Nov 2011 03:40:02 +0000 (03:40 +0000)
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/editderivedbmesh.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_view3d/drawmesh.c
source/blender/editors/uvedit/uvedit_ops.c

index 646497e5e11a4f3c4ab774786e74699e05224f73..e5196c4694aabf0a54d3128b3d5f8ffd0c060392 100644 (file)
@@ -1397,9 +1397,9 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm,
        DMVertexAttribs attribs;
        MVert *mvert = cddm->mvert;
        MFace *mf = cddm->mface;
        DMVertexAttribs attribs;
        MVert *mvert = cddm->mvert;
        MFace *mf = cddm->mface;
-       float (*nors)[3] = dm->getFaceDataArray(dm, CD_NORMAL);
+       float (*nors)[3] = dm->getTessFaceDataArray(dm, CD_NORMAL);
        int a, matnr, new_matnr;
        int a, matnr, new_matnr;
-       int orig, *index = dm->getFaceDataArray(dm, CD_ORIGINDEX);
+       int orig, *index = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 
        cdDM_update_normals_from_pbvh(dm);
 
 
        cdDM_update_normals_from_pbvh(dm);
 
index aa2b6e9dc83776cfc6367d4162247f8e025b3d63..1c95bc7d683591d43c463bb856994e6649590ae5 100644 (file)
@@ -1112,6 +1112,7 @@ static void bmDM_drawMappedFacesGLSL(DerivedMesh *dm,
                        glEnd();
                }
        }
                        glEnd();
                }
        }
+#undef PASSATTRIB
 }
 
 static void bmDM_drawFacesGLSL(DerivedMesh *dm,
 }
 
 static void bmDM_drawFacesGLSL(DerivedMesh *dm,
@@ -1126,43 +1127,41 @@ static void bmDM_drawMappedFacesMat(DerivedMesh *dm,
                           int (*setFace)(void *userData, int index), void *userData)
 {
        EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
                           int (*setFace)(void *userData, int index), void *userData)
 {
        EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
-       EditMesh *em= bmdm->em;
+       BMesh *bm= bmdm->tc->bm;
+       BMEditMesh *em = bmdm->tc;
        float (*vertexCos)[3]= bmdm->vertexCos;
        float (*vertexNos)[3]= bmdm->vertexNos;
        float (*vertexCos)[3]= bmdm->vertexCos;
        float (*vertexNos)[3]= bmdm->vertexNos;
-       EditVert *eve;
-       EditFace *efa;
+       BMVert *eve;
+       BMFace *efa;
+       BMIter iter;
+       BMLoop **ltri;
        DMVertexAttribs attribs= {{{0}}};
        GPUVertexAttribs gattribs;
        DMVertexAttribs attribs= {{{0}}};
        GPUVertexAttribs gattribs;
-       int i, b, matnr, new_matnr;
+       int i, b, matnr, new_matnr, dodraw;
 
        matnr = -1;
 
        /* always use smooth shading even for flat faces, else vertex colors wont interpolate */
        glShadeModel(GL_SMOOTH);
 
 
        matnr = -1;
 
        /* always use smooth shading even for flat faces, else vertex colors wont interpolate */
        glShadeModel(GL_SMOOTH);
 
-       for (i=0,eve=em->verts.first; eve; eve= eve->next)
-               eve->tmp.l = (intptr_t) i++;
+       BM_ITER_INDEX(eve, &iter, bm, BM_VERTS_OF_MESH, NULL, i) {
+                BM_SetIndex(eve, i);
+       }
 
 
-#define PASSATTRIB(efa, eve, vert) {                                                                                   \
+#define PASSATTRIB(loop, eve, vert) {                                                                                  \
        if(attribs.totorco) {                                                                                                           \
        if(attribs.totorco) {                                                                                                           \
-               float *orco = attribs.orco.array[eve->tmp.l];                                                   \
-               if(attribs.orco.glTexco)                                                                                                \
-                       glTexCoord3fv(orco);                                                                                            \
-               else                                                                                                                                    \
-                       glVertexAttrib3fvARB(attribs.orco.glIndex, orco);                                       \
+               float *orco = attribs.orco.array[BM_GetIndex(eve)];                                             \
+               glVertexAttrib3fvARB(attribs.orco.glIndex, orco);                                               \
        }                                                                                                                                                       \
        for(b = 0; b < attribs.tottface; b++) {                                                                         \
        }                                                                                                                                                       \
        for(b = 0; b < attribs.tottface; b++) {                                                                         \
-               MTFace *_tf = (MTFace*)((char*)efa->data + attribs.tface[b].emOffset);  \
-               if(attribs.tface[b].glTexco)                                                                                    \
-                       glTexCoord2fv(_tf->uv[vert]);                                                                           \
-               else                                                                                                                                    \
-                       glVertexAttrib2fvARB(attribs.tface[b].glIndex, _tf->uv[vert]);          \
+               MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPUV, b);\
+               glVertexAttrib2fvARB(attribs.tface[b].glIndex, _luv->uv);                               \
        }                                                                                                                                                       \
        for(b = 0; b < attribs.totmcol; b++) {                                                                          \
        }                                                                                                                                                       \
        for(b = 0; b < attribs.totmcol; b++) {                                                                          \
-               MCol *cp = (MCol*)((char*)efa->data + attribs.mcol[b].emOffset);                \
-               GLubyte col[4];                                                                                                                 \
-               col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;                             \
-               glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col);                                    \
+               MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPCOL, b);\
+               GLubyte _col[4];                                                                                                                \
+               _col[0]= _cp->b; _col[1]= _cp->g; _col[2]= _cp->r; _col[3]= _cp->a;             \
+               glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, _col);                                   \
        }                                                                                                                                                       \
        if(attribs.tottang) {                                                                                                           \
                float *tang = attribs.tang.array[i*4 + vert];                                                   \
        }                                                                                                                                                       \
        if(attribs.tottang) {                                                                                                           \
                float *tang = attribs.tang.array[i*4 + vert];                                                   \
@@ -1170,11 +1169,13 @@ static void bmDM_drawMappedFacesMat(DerivedMesh *dm,
        }                                                                                                                                                       \
 }
 
        }                                                                                                                                                       \
 }
 
-       for (i=0,efa= em->faces.first; efa; i++,efa= efa->next) {
-               int drawSmooth= (efa->flag & ME_SMOOTH);
+       for (i=0, ltri=em->looptris[0]; i<em->tottri; i++, ltri += 3) {
+               int drawSmooth= BM_TestHFlag(efa, BM_SMOOTH);
+
+               efa = ltri[0]->f;
 
                /* face hiding */
 
                /* face hiding */
-               if(setFace && !setFace(userData, i))
+               if(setFace && !setFace(userData, BM_GetIndex(efa)))
                        continue;
 
                /* material */
                        continue;
 
                /* material */
@@ -1185,69 +1186,52 @@ static void bmDM_drawMappedFacesMat(DerivedMesh *dm,
                }
 
                /* face */
                }
 
                /* face */
-               glBegin(efa->v4?GL_QUADS:GL_TRIANGLES);
+               glBegin(GL_TRIANGLES);
                if (!drawSmooth) {
                        if(vertexCos) glNormal3fv(bmdm->faceNos[i]);
                if (!drawSmooth) {
                        if(vertexCos) glNormal3fv(bmdm->faceNos[i]);
-                       else glNormal3fv(efa->n);
+                       else glNormal3fv(efa->no);
 
 
-                       PASSATTRIB(efa, efa->v1, 0);
-                       if(vertexCos) glVertex3fv(vertexCos[(int) efa->v1->tmp.l]);
-                       else glVertex3fv(efa->v1->co);
+                       PASSATTRIB(ltri[0], ltri[0]->v, 0);
+                       if(vertexCos) glVertex3fv(vertexCos[BM_GetIndex(ltri[0]->v)]);
+                       else glVertex3fv(ltri[0]->v->co);
 
 
-                       PASSATTRIB(efa, efa->v2, 1);
-                       if(vertexCos) glVertex3fv(vertexCos[(int) efa->v2->tmp.l]);
-                       else glVertex3fv(efa->v2->co);
+                       PASSATTRIB(ltri[1], ltri[1]->v, 1);
+                       if(vertexCos) glVertex3fv(vertexCos[BM_GetIndex(ltri[1]->v)]);
+                       else glVertex3fv(ltri[1]->v->co);
 
 
-                       PASSATTRIB(efa, efa->v3, 2);
-                       if(vertexCos) glVertex3fv(vertexCos[(int) efa->v3->tmp.l]);
-                       else glVertex3fv(efa->v3->co);
+                       PASSATTRIB(ltri[2], ltri[2]->v, 2);
+                       if(vertexCos) glVertex3fv(vertexCos[BM_GetIndex(ltri[2]->v)]);
+                       else glVertex3fv(ltri[2]->v->co);
 
 
-                       if(efa->v4) {
-                               PASSATTRIB(efa, efa->v4, 3);
-                               if(vertexCos) glVertex3fv(vertexCos[(int) efa->v4->tmp.l]);
-                               else glVertex3fv(efa->v4->co);
-                       }
                } else {
                } else {
-                       PASSATTRIB(efa, efa->v1, 0);
+                       PASSATTRIB(ltri[0], ltri[0]->v, 0);
                        if(vertexCos) {
                        if(vertexCos) {
-                               glNormal3fv(vertexNos[(int) efa->v1->tmp.l]);
-                               glVertex3fv(vertexCos[(int) efa->v1->tmp.l]);
+                               glNormal3fv(vertexNos[BM_GetIndex(ltri[0]->v)]);
+                               glVertex3fv(vertexCos[BM_GetIndex(ltri[0]->v)]);
                        }
                        else {
                        }
                        else {
-                               glNormal3fv(efa->v1->no);
-                               glVertex3fv(efa->v1->co);
+                               glNormal3fv(ltri[0]->v->no);
+                               glVertex3fv(ltri[0]->v->co);
                        }
 
                        }
 
-                       PASSATTRIB(efa, efa->v2, 1);
+                       PASSATTRIB(ltri[1], ltri[1]->v, 1);
                        if(vertexCos) {
                        if(vertexCos) {
-                               glNormal3fv(vertexNos[(int) efa->v2->tmp.l]);
-                               glVertex3fv(vertexCos[(int) efa->v2->tmp.l]);
+                               glNormal3fv(vertexNos[BM_GetIndex(ltri[1]->v)]);
+                               glVertex3fv(vertexCos[BM_GetIndex(ltri[1]->v)]);
                        }
                        else {
                        }
                        else {
-                               glNormal3fv(efa->v2->no);
-                               glVertex3fv(efa->v2->co);
+                               glNormal3fv(ltri[1]->v->no);
+                               glVertex3fv(ltri[1]->v->co);
                        }
 
                        }
 
-                       PASSATTRIB(efa, efa->v3, 2);
+                       PASSATTRIB(ltri[2], ltri[2]->v, 2);
                        if(vertexCos) {
                        if(vertexCos) {
-                               glNormal3fv(vertexNos[(int) efa->v3->tmp.l]);
-                               glVertex3fv(vertexCos[(int) efa->v3->tmp.l]);
+                               glNormal3fv(vertexNos[BM_GetIndex(ltri[2]->v)]);
+                               glVertex3fv(vertexCos[BM_GetIndex(ltri[2]->v)]);
                        }
                        else {
                        }
                        else {
-                               glNormal3fv(efa->v3->no);
-                               glVertex3fv(efa->v3->co);
-                       }
-
-                       if(efa->v4) {
-                               PASSATTRIB(efa, efa->v4, 3);
-                               if(vertexCos) {
-                                       glNormal3fv(vertexNos[(int) efa->v4->tmp.l]);
-                                       glVertex3fv(vertexCos[(int) efa->v4->tmp.l]);
-                               }
-                               else {
-                                       glNormal3fv(efa->v4->no);
-                                       glVertex3fv(efa->v4->co);
-                               }
+                               glNormal3fv(ltri[2]->v->no);
+                               glVertex3fv(ltri[2]->v->co);
                        }
                }
                glEnd();
                        }
                }
                glEnd();
index 79b19a7a3675c45e224ee007188654adc38b08e9..f462f1182038365fe3a045ff9654ce7f35ea2f60 100644 (file)
@@ -52,6 +52,7 @@
 #include "BKE_mesh.h"
 #include "BKE_scene.h"
 #include "BKE_screen.h"
 #include "BKE_mesh.h"
 #include "BKE_scene.h"
 #include "BKE_screen.h"
+#include "BKE_tessmesh.h"
 
 #include "IMB_imbuf_types.h"
 
 
 #include "IMB_imbuf_types.h"
 
index 31046603216b4543e0249c5b191bf36fa179b3e2..56215f6523ca04559f71b9b0fc04b594e11d85c0 100644 (file)
@@ -797,12 +797,14 @@ static int tex_mat_set_face_mesh_cb(void *userData, int index)
        return !(mface->flag & ME_HIDE);
 }
 
        return !(mface->flag & ME_HIDE);
 }
 
-static int tex_mat_set_face_editmesh_cb(void *UNUSED(userData), int index)
+static int tex_mat_set_face_editmesh_cb(void *userData, int index)
 {
        /* editmode face hiding */
 {
        /* editmode face hiding */
-       EditFace *efa= EM_get_face_for_index(index);
+       TexMatCallback *data= (TexMatCallback*)userData;
+       Mesh *me = (Mesh*)data->me;
+       BMFace *efa= EDBM_get_face_for_index(me->edit_btmesh, index);
 
 
-       return !(efa->h);
+       return !BM_TestHFlag(efa, BM_HIDDEN);
 }
 
 void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int faceselect)
 }
 
 void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int faceselect)
index 65f65d4579c8d776eed28919eca2239efa5a8a5b..5f58c710c5348cd61a2fcf8c6e5ce3e09b32b6d4 100644 (file)
@@ -59,7 +59,9 @@
 #include "BKE_main.h"
 #include "BKE_material.h"
 #include "BKE_mesh.h"
 #include "BKE_main.h"
 #include "BKE_material.h"
 #include "BKE_mesh.h"
+#include "BKE_node.h"
 #include "BKE_report.h"
 #include "BKE_report.h"
+#include "BKE_scene.h"
 #include "BKE_tessmesh.h"
 
 #include "ED_image.h"
 #include "BKE_tessmesh.h"
 
 #include "ED_image.h"