]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/scene.py
Store prototype reference instead of just name in scene instances
[libs/gl.git] / blender / io_mspgl / scene.py
index 28c30ad78b58a452309f9f24552edb6b56647ac2..03e239e6a77dce8dcb601e59230512d73e9c6a1f 100644 (file)
@@ -13,7 +13,7 @@ class Instance:
                self.name = obj.name
                self.matrix_world = obj.matrix_world
                self.rotation_mode = obj.rotation_mode
-               self.prototype = prototype.name
+               self.prototype = prototype
 
 class Scene:
        def __init__(self, scene, obj_filter=None):
@@ -23,6 +23,7 @@ class Scene:
                self.camera = scene.camera
                self.prototypes = []
                self.instances = []
+               self.blended_instances = []
                self.lights = []
                self.ambient_light = mathutils.Color((0.0, 0.0, 0.0))
                self.exposure = scene.view_settings.exposure
@@ -55,8 +56,11 @@ class Scene:
                        if o.type=='MESH':
                                clones = [c for c in objects if is_same_object(o, c)]
                                self.prototypes.append(o)
+                               instance_list = self.instances
+                               if o.material_slots and o.material_slots[0].material and o.material_slots[0].material.blend_method=='BLEND':
+                                       instance_list = self.blended_instances
                                for c in clones:
-                                       self.instances.append(Instance(c, o))
+                                       instance_list.append(Instance(c, o))
                                        processed.add(c.name)
                        elif o.type=='LIGHT':
                                self.lights.append(o)