use mix-in classes for import export operators, these define the filepath property and invoke function at the moment.

This commit is contained in:
2010-09-01 02:25:49 +00:00
parent d67eedcef9
commit 5036a9d20c
12 changed files with 138 additions and 142 deletions

View File

@@ -1455,17 +1455,15 @@ else:
'''
from bpy.props import *
from io_utils import ImportHelper
class IMPORT_OT_obj(bpy.types.Operator):
class IMPORT_OT_obj(bpy.types.Operator, ImportHelper):
'''Load a Wavefront OBJ File'''
bl_idname = "import_scene.obj"
bl_label = "Import OBJ"
# 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 importing the OBJ file", maxlen= 1024, default= "", subtype='FILE_PATH')
filename_ext = ".obj"
CREATE_SMOOTH_GROUPS = BoolProperty(name="Smooth Groups", description="Surround smooth groups by sharp edges", default= True)
CREATE_FGONS = BoolProperty(name="NGons as FGons", description="Import faces with more then 4 verts as fgons", default= True)
@@ -1498,10 +1496,6 @@ class IMPORT_OT_obj(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
def menu_func(self, context):
self.layout.operator(IMPORT_OT_obj.bl_idname, text="Wavefront (.obj)")