dont use tface hide or select anymore, since maintaining 2 sets of hide/select data...
authorCampbell Barton <ideasman42@gmail.com>
Sun, 29 Apr 2007 13:39:46 +0000 (13:39 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 29 Apr 2007 13:39:46 +0000 (13:39 +0000)
using mface->flag for both.

Also found that the cdDM_drawMappedFaces and cdDM_drawFacesTex_common could get normals mixed up when rendering hidden faces. because hidden/invisible faces used continue without advancing to the next normal.

38 files changed:
release/scripts/bpymodules/BPyRender.py
release/scripts/bpymodules/mesh_gradient.py
release/scripts/discombobulator.py
release/scripts/faceselect_same_weights.py
release/scripts/mesh_unfolder.py
release/scripts/uv_from_adjacent.py
release/scripts/uvcalc_follow_active_coords.py
release/scripts/uvcalc_from_adjacent.py
release/scripts/uvcalc_lightmap.py
release/scripts/uvcalc_quad_clickproj.py
release/scripts/uvcalc_smart_project.py
release/scripts/vertexpaint_from_material.py
release/scripts/vertexpaint_selfshadow_ao.py
release/scripts/weightpaint_copy.py
release/scripts/x3d_export.py
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/mesh.c
source/blender/include/BDR_editface.h
source/blender/makesdna/DNA_meshdata_types.h
source/blender/python/api2_2x/doc/Mesh.py
source/blender/python/api2_2x/doc/NMesh.py
source/blender/src/buttons_editing.c
source/blender/src/drawimage.c
source/blender/src/drawmesh.c
source/blender/src/drawobject.c
source/blender/src/editface.c
source/blender/src/editmesh.c
source/blender/src/editmesh_mods.c
source/blender/src/editobject.c
source/blender/src/editsima.c
source/blender/src/editview.c
source/blender/src/header_view3d.c
source/blender/src/transform_conversions.c
source/blender/src/unwrapper.c
source/blender/src/vpaint.c
source/gameengine/Converter/BL_BlenderDataConversion.cpp

index 514d62bd64fa86440d37f2119ce25936633e50be..bb5ef6283568af1400c4e903ecdc6aab030e7ec4 100644 (file)
@@ -223,9 +223,8 @@ def mesh2uv(me_s, PREF_SEL_FACES_ONLY=False):
        material_list= []
        for me in me_s:
                me_materials= me.materials
-               FACE_SEL= Blender.Mesh.FaceFlags.SELECT
                if PREF_SEL_FACES_ONLY:
-                       me_faces= [f for f in me.faces if f.flag & FACE_SEL]
+                       me_faces= [f for f in me.faces if f.sel]
                else:
                        me_faces= me.faces
                
index 4f752e2bf173407e01cbfe4435bc57feffb483b8..936f4958467ca63a334ae578b26256b9ea8434ee 100755 (executable)
@@ -117,14 +117,12 @@ def vertexGradientPick(ob, MODE):
        if not ORTHO:
                line_angle= AngleBetweenVecs(lineA[1], lineB[1])/2
                line_mid= (lineA[1]+lineB[1])*0.5
-       
-       FSEL= Blender.Mesh.FaceFlags.SELECT
 
        VSEL= [False] * (len(me.verts))
        
        # Get the selected faces and apply the selection to the verts.
        for f in me.faces:
-               if f.flag & FSEL:
+               if f.sel:
                        for v in f.v:
                                VSEL[v.index]= True
        groupNames, vWeightDict= BPyMesh.meshWeight2Dict(me)
@@ -206,7 +204,7 @@ def vertexGradientPick(ob, MODE):
        
        else: # MODE==1 VCol
                for f in me.faces:
-                       if f.flag & FSEL:
+                       if f.sel:
                                f_v= f.v
                                for i in xrange(len(f_v)):
                                        v= f_v[i]
index 4b443c030c099b720a1594863b5b2c561b6273fa..6dbb4e5382b3a5c16f8b101e4c25d45acd3a0931 100644 (file)
@@ -184,8 +184,6 @@ doodadminheight = 0.0
 doodadmaxheight = 0.1
 doodadArray = [1,2,3,4,5,6]
 
-SEL = NMesh.FaceFlags['SELECT']
-
 def makeSubfaceArray():
        global subfaceArray
        global subface1
index 0aa9d2ffb6d810f764df4950dd350fac456ea53f..b8d50cf09b6043b6a66f57ef1d1eb850c0e37dcd 100644 (file)
@@ -40,8 +40,6 @@ Select same weights as the active face on the active group.
 from Blender import Scene, Draw, Mesh
 import BPyMesh
 
-SEL_FLAG = Mesh.FaceFlags['SELECT']
-
 def selSameWeights(me, PREF_TOLERENCE):
        
        # Check for missing data
@@ -76,7 +74,7 @@ def selSameWeights(me, PREF_TOLERENCE):
        
        weight_from, weight_range_from = get_face_weight(act_face)
        for f in me.faces:
-               if (not f.flag & SEL_FLAG) and (not f.hide) and f != act_face:
+               if (not f.sel) and f != act_face:
                        weight, weight_range = get_face_weight(f)
                        
                        # Compare the 2 faces weight difference and difference in their contrast.
@@ -84,7 +82,6 @@ def selSameWeights(me, PREF_TOLERENCE):
                        abs(weight - weight_from) <= PREF_TOLERENCE and\
                        abs(weight_range - weight_range_from) <= PREF_TOLERENCE:
                                f.sel = True
-                               f.flag |= SEL_FLAG
 
 
 def main():
index ea958dfea84c5d45ec857d8c894a5136c8c18902..c24063e674e7e9e323d41e4265744f9c93088450 100644 (file)
@@ -368,7 +368,7 @@ class Net:
                self.showProgress = show
        # this method really needs work
        def unfold(self):
-               selectedFaces = [face for face in self.src.faces if (self.src.faceUV and face.flag & Mesh.FaceFlags.SELECT)]
+               selectedFaces = [face for face in self.src.faces if (self.src.faceUV and face.sel)]
                if(self.avoidsOverlaps):
                        print "unfolding with overlap detection"
                if(self.firstFaceIndex==None):
@@ -662,7 +662,7 @@ class Net:
                except:
                        print "Problem setting materials here"
                net = Net(mesh, netMesh)
-               if(mesh.faceUV and mesh.activeFace>=0 and (mesh.faces[mesh.activeFace].flag & Mesh.FaceFlags.SELECT)):
+               if mesh.faceUV and mesh.activeFace>=0 and (mesh.faces[mesh.activeFace].sel):
                        net.firstFaceIndex = mesh.activeFace
                net.object = ob
                net.feedback = feedback
index c2c5246c015507afd1132a56d234f266650988aa..dfdad3118d9a5bbfc053f462079166b6bdb6a716 100644 (file)
@@ -38,7 +38,7 @@ Use this script in face select mode for texturing between textured faces.
 
 
 from Blender import *
-
+import bpy
 
 def mostUsedImage(imageList): # Returns the image most used in the list.
        if not imageList:
@@ -70,8 +70,9 @@ def mostUsedImage(imageList): # Returns the image most used in the list.
 
 
 def main():
-       scn = Scene.GetCurrent()
-       ob = scn.objects.active
+       sce = bpy.data.scenes.active
+       ob = sce.objects.active
+       
        if ob == None or ob.type != 'Mesh':
                Draw.PupMenu('ERROR: No mesh object in face select mode.')
                return
@@ -80,9 +81,9 @@ def main():
        if not me.faceUV:
                Draw.PupMenu('ERROR: No mesh object in face select mode.')
                return
-       SEL_FLAG = Mesh.FaceFlags['SELECT']
-       selfaces = [f for f in me.faces if f.flag & SEL_FLAG]
-       unselfaces = [f for f in me.faces if not f.flag & SEL_FLAG]
+       
+       selfaces = [f for f in me.faces if f.sel]
+       unselfaces = [f for f in me.faces if not f.sel]
        
        
        # Gather per Vert UV and Image, store in vertUvAverage
@@ -103,8 +104,6 @@ def main():
                else:
                        vertUvData[0] = None
        
-       
-       
        # Assign to selected faces
        TEX_FLAG = Mesh.FaceModes['TEX']
        for f in selfaces:
index fc91c0b648a6bf4bfab63e9c6fc228429eda5a1b..c97e7168d2fc090753ca2595052304c92af7b159 100644 (file)
@@ -43,8 +43,8 @@ import bpy
 import BPyMesh
 
 def extend():
-       scn = bpy.data.scenes.active
-       ob = scn.objects.active
+       sce = bpy.data.scenes.active
+       ob = sce.objects.active
        
        # print ob, ob.type
        if ob == None or ob.type != 'Mesh':
@@ -156,15 +156,7 @@ def extend():
                Draw.PupMenu('ERROR: No active face')
                return
        
-       
-       SELECT_FLAG = Mesh.FaceFlags.SELECT
-       HIDE_FLAG = Mesh.FaceFlags.HIDE
-       def use_face(f_flag):
-               if f_flag & HIDE_FLAG:          return False
-               elif f_flag & SELECT_FLAG:      return True
-               else:                                           return False
-       
-       face_sel= [f for f in me.faces if len(f) == 4 and use_face(f.flag)]
+       face_sel= [f for f in me.faces if len(f) == 4 and f.sel]
        
        face_act_local_index = -1
        for i, f in enumerate(face_sel):
index b4ed25868df91706f6f484d63afabcf1cb68c29b..32bbd9e08e634ba2368fc9c17eded6bf2d846472 100644 (file)
@@ -81,15 +81,8 @@ def main():
                Draw.PupMenu('ERROR: No mesh object in face select mode.')
                return
        
-       SELECT_FLAG = Mesh.FaceFlags.SELECT
-       HIDE_FLAG = Mesh.FaceFlags.HIDE
-       def use_face(f_flag):
-               if f_flag & HIDE_FLAG:          return False
-               elif f_flag & SELECT_FLAG:      return True
-               else:                                           return False
-       
-       selfaces = [f for f in me.faces if use_face(f.flag)]
-       unselfaces = [f for f in me.faces if not use_face(f.flag)]
+       selfaces = [f for f in me.faces if f.sel]
+       unselfaces = [f for f in me.faces if not f.sel if not f.hide]
        
        # Gather per Vert UV and Image, store in vertUvAverage
        vertUvAverage = [[[],[]] for i in xrange(len(me.verts))]
index 64eb1bb4e7589baf1b510eaf617d203f9b6c3da6..a4269149203b51bb16feb686459212f3b46f5f2b 100644 (file)
@@ -221,12 +221,9 @@ PREF_MARGIN_DIV=           512):
        else:
                face_groups = []
        
-       
-       SEL_FLAG = Mesh.FaceFlags.SELECT
-       
        for me in meshes:                       
                if PREF_SEL_ONLY:
-                       faces = [f for f in me.faces if f.flag & SEL_FLAG]
+                       faces = [f for f in me.faces if f.sel]
                else:
                        faces = list(me.faces)
                
@@ -239,8 +236,6 @@ PREF_MARGIN_DIV=            512):
                        me.addUVLayer('lightmap')
                        me.activeUVLayer = 'lightmap'
        
-       del SEL_FLAG
-       
        for face_sel in face_groups:
                print "\nStarting unwrap"
                
index 84c54ae30da349484aff567107305a157280f01a..67b58885f9dafca0fda9281161af49c9c54b85e2 100644 (file)
@@ -47,8 +47,8 @@ import BPyWindow
 mouseViewRay= BPyWindow.mouseViewRay
 from Blender import Mathutils, Window, Scene, Draw, sys
 from Blender.Mathutils import CrossVecs, Vector, Matrix, LineIntersect, Intersect #, AngleBetweenVecs, Intersect
-LMB= Window.MButs['L']
-RMB= Window.MButs['R']
+LMB= Window.MButs.L
+RMB= Window.MButs.R
 
 def using_modifier(ob):
        for m in ob.modifiers:
@@ -168,17 +168,8 @@ def main():
        def get_face_coords(f):
                f_uv = f.uv
                return [(v.co-face_corner_main, f_uv[i]) for i,v in enumerate(f.v)]
-               
-               
-               
-       SELECT_FLAG = Blender.Mesh.FaceFlags.SELECT
-       HIDE_FLAG = Blender.Mesh.FaceFlags.HIDE
-       def use_face(f_flag):
-               if f_flag & HIDE_FLAG:          return False
-               elif f_flag & SELECT_FLAG:      return True
-               else:                                           return False
        
-       coords = [ (co,uv) for f in me.faces if use_face(f.flag) for co, uv in get_face_coords(f)]
+       coords = [ (co,uv) for f in me.faces if f.sel for co, uv in get_face_coords(f)]
        
        coords_orig = [uv.copy() for co, uv in coords]
        USE_MODIFIER = using_modifier(ob)
index 9f40b63b67e394e2f42906b1899fec31e3cc7964..7ec3afd77691fda07a5b8fa2657b8428fffd54fa 100644 (file)
@@ -937,8 +937,7 @@ def main():
                        me.faceUV= True
                
                if USER_ONLY_SELECTED_FACES:
-                       SELECT_FLAG = Mesh.FaceFlags.SELECT
-                       meshFaces = [thickface(f) for f in me.faces if f.flag & SELECT_FLAG]
+                       meshFaces = [thickface(f) for f in me.faces if f.sel]
                else:
                        meshFaces = map(thickface, me.faces)
                
index 6ecde41347df4916233038dc7b8d8b41aa89db3e..2df5b7e721fcfe186ddbedd8ba91d939392d46dd 100644 (file)
@@ -53,10 +53,9 @@ def mat2vcol(PREF_SEL_FACES_ONLY, PREF_ACTOB_ONLY, PREF_MULTIPLY_COLOR):
                
                matcols= [matcol(mat) for mat in me.materials]
                len_matcols= len(matcols)
-               FSEL= Mesh.FaceFlags.SELECT
                
                for f in me.faces:
-                       if not PREF_SEL_FACES_ONLY or f.flag & FSEL:
+                       if not PREF_SEL_FACES_ONLY or f.sel:
                                f_mat= f.mat
                                if f_mat < len_matcols:
                                        mat= matcols[f.mat]
index 31306ecaef81c1c2097fc4fc9a31236360fe196d..c083bc9e8b059cecc517ff7aa32454ac6132930d 100644 (file)
@@ -119,9 +119,9 @@ def vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PRE
        tone_range= max_tone-min_tone
        if max_tone==min_tone:
                return
-       SELFLAG= Mesh.FaceFlags.SELECT
+       
        for f in me.faces:
-               if not PREF_SEL_ONLY or f.flag & SELFLAG:
+               if not PREF_SEL_ONLY or f.sel:
                        f_col= f.col
                        for i, v in enumerate(f):
                                col= f_col[i]
index b75e609cdfe6805530be4be8423c79ade060eb76..976bba0ea2ce581f9f37512c792d403f654cde40 100644 (file)
@@ -51,10 +51,9 @@ def copy_act_vgroup(me, PREF_NAME, PREF_SEL_ONLY):
                        except:         pass
        else:
                # Selected faces only
-               SEL_FLAG = Mesh.FaceFlags.SELECT
                verts = {} # should use set
                for f in me.faces:
-                       if f.flag & SEL_FLAG:
+                       if f.sel:
                                for v in f:
                                        verts[v.index] = None
                
index 0f6cb1baa2e7593c267050ce428bb9024784e949..36359f1d122b898eaed8f01996340b85dadfc3bc 100644 (file)
@@ -831,8 +831,8 @@ class VRML2Export:
     def faceToString(self,face):
 
         print "Debug: face.flag=0x%x (bitflags)" % face.flag
-        if face.flag & NMesh.FaceFlags.SELECT == NMesh.FaceFlags.SELECT:
-            print "Debug: face.flag.SELECT=true"
+        if face.sel:
+            print "Debug: face.sel=true"
 
         print "Debug: face.mode=0x%x (bitflags)" % face.mode
         if (face.mode & NMesh.FaceModes.TWOSIDE) == NMesh.FaceModes.TWOSIDE:
index 38762d8f49aa6b13eb18a9c02e3ce5f08459a56c..fa8f76178d590d53a7e9a0a358edf00ffd2d7858 100644 (file)
@@ -572,7 +572,7 @@ static void emDM_drawUVEdges(DerivedMesh *dm)
        for(efa= emdm->em->faces.first; efa; efa= efa->next) {
                tf = CustomData_em_get(&emdm->em->fdata, efa->data, CD_MTFACE);
 
-               if(tf && !(tf->flag&TF_HIDE)) {
+               if(tf && !(efa->h)) {
                        glVertex2fv(tf->uv[0]);
                        glVertex2fv(tf->uv[1]);
 
index c983f6b48e535ac9bf8f106bd5091f50b57ff21e..2d5f5f091c37670cf9d34dea68189be0154eec14 100644 (file)
@@ -177,14 +177,14 @@ static void cdDM_drawVerts(DerivedMesh *dm)
 static void cdDM_drawUVEdges(DerivedMesh *dm)
 {
        CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
-       MTFace *tf = DM_get_face_data_layer(dm, CD_MTFACE);
        MFace *mf = cddm->mface;
+       MTFace *tf = DM_get_face_data_layer(dm, CD_MTFACE);
        int i;
 
-       if(tf) {
+       if(mf) {
                glBegin(GL_LINES);
-               for(i = 0; i < dm->numFaceData; i++, tf++, mf++) {
-                       if(!(tf->flag&TF_HIDE)) {
+               for(i = 0; i < dm->numFaceData; i++, mf++, tf++) {
+                       if(!(mf->flag&ME_HIDE)) {
                                glVertex2fv(tf->uv[0]);
                                glVertex2fv(tf->uv[1]);
 
@@ -399,67 +399,67 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
                else {
                        if(index) {
                                orig = *index++;
-                               if(orig == ORIGINDEX_NONE) continue;
+                               if(orig == ORIGINDEX_NONE)              { if(nors) nors += 3; continue; }
                                if(drawParamsMapped) flag = drawParamsMapped(userData, orig);
-                               else continue;
+                               else    { if(nors) nors += 3; continue; }
                        }
                        else
                                if(drawParamsMapped) flag = drawParamsMapped(userData, i);
-                               else continue;
+                               else    { if(nors) nors += 3; continue; }
                }
+               
+               if(flag != 0) { /* if the flag is 0 it means the face is hidden or invisible */
+                       if (flag==1 && mcol)
+                               cp= (unsigned char*) &mcol[i*4];
 
-               if(flag == 0)
-                       continue;
-               else if (flag==1 && mcol)
-                       cp= (unsigned char*) &mcol[i*4];
-
-               if(!(mf->flag&ME_SMOOTH)) {
-                       if (nors) {
-                               glNormal3fv(nors);
-                       }
-                       else {
-                               /* TODO make this better (cache facenormals as layer?) */
-                               float nor[3];
-                               if(mf->v4) {
-                                       CalcNormFloat4(mv[mf->v1].co, mv[mf->v2].co,
-                                                                  mv[mf->v3].co, mv[mf->v4].co,
-                                                                  nor);
-                               } else {
-                                       CalcNormFloat(mv[mf->v1].co, mv[mf->v2].co,
-                                                                 mv[mf->v3].co, nor);
+                       if(!(mf->flag&ME_SMOOTH)) {
+                               if (nors) {
+                                       glNormal3fv(nors);
+                               }
+                               else {
+                                       /* TODO make this better (cache facenormals as layer?) */
+                                       float nor[3];
+                                       if(mf->v4) {
+                                               CalcNormFloat4(mv[mf->v1].co, mv[mf->v2].co,
+                                                                          mv[mf->v3].co, mv[mf->v4].co,
+                                                                          nor);
+                                       } else {
+                                               CalcNormFloat(mv[mf->v1].co, mv[mf->v2].co,
+                                                                         mv[mf->v3].co, nor);
+                                       }
+                                       glNormal3fv(nor);
                                }
-                               glNormal3fv(nor);
                        }
-               }
 
-               glBegin(mf->v4?GL_QUADS:GL_TRIANGLES);
-               if(tf) glTexCoord2fv(tf[i].uv[0]);
-               if(cp) glColor3ub(cp[3], cp[2], cp[1]);
-               mvert = &mv[mf->v1];
-               if(mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
-               glVertex3fv(mvert->co);
-                       
-               if(tf) glTexCoord2fv(tf[i].uv[1]);
-               if(cp) glColor3ub(cp[7], cp[6], cp[5]);
-               mvert = &mv[mf->v2];
-               if(mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
-               glVertex3fv(mvert->co);
-
-               if(tf) glTexCoord2fv(tf[i].uv[2]);
-               if(cp) glColor3ub(cp[11], cp[10], cp[9]);
-               mvert = &mv[mf->v3];
-               if(mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
-               glVertex3fv(mvert->co);
-
-               if(mf->v4) {
-                       if(tf) glTexCoord2fv(tf[i].uv[3]);
-                       if(cp) glColor3ub(cp[15], cp[14], cp[13]);
-                       mvert = &mv[mf->v4];
+                       glBegin(mf->v4?GL_QUADS:GL_TRIANGLES);
+                       if(tf) glTexCoord2fv(tf[i].uv[0]);
+                       if(cp) glColor3ub(cp[3], cp[2], cp[1]);
+                       mvert = &mv[mf->v1];
+                       if(mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
+                       glVertex3fv(mvert->co);
+                               
+                       if(tf) glTexCoord2fv(tf[i].uv[1]);
+                       if(cp) glColor3ub(cp[7], cp[6], cp[5]);
+                       mvert = &mv[mf->v2];
                        if(mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
                        glVertex3fv(mvert->co);
-               }
-               glEnd();
 
+                       if(tf) glTexCoord2fv(tf[i].uv[2]);
+                       if(cp) glColor3ub(cp[11], cp[10], cp[9]);
+                       mvert = &mv[mf->v3];
+                       if(mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
+                       glVertex3fv(mvert->co);
+
+                       if(mf->v4) {
+                               if(tf) glTexCoord2fv(tf[i].uv[3]);
+                               if(cp) glColor3ub(cp[15], cp[14], cp[13]);
+                               mvert = &mv[mf->v4];
+                               if(mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
+                               glVertex3fv(mvert->co);
+                       }
+                       glEnd();
+               }
+               
                if(nors) nors += 3;
        }
 }
@@ -483,7 +483,8 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
 
                if(index) {
                        orig = *index++;
-                       if(setDrawOptions && orig == ORIGINDEX_NONE) continue;
+                       if(setDrawOptions && orig == ORIGINDEX_NONE)
+                               { if(nors) nors += 3; continue; }
                }
                else
                        orig = i;
index 033c1b26471d2656534ee565662f01b1e77cc191..68319b799a2ed5325b14ac16da990340fc964888 100644 (file)
@@ -272,7 +272,7 @@ static void layerSwap_tface(void *data, int *corner_indices)
 static void layerDefault_tface(void *data, int count)
 {
        static MTFace default_tf = {{{0, 1}, {0, 0}, {1, 0}, {1, 1}}, NULL,
-                                  TF_SELECT, 0, TF_DYNAMIC, 0, 0};
+                                  0, 0, TF_DYNAMIC, 0, 0};
        MTFace *tf = (MTFace*)data;
        int i;
 
index 7da2454b4749a3ba335c452f78a6f8593dae8014..93a3981c4a9426f8e37c2b638a0574661cbcbea7 100644 (file)
@@ -1150,7 +1150,7 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned
        mf= mface;
        tf= tface;
        for(a=0; a<totface; a++, mf++, tf++)
-               if(!selected || (!(tf->flag & TF_HIDE) && (tf->flag & TF_SELECT)))
+               if(!selected || (!(mf->flag & ME_HIDE) && (mf->flag & ME_FACE_SEL)))
                        totuv += (mf->v4)? 4: 3;
                
        if(totuv==0)
@@ -1171,7 +1171,7 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned
        mf= mface;
        tf= tface;
        for(a=0; a<totface; a++, mf++, tf++) {
-               if(!selected || (!(tf->flag & TF_HIDE) && (tf->flag & TF_SELECT))) {
+               if(!selected || (!(mf->flag & ME_HIDE) && (mf->flag & ME_FACE_SEL))) {
                        nverts= (mf->v4)? 4: 3;
 
                        for(i=0; i<nverts; i++) {
index aa5276abe67a5c8ad3b673eab20a48e3e43004c0..31971da292b82282cdff5fcf28fb7a535e6f17fa 100644 (file)
@@ -57,8 +57,5 @@ void set_texturepaint(void);
 void get_same_uv(void);  
 void seam_mark_clear_tface(short mode);
 
-void select_mface_from_tface(struct Mesh *me);
-void select_tface_from_mface(struct Mesh *me);
-
 #endif /* BDR_EDITFACE_H */
 
index f61b919a426ced50234e4de3dfa069ed073e24f5..4d78f57713729833b7ef1f7f46650619d3fed74a 100644 (file)
@@ -183,13 +183,13 @@ typedef struct PartialVisibility {
 #define ME_FSEL 2
 
 /* mtface->flag */
-#define TF_SELECT      1
+#define TF_SELECT      1 /* use MFace hide flag (after 2.43), should be able to reuse after 2.44 */
 #define TF_ACTIVE      2
 #define TF_SEL1                4
 #define TF_SEL2                8
 #define TF_SEL3                16
 #define TF_SEL4                32
-#define TF_HIDE                64
+#define TF_HIDE                64 /* unused, same as TF_SELECT */
 
 /* mtface->mode */
 #define TF_DYNAMIC             1
index a89f075e7f63dd15cc2068e624cbf86d2b9c3323..69a8feba7e6928598deaea0bd40a1eb2bb291f41 100644 (file)
@@ -58,8 +58,8 @@ done once.
 @var FaceFlags: The available *texture face* (uv face select mode) selection
        flags.  Note: these refer to TexFace faces, available if mesh.faceUV
        returns true.
-               - SELECT - selected.
-               - HIDE - hidden.
+               - SELECT - selected (deprecated in versions after 2.43, use face.sel).
+               - HIDE - hidden  (deprecated in versions after 2.43, use face.hide).
                - ACTIVE - the active face, read only - Use L{mesh.activeFace<Mesh.Mesh.activeFace>} to set.
 @var FaceModes: The available *texture face* modes. Note: these are only
        meaningful if mesh.faceUV returns true, since in Blender this info is
index aa52400656f0baab599dd4119bd1b5aec8887725..e6d779aebb88a7c3457d968d1e0d78575e0b00a0 100644 (file)
@@ -53,8 +53,8 @@ Example::
 @var FaceFlags: The available *texture face* (uv face select mode) selection
   flags.  Note: these refer to TexFace faces, available if nmesh.hasFaceUV()
   returns true.
-    - SELECT - selected.
-    - HIDE - hidden.
+    - SELECT - selected (deprecated after 2.43 release, use face.sel).
+    - HIDE - hidden (deprecated after 2.43 release, use face.sel).
     - ACTIVE - the active face.
 @var FaceModes: The available *texture face* modes. Note: these are only
   meaningful if nmesh.hasFaceUV() returns true, since in Blender this info is
index b52b5ebc306a00728c4f33f8e76cef6ff13d40d3..976d50cd9e1b8a253a7d97ea6164366d0d0d6eed 100644 (file)
@@ -4099,9 +4099,6 @@ void do_meshbuts(unsigned short event)
                        if (G.obedit || me) {
                                CustomData *fdata= (G.obedit)? &em->fdata: &me->fdata;
 
-                               if (G.f & G_FACESELECT)
-                                       select_mface_from_tface(me);
-
                                CustomData_set_layer_active(fdata, CD_MTFACE, acttface-1);
                                mesh_update_customdata_pointers(me);
                                
@@ -4109,9 +4106,6 @@ void do_meshbuts(unsigned short event)
                                if(me && me->mr && me->mr->current != 1)
                                        CustomData_set_layer_active(&me->mr->fdata, CD_MTFACE, acttface-1);
 
-                               if (G.f & G_FACESELECT)
-                                       select_tface_from_mface(me);
-
                                DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
                                BIF_undo_push("Set Active UV Texture");
                                allqueue(REDRAWVIEW3D, 0);
@@ -4745,6 +4739,7 @@ void do_fpaintbuts(unsigned short event)
        Object *ob;
        bDeformGroup *defGroup;
        MTFace *activetf, *tf;
+       MFace *mf;
        MCol *activemcol;
        int a;
        SculptData *sd= &G.scene->sculptdata;
@@ -4770,8 +4765,8 @@ void do_fpaintbuts(unsigned short event)
                activetf= get_active_tface(&activemcol);
 
                if(me && activetf) {
-                       for (a=0, tf=me->mtface; a < me->totface; a++, tf++) {
-                               if(tf!=activetf && (tf->flag & TF_SELECT)) {
+                       for (a=0, tf=me->mtface, mf=me->mface; a < me->totface; a++, tf++, mf++) {
+                               if(tf!=activetf && (mf->flag & ME_FACE_SEL)) {
                                        if(event==B_COPY_TF_MODE) {
                                                tf->mode= activetf->mode;
                                                tf->transp= activetf->transp;
index aea926ef5fb224383bab22b7b4593c49248dc023..188f48bcdca1adb96d2255590b02a4b291b20eb7 100644 (file)
@@ -290,6 +290,7 @@ ImBuf *imagewindow_get_ibuf(SpaceImage *sima)
 void image_changed(SpaceImage *sima, int dotile)
 {
        MTFace *tface;
+       MFace *mface;
        Mesh *me;
        int a;
 
@@ -312,9 +313,10 @@ void image_changed(SpaceImage *sima, int dotile)
                        if(me && me->mtface) {
                                
                                tface= me->mtface;
+                               mface = me->mface;
                                a= me->totface;
                                while(a--) {
-                                       if(tface->flag & TF_SELECT) {
+                                       if(mface->flag & ME_FACE_SEL) {
                                                
                                                if(dotile==2) {
                                                        tface->mode &= ~TF_TILES;
@@ -335,6 +337,7 @@ void image_changed(SpaceImage *sima, int dotile)
                                                }
                                        }
                                        tface++;
+                                       mface++;
                                }
 
                                object_uvs_changed(OBACT);
@@ -426,7 +429,7 @@ void draw_tfaces(void)
 
                                        glColor3ub(112, 112, 112);
                                        while(a--) {
-                                               if(!(tface->flag & TF_HIDE) && (tface->flag & TF_SELECT)) {
+                                               if(!(mface->flag & ME_HIDE) && (mface->flag & ME_FACE_SEL)) {
                                                        glBegin(GL_LINE_LOOP);
                                                        glVertex2fv(tface->uv[0]);
                                                        glVertex2fv(tface->uv[1]);
@@ -453,7 +456,7 @@ void draw_tfaces(void)
                                mface= me->mface;
                                a= me->totface;                 
                                while(a--) {
-                                       if(tface->flag & TF_SELECT) {
+                                       if(mface->flag & ME_FACE_SEL) {
                                                if(!(~tface->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) &&
                                                   (!mface->v4 || tface->flag & TF_SEL4))
                                                        glColor4ubv((GLubyte *)col2);
@@ -478,7 +481,7 @@ void draw_tfaces(void)
                        mface= me->mface;
                        a= me->totface;
                        while(a--) {
-                               if(tface->flag & TF_SELECT) {
+                               if(mface->flag & ME_FACE_SEL) {
                                        if(tface->flag & TF_ACTIVE){
                                                activetface= tface; 
                                                activemface= mface; 
@@ -565,7 +568,7 @@ void draw_tfaces(void)
                        mface= me->mface;
                        a= me->totface;
                        while(a--) {
-                               if(tface->flag & TF_SELECT) {
+                               if(mface->flag & ME_FACE_SEL) {
                                        
                                        if(tface->flag & TF_SEL1); else bglVertex2fv(tface->uv[0]);
                                        if(tface->flag & TF_SEL2); else bglVertex2fv(tface->uv[1]);
@@ -589,7 +592,7 @@ void draw_tfaces(void)
                        mface= me->mface;
                        a= me->totface;
                        while(a--) {
-                               if(tface->flag & TF_SELECT) {
+                               if(mface->flag & ME_FACE_SEL) {
                                        
                                        if(tface->unwrap & TF_PIN1) bglVertex2fv(tface->uv[0]);
                                        if(tface->unwrap & TF_PIN2) bglVertex2fv(tface->uv[1]);
@@ -612,7 +615,7 @@ void draw_tfaces(void)
                        mface= me->mface;
                        a= me->totface;
                        while(a--) {
-                               if(tface->flag & TF_SELECT) {
+                               if(mface->flag & ME_FACE_SEL) {
                                        
                                        if(tface->flag & TF_SEL1) bglVertex2fv(tface->uv[0]);
                                        if(tface->flag & TF_SEL2) bglVertex2fv(tface->uv[1]);
@@ -763,7 +766,7 @@ void image_editvertex_buts(uiBlock *block)
                MFace *mf= &((MFace*) me->mface)[i];
                MTFace *tf= &((MTFace*) me->mtface)[i];
                
-               if (!(tf->flag & TF_SELECT))
+               if (!(mf->flag & ME_FACE_SEL))
                        continue;
                
                if (tf->flag & TF_SEL1) {
@@ -835,7 +838,7 @@ void image_editvertex_buts(uiBlock *block)
                        MFace *mf= &((MFace*) me->mface)[i];
                        MTFace *tf= &((MTFace*) me->mtface)[i];
                
-                       if (!(tf->flag & TF_SELECT))
+                       if (!(mf->flag & ME_FACE_SEL))
                                continue;
                
                        if (tf->flag & TF_SEL1) {
index cf14427e029aed9f4dcea0bad5f5d5efe1ebea5a..53a537e92b0fd2202e3664744e484927e22f6fde 100644 (file)
@@ -615,12 +615,12 @@ EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me)
                MTFace *tf = &me->mtface[i];
                
                if (mf->v3) {
-                       if (!(tf->flag&TF_HIDE)) {
+                       if (!(mf->flag&ME_HIDE)) {
                                unsigned int flags = eEdge_Visible;
-                               if (tf->flag&TF_SELECT) flags |= eEdge_Select;
+                               if (mf->flag&ME_FACE_SEL) flags |= eEdge_Select;
                                if (tf->flag&TF_ACTIVE) {
                                        flags |= eEdge_Active;
-                                       if (tf->flag&TF_SELECT) flags |= eEdge_SelectAndActive;
+                                       if (mf->flag&ME_FACE_SEL) flags |= eEdge_SelectAndActive;
                                }
 
                                get_marked_edge_info__orFlags(eh, mf->v1, mf->v2, flags);
@@ -713,8 +713,8 @@ static int draw_tfaces3D__drawFaceOpts(void *userData, int index)
        Mesh *me = (Mesh*)userData;
 
        if (me->mtface) {
-               MTFace *tface = &me->mtface[index];
-               if (!(tface->flag&TF_HIDE) && (tface->flag&TF_SELECT))
+               MFace *mface = &me->mface[index];
+               if (!(mface->flag&ME_HIDE) && (mface->flag&ME_FACE_SEL))
                        return 2; /* Don't set color */
                else
                        return 0;
@@ -936,7 +936,7 @@ static unsigned char g_draw_tface_mesh_obcol[4];
 
 static int draw_tface__set_draw(MTFace *tface, MCol *mcol, int matnr)
 {
-       if (tface && ((tface->flag&TF_HIDE) || (tface->mode&TF_INVISIBLE))) return 0;
+       if (!tface || (tface->mode&TF_INVISIBLE)) return 0;
 
        if (tface && set_draw_settings_cached(0, g_draw_tface_mesh_istex, tface, g_draw_tface_mesh_islight, g_draw_tface_mesh_ob, matnr, TF_TWOSIDE)) {
                glColor3ub(0xFF, 0x00, 0xFF);
@@ -961,18 +961,21 @@ static int draw_tface_mapped__set_draw(void *userData, int index)
 {
        Mesh *me = (Mesh*)userData;
        MTFace *tface = (me->mtface)? &me->mtface[index]: NULL;
+       MFace *mface = (me->mface)? &me->mface[index]: NULL;
        MCol *mcol = (me->mcol)? &me->mcol[index]: NULL;
        int matnr = me->mface[index].mat_nr;
-
+       if (mface && mface->flag&ME_HIDE) return 0;
        return draw_tface__set_draw(tface, mcol, matnr);
 }
 
 static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r)
 {
-       MTFace *tface = (MTFace *)userData;
+       Mesh *me = (Mesh*)userData;
+       MTFace *tface = (me->mtface)? &me->mtface[index]: NULL;
+       MFace *mface = (me->mface)? &me->mface[index]: NULL;
+       
        if (tface) {
-               tface+= index;
-               if ((tface->flag&TF_HIDE) || (tface->mode&TF_INVISIBLE)) 
+               if ((mface->flag&ME_HIDE) || (tface->mode&TF_INVISIBLE)) 
                        return 0;
        }
        *drawSmooth_r = 1;
@@ -1034,7 +1037,7 @@ void draw_tface_mesh(Object *ob, Mesh *me, int dt)
                if(ob==OBACT && (G.f & G_FACESELECT) && me && me->mtface) {
 #endif         
                        if(G.f & G_WEIGHTPAINT)
-                               dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mtface, 1);
+                               dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, (void*)me, 1);
                        else
                                dm->drawMappedFacesTex(dm, draw_tface_mapped__set_draw, (void*)me);
                }
@@ -1057,7 +1060,7 @@ void draw_tface_mesh(Object *ob, Mesh *me, int dt)
                                int matnr= mf->mat_nr;
                                int mf_smooth= mf->flag & ME_SMOOTH;
 
-                               if (!(tface->flag&TF_HIDE) && !(mode&TF_INVISIBLE) && (mode&TF_BMFONT)) {
+                               if (!(mf->flag&ME_HIDE) && !(mode&TF_INVISIBLE) && (mode&TF_BMFONT)) {
                                        int badtex= set_draw_settings_cached(0, g_draw_tface_mesh_istex, tface, g_draw_tface_mesh_islight, g_draw_tface_mesh_ob, matnr, TF_TWOSIDE);
                                        float v1[3], v2[3], v3[3], v4[3];
                                        char string[MAX_PROPSTRING];
index b1b373ee47d0514b48f06f557e66a2230b7c225b..4a3616c0c6e4cf977989773234653571cda1ccc5 100644 (file)
@@ -4333,7 +4333,7 @@ static int bbs_mesh_solid__setDrawOpts(void *userData, int index, int *drawSmoot
 {
        Mesh *me = userData;
 
-       if (!me->mtface || !(me->mtface[index].flag&TF_HIDE)) {
+       if (!me->mtface || !(me->mface[index].flag&ME_HIDE)) {
                set_framebuffer_index_color(index+1);
                return 1;
        } else {
index 2c14e53eff8d9e85827a5d9dbe30bb4e73ba8631..c45d742301eaae2a55dd0a2630fe7630250ca805 100644 (file)
@@ -191,7 +191,7 @@ static void uv_calc_center_vector(float *result, Object *ob, Mesh *me)
                tface= me->mtface;
                mface= me->mface;
                for(a=0; a<me->totface; a++, mface++, tface++) {
-                       if(tface->flag & TF_SELECT) {
+                       if(mface->flag & ME_FACE_SEL) {
                                DO_MINMAX((me->mvert+mface->v1)->co, min, max);
                                DO_MINMAX((me->mvert+mface->v2)->co, min, max);
                                DO_MINMAX((me->mvert+mface->v3)->co, min, max);
@@ -373,7 +373,7 @@ void calculate_uv_map(unsigned short mapmode)
                tface= me->mtface;
                mface= me->mface;
                for(a=0; a<me->totface; a++, mface++, tface++) {
-                       if(tface->flag & TF_SELECT) {
+                       if(mface->flag & ME_FACE_SEL) {
                                uv_calc_shift_project(tface->uv[0],cent,rotatematrix,3,(me->mvert+mface->v1)->co,min,max);
                                uv_calc_shift_project(tface->uv[1],cent,rotatematrix,3,(me->mvert+mface->v2)->co,min,max);
                                uv_calc_shift_project(tface->uv[2],cent,rotatematrix,3,(me->mvert+mface->v3)->co,min,max);
@@ -389,7 +389,7 @@ void calculate_uv_map(unsigned short mapmode)
                tface= me->mtface;
                mface= me->mface;
                for(a=0; a<me->totface; a++, mface++, tface++) {
-                       if(tface->flag & TF_SELECT) {
+                       if(mface->flag & ME_FACE_SEL) {
                                if(mface->v4) b= 3; else b= 2;
                                for(; b>=0; b--) {
                                        tface->uv[b][0]= ((tface->uv[b][0]-min[0])*fac)/dx;
@@ -406,7 +406,7 @@ void calculate_uv_map(unsigned short mapmode)
                tface= me->mtface;
                mface= me->mface;
                for(a=0; a<me->totface; a++, mface++, tface++) {
-                       if(tface->flag & TF_SELECT) {
+                       if(mface->flag & ME_FACE_SEL) {
                                uv_calc_shift_project(tface->uv[0],cent,rotatematrix,4,(me->mvert+mface->v1)->co,NULL,NULL);
                                uv_calc_shift_project(tface->uv[1],cent,rotatematrix,4,(me->mvert+mface->v2)->co,NULL,NULL);
                                uv_calc_shift_project(tface->uv[2],cent,rotatematrix,4,(me->mvert+mface->v3)->co,NULL,NULL);
@@ -419,7 +419,7 @@ void calculate_uv_map(unsigned short mapmode)
        case B_UVAUTO_RESET:
                tface= me->mtface;
                for(a=0; a<me->totface; a++, tface++)
-                       if(tface->flag & TF_SELECT
+                       if(mface->flag & ME_FACE_SEL
                                default_uv(tface->uv, 1.0);
                break;
 
@@ -438,7 +438,7 @@ void calculate_uv_map(unsigned short mapmode)
                tface= me->mtface;
                mface= me->mface;
                for(a=0; a<me->totface; a++, mface++, tface++) {
-                       if(tface->flag & TF_SELECT) {
+                       if(mface->flag & ME_FACE_SEL) {
                                uv_calc_shift_project(tface->uv[0],cent,rotatematrix,mapmode,(me->mvert+mface->v1)->co,NULL,NULL);
                                uv_calc_shift_project(tface->uv[1],cent,rotatematrix,mapmode,(me->mvert+mface->v2)->co,NULL,NULL);
                                uv_calc_shift_project(tface->uv[2],cent,rotatematrix,mapmode,(me->mvert+mface->v3)->co,NULL,NULL);
@@ -476,7 +476,7 @@ void calculate_uv_map(unsigned short mapmode)
                tface= me->mtface;
                mface= me->mface;
                for(a=0; a<me->totface; a++, mface++, tface++) {
-                       if(tface->flag & TF_SELECT) {
+                       if(mface->flag & ME_FACE_SEL) {
                                CalcNormFloat((mv+mface->v1)->co, (mv+mface->v2)->co, (mv+mface->v3)->co, no);
                                        
                                no[0]= fabs(no[0]);
@@ -521,7 +521,7 @@ void calculate_uv_map(unsigned short mapmode)
                tface= me->mtface;
                mface= me->mface;
                for(a=0; a<me->totface; a++, mface++, tface++) {
-                       if(!(tface->flag & TF_SELECT)) continue;
+                       if(!(mface->flag & ME_FACE_SEL)) continue;
                                
                        dx= dy= 0;
                        if(mface->v4) b= 3; else b= 2;
@@ -555,6 +555,7 @@ MTFace *get_active_tface(MCol **mcol)
 {
        Mesh *me;
        MTFace *tf;
+       MTFace *mf;
        int a;
        
        if(OBACT==NULL || OBACT->type!=OB_MESH)
@@ -571,15 +572,16 @@ MTFace *get_active_tface(MCol **mcol)
                }
        }
 
-       for(a=0, tf=me->mtface; a < me->totface; a++, tf++) {
-               if(tf->flag & TF_SELECT) {
+       
+       for(a=0, tf=me->mtface, mf=me->mface; a < me->totface; a++, tf++, mf++) {
+               if(mf->flag & ME_FACE_SEL) {
                        if(mcol) *mcol = (me->mcol)? &me->mcol[a*4]: NULL;
                        return tf;
                }
        }
 
-       for(a=0, tf=me->mtface; a < me->totface; a++, tf++) {
-               if((tf->flag & TF_HIDE)==0) {
+       for(a=0, tf=me->mtface, mf=me->mface; a < me->totface; a++, tf++, mf++) {
+               if((mf->flag & ME_HIDE)==0) {
                        if(mcol) *mcol = (me->mcol)? &me->mcol[a*4]: NULL;
                        return tf;
                }
@@ -627,20 +629,20 @@ void make_tfaces(Mesh *me)
 void reveal_tface()
 {
        Mesh *me;
-       MTFace *tface;
+       MFace *mface;
        int a;
        
        me= get_mesh(OBACT);
        if(me==0 || me->mtface==0 || me->totface==0) return;
        
-       tface= me->mtface;
+       mface= me->mface;
        a= me->totface;
        while(a--) {
-               if(tface->flag & TF_HIDE) {
-                       tface->flag |= TF_SELECT;
-                       tface->flag -= TF_HIDE;
+               if(mface->flag & ME_HIDE) {
+                       mface->flag |= ME_FACE_SEL;
+                       mface->flag -= ME_HIDE;
                }
-               tface++;
+               mface++;
        }
 
        BIF_undo_push("Reveal UV face");
@@ -651,7 +653,7 @@ void reveal_tface()
 void hide_tface()
 {
        Mesh *me;
-       MTFace *tface;
+       MFace *mface;
        int a;
        
        me= get_mesh(OBACT);
@@ -662,21 +664,21 @@ void hide_tface()
                return;
        }
        
-       tface= me->mtface;
+       mface= me->mface;
        a= me->totface;
        while(a--) {
-               if(tface->flag & TF_HIDE);
+               if(mface->flag & ME_HIDE);
                else {
                        if(G.qual & LR_SHIFTKEY) {
-                               if( (tface->flag & TF_SELECT)==0) tface->flag |= TF_HIDE;
+                               if( (mface->flag & ME_FACE_SEL)==0) mface->flag |= ME_HIDE;
                        }
                        else {
-                               if( (tface->flag & TF_SELECT)) tface->flag |= TF_HIDE;
+                               if( (mface->flag & ME_FACE_SEL)) mface->flag |= ME_HIDE;
                        }
                }
-               if(tface->flag & TF_HIDE) tface->flag &= ~TF_SELECT;
+               if(mface->flag & ME_HIDE) mface->flag &= ~ME_FACE_SEL;
                
-               tface++;
+               mface++;
        }
 
        BIF_undo_push("Hide UV face");
@@ -709,30 +711,30 @@ void select_linked_tfaces(int mode)
 void deselectall_tface()
 {
        Mesh *me;
-       MTFace *tface;
+       MFace *mface;
        int a, sel;
                
        me= get_mesh(OBACT);
        if(me==0 || me->mtface==0) return;
        
-       tface= me->mtface;
+       mface= me->mface;
        a= me->totface;
        sel= 0;
        while(a--) {
-               if(tface->flag & TF_HIDE);
-               else if(tface->flag & TF_SELECT) sel= 1;
-               tface++;
+               if(mface->flag & ME_HIDE);
+               else if(mface->flag & ME_FACE_SEL) sel= 1;
+               mface++;
        }
        
-       tface= me->mtface;
+       mface= me->mface;
        a= me->totface;
        while(a--) {
-               if(tface->flag & TF_HIDE);
+               if(mface->flag & ME_HIDE);
                else {
-                       if(sel) tface->flag &= ~TF_SELECT;
-                       else tface->flag |= TF_SELECT;
+                       if(sel) mface->flag &= ~ME_FACE_SEL;
+                       else mface->flag |= ME_FACE_SEL;
                }
-               tface++;
+               mface++;
        }
 
        BIF_undo_push("(De)select all UV face");
@@ -743,21 +745,21 @@ void deselectall_tface()
 void selectswap_tface(void)
 {
        Mesh *me;
-       MTFace *tface;
+       MFace *mface;
        int a;
                
        me= get_mesh(OBACT);
        if(me==0 || me->mtface==0) return;
        
-       tface= me->mtface;
+       mface= me->mface;
        a= me->totface;
        while(a--) {
-               if(tface->flag & TF_HIDE);
+               if(mface->flag & ME_HIDE);
                else {
-                       if(tface->flag & TF_SELECT) tface->flag &= ~TF_SELECT;
-                       else tface->flag |= TF_SELECT;
+                       if(mface->flag & ME_FACE_SEL) mface->flag &= ~ME_FACE_SEL;
+                       else mface->flag |= ME_FACE_SEL;
                }
-               tface++;
+               mface++;
        }
 
        BIF_undo_push("Select inverse UV face");
@@ -783,7 +785,7 @@ void rotate_uv_tface()
                tf= me->mtface;
                mf= me->mface;
                for(a=0; a<me->totface; a++, tf++, mf++) {
-                       if(tf->flag & TF_SELECT) {
+                       if(mf->flag & ME_FACE_SEL) {
                                float u1= tf->uv[0][0];
                                float v1= tf->uv[0][1];
                                
@@ -815,7 +817,7 @@ void rotate_uv_tface()
                mcol= me->mcol;
                mf= me->mface;
                for(a=0; a<me->totface; a++, tf++, mf++, mcol+=4) {
-                       if(tf->flag & TF_SELECT) {
+                       if(mf->flag & ME_FACE_SEL) {
                                MCol tmpcol= mcol[0];
                                
                                mcol[0]= mcol[1];
@@ -854,7 +856,7 @@ void mirror_uv_tface()
                tf= me->mtface;
 
                for (a=0; a<me->totface; a++, tf++, mf++) {
-                       if(tf->flag & TF_SELECT) {
+                       if(mf->flag & ME_FACE_SEL) {
                                float u1= tf->uv[0][0];
                                float v1= tf->uv[0][1];
                                if(mf->v4) {
@@ -888,7 +890,7 @@ void mirror_uv_tface()
                mcol= me->mcol;
 
                for (a=0; a<me->totface; a++, tf++, mf++, mcol+=4) {
-                       if(tf->flag & TF_SELECT) {
+                       if(mf->flag & ME_FACE_SEL) {
                                MCol tmpcol= mcol[0];
 
                                if(mf->v4) {
@@ -933,7 +935,7 @@ int minmax_tface(float *min, float *max)
        mf= me->mface;
        tf= me->mtface;
        for (a=me->totface; a>0; a--, mf++, tf++) {
-               if (tf->flag & TF_HIDE || !(tf->flag & TF_SELECT))
+               if (mf->flag & ME_HIDE || !(mf->flag & ME_FACE_SEL))
                        continue;
 
                VECCOPY(vec, (mv+mf->v1)->co);
@@ -1012,14 +1014,13 @@ static int seam_shortest_path(Mesh *me, int source, int target)
        float *cost;
        MEdge *med;
        int a, *nedges, *edges, *prevedge, mednum = -1, nedgeswap = 0;
-       MTFace *tf;
        MFace *mf;
 
        /* mark hidden edges as done, so we don't use them */
        ehash = BLI_edgehash_new();
 
-       for (a=0, mf=me->mface, tf=me->mtface; a<me->totface; a++, tf++, mf++) {
-               if (!(tf->flag & TF_HIDE)) {
+       for (a=0, mf=me->mface; a<me->totface; a++, mf++) {
+               if (!(mf->flag & ME_HIDE)) {
                        BLI_edgehash_insert(ehash, mf->v1, mf->v2, NULL);
                        BLI_edgehash_insert(ehash, mf->v2, mf->v3, NULL);
                        if (mf->v4) {
@@ -1175,7 +1176,6 @@ void seam_edgehash_insert_face(EdgeHash *ehash, MFace *mf)
 void seam_mark_clear_tface(short mode)
 {
        Mesh *me;
-       MTFace *tf;
        MFace *mf;
        MEdge *med;
        int a;
@@ -1192,8 +1192,8 @@ void seam_mark_clear_tface(short mode)
        if (mode == 2) {
                EdgeHash *ehash = BLI_edgehash_new();
 
-               for (a=0, mf=me->mface, tf=me->mtface; a<me->totface; a++, tf++, mf++)
-                       if (!(tf->flag & TF_HIDE) && (tf->flag & TF_SELECT))
+               for (a=0, mf=me->mface; a<me->totface; a++, mf++)
+                       if (!(mf->flag & ME_HIDE) && (mf->flag & ME_FACE_SEL))
                                seam_edgehash_insert_face(ehash, mf);
 
                for (a=0, med=me->medge; a<me->totedge; a++, med++)
@@ -1207,8 +1207,8 @@ void seam_mark_clear_tface(short mode)
                EdgeHash *ehash1 = BLI_edgehash_new();
                EdgeHash *ehash2 = BLI_edgehash_new();
 
-               for (a=0, mf=me->mface, tf=me->mtface; a<me->totface; a++, tf++, mf++) {
-                       if ((tf->flag & TF_HIDE) || !(tf->flag & TF_SELECT))
+               for (a=0, mf=me->mface; a<me->totface; a++, mf++) {
+                       if ((mf->flag & ME_HIDE) || !(mf->flag & ME_FACE_SEL))
                                seam_edgehash_insert_face(ehash1, mf);
                        else
                                seam_edgehash_insert_face(ehash2, mf);
@@ -1237,7 +1237,7 @@ void face_select()
        Object *ob;
        Mesh *me;
        MTFace *tface, *tsel;
-       MFace *msel;
+       MFace *mface, *msel;
        short mval[2];
        unsigned int a, index;
 
@@ -1259,28 +1259,32 @@ void face_select()
        tsel= (((MTFace*)me->mtface)+index);
        msel= (((MFace*)me->mface)+index);
 
-       if (tsel->flag & TF_HIDE) return;
+       if (msel->flag & ME_HIDE) return;
        
        /* clear flags */
        tface = me->mtface;
+       mface = me->mface;
        a = me->totface;
        while (a--) {
                if (G.qual & LR_SHIFTKEY)
                        tface->flag &= ~TF_ACTIVE;
-               else
-                       tface->flag &= ~(TF_ACTIVE+TF_SELECT);
+               else {
+                       tface->flag &= ~TF_ACTIVE;
+                       mface->flag &= ~ME_FACE_SEL;
+               }
                tface++;
+               mface++;
        }
        
        tsel->flag |= TF_ACTIVE;
 
        if (G.qual & LR_SHIFTKEY) {
-               if (tsel->flag & TF_SELECT)
-                       tsel->flag &= ~TF_SELECT;
+               if (msel->flag & ME_FACE_SEL)
+                       msel->flag &= ~ME_FACE_SEL;
                else
-                       tsel->flag |= TF_SELECT;
+                       msel->flag |= ME_FACE_SEL;
        }
-       else tsel->flag |= TF_SELECT;
+       else msel->flag |= ME_FACE_SEL;
        
        /* image window redraw */
        
@@ -1293,6 +1297,7 @@ void face_borderselect()
 {
        Mesh *me;
        MTFace *tface;
+       MFace *mface;
        rcti rect;
        struct ImBuf *ibuf;
        unsigned int *rt;
@@ -1332,13 +1337,13 @@ void face_borderselect()
                        rt++;
                }
                
-               tface= me->mtface;
+               mface= me->mface;
                for(a=1; a<=me->totface; a++, tface++) {
                        if(selar[a]) {
-                               if(tface->flag & TF_HIDE);
+                               if(mface->flag & ME_HIDE);
                                else {
-                                       if(val==LEFTMOUSE) tface->flag |= TF_SELECT;
-                                       else tface->flag &= ~TF_SELECT;
+                                       if(val==LEFTMOUSE) mface->flag |= ME_FACE_SEL;
+                                       else mface->flag &= ~ME_FACE_SEL;
                                }
                        }
                }
@@ -1441,15 +1446,11 @@ void set_faceselect()   /* toggle */
                        setcursor_space(SPACE_VIEW3D, CURSOR_STD);
                        BIF_undo_push("End UV Faceselect");
                }
-
-               if(me)
-                       select_mface_from_tface(me);
        }
        else if (me && (ob->lay & G.vd->lay)) {
                G.f |= G_FACESELECT;
                if(me->mtface==NULL)
                        make_tfaces(me);
-               select_tface_from_mface(me);
 
                setcursor_space(SPACE_VIEW3D, CURSOR_FACESEL);
                BIF_undo_push("Set UV Faceselect");
@@ -1462,49 +1463,6 @@ void set_faceselect()    /* toggle */
        allqueue(REDRAWIMAGE, 0);
 }
 
-void select_tface_from_mface(Mesh *me)
-{
-       MFace *mf;
-       MTFace *tf;
-       int a, hasactive=0;
-
-       if(!me->mtface) return;
-
-       mf= me->mface;
-       tf= me->mtface;
-       for(a=0; a<me->totface; a++, mf++, tf++) {
-               if(mf->flag & ME_FACE_SEL) tf->flag |= TF_SELECT;
-               else tf->flag &= ~TF_SELECT;
-
-               if(mf->flag & ME_HIDE) tf->flag |= TF_HIDE;
-               else tf->flag &= ~TF_HIDE;
-
-               if(tf->flag & TF_ACTIVE) {
-                       if(hasactive) tf->flag &= ~TF_ACTIVE;
-                       else hasactive= 1;
-               }
-       }
-}
-
-void select_mface_from_tface(Mesh *me)
-{
-       MFace *mf;
-       MTFace *tf;
-       int a;
-
-       if(!me->mtface) return;
-
-       mf= me->mface;
-       tf= me->mtface;
-       for(a=0; a<me->totface; a++, mf++, tf++) {
-               if(tf->flag & TF_SELECT) mf->flag |= ME_FACE_SEL;
-               else mf->flag &= ~ME_FACE_SEL;
-
-               if(tf->flag & TF_HIDE) mf->flag |= ME_HIDE;
-               else mf->flag &= ~ME_HIDE;
-       }
-}
-
 /* Texture Paint */
 
 void set_texturepaint() /* toggle */
@@ -1683,7 +1641,8 @@ void get_same_uv(void)
 {
        Object *ob;
        Mesh *me;
-       MTFace *tface;  
+       MTFace *tface;
+       MFace *mface;   
        short a, foundtex=0;
        Image *ima;
        char uvname[160];
@@ -1718,17 +1677,19 @@ void get_same_uv(void)
 
        /* select everything with the same texture */
        tface = me->mtface;
+       mface = me->mface;
        a = me->totface;
        while (a--) {           
                ima=tface->tpage;
-               if(ima && ima->name){
+               if(!(mface->flag & ME_HIDE) && ima && ima->name){
                        if(!strcmp(ima->name, uvname)){
-                               tface->flag |= TF_SELECT;
+                               mface->flag |= ME_FACE_SEL;
                        }
-                       else tface->flag &= ~TF_SELECT;
+                       else mface->flag &= ~ME_FACE_SEL;
                }
-               else tface->flag &= ~TF_SELECT;
+               else mface->flag &= ~ME_FACE_SEL;
                tface++;
+               mface++;
        }
        
        /* image window redraw */
index 15840335169576f1c132ae0e907293fa6dc6008c..9b0811bf788aef70c9e6f1391baa88d2d2bdb9b8 100644 (file)
@@ -877,8 +877,6 @@ void make_editMesh()
                }
                
                CustomData_copy(&me->fdata, &em->fdata, CD_MASK_EDITMESH, CD_CALLOC, 0);
-               if (G.f & G_FACESELECT)
-                       select_mface_from_tface(me);
 
                /* make faces */
                mface= me->mface;
@@ -1150,10 +1148,6 @@ void load_editMesh(void)
                efa= efa->next;
        }
 
-       /* sync hide and select flags with faceselect mode */
-       if (G.f & G_FACESELECT)
-               select_tface_from_mface(me);
-
        /* patch hook indices and vertex parents */
        {
                Object *ob;
index c9190692f1a0ac307a06ff538dc5876e1b9fab89..b25c9afd3c2f4d082db29da3715f1b1107ebba27 100644 (file)
@@ -2977,9 +2977,9 @@ static void editmesh_calc_selvert_center(float cent_r[3])
        }
 }
 
-static int tface_is_selected(MTFace *tf)
+static int mface_is_selected(MFace *mf)
 {
-       return (!(tf->flag & TF_HIDE) && (tf->flag & TF_SELECT));
+       return (!(mf->flag & ME_HIDE) && (mf->flag & ME_FACE_SEL));
 }
 
        /* XXX, code for both these functions should be abstract,
@@ -2995,9 +2995,8 @@ void faceselect_align_view_to_selected(View3D *v3d, Mesh *me, int axis)
        norm[0]= norm[1]= norm[2]= 0.0;
        for (i=0; i<me->totface; i++) {
                MFace *mf= ((MFace*) me->mface) + i;
-               MTFace *tf= ((MTFace*) me->mtface) + i;
 
-               if (tface_is_selected(tf)) {
+               if (mface_is_selected(mf)) {
                        float *v1, *v2, *v3, fno[3];
 
                        v1= me->mvert[mf->v1].co;
index fa5fe913f5bb79ed567bc828372495d6f2a5c2ca..0c42b4c14aa6ff0d1ba72259913dd6bc3e086327 100644 (file)
@@ -2182,14 +2182,17 @@ void special_editmenu(void)
                else if(G.f & G_FACESELECT) {
                        Mesh *me= get_mesh(ob);
                        MTFace *tface;
+                       MFace *mface;
                        int a;
                        
                        if(me==0 || me->mtface==0) return;
                        
                        nr= pupmenu("Specials%t|Set     Tex%x1|         Shared%x2|         Light%x3|         Invisible%x4|         Collision%x5|         TwoSide%x6|Clr     Tex%x7|         Shared%x8|         Light%x9|         Invisible%x10|         Collision%x11|         TwoSide%x12");
-       
-                       for(a=me->totface, tface= me->mtface; a>0; a--, tface++) {
-                               if(tface->flag & SELECT) {
+                       
+                       tface= me->mtface;
+                       mface= me->mface;
+                       for(a=me->totface; a>0; a--, tface++, mface++) {
+                               if(mface->flag & ME_FACE_SEL) {
                                        switch(nr) {
                                        case 1:
                                                tface->mode |= TF_TEX; break;
@@ -3334,6 +3337,7 @@ void copy_attr_tface(short event)
        Object *ob= OBACT;
        Mesh *me= get_mesh(ob);
        MTFace *tface;
+       MFace *mface;
        MCol *activemcol;
        MTFace *activetf= get_active_tface(&activemcol);
        int a;
@@ -3341,8 +3345,9 @@ void copy_attr_tface(short event)
        if(activetf==NULL) return;
        
        tface= me->mtface;
-       for(a=0; a<me->totface; a++, tface++) {
-               if(tface->flag & SELECT) {
+       mface= me->mface;
+       for(a=0; a<me->totface; a++, tface++, mface++) {
+               if(mface->flag & ME_FACE_SEL) {
                        switch(event) {
                        case 1:
                                tface->tpage = activetf->tpage;
index 6c84b6f5f0199a5c0ece56e43266bdb4e28e7915..2af4444cd0876413d506c8dd8dddeeca6bee8745 100644 (file)
@@ -181,7 +181,7 @@ void clever_numbuts_sima(void)
                MFace *mf= &((MFace*) me->mface)[i];
                MTFace *tf= &((MTFace*) me->mtface)[i];
                
-               if (!(tf->flag & TF_SELECT))
+               if (!(mf->flag & ME_FACE_SEL))
                        continue;
                
                if (tf->flag & TF_SEL1) {
@@ -225,7 +225,7 @@ void clever_numbuts_sima(void)
                                MFace *mf= &((MFace*) me->mface)[i];
                                MTFace *tf= &((MTFace*) me->mtface)[i];
                        
-                               if (!(tf->flag & TF_SELECT))
+                               if (!(mf->flag & ME_FACE_SEL))
                                        continue;
                        
                                if (tf->flag & TF_SEL1) {
@@ -262,7 +262,7 @@ void be_square_tface_uv(Mesh *me)
        tface= (MTFace*)me->mtface;
        for(a=me->totface; a>0; a--, tface++, mface++) {
                if(mface->v4) {
-                       if(tface->flag & TF_SELECT) {
+                       if(mface->flag & ME_FACE_SEL) {
                                if(tface->flag & TF_SEL1) {
                                        if( tface->uv[1][0] == tface->uv[2][0] ) {
                                                tface->uv[1][1]= tface->uv[0][1];
@@ -379,7 +379,7 @@ void weld_align_tface_uv(char tool)
                tface= me->mtface;
                mface= me->mface;
                for(a=me->totface; a>0; a--, tface++, mface++) {
-                       if(tface->flag & TF_SELECT) {
+                       if(mface->flag & ME_FACE_SEL) {
                                if(tface->flag & TF_SEL1)
                                        tface->uv[0][0]= cent[0];
                                if(tface->flag & TF_SEL2)
@@ -396,7 +396,7 @@ void weld_align_tface_uv(char tool)
                tface= me->mtface;
                mface= me->mface;
                for(a=me->totface; a>0; a--, tface++, mface++) {
-                       if(tface->flag & TF_SELECT) {
+                       if(mface->flag & ME_FACE_SEL) {
                                if(tface->flag & TF_SEL1)
                                        tface->uv[0][1]= cent[1];
                                if(tface->flag & TF_SEL2)
@@ -440,8 +440,9 @@ void select_swap_tface_uv(void)
        if( is_uv_tface_editing_allowed()==0 ) return;
        me= get_mesh(OBACT);
 
-       for(a=me->totface, tface= me->mtface; a>0; a--, tface++) {
-               if(tface->flag & TF_SELECT) {   
+       mface= me->mface;
+       for(a=me->totface, tface= me->mtface; a>0; a--, tface++, mface++) {
+               if(mface->flag & ME_FACE_SEL) { 
                        if(tface->flag & (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4)) {
                                sel= 1;
                                break;
@@ -451,7 +452,7 @@ void select_swap_tface_uv(void)
        
        mface= me->mface;
        for(a=me->totface, tface= me->mtface; a>0; a--, tface++, mface++) {
-               if(tface->flag & TF_SELECT) {
+               if(mface->flag & ME_FACE_SEL) {
                        if(mface->v4) {
                                if(sel) tface->flag &= ~(TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
                                else tface->flag |= (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
@@ -499,11 +500,11 @@ static void find_nearest_tface(MTFace **nearesttf, MFace **nearestmf)
        *nearestmf= NULL;
 
        me= get_mesh(OBACT);
-       mf= (MFace*)me->mface;
+       mf= (MFace*)me  ->mface;
        tf= (MTFace*)me->mtface;
 
        for(a=me->totface; a>0; a--, tf++, mf++) {
-               if(tf->flag & TF_SELECT) {
+               if(mf->flag & ME_FACE_SEL) {
 
                        fcenter[0]= fcenter[1]= 0;
                        nverts= mf->v4? 4: 3;
@@ -571,7 +572,7 @@ static void find_nearest_uv(MTFace **nearesttf, unsigned int *nearestv, int *nea
        tf= (MTFace*)me->mtface;
 
        for(a=me->totface; a>0; a--, tf++, mf++) {
-               if(tf->flag & TF_SELECT) {
+               if(mf->flag & ME_FACE_SEL) {
 
                        nverts= mf->v4? 4: 3;
                        for(i=0; i<nverts; i++) {
@@ -686,7 +687,7 @@ void mouse_select_sima(void)
                        /* deselect */
                        if(selectsticky==0) {
                                for(a=me->totface; a>0; a--, tf++, mf++) {
-                                       if(!(tf->flag & TF_SELECT)) continue;
+                                       if(!(mf->flag & ME_FACE_SEL)) continue;
                                        if(nearesttf && tf!=nearesttf) tf->flag &=~ TF_ACTIVE;
                                        if (!sticky) continue;
 
@@ -704,7 +705,7 @@ void mouse_select_sima(void)
                        /* select */
                        else {
                                for(a=me->totface; a>0; a--, tf++, mf++) {
-                                       if(!(tf->flag & TF_SELECT)) continue;
+                                       if(!(mf->flag & ME_FACE_SEL)) continue;
                                        if(nearesttf && tf!=nearesttf)
                                                tf->flag &=~ TF_ACTIVE;
                                        if (!sticky) continue;
@@ -740,7 +741,7 @@ void mouse_select_sima(void)
                mf= (MFace*)me->mface;
                tf= (MTFace*)me->mtface;
                for(a=me->totface; a>0; a--, tf++, mf++) {
-                       if(tf->flag & TF_SELECT) {
+                       if(mf->flag & ME_FACE_SEL) {
                                if(!actface) tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
                                if(!sticky) continue;
 
@@ -792,7 +793,7 @@ void borderselect_sima(short whichuvs)
                mface= me->mface;
                for(a=me->totface, tface= me->mtface; a>0; a--, tface++, mface++) {
                
-                       if(tface->flag & TF_SELECT) {
+                       if(mface->flag & ME_FACE_SEL) {
                                
                                if (whichuvs == UV_SELECT_ALL) {
                                
@@ -995,23 +996,23 @@ void hide_tface_uv(int swap)
        if(swap) {
                mface= me->mface;
                for(a=me->totface, tface= me->mtface; a>0; a--, tface++, mface++) {
-                       if(tface->flag & TF_SELECT) {
+                       if(mface->flag & ME_FACE_SEL) {
                                if((tface->flag & (TF_SEL1|TF_SEL2|TF_SEL3))==0) {
                                        if(!mface->v4)
-                                               tface->flag &= ~TF_SELECT;
+                                               mface->flag &= ~ME_FACE_SEL;
                                        else if(!(tface->flag & TF_SEL4))
-                                               tface->flag &= ~TF_SELECT;
+                                               mface->flag &= ~ME_FACE_SEL;
                                }
                        }
                }
        } else {
                mface= me->mface;
                for(a=me->totface, tface= me->mtface; a>0; a--, tface++, mface++) {
-                       if(tface->flag & TF_SELECT) {
+                       if(mface->flag & ME_FACE_SEL) {
                                if(tface->flag & (TF_SEL1|TF_SEL2|TF_SEL3))
-                                               tface->flag &= ~TF_SELECT;
+                                               mface->flag &= ~ME_FACE_SEL;
                                else if(mface->v4 && tface->flag & TF_SEL4)
-                                               tface->flag &= ~TF_SELECT;
+                                               mface->flag &= ~ME_FACE_SEL;
                        }
                }
        }
@@ -1033,9 +1034,9 @@ void reveal_tface_uv(void)
 
        mface= me->mface;
        for(a=me->totface, tface= me->mtface; a>0; a--, tface++, mface++)
-               if(!(tface->flag & TF_HIDE))
-                       if(!(tface->flag & TF_SELECT))
-                               tface->flag |= (TF_SELECT|TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
+               if(!(mface->flag & ME_HIDE))
+                       if(!(mface->flag & ME_FACE_SEL))
+                               tface->flag |= (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
        
        BIF_undo_push("Reveal UV");
 
@@ -1189,8 +1190,9 @@ void select_linked_tface_uv(int mode)
 
        if (mode == 2) {
                tf= me->mtface;
-               for(a=0; a<me->totface; a++, tf++)
-                       if(!(tf->flag & TF_HIDE) && (tf->flag & TF_SELECT))
+               mf= me->mface;
+               for(a=0; a<me->totface; a++, tf++, mf++)
+                       if(!(mf->flag & ME_HIDE) && (mf->flag & ME_FACE_SEL))
                                if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)) {
                                        stack[stacksize]= a;
                                        stacksize++;
@@ -1291,7 +1293,7 @@ void unlink_selection(void)
 
        mface= me->mface;
        for(a=me->totface, tface= me->mtface; a>0; a--, tface++, mface++) {
-               if(tface->flag & TF_SELECT) {
+               if(mface->flag & ME_FACE_SEL) {
                        if(mface->v4) {
                                if(~tface->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4))
                                        tface->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
@@ -1342,7 +1344,7 @@ void pin_tface_uv(int mode)
        mface= me->mface;
        tface= me->mtface;
        for(a=me->totface; a>0; a--, tface++, mface++) {
-               if(tface->flag & TF_SELECT) {
+               if(mface->flag & ME_FACE_SEL) {
                        if(mode ==1){
                                if(tface->flag & TF_SEL1) tface->unwrap |= TF_PIN1;
                                if(tface->flag & TF_SEL2) tface->unwrap |= TF_PIN2;
@@ -1355,7 +1357,7 @@ void pin_tface_uv(int mode)
                                if(tface->flag & TF_SEL2) tface->unwrap &= ~TF_PIN2;
                                if(tface->flag & TF_SEL3) tface->unwrap &= ~TF_PIN3;
                                if(mface->v4)
-                               if(tface->flag & TF_SEL4) tface->unwrap &= ~TF_PIN4;
+                                       if(tface->flag & TF_SEL4) tface->unwrap &= ~TF_PIN4;
                        }
                }
        }
@@ -1377,7 +1379,7 @@ void select_pinned_tface_uv(void)
        mface= me->mface;
        tface= me->mtface;
        for(a=me->totface; a>0; a--, tface++, mface++) {
-               if(tface->flag & TF_SELECT) {
+               if(mface->flag & ME_FACE_SEL) {
                
                        if (tface->unwrap & TF_PIN1) tface->flag |= TF_SEL1;
                        if (tface->unwrap & TF_PIN2) tface->flag |= TF_SEL2;
@@ -1409,8 +1411,8 @@ int minmax_tface_uv(float *min, float *max)
        mf= (MFace*)me->mface;
        tf= (MTFace*)me->mtface;
        for(a=me->totface; a>0; a--, tf++, mf++) {
-               if(tf->flag & TF_HIDE);
-               else if(tf->flag & TF_SELECT) {
+               if(mf->flag & ME_HIDE);
+               else if(mf->flag & ME_FACE_SEL) {
 
                        if (tf->flag & TF_SEL1) {
                                DO_MINMAX2(tf->uv[0], min, max);
index d367ae051a55b06ecc0f3240ec66aadf7de52fdf..a787424517a38f045c00d7e16b75bca8535863a0 100644 (file)
@@ -164,13 +164,13 @@ void EM_backbuf_checkAndSelectFaces(EditMesh *em, int select)
 
 void EM_backbuf_checkAndSelectTFaces(Mesh *me, int select)
 {
-       MTFace *tface = me->mtface;
+       MFace *mface = me->mface;
        int a;
 
-       if (tface) {
-               for(a=1; a<=me->totface; a++, tface++) {
+       if (mface) {
+               for(a=1; a<=me->totface; a++, mface++) {
                        if(EM_check_backbuf(a)) {
-                               tface->flag = select?(tface->flag|TF_SELECT):(tface->flag&~TF_SELECT);
+                               mface->flag = select?(mface->flag|ME_FACE_SEL):(mface->flag&~ME_FACE_SEL);
                        }
                }
        }
index 42ba1a70a55b50605cf107e7a0e2455f6d319edc..06a86a3f8eaf8af2560d535a42253eb6bee8d63f 100644 (file)
@@ -4399,6 +4399,7 @@ static void do_view3d_faceselmenu(void *arg, int event)
                would be nice if it was split up into functions */
        Mesh *me;
        MTFace *tf, *activetf;
+       MFace *mf;
        MCol *activemcol;
        int a;
        
@@ -4410,8 +4411,9 @@ static void do_view3d_faceselmenu(void *arg, int event)
                activetf = get_active_tface(&activemcol);
 
                if (me && activetf) {
-                       for (a=0, tf=me->mtface; a < me->totface; a++, tf++) {
-                               if(tf!=activetf && (tf->flag & TF_SELECT)) {
+                       mf = me->mface;
+                       for (a=0, tf=me->mtface; a < me->totface; a++, tf++, mf++) {
+                               if(tf!=activetf && (mf->flag & ME_FACE_SEL)) {
                                        if(event==0) {
                                                tf->mode= activetf->mode;
                                                tf->transp= activetf->transp;
index b4a446e773e9853ffd95d231f923f6f4af3f83df..c76f545ee8f9076031416d5058015e5efb663d32 100755 (executable)
@@ -1826,7 +1826,7 @@ static void createTransUVs(TransInfo *t)
        tf= me->mtface;
        mf= me->mface;
        for(a=me->totface; a>0; a--, tf++, mf++) {
-               if(mf->v3 && tf->flag & TF_SELECT) {
+               if(mf->v3 && mf->flag & ME_FACE_SEL) {
                        if(tf->flag & TF_SEL1) countsel++;
                        if(tf->flag & TF_SEL2) countsel++;
                        if(tf->flag & TF_SEL3) countsel++;
@@ -1853,7 +1853,7 @@ static void createTransUVs(TransInfo *t)
        tf= me->mtface;
        mf= me->mface;
        for(a=me->totface; a>0; a--, tf++, mf++) {
-               if(mf->v3 && tf->flag & TF_SELECT) {
+               if(mf->v3 && mf->flag & ME_FACE_SEL) {
                        if(tf->flag & TF_SEL1 || propmode)
                                UVsToTransData(td++, td2d++, tf->uv[0], (tf->flag & TF_SEL1));
                        if(tf->flag & TF_SEL2 || propmode)
index 3b6d3eaf91a7b47d4544fe3547319d78bc1fd60b..5a93c2b3077e3aff14cf4cfd18cafec443ff3f60 100644 (file)
@@ -105,11 +105,10 @@ void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int index)
        }
        else {
                /* fill array by selection */
-               tf= me->mtface;
                mf= me->mface;
-               for(a=0; a<me->totface; a++, tf++, mf++) {
-                       if(tf->flag & TF_HIDE);
-                       else if(tf->flag & TF_SELECT) {
+               for(a=0; a<me->totface; a++, mf++) {
+                       if(mf->flag & ME_HIDE);
+                       else if(mf->flag & ME_FACE_SEL) {
                                hash_add_face(ehash, mf);
                                linkflag[a]= 1;
                        }
@@ -120,10 +119,9 @@ void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int index)
                doit= 0;
                
                /* expand selection */
-               tf= me->mtface;
                mf= me->mface;
-               for(a=0; a<me->totface; a++, tf++, mf++) {
-                       if(tf->flag & TF_HIDE)
+               for(a=0; a<me->totface; a++, mf++) {
+                       if(mf->flag & ME_HIDE)
                                continue;
 
                        if(!linkflag[a]) {
@@ -161,26 +159,26 @@ void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int index)
        BLI_edgehash_free(seamhash, NULL);
 
        if(mode==0 || mode==2) {
-               for(a=0, tf=me->mtface; a<me->totface; a++, tf++)
+               for(a=0, mf=me->mface; a<me->totface; a++, mf++)
                        if(linkflag[a])
-                               tf->flag |= TF_SELECT;
+                               mf->flag |= ME_FACE_SEL;
                        else
-                               tf->flag &= ~TF_SELECT;
+                               mf->flag &= ~ME_FACE_SEL;
        }
        else if(mode==1) {
-               for(a=0, tf=me->mtface; a<me->totface; a++, tf++)
-                       if(linkflag[a] && (tf->flag & TF_SELECT))
+               for(a=0, mf=me->mface; a<me->totface; a++, mf++)
+                       if(linkflag[a] && (mf->flag & ME_FACE_SEL))
                                break;
 
                if (a<me->totface) {
-                       for(a=0, tf=me->mtface; a<me->totface; a++, tf++)
+                       for(a=0, mf=me->mface; a<me->totface; a++, mf++)
                                if(linkflag[a])
-                                       tf->flag &= ~TF_SELECT;
+                                       mf->flag &= ~ME_FACE_SEL;
                }
                else {
-                       for(a=0, tf=me->mtface; a<me->totface; a++, tf++)
+                       for(a=0, mf=me->mface; a<me->totface; a++, mf++)
                                if(linkflag[a])
-                                       tf->flag |= TF_SELECT;
+                                       mf->flag |= ME_FACE_SEL;
                }
        }
        
@@ -213,10 +211,10 @@ ParamHandle *construct_param_handle(Mesh *me, short implicit, short fill, short
                float *uv[4];
                int nverts;
 
-               if (tf->flag & TF_HIDE)
+               if (mf->flag & ME_HIDE)
                        continue;
 
-               if (sel && !(tf->flag & TF_SELECT))
+               if (sel && !(me->flag & ME_FACE_SEL))
                        continue;
 
                if (implicit && !(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)))
index 20fb8cb2500459b697c06d1d29db02e5c4f7b649..a53c1508f0ab694573edd0117373704396b53694 100644 (file)
@@ -319,7 +319,7 @@ void clear_vpaint()
 void clear_vpaint_selectedfaces()
 {
        Mesh *me;
-       MTFace *tf;
+       MFace *mf;
        Object *ob;
        unsigned int paintcol, *mcol;
        int i;
@@ -333,10 +333,10 @@ void clear_vpaint_selectedfaces()
 
        paintcol= vpaint_get_current_col(&Gvp);
 
-       tf = me->mtface;
+       mf = me->mface;
        mcol = (unsigned int*)me->mcol;
-       for (i = 0; i < me->totface; i++, tf++, mcol+=4) {
-               if (tf->flag & TF_SELECT) {
+       for (i = 0; i < me->totface; i++, mf++, mcol+=4) {
+               if (mf->flag & ME_FACE_SEL) {
                        mcol[0] = paintcol;
                        mcol[1] = paintcol;
                        mcol[2] = paintcol;
@@ -356,7 +356,6 @@ void clear_wpaint_selectedfaces()
        extern float editbutvweight;
        float paintweight= editbutvweight;
        Mesh *me;
-       MTFace *tface;
        MFace *mface;
        Object *ob;
        MDeformWeight *dw, *uw;
@@ -368,11 +367,11 @@ void clear_wpaint_selectedfaces()
        
        ob= OBACT;
        me= ob->data;
-       if(me==0 || me->totface==0 || me->dvert==0 || !me->mtface) return;
+       if(me==0 || me->totface==0 || me->dvert==0 || !me->mface) return;
        
        indexar= get_indexarray();
-       for(index=0, tface=me->mtface; index<me->totface; index++, tface++) {
-               if((tface->flag & TF_SELECT)==0)
+       for(index=0, mface=me->mface; index<me->totface; index++, mface++) {
+               if((mface->flag & ME_FACE_SEL)==0)
                        indexar[index]= 0;
                else
                        indexar[index]= index+1;
@@ -1220,13 +1219,13 @@ void weight_paint(void)
                                }
                        }
 
-                       if((G.f & G_FACESELECT) && me->mtface) {
+                       if((G.f & G_FACESELECT) && me->mface) {
                                for(index=0; index<totindex; index++) {
                                        if(indexar[index] && indexar[index]<=me->totface) {
                                        
-                                               tface= ((MTFace *)me->mtface) + (indexar[index]-1);
+                                               mface= ((MFace *)me->mface) + (indexar[index]-1);
                                        
-                                               if((tface->flag & TF_SELECT)==0) {
+                                               if((mface->flag & ME_FACE_SEL)==0) {
                                                        indexar[index]= 0;
                                                }
                                        }                                       
@@ -1439,12 +1438,12 @@ void vertex_paint()
                                        }                                       
                                }
                        }
-                       if((G.f & G_FACESELECT) && me->mtface) {
+                       if((G.f & G_FACESELECT) && me->mface) {
                                for(index=0; index<totindex; index++) {
                                        if(indexar[index] && indexar[index]<=me->totface) {
-                                               tface= ((MTFace *)me->mtface) + (indexar[index]-1);
+                                               mface= ((MFace *)me->mface) + (indexar[index]-1);
                                        
-                                               if((tface->flag & TF_SELECT)==0)
+                                               if((mface->flag & ME_FACE_SEL)==0)
                                                        indexar[index]= 0;
                                        }                                       
                                }
index dc3ae581a230ae199d7e793367c1fc3e45e3a421..0e2a009a1922688a5f55911a76e2668ac94dbfa9 100644 (file)
@@ -592,7 +592,7 @@ BL_Material* ConvertMaterial(
        if( validface ) {
 
                material->ras_mode |= !( 
-                       (tface->flag & TF_HIDE) ||
+                       (mface->flag & ME_HIDE) ||
                        (tface->mode & TF_INVISIBLE)
                        )?POLY_VIS:0;
 
@@ -954,7 +954,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools*
                                                tile = tface->tile;
                                                mode = tface->mode;
                                                
-                                               polyvisible = !((tface->flag & TF_HIDE)||(tface->mode & TF_INVISIBLE));
+                                               polyvisible = !((mface->flag & ME_HIDE)||(tface->mode & TF_INVISIBLE));
                                                
                                                uv0 = MT_Point2(tface->uv[0]);
                                                uv1 = MT_Point2(tface->uv[1]);