X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Fexport.py;h=b724eddd4f8c071953cad9dc1c7c9cb38a24cc59;hb=857e0a3f684fba4810260697a78a769dff514f1f;hp=b74fa5300bc86c06af1c5846c36dfa7218849add;hpb=1664213bbfc5e345b98bcdcc57e6c93f5bbb8d48;p=libs%2Fgl.git diff --git a/blender/io_mspgl/export.py b/blender/io_mspgl/export.py index b74fa530..b724eddd 100644 --- a/blender/io_mspgl/export.py +++ b/blender/io_mspgl/export.py @@ -2,13 +2,12 @@ import os class DataExporter: def export_to_file(self, ctx, out_fn, *, collection=False, shared_resources=False): - objects = context.context.selected_objects + objects = ctx.context.selected_objects resources = {} - material_atlases = {} task = ctx.task("Exporting resources", 1.0) - dummy_res = self.export_resources(task, objects, resources, material_atlases) + dummy_res = self.export_resources(task, objects, resources) path, base = os.path.split(out_fn) base, ext = os.path.splitext(base) @@ -32,10 +31,7 @@ class DataExporter: for r in refs: r.write_to_file(os.path.join(path, r.name)) - def export_resources(self, ctx, objects, resources, material_atlases): - if material_atlases is None: - material_atlases = {} - + def export_resources(self, ctx, objects, resources): object_exporter = None camera_exporter = None armature_exporter = None @@ -55,7 +51,7 @@ class DataExporter: if not object_exporter: from .export_object import ObjectExporter object_exporter = ObjectExporter() - object_exporter.export_object_resources(task, obj, resources, material_atlases) + object_exporter.export_object_resources(task, obj, resources) res = object_exporter.export_object(obj, resources) elif obj.type=='CAMERA': res_name = obj.name+".camera" @@ -93,28 +89,27 @@ class ProjectExporter: task.set_slices(len(ctx.context.blend_data.scenes)) scenes = {} + scene_queue = [] sequences = [] for s in ctx.context.blend_data.scenes: subtask = task.next_slice(s) - if s.export_disposition=='IGNORE': - continue - if s.export_disposition=='SEQUENCE': scene = create_scene_chain(s, scenes) sequences.append(scene) + scene_queue.append(scene) elif s.export_disposition!='IGNORE' and s.name not in scenes: scene = create_scene(s) + scenes[scene.name] = scene if s.export_disposition=='SCENE': - scenes[scene.name] = scene + scene_queue.append(scene) all_objects = [] for s in scenes.values(): - all_objects += s.prototypes + all_objects += [p.object for p in s.prototypes] all_objects += s.lights if s.camera: all_objects.append(s.camera) - scene_queue = list(scenes.values()) ordered_scenes = [] while scene_queue: s = scene_queue.pop(0) @@ -132,7 +127,7 @@ class ProjectExporter: task = ctx.task("Exporting resources", 1.0) resources = {} - dummy_res = data_exporter.export_resources(task, all_objects, resources, None) + dummy_res = data_exporter.export_resources(task, all_objects, resources) task = ctx.task("Exporting scenes", 1.0) for s in ordered_scenes: @@ -143,6 +138,7 @@ class ProjectExporter: resources[scene_name] = scene_res dummy_res.create_reference_statement("ref", scene_res) + task = ctx.task("Exporting sequences", 1.0) for s in sequences: subtask = task.task(s, 0.5) seq_name = s.name+".seq"