Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-09-20 15:33:37 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-09-20 15:33:37 +0400
commit621354eded371e761f1fd4b0a312b42b81ac0360 (patch)
tree76a3cbe926967437e1764dd2305c51ea962a4eb4 /io_mesh_stl
parent725f477722a2ab2cb0cbcf29e209b5eabb321675 (diff)
fix for py error and use io_utils for path checking.
Diffstat (limited to 'io_mesh_stl')
-rw-r--r--io_mesh_stl/__init__.py29
1 files changed, 6 insertions, 23 deletions
diff --git a/io_mesh_stl/__init__.py b/io_mesh_stl/__init__.py
index 40f8a363..a96f1a75 100644
--- a/io_mesh_stl/__init__.py
+++ b/io_mesh_stl/__init__.py
@@ -51,6 +51,7 @@ import os
import bpy
from bpy.props import *
+from io_utils import ExportHelper, ImportHelper
try:
@@ -65,12 +66,14 @@ except:
init_data = True
-class StlImporter(bpy.types.Operator):
+class StlImporter(bpy.types.Operator, ImportHelper):
'''
Load STL triangle mesh data
'''
bl_idname = "import_mesh.stl"
bl_label = "Import STL"
+
+ filename_ext = ".stl"
files = CollectionProperty(name="File Path",
description="File path used for importing "
@@ -90,30 +93,15 @@ class StlImporter(bpy.types.Operator):
return {'FINISHED'}
- def invoke(self, context, event):
- wm = context.window_manager
- wm.add_fileselect(self)
- return {'RUNNING_MODAL'}
-
-
-class StlExporter(bpy.types.Operator):
+class StlExporter(bpy.types.Operator, ExportHelper):
'''
Save STL triangle mesh data from the active object
'''
bl_idname = "export_mesh.stl"
bl_label = "Export STL"
- filepath = StringProperty(name="File Path",
- description="File path used for exporting "
- "the active object to STL file",
- maxlen=1024,
- default="")
- check_existing = BoolProperty(name="Check Existing",
- description="Check and warn on "
- "overwriting existing files",
- default=True,
- options={'HIDDEN'})
+ filename_ext = ".stl"
ascii = BoolProperty(name="Ascii",
description="Save the file in ASCII file format",
@@ -132,11 +120,6 @@ class StlExporter(bpy.types.Operator):
return {'FINISHED'}
- def invoke(self, context, event):
- wm = context.window_manager
- wm.add_fileselect(self)
- return {'RUNNING_MODAL'}
-
def menu_import(self, context):
self.layout.operator(StlImporter.bl_idname,