]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/export_scene.py
Adjust scene export code
[libs/gl.git] / blender / io_mspgl / export_scene.py
index 9590fc178563609a5762cc26d81f3345a75ddb07..02566ef6a3dc68b7691741d5cb47ab9bf101f693 100644 (file)
@@ -5,7 +5,7 @@ class SceneExporter:
        def __init__(self):
                self.selected_only = False
                self.visible_only = True
-               self.resource_collection = True
+               self.collection = True
                self.skip_existing = True
                self.show_progress = True
 
@@ -84,23 +84,19 @@ class SceneExporter:
                scene_res = self.export_scene(context, objs, resources, object_prototypes, progress)
                refs = scene_res.collect_references()
 
-               if self.resource_collection:
-                       filter = None
+               if self.collection:
+                       existing = None
                        if self.skip_existing:
-                               filter = lambda r: not os.path.exists(os.path.join(path, r.name))
-                       scene_res.write_collection(os.path.join(path, base+"_resources.mdc"), exclude_self=True, filter=filter)
+                               existing = lambda r: not os.path.exists(os.path.join(path, r.name))
+                       scene_res.write_collection(out_fn, filter=existing)
                else:
-                       res_dir = os.path.join(path, base+"_resources")
-                       if not os.path.exists(res_dir):
-                               os.makedirs(res_dir)
+                       scene_res.write_to_file(out_fn)
                        for r in refs:
-                               r.write_to_file(os.path.join(res_dir, r.name))
-
-               scene_res.write_to_file(out_fn)
+                               r.write_to_file(os.path.join(path, r.name))
 
        def export_scene(self, context, objs, resources, prototypes, progress):
                from .datafile import Resource, Statement, Token
-               scene_res = Resource("scene.scene", "scene")
+               scene_res = Resource(context.scene.name+".scene", "scene")
 
                scene_res.statements.append(Statement("type", Token(context.scene.scene_type.lower())))