]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/export_scene.py
Replace the instance variables of exporters by function parameters
[libs/gl.git] / blender / io_mspgl / export_scene.py
index 0ad6769f1dedb0daa1230aa131d0fed229f11db2..45a681c6e888d63e58b615977af599bcc1758987 100644 (file)
@@ -2,18 +2,12 @@ import math
 import os
 
 class SceneExporter:
-       def __init__(self):
-               self.selected_only = False
-               self.visible_only = True
-               self.collection = True
-               self.skip_existing = True
-
-       def export_to_file(self, context, out_fn):
+       def export_to_file(self, context, out_fn, *, selected_only=False, visible_only=True, collection=True, skip_existing=True):
                from .util import Progress
                progress = Progress(context)
 
                from .scene import create_scene_from_current
-               scene = create_scene_from_current(context, selected_only=self.selected_only, visible_only=self.visible_only)
+               scene = create_scene_from_current(context, selected_only=selected_only, visible_only=visible_only)
 
                resources = {}
                self.export_scene_resources(context, scene, resources, progress)
@@ -23,9 +17,9 @@ class SceneExporter:
                path, base = os.path.split(out_fn)
                base, ext = os.path.splitext(base)
 
-               if self.collection:
+               if collection:
                        existing = None
-                       if self.skip_existing:
+                       if skip_existing:
                                existing = lambda r: not os.path.exists(os.path.join(path, r.name))
                        scene_res.write_collection(out_fn, filter=existing)
                else: