]> 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 69782b64cbb4cd7c3edf4fb3ebcd8064313141d3..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)
@@ -50,18 +49,14 @@ def create_technique_resource(material, resources):
        return tech_res
 
 class MaterialExporter:
-       def create_texture_exporter(self):
-               from .export_texture import TextureExporter
-               texture_export = TextureExporter()
-               return texture_export
-
        def export_technique_resources(self, material, resources):
-               from .export_texture import SamplerExporter
-               texture_export = self.create_texture_exporter()
+               from .export_texture import SamplerExporter, TextureExporter
+               texture_export = TextureExporter()
                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:
@@ -81,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):