]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/export_material.py
Handle certain shader graph patterns that occur in imported glTF files
[libs/gl.git] / blender / io_mspgl / export_material.py
index 4941a5851d1b34592e567f80c08cb33af0e919fd..b0df347f7fb0a2af9f07014e16a60bd2023afae8 100644 (file)
@@ -1,5 +1,3 @@
-import os
-
 def create_technique_resource(material, resources):
        from .datafile import Resource, Statement, Token
        tech_res = Resource(material.name+".tech", "technique")
@@ -77,7 +75,7 @@ class MaterialExporter:
                for p in textured_props:
                        ctx.next_slice(p.texture.image)
 
-                       tex_name = p.texture.image.name+".tex"
+                       tex_name = texture_export.get_texture_name(p.texture, p.tex_channels)
                        if tex_name not in resources:
                                resources[tex_name] = texture_export.export_texture(p.texture, p.tex_channels)
 
@@ -123,7 +121,9 @@ class MaterialExporter:
        def create_property_statement(self, mat_res, prop, resources):
                from .datafile import Statement
                if prop.texture:
-                       tex_res = resources[prop.texture.image.name+".tex"]
+                       from .export_texture import TextureExporter
+                       texture_export = TextureExporter()
+                       tex_res = resources[texture_export.get_texture_name(prop.texture, prop.tex_channels)]
                        return mat_res.create_reference_statement(prop.tex_keyword, tex_res)
                elif not prop.keyword:
                        return