[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2872] trunk/py/scripts/addons/ io_mesh_uv_layout/__init__.py: option for UV layout export to write ' modified' UV's
Campbell Barton
ideasman42 at gmail.com
Tue Jan 10 09:03:26 CET 2012
Revision: 2872
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2872
Author: campbellbarton
Date: 2012-01-10 08:03:15 +0000 (Tue, 10 Jan 2012)
Log Message:
-----------
option for UV layout export to write 'modified' UV's
Modified Paths:
--------------
trunk/py/scripts/addons/io_mesh_uv_layout/__init__.py
Modified: trunk/py/scripts/addons/io_mesh_uv_layout/__init__.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_uv_layout/__init__.py 2012-01-09 02:47:50 UTC (rev 2871)
+++ trunk/py/scripts/addons/io_mesh_uv_layout/__init__.py 2012-01-10 08:03:15 UTC (rev 2872)
@@ -76,6 +76,11 @@
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 @@
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 @@
if is_editmode:
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
- mesh = obj.data
-
mode = self.mode
filepath = self.filepath
@@ -186,9 +187,17 @@
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)
More information about the Bf-extensions-cvs
mailing list