diff --git a/io_mesh_ply/export_ply.py b/io_mesh_ply/export_ply.py index 0dd0b39d01525ded6ac90b86a19bd02811b4c1ea..2b58186b3410e3da97a757d180497838cfc1a179 100644 --- a/io_mesh_ply/export_ply.py +++ b/io_mesh_ply/export_ply.py @@ -66,7 +66,8 @@ def save(operator, # mesh.transform(obj.matrix_world) # XXX # Be sure tessface & co are available! - mesh.calc_tessface() + if not mesh.tessfaces and mesh.polygons: + mesh.calc_tessface() has_uv = (len(mesh.tessface_uv_textures) > 0) has_uv_vertex = (len(mesh.sticky) > 0) diff --git a/io_mesh_raw/__init__.py b/io_mesh_raw/__init__.py index d677e4533b64e250ac853e2d4f969ea06329c807..079248d74971408a4836ee66b74bbf5764a95f8a 100644 --- a/io_mesh_raw/__init__.py +++ b/io_mesh_raw/__init__.py @@ -43,6 +43,7 @@ else: import bpy from bpy.props import StringProperty, BoolProperty +from bpy_extras.io_utils import ExportHelper class RawImporter(bpy.types.Operator): @@ -67,20 +68,14 @@ class RawImporter(bpy.types.Operator): return {'RUNNING_MODAL'} -class RawExporter(bpy.types.Operator): +class RawExporter(bpy.types.Operator, ExportHelper): '''Save Raw triangle mesh data''' bl_idname = "export_mesh.raw" bl_label = "Export RAW" - filepath = StringProperty( - subtype='FILE_PATH', - ) - check_existing = BoolProperty( - name="Check Existing", - description="Check and warn on overwriting existing files", - default=True, - options={'HIDDEN'}, - ) + filename_ext = ".raw" + filter_glob = StringProperty(default="*.raw", options={'HIDDEN'}) + apply_modifiers = BoolProperty( name="Apply Modifiers", description="Use transformed mesh data from each object", @@ -101,13 +96,6 @@ class RawExporter(bpy.types.Operator): return {'FINISHED'} - def invoke(self, context, event): - if not self.filepath: - self.filepath = bpy.path.ensure_ext(bpy.data.filepath, ".raw") - wm = context.window_manager - wm.fileselect_add(self) - return {'RUNNING_MODAL'} - def menu_import(self, context): self.layout.operator(RawImporter.bl_idname, text="Raw Faces (.raw)") diff --git a/io_mesh_raw/export_raw.py b/io_mesh_raw/export_raw.py index a180151855602bf9d87746360f94cd1f2b051537..b5c5ef36fea3b28cc3b7d5627738ef87e4a9815a 100644 --- a/io_mesh_raw/export_raw.py +++ b/io_mesh_raw/export_raw.py @@ -75,6 +75,8 @@ def write(filepath, is_tmp_mesh = True else: me = obj.data + if not me.tessfaces and me.polygons: + me.calc_tessface() is_tmp_mesh = False if me is not None: