diff --git a/release/scripts/bpymodules/BPyMesh.py b/release/scripts/bpymodules/BPyMesh.py index 53268cd1bbf..d0d48504d9d 100644 --- a/release/scripts/bpymodules/BPyMesh.py +++ b/release/scripts/bpymodules/BPyMesh.py @@ -236,7 +236,59 @@ def dictWeightFlipGroups(dict_weight, groupNames, createNewGroups): new_wdict[flipname]= weight return new_wdict, groupNames + + +def mesh2linkedFaces(me): + ''' + Splits the mesh into connected parts, + these parts are returned as lists of faces. + used for seperating cubes from other mesh elements in the 1 mesh + ''' + # Build vert face connectivity + vert_faces= [[] for i in xrange(len(me.verts))] + for f in me.faces: + for v in f: + vert_faces[v.index].append(f) + + # sort faces into connectivity groups + face_groups= [[f] for f in me.faces] + face_mapping = range(len(me.faces)) # map old, new face location + + # Now clump faces iterativly + ok= True + while ok: + ok= False + + for i, f in enumerate(me.faces): + mapped_index= face_mapping[f.index] + mapped_group= face_groups[mapped_index] + + for v in f: + for nxt_f in vert_faces[v.index]: + if nxt_f != f: + nxt_mapped_index= face_mapping[nxt_f.index] + + # We are not a part of the same group + if mapped_index != nxt_mapped_index: + + ok= True + + # Assign mapping to this group so they all map to this group + for grp_f in face_groups[nxt_mapped_index]: + face_mapping[grp_f.index] = mapped_index + + # Move faces into this group + mapped_group.extend(face_groups[nxt_mapped_index]) + + # remove reference to the list + face_groups[nxt_mapped_index]= None + + + # return all face groups that are not null + # this is all the faces that are connected in their own lists. + return [fg for fg in face_groups if fg] + def getMeshFromObject(ob, container_mesh=None, apply_modifiers=True, vgroups=True, scn=None): ''' diff --git a/release/scripts/image_dump2path.py b/release/scripts/image_dump2path.py index fe864df05f4..21b944d7150 100644 --- a/release/scripts/image_dump2path.py +++ b/release/scripts/image_dump2path.py @@ -49,7 +49,7 @@ def makeUnique(path): i= 1 while sys.exists(path): - path = '%s_%.3d.%s' % (orig_path_noext, i, ext) + path = '%s_%.3d%s' % (orig_path_noext, i, ext) i+= 1 return path @@ -72,6 +72,7 @@ def main(): continue if not sys.exists(filename): + #continue # ignore missing images. image_missing.append(name)