From 77774b1f12f94a7dd5ee9b0f21f99cb7780f51be Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 31 Dec 2011 10:27:24 +0000 Subject: formatting edits only --- io_mesh_uv_layout/export_uv_eps.py | 8 +++++--- io_mesh_uv_layout/export_uv_png.py | 33 ++++++++++++++++++++++++--------- io_mesh_uv_layout/export_uv_svg.py | 12 ++++++++---- 3 files changed, 37 insertions(+), 16 deletions(-) (limited to 'io_mesh_uv_layout') diff --git a/io_mesh_uv_layout/export_uv_eps.py b/io_mesh_uv_layout/export_uv_eps.py index df75cf73..bf136c9c 100644 --- a/io_mesh_uv_layout/export_uv_eps.py +++ b/io_mesh_uv_layout/export_uv_eps.py @@ -16,7 +16,7 @@ # # ##### END GPL LICENSE BLOCK ##### -# +# import bpy @@ -27,7 +27,8 @@ def write(fw, mesh, image_width, image_height, opacity, face_iter_func): fw("%%Pages: 1\n") fw("%%Orientation: Portrait\n") fw("%%%%BoundingBox: 0 0 %d %d\n" % (image_width, image_height)) - fw("%%%%HiResBoundingBox: 0.0 0.0 %.4f %.4f\n" % (image_width, image_height)) + fw("%%%%HiResBoundingBox: 0.0 0.0 %.4f %.4f\n" % + (image_width, image_height)) fw("%%EndComments\n") fw("%%Page: 1 1\n") fw("0 0 translate\n") @@ -45,7 +46,8 @@ def write(fw, mesh, image_width, image_height, opacity, face_iter_func): fw("/DRAW_%d {" % i) fw("gsave\n") if mat: - color = tuple((1.0 - ((1.0 - c) * opacity)) for c in mat.diffuse_color) + color = tuple((1.0 - ((1.0 - c) * opacity)) + for c in mat.diffuse_color) else: color = 1.0, 1.0, 1.0 fw("%.3g %.3g %.3g setrgbcolor\n" % color) diff --git a/io_mesh_uv_layout/export_uv_png.py b/io_mesh_uv_layout/export_uv_png.py index ad420df7..fa67042e 100644 --- a/io_mesh_uv_layout/export_uv_png.py +++ b/io_mesh_uv_layout/export_uv_png.py @@ -16,7 +16,7 @@ # # ##### END GPL LICENSE BLOCK ##### -# +# import bpy @@ -25,7 +25,9 @@ def write(fw, mesh_source, image_width, image_height, opacity, face_iter_func): filepath = fw.__self__.name fw.__self__.close() - material_solids = [bpy.data.materials.new("uv_temp_solid") for i in range(max(1, len(mesh_source.materials)))] + material_solids = [bpy.data.materials.new("uv_temp_solid") + for i in range(max(1, len(mesh_source.materials)))] + material_wire = bpy.data.materials.new("uv_temp_wire") scene = bpy.data.scenes.new("uv_temp") @@ -39,15 +41,21 @@ def write(fw, mesh_source, image_width, image_height, opacity, face_iter_func): faces_source = mesh_source.faces - # get unique UV's in case there are many overlapping which slow down filling. + # get unique UV's in case there are many overlapping + # which slow down filling. face_hash_3 = set() face_hash_4 = set() for i, uv in face_iter_func(): material_index = faces_source[i].material_index if len(uv) == 3: - face_hash_3.add((uv[0][0], uv[0][1], uv[1][0], uv[1][1], uv[2][0], uv[2][1], material_index)) + face_hash_3.add((uv[0][0], uv[0][1], + uv[1][0], uv[1][1], + uv[2][0], uv[2][1], material_index)) else: - face_hash_4.add((uv[0][0], uv[0][1], uv[1][0], uv[1][1], uv[2][0], uv[2][1], uv[3][0], uv[3][1], material_index)) + face_hash_4.add((uv[0][0], uv[0][1], + uv[1][0], uv[1][1], + uv[2][0], uv[2][1], + uv[3][0], uv[3][1], material_index)) # now set the faces coords and locations # build mesh data @@ -58,13 +66,20 @@ def write(fw, mesh_source, image_width, image_height, opacity, face_iter_func): current_vert = 0 for face_data in face_hash_3: - mesh_new_vertices.extend([face_data[0], face_data[1], 0.0, face_data[2], face_data[3], 0.0, face_data[4], face_data[5], 0.0]) - mesh_new_face_vertices.extend([current_vert, current_vert + 1, current_vert + 2, 0]) + mesh_new_vertices.extend([face_data[0], face_data[1], 0.0, + face_data[2], face_data[3], 0.0, + face_data[4], face_data[5], 0.0]) + mesh_new_face_vertices.extend([current_vert, current_vert + 1, + current_vert + 2, 0]) mesh_new_materials.append(face_data[6]) current_vert += 3 for face_data in face_hash_4: - mesh_new_vertices.extend([face_data[0], face_data[1], 0.0, face_data[2], face_data[3], 0.0, face_data[4], face_data[5], 0.0, face_data[6], face_data[7], 0.0]) - mesh_new_face_vertices.extend([current_vert, current_vert + 1, current_vert + 2, current_vert + 3]) + mesh_new_vertices.extend([face_data[0], face_data[1], 0.0, + face_data[2], face_data[3], 0.0, + face_data[4], face_data[5], 0.0, + face_data[6], face_data[7], 0.0]) + mesh_new_face_vertices.extend([current_vert, current_vert + 1, + current_vert + 2, current_vert + 3]) mesh_new_materials.append(face_data[8]) current_vert += 4 diff --git a/io_mesh_uv_layout/export_uv_svg.py b/io_mesh_uv_layout/export_uv_svg.py index 464211cb..806ee608 100644 --- a/io_mesh_uv_layout/export_uv_svg.py +++ b/io_mesh_uv_layout/export_uv_svg.py @@ -16,7 +16,7 @@ # # ##### END GPL LICENSE BLOCK ##### -# +# import bpy @@ -29,9 +29,11 @@ def write(fw, mesh, image_width, image_height, opacity, face_iter_func): fw('\n') fw('\n') - fw('\n') - desc = "%r, %s, (Blender %s)" % (basename(bpy.data.filepath), mesh.name, bpy.app.version_string) + desc = ("%r, %s, (Blender %s)" % + (basename(bpy.data.filepath), mesh.name, bpy.app.version_string)) fw('%s\n' % escape(desc)) # svg colors @@ -39,7 +41,9 @@ def write(fw, mesh, image_width, image_height, opacity, face_iter_func): fill_default = 'fill="grey"' for mat in mesh.materials if mesh.materials else [None]: if mat: - fill_settings.append('fill="rgb(%d, %d, %d)"' % tuple(int(c * 255) for c in mat.diffuse_color)) + fill_settings.append('fill="rgb(%d, %d, %d)"' % + tuple(int(c * 255) + for c in mat.diffuse_color)) else: fill_settings.append(fill_default) -- cgit v1.2.3