X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Foperators.py;h=3741358406bad0cbf67ac12f4825220bbc5d9d82;hb=308dc6b8f5ee1aa3bb8f205e2ed6464749eebbe5;hp=a6fc592307fd5a549e57f6035271d8b2054e5d3b;hpb=08942dd73918a51baefbe7344b62afc0cad42e55;p=libs%2Fgl.git diff --git a/blender/io_mspgl/operators.py b/blender/io_mspgl/operators.py index a6fc5923..37413584 100644 --- a/blender/io_mspgl/operators.py +++ b/blender/io_mspgl/operators.py @@ -19,6 +19,7 @@ class ExportMspGLData(bpy.types.Operator): filepath: bpy.props.StringProperty(name="File path", description="File path for exporting the data", subtype='FILE_PATH') collection: bpy.props.BoolProperty(name="As a collection", description="Export all data as a single collection file", default=False) shared_resources: bpy.props.BoolProperty(name="Shared resources", description="Use global names for resource files to enable sharing", default=True) + debug_mode: bpy.props.BoolProperty(name="Debug mode", description="Enable debugging output to console") @classmethod def poll(cls, context): @@ -34,11 +35,14 @@ class ExportMspGLData(bpy.types.Operator): return {'RUNNING_MODAL'} def execute(self, context): + from .context import ExportContext from .export import DataExporter + + ex_ctx = ExportContext(context, verbose=self.debug_mode) exporter = DataExporter() - exporter.collection = self.collection - exporter.shared_resources = self.shared_resources - exporter.export_to_file(context, self.filepath) + ex_ctx.export(exporter.export_to_file, self.filepath, + collection=self.collection, + shared_resources=self.shared_resources) return {'FINISHED'} def draw(self, context): @@ -47,6 +51,11 @@ class ExportMspGLData(bpy.types.Operator): col.prop(self, "collection") col.prop(self, "shared_resources") + self.layout.separator() + + col = self.layout.column() + col.prop(self, "debug_mode") + class ExportMspGLAnimation(bpy.types.Operator, ExportHelper): bl_idname = "export.mspgl_animation" bl_label = "Export Msp GL animation" @@ -57,6 +66,7 @@ class ExportMspGLAnimation(bpy.types.Operator, ExportHelper): export_all: bpy.props.BoolProperty(name="Export all animations", description="Export all animations present on the selected objects' NLA tracks") collection: bpy.props.BoolProperty(name="As a collection", description="Export the animations as a single collection file", default=True) looping_threshold: bpy.props.FloatProperty(name="Looping threshold", description="Tolerance for curve beginning and end values for looping", min=0.0, soft_max=1.0, precision=4, default=0.001) + debug_mode: bpy.props.BoolProperty(name="Debug mode", description="Enable debugging output to console") def check(self, context): ext_changed = self.set_extension(".mdc" if self.export_all and self.collection else ".anim") @@ -64,12 +74,15 @@ class ExportMspGLAnimation(bpy.types.Operator, ExportHelper): return ext_changed or super_result def execute(self, context): + from .context import ExportContext from .export_animation import AnimationExporter + + ex_ctx = ExportContext(context, verbose=self.debug_mode) exporter = AnimationExporter() - exporter.export_all = self.export_all - exporter.collection = self.collection - exporter.looping_threshold = self.looping_threshold - exporter.export_to_file(context, self.filepath) + ex_ctx.export(exporter.export_to_file, self.filepath, + export_all=self.export_all, + collection=self.collection, + looping_threshold=looping_threshold) return {'FINISHED'} def draw(self, context): @@ -79,6 +92,11 @@ class ExportMspGLAnimation(bpy.types.Operator, ExportHelper): col.prop(self, "collection") col.prop(self, "looping_threshold") + self.layout.separator() + + col = self.layout.column() + col.prop(self, "debug_mode") + class ExportMspGLScene(bpy.types.Operator, ExportHelper): bl_idname = "export_scene.mspgl_scene" bl_label = "Export Msp GL scene" @@ -90,6 +108,7 @@ class ExportMspGLScene(bpy.types.Operator, ExportHelper): visible_only: bpy.props.BoolProperty(name="Visible only", description="Only export objects in visible collections", default=True) collection: bpy.props.BoolProperty(name="As a collection", description="Export the scene and all resources as a single collection file", default=False) skip_existing: bpy.props.BoolProperty(name="Skip existing files", description="Skip resources that already exist as files", default=True) + debug_mode: bpy.props.BoolProperty(name="Debug mode", description="Enable debugging output to console") def invoke(self, context, event): self.filepath = context.scene.name+".scene" @@ -101,13 +120,16 @@ class ExportMspGLScene(bpy.types.Operator, ExportHelper): return ext_changed or super_result def execute(self, context): + from .context import ExportContext from .export_scene import SceneExporter + + ex_ctx = ExportContext(context, verbose=self.debug_mode) exporter = SceneExporter() - exporter.selected_only = self.selected_only - exporter.visible_only = self.visible_only - exporter.collection = self.collection - exporter.skip_existing = self.skip_existing - exporter.export_to_file(context, self.filepath) + ex_ctx.export(exporter.export_to_file, self.filepath, + selected_only=self.selected_only, + visible_only=self.visible_only, + collection=self.collection, + skip_existing=self.skip_existing) return {'FINISHED'} def draw(self, context): @@ -118,12 +140,18 @@ class ExportMspGLScene(bpy.types.Operator, ExportHelper): if self.collection: col.prop(self, "skip_existing") + self.layout.separator() + + col = self.layout.column() + col.prop(self, "debug_mode") + class ExportMspGLProject(bpy.types.Operator): bl_idname = "export.mspgl_project" bl_label = "Export Msp GL project" bl_description = "Export the entire project in Msp GL format" directory: bpy.props.StringProperty(name="Directory", description="Directory for exporting the data", subtype='FILE_PATH') + debug_mode: bpy.props.BoolProperty(name="Debug mode", description="Enable debugging output to console") def invoke(self, context, event): blend_filepath = context.blend_data.filepath @@ -133,11 +161,18 @@ class ExportMspGLProject(bpy.types.Operator): return {'RUNNING_MODAL'} def execute(self, context): + from .context import ExportContext from .export import ProjectExporter + + ex_ctx = ExportContext(context, verbose=self.debug_mode) exporter = ProjectExporter() - exporter.export_to_directory(context, self.directory) + ex_ctx.export(exporter.export_to_directory, self.directory) return {'FINISHED'} + def draw(self, context): + col = self.layout.column() + col.prop(self, "debug_mode") + class AddRenderMethod(bpy.types.Operator): bl_idname = "material.add_render_method" bl_label = "Add Render Method"