diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-04-29 17:39:46 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-04-29 17:39:46 +0400 |
commit | 99135b0674830528eaed3067c40905af8e4557a9 (patch) | |
tree | 604d8d7713c8e8f35111b9cc507f42944eb468f3 | |
parent | 243d1a28c0635a85c2dca9a23e9465b170b0ba3a (diff) |
dont use tface hide or select anymore, since maintaining 2 sets of hide/select data for each face is annoying.
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, 292 insertions, 374 deletions
diff --git a/release/scripts/bpymodules/BPyRender.py b/release/scripts/bpymodules/BPyRender.py index 514d62bd64f..bb5ef628356 100644 --- a/release/scripts/bpymodules/BPyRender.py +++ b/release/scripts/bpymodules/BPyRender.py @@ -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 diff --git a/release/scripts/bpymodules/mesh_gradient.py b/release/scripts/bpymodules/mesh_gradient.py index 4f752e2bf17..936f4958467 100755 --- a/release/scripts/bpymodules/mesh_gradient.py +++ b/release/scripts/bpymodules/mesh_gradient.py @@ -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] diff --git a/release/scripts/discombobulator.py b/release/scripts/discombobulator.py index 4b443c030c0..6dbb4e5382b 100644 --- a/release/scripts/discombobulator.py +++ b/release/scripts/discombobulator.py @@ -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 diff --git a/release/scripts/faceselect_same_weights.py b/release/scripts/faceselect_same_weights.py index 0aa9d2ffb6d..b8d50cf09b6 100644 --- a/release/scripts/faceselect_same_weights.py +++ b/release/scripts/faceselect_same_weights.py @@ -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(): diff --git a/release/scripts/mesh_unfolder.py b/release/scripts/mesh_unfolder.py index ea958dfea84..c24063e674e 100644 --- a/release/scripts/mesh_unfolder.py +++ b/release/scripts/mesh_unfolder.py @@ -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 diff --git a/release/scripts/uv_from_adjacent.py b/release/scripts/uv_from_adjacent.py index c2c5246c015..dfdad3118d9 100644 --- a/release/scripts/uv_from_adjacent.py +++ b/release/scripts/uv_from_adjacent.py @@ -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: diff --git a/release/scripts/uvcalc_follow_active_coords.py b/release/scripts/uvcalc_follow_active_coords.py index fc91c0b648a..c97e7168d2f 100644 --- a/release/scripts/uvcalc_follow_active_coords.py +++ b/release/scripts/uvcalc_follow_active_coords.py @@ -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): diff --git a/release/scripts/uvcalc_from_adjacent.py b/release/scripts/uvcalc_from_adjacent.py index b4ed25868df..32bbd9e08e6 100644 --- a/release/scripts/uvcalc_from_adjacent.py +++ b/release/scripts/uvcalc_from_adjacent.py @@ -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))] diff --git a/release/scripts/uvcalc_lightmap.py b/release/scripts/uvcalc_lightmap.py index 64eb1bb4e75..a4269149203 100644 --- a/release/scripts/uvcalc_lightmap.py +++ b/release/scripts/uvcalc_lightmap.py @@ -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" diff --git a/release/scripts/uvcalc_quad_clickproj.py b/release/scripts/uvcalc_quad_clickproj.py index 84c54ae30da..67b58885f9d 100644 --- a/release/scripts/uvcalc_quad_clickproj.py +++ b/release/scripts/uvcalc_quad_clickproj.py @@ -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) diff --git a/release/scripts/uvcalc_smart_project.py b/release/scripts/uvcalc_smart_project.py index 9f40b63b67e..7ec3afd7769 100644 --- a/release/scripts/uvcalc_smart_project.py +++ b/release/scripts/uvcalc_smart_project.py @@ -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) diff --git a/release/scripts/vertexpaint_from_material.py b/release/scripts/vertexpaint_from_material.py index 6ecde41347d..2df5b7e721f 100644 --- a/release/scripts/vertexpaint_from_material.py +++ b/release/scripts/vertexpaint_from_material.py @@ -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] diff --git a/release/scripts/vertexpaint_selfshadow_ao.py b/release/scripts/vertexpaint_selfshadow_ao.py index 31306ecaef8..c083bc9e8b0 100644 --- a/release/scripts/vertexpaint_selfshadow_ao.py +++ b/release/scripts/vertexpaint_selfshadow_ao.py @@ -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] diff --git a/release/scripts/weightpaint_copy.py b/release/scripts/weightpaint_copy.py index b75e609cdfe..976bba0ea2c 100644 --- a/release/scripts/weightpaint_copy.py +++ b/release/scripts/weightpaint_copy.py @@ -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 diff --git a/release/scripts/x3d_export.py b/release/scripts/x3d_export.py index 0f6cb1baa2e..36359f1d122 100644 --- a/release/scripts/x3d_export.py +++ b/release/scripts/x3d_export.py @@ -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: diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 38762d8f49a..fa8f76178d5 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -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]); diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index c983f6b48e5..2d5f5f091c3 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -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; diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 033c1b26471..68319b799a2 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -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; diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 7da2454b474..93a3981c4a9 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -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++) { diff --git a/source/blender/include/BDR_editface.h b/source/blender/include/BDR_editface.h index aa5276abe67..31971da292b 100644 --- a/source/blender/include/BDR_editface.h +++ b/source/blender/include/BDR_editface.h @@ -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 */ diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h index f61b919a426..4d78f577137 100644 --- a/source/blender/makesdna/DNA_meshdata_types.h +++ b/source/blender/makesdna/DNA_meshdata_types.h @@ -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 diff --git a/source/blender/python/api2_2x/doc/Mesh.py b/source/blender/python/api2_2x/doc/Mesh.py index a89f075e7f6..69a8feba7e6 100644 --- a/source/blender/python/api2_2x/doc/Mesh.py +++ b/source/blender/python/api2_2x/doc/Mesh.py @@ -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 diff --git a/source/blender/python/api2_2x/doc/NMesh.py b/source/blender/python/api2_2x/doc/NMesh.py index aa52400656f..e6d779aebb8 100644 --- a/source/blender/python/api2_2x/doc/NMesh.py +++ b/source/blender/python/api2_2x/doc/NMesh.py @@ -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 diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index b52b5ebc306..976d50cd9e1 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -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; diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c index aea926ef5fb..188f48bcdca 100644 --- a/source/blender/src/drawimage.c +++ b/source/blender/src/drawimage.c @@ -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) { diff --git a/source/blender/src/drawmesh.c b/source/blender/src/drawmesh.c index cf14427e029..53a537e92b0 100644 --- a/source/blender/src/drawmesh.c +++ b/source/blender/src/drawmesh.c @@ -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]; diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index b1b373ee47d..4a3616c0c6e 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -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 { diff --git a/source/blender/src/editface.c b/source/blender/src/editface.c index 2c14e53eff8..c45d742301e 100644 --- a/source/blender/src/editface.c +++ b/source/blender/src/editface.c @@ -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 */ diff --git a/source/blender/src/editmesh.c b/source/blender/src/editmesh.c index 15840335169..9b0811bf788 100644 --- a/source/blender/src/editmesh.c +++ b/source/blender/src/editmesh.c @@ -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; diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c index c9190692f1a..b25c9afd3c2 100644 --- a/source/blender/src/editmesh_mods.c +++ b/source/blender/src/editmesh_mods.c @@ -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; diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index fa5fe913f5b..0c42b4c14aa 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -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; diff --git a/source/blender/src/editsima.c b/source/blender/src/editsima.c index 6c84b6f5f01..2af4444cd08 100644 --- a/source/blender/src/editsima.c +++ b/source/blender/src/editsima.c @@ -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); diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c index d367ae051a5..a787424517a 100644 --- a/source/blender/src/editview.c +++ b/source/blender/src/editview.c @@ -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); } } } diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index 42ba1a70a55..06a86a3f8ea 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -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; diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c index b4a446e773e..c76f545ee8f 100755 --- a/source/blender/src/transform_conversions.c +++ b/source/blender/src/transform_conversions.c @@ -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) diff --git a/source/blender/src/unwrapper.c b/source/blender/src/unwrapper.c index 3b6d3eaf91a..5a93c2b3077 100644 --- a/source/blender/src/unwrapper.c +++ b/source/blender/src/unwrapper.c @@ -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))) diff --git a/source/blender/src/vpaint.c b/source/blender/src/vpaint.c index 20fb8cb2500..a53c1508f0a 100644 --- a/source/blender/src/vpaint.c +++ b/source/blender/src/vpaint.c @@ -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; } } diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index dc3ae581a23..0e2a009a192 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -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]); |