diff options
Diffstat (limited to 'io_mesh_uv_layout/export_uv_eps.py')
-rw-r--r-- | io_mesh_uv_layout/export_uv_eps.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/io_mesh_uv_layout/export_uv_eps.py b/io_mesh_uv_layout/export_uv_eps.py index 04b8a38e..9e013e13 100644 --- a/io_mesh_uv_layout/export_uv_eps.py +++ b/io_mesh_uv_layout/export_uv_eps.py @@ -8,6 +8,7 @@ def export(filepath, face_data, colors, width, height, opacity): for text in get_file_parts(face_data, colors, width, height, opacity): file.write(text) + def get_file_parts(face_data, colors, width, height, opacity): yield from header(width, height) if opacity > 0.0: @@ -35,6 +36,7 @@ def header(width, height): yield "1 setlinejoin\n" yield "1 setlinecap\n" + def prepare_colors(colors, out_name_by_color): for i, color in enumerate(colors): name = f"COLOR_{i}" @@ -48,18 +50,21 @@ def prepare_colors(colors, out_name_by_color): yield "0 setgray\n" yield "} def\n" + def draw_colored_polygons(face_data, name_by_color, width, height): for uvs, color in face_data: yield from draw_polygon_path(uvs, width, height) yield "closepath\n" yield "%s\n" % name_by_color[color] + def draw_lines(face_data, width, height): for uvs, _ in face_data: yield from draw_polygon_path(uvs, width, height) yield "closepath\n" yield "stroke\n" + def draw_polygon_path(uvs, width, height): yield "newpath\n" for j, uv in enumerate(uvs): @@ -69,6 +74,7 @@ def draw_polygon_path(uvs, width, height): else: yield "%.5f %.5f lineto\n" % uv_scale + def footer(): yield "showpage\n" yield "%%EOF\n" |