]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/material.py
Export shadow settings from Blender
[libs/gl.git] / blender / io_mspgl / material.py
index ba5fc3e2c6cb7567b0563b391cf8d4a3c0c21cf2..2613edac67478dae4d4ef57a1c537bc6af487bd8 100644 (file)
@@ -96,6 +96,8 @@ class Material:
                self.render_mode = material.render_mode
                self.technique = material.technique
                self.shader = material.shader
+               self.receive_shadows = material.receive_shadows
+               self.cast_shadows = (material.shadow_method!='NONE')
 
                if self.render_mode=='EXTERNAL' and not self.technique:
                        raise Exception("Invalid configuration on material {}: No technique for external rendering".format(self.name))
@@ -171,6 +173,8 @@ class MaterialAtlas:
                        self.name = "material_atlas_"+os.path.splitext(self.shader)[0]
                else:
                        self.name = "material_atlas"
+               self.receive_shadows = materials[0].receive_shadows
+               self.cast_shadows = (materials[0].shadow_method!='NONE')
                self.materials = materials
                self.material_names = [m.name for m in self.materials]
                for m in self.materials:
@@ -178,6 +182,8 @@ class MaterialAtlas:
                                raise Exception("Conflicting render modes in MaterialAtlas constructor")
                        if self.render_mode=='CUSTOM' and m.shader!=self.shader:
                                raise Exception("Conflicting shaders in MaterialAtlas constructor")
+                       if m.receive_shadows!=self.receive_shadows or m.shadow_method!=materials[0].shadow_method:
+                               raise Exception("Conflicting shadow settings in MaterialAtlas constructor")
 
                count = len(self.materials)
                size = 1