]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/export.py
Fix exporting of single objects
[libs/gl.git] / blender / io_mspgl / export.py
index 95cc556f5504d984291cd45d124fac2dee29fbd3..9e60f28487f0ccd8b7b42aaad14484b2e72d530f 100644 (file)
@@ -2,7 +2,7 @@ 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 = {}
 
@@ -89,6 +89,7 @@ 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)
@@ -98,19 +99,20 @@ class ProjectExporter:
                        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)