[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1071] trunk/py/scripts/addons/ io_mesh_stl/__init__.py: fix for py error and use io_utils for path checking.
Campbell Barton
ideasman42 at gmail.com
Mon Sep 20 13:33:37 CEST 2010
Revision: 1071
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1071
Author: campbellbarton
Date: 2010-09-20 13:33:37 +0200 (Mon, 20 Sep 2010)
Log Message:
-----------
fix for py error and use io_utils for path checking.
Modified Paths:
--------------
trunk/py/scripts/addons/io_mesh_stl/__init__.py
Modified: trunk/py/scripts/addons/io_mesh_stl/__init__.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_stl/__init__.py 2010-09-20 11:25:38 UTC (rev 1070)
+++ trunk/py/scripts/addons/io_mesh_stl/__init__.py 2010-09-20 11:33:37 UTC (rev 1071)
@@ -51,6 +51,7 @@
import bpy
from bpy.props import *
+from io_utils import ExportHelper, ImportHelper
try:
@@ -65,12 +66,14 @@
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 @@
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,12 +120,7 @@
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,
text="Stl (.stl)").filepath = "*.stl"
More information about the Bf-extensions-cvs
mailing list