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 /release | |
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.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/bpymodules/BPyRender.py | 3 | ||||
-rwxr-xr-x | release/scripts/bpymodules/mesh_gradient.py | 6 | ||||
-rw-r--r-- | release/scripts/discombobulator.py | 2 | ||||
-rw-r--r-- | release/scripts/faceselect_same_weights.py | 5 | ||||
-rw-r--r-- | release/scripts/mesh_unfolder.py | 4 | ||||
-rw-r--r-- | release/scripts/uv_from_adjacent.py | 15 | ||||
-rw-r--r-- | release/scripts/uvcalc_follow_active_coords.py | 14 | ||||
-rw-r--r-- | release/scripts/uvcalc_from_adjacent.py | 11 | ||||
-rw-r--r-- | release/scripts/uvcalc_lightmap.py | 7 | ||||
-rw-r--r-- | release/scripts/uvcalc_quad_clickproj.py | 15 | ||||
-rw-r--r-- | release/scripts/uvcalc_smart_project.py | 3 | ||||
-rw-r--r-- | release/scripts/vertexpaint_from_material.py | 3 | ||||
-rw-r--r-- | release/scripts/vertexpaint_selfshadow_ao.py | 4 | ||||
-rw-r--r-- | release/scripts/weightpaint_copy.py | 3 | ||||
-rw-r--r-- | release/scripts/x3d_export.py | 4 |
15 files changed, 29 insertions, 70 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: |