X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Fexport.py;h=6db2c81c6cbb9f718ebec222227182e9e8d7e96b;hb=b360bb3cdc7ea3f9f5aba94d11e4f9d4f90c42a7;hp=37813d081a0d1bebf2cf5407431b59dce6de4589;hpb=7ae4af705535271ad84dbfe2b5a24bc9c546ae01;p=libs%2Fgl.git diff --git a/blender/io_mspgl/export.py b/blender/io_mspgl/export.py index 37813d08..6db2c81c 100644 --- a/blender/io_mspgl/export.py +++ b/blender/io_mspgl/export.py @@ -2,11 +2,7 @@ import os import itertools class DataExporter: - def __init__(self): - self.collection = False - self.shared_resources = True - - def export_to_file(self, context, out_fn): + def export_to_file(self, context, out_fn, *, collection=False, shared_resources=False): from .util import Progress progress = Progress(context) @@ -21,7 +17,7 @@ class DataExporter: base, ext = os.path.splitext(base) refs = dummy_res.collect_references() - if not self.shared_resources: + if not shared_resources: numbers = {} for r in refs: res_ext = os.path.splitext(r.name)[1] @@ -32,7 +28,7 @@ class DataExporter: r.name = base+res_ext numbers[res_ext] = n+1 - if self.collection: + if collection: dummy_res.write_collection(out_fn, exclude_self=True) else: for r in refs: @@ -120,6 +116,15 @@ class ProjectExporter: if s.camera: all_objects.append(s.camera) + scene_queue = list(scenes.values()) + ordered_scenes = [] + while scene_queue: + s = scene_queue.pop(0) + if not s.background_set or s.background_set in ordered_scenes: + ordered_scenes.append(s) + else: + scene_queue.append(s) + from .util import make_unique all_objects = make_unique(all_objects) @@ -129,7 +134,7 @@ class ProjectExporter: resources = {} dummy_res = data_exporter.export_resources(context, all_objects, resources, None, progress) - for s in scenes.values(): + for s in ordered_scenes: scene_name = s.name+".scene" if scene_name not in resources: scene_res = scene_exporter.export_scene(s, resources)