]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/export_material.py
Wrap material before passing it to create_technique_resource
[libs/gl.git] / blender / io_mspgl / export_material.py
index 792ab2903576ba4a10518fef480c06cb5cc49ac9..7e8f60660b4563eddc2e04f4f93ae2b3ff635e41 100644 (file)
@@ -1,7 +1,6 @@
 import os
 
 def create_technique_resource(material, resources):
-       # This operates on a Blender material, not a custom object
        from .datafile import Resource, Statement
        tech_res = Resource(material.name+".tech", "technique")
 
@@ -38,7 +37,7 @@ def create_technique_resource(material, resources):
 
                tech_res.statements.append(st)
 
-               if material.shadow_method!='NONE':
+               if material.cast_shadows:
                        st = Statement("method", "shadow")
                        st.sub.append(Statement("shader", "occluder.glsl.shader"))
                        tech_res.statements.append(st)
@@ -56,7 +55,8 @@ class MaterialExporter:
                sampler_export = SamplerExporter()
 
                from .material import Material
-               material = Material(material)
+               if type(material)!=Material:
+                       material = Material(material)
 
                for p in material.properties:
                        if p.texture:
@@ -76,6 +76,10 @@ class MaterialExporter:
                                resources[mat_name] = None
 
        def export_technique(self, material, resources):
+               from .material import Material
+               if type(material)!=Material:
+                       material = Material(material)
+
                return create_technique_resource(material, resources)
 
        def export_material(self, material, resources):