class ExportMspGLBase(ExportHelper):
show_progress = bpy.props.BoolProperty(name="Show progress", description="Display progress indicator while exporting", default=True)
+ def set_extension(self, ext):
+ ext_changed = (ext!=self.filename_ext)
+ if ext_changed:
+ if self.filepath.endswith(self.filename_ext):
+ self.filepath = self.filepath[:-len(self.filename_ext)]
+ self.filename_ext = ext
+ return ext_changed
+
def execute(self, context):
exporter = self.create_exporter()
self.prepare_exporter(exporter)
filename_ext = ".object"
- single_file = bpy.props.BoolProperty(name="Single file", description="Write all data into a single file", default=True)
+ collection = bpy.props.BoolProperty(name="As a collection", description="Write all data into 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)
export_lods = bpy.props.BoolProperty(name="Export LoDs", description="Export all levels of detail", default=True)
use_textures = bpy.props.BoolProperty(name="Use textures", description="Use textures in the exported object", default=True)
+ def check(self, context):
+ ext_changed = self.set_extension(".mdc" if self.collection else ".object")
+ super_result = super().check(context)
+ return ext_changed or super_result
+
def create_exporter(self):
from .export_object import ObjectExporter
return ObjectExporter()
col = self.layout.column()
col.label(text="Files")
- col.prop(self, "single_file")
- if not self.single_file:
- col.prop(self, "shared_resources")
+ col.prop(self, "collection")
+ col.prop(self, "shared_resources")
class ExportMspGLArmature(bpy.types.Operator, ExportMspGLBase):
bl_idname = "export.mspgl_armature"
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)
def check(self, context):
- result = False
-
- ext = ".mdc" if self.export_all and self.collection else ".anim"
- ext_changed = (ext!=self.filename_ext)
- if ext_changed:
- if self.filepath.endswith(self.filename_ext):
- self.filepath = self.filepath[:-len(self.filename_ext)]
- self.filename_ext = ext
-
+ ext_changed = self.set_extension(".mdc" if self.export_all and self.collection else ".anim")
super_result = super().check(context)
-
return ext_changed or super_result
def create_exporter(self):