diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-09-01 06:25:49 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-09-01 06:25:49 +0400 |
commit | 5036a9d20c2098cf779ae832855761ad038bf27f (patch) | |
tree | a932affea745f76f597cdbd7c6169c7f15ef7d19 /release/scripts/io/export_ply.py | |
parent | d67eedcef9a4fb34f29513bc0dd21b97ea9567be (diff) |
use mix-in classes for import export operators, these define the filepath property and invoke function at the moment.
Diffstat (limited to 'release/scripts/io/export_ply.py')
-rw-r--r-- | release/scripts/io/export_ply.py | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/release/scripts/io/export_ply.py b/release/scripts/io/export_ply.py index 946be68ec41..759332ac87c 100644 --- a/release/scripts/io/export_ply.py +++ b/release/scripts/io/export_ply.py @@ -257,19 +257,19 @@ def write(filename, scene, ob, \ """ from bpy.props import * +from io_utils import ExportHelper -class ExportPLY(bpy.types.Operator): +class ExportPLY(bpy.types.Operator, ExportHelper): '''Export a single object as a stanford PLY with normals, colours and texture coordinates.''' bl_idname = "export.ply" bl_label = "Export PLY" + + filename_ext = ".ply" # List of operator properties, the attributes will be assigned # to the class instance from the operator settings before calling. - - filepath = StringProperty(name="File Path", description="Filepath used for exporting the PLY file", maxlen=1024, default="") - check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'}) use_modifiers = BoolProperty(name="Apply Modifiers", description="Apply Modifiers to the exported mesh", default=True) use_normals = BoolProperty(name="Normals", description="Export Normals for smooth and hard shaded faces", default=True) use_uvs = BoolProperty(name="UVs", description="Exort the active UV layer", default=True) @@ -281,7 +281,7 @@ class ExportPLY(bpy.types.Operator): def execute(self, context): filepath = self.properties.filepath - filepath = bpy.path.ensure_ext(filepath, ".ply") + filepath = bpy.path.ensure_ext(filepath, self.filename_ext) write(filepath, context.scene, context.active_object,\ EXPORT_APPLY_MODIFIERS=self.properties.use_modifiers, @@ -292,14 +292,6 @@ class ExportPLY(bpy.types.Operator): return {'FINISHED'} - def invoke(self, context, event): - import os - if not self.properties.is_property_set("filepath"): - self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".ply" - - context.manager.add_fileselect(self) - return {'RUNNING_MODAL'} - def draw(self, context): layout = self.layout props = self.properties |