diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-01-10 12:03:15 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-01-10 12:03:15 +0400 |
commit | a8501db1f6ebe9100065b120921220f2b215d045 (patch) | |
tree | 169b6b103fbfc0829f71c149fb14438fa81ef594 /io_mesh_uv_layout/__init__.py | |
parent | d84fff4b3a70906b320fd143596403e359c4b9a6 (diff) |
option for UV layout export to write 'modified' UV's
Diffstat (limited to 'io_mesh_uv_layout/__init__.py')
-rw-r--r-- | io_mesh_uv_layout/__init__.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/io_mesh_uv_layout/__init__.py b/io_mesh_uv_layout/__init__.py index 255fd53d..a012b5a3 100644 --- a/io_mesh_uv_layout/__init__.py +++ b/io_mesh_uv_layout/__init__.py @@ -76,6 +76,11 @@ class ExportUVLayout(bpy.types.Operator): description="Export all UVs in this mesh (not just visible ones)", default=False, ) + modified = BoolProperty( + name="Modified", + description="Exports UVs from the modified mesh", + default=False, + ) mode = EnumProperty( items=(('SVG', "Scalable Vector Graphic (.svg)", "Export the UV layout to a vector SVG file"), @@ -127,9 +132,7 @@ class ExportUVLayout(bpy.types.Operator): return image_width, image_height - def _face_uv_iter(self, context): - obj = context.active_object - mesh = obj.data + def _face_uv_iter(self, context, mesh): uv_layer = mesh.uv_textures.active.data uv_layer_len = len(uv_layer) @@ -167,8 +170,6 @@ class ExportUVLayout(bpy.types.Operator): if is_editmode: bpy.ops.object.mode_set(mode='OBJECT', toggle=False) - mesh = obj.data - mode = self.mode filepath = self.filepath @@ -186,8 +187,16 @@ class ExportUVLayout(bpy.types.Operator): from . import export_uv_svg func = export_uv_svg.write + if self.modified: + mesh = obj.to_mesh(context.scene, True, 'PREVIEW') + else: + mesh = obj.data + func(fw, mesh, self.size[0], self.size[1], self.opacity, - lambda: self._face_uv_iter(context)) + lambda: self._face_uv_iter(context, mesh)) + + if self.modified: + bpy.data.meshes.remove(mesh) if is_editmode: bpy.ops.object.mode_set(mode='EDIT', toggle=False) |