]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/material.py
Improve error reporting in the Blender exporter
[libs/gl.git] / blender / io_mspgl / material.py
index a24c09e3b59dd59a05f9c3ba504afd398a1f7fbf..ba5fc3e2c6cb7567b0563b391cf8d4a3c0c21cf2 100644 (file)
@@ -98,9 +98,9 @@ class Material:
                self.shader = material.shader
 
                if self.render_mode=='EXTERNAL' and not self.technique:
-                       raise Exception("Missing technique with external rendering mode")
+                       raise Exception("Invalid configuration on material {}: No technique for external rendering".format(self.name))
                elif self.render_mode=='CUSTOM' and not self.shader:
-                       raise Exception("Missing shader with custom rendering mode")
+                       raise Exception("Invalid configuration on material {}: No shader for custom rendering".format(self.name))
 
                out_node = None
                for n in material.node_tree.nodes:
@@ -109,12 +109,12 @@ class Material:
                                break
 
                if not out_node:
-                       raise Exception("No material output node found")
+                       raise Exception("No output node found on material {}".format(self.name))
 
                surface_node, _ = get_linked_node_and_socket(material.node_tree, out_node.inputs["Surface"])
                if not surface_node:
                        if self.render_mode=='BUILTIN':
-                               raise Exception("Empty material can't use builtin rendering mode")
+                               raise Exception("Invalid configuration on material {}: Empty material with builtin rendering".format(self.name))
                        return
                elif surface_node.type=='BSDF_PRINCIPLED':
                        self.type = "pbr"
@@ -137,7 +137,7 @@ class Material:
 
                        color.set_from_input(material.node_tree, surface_node.inputs["Color"])
                else:
-                       raise Exception("Unsupported surface node type "+surface_node.type)
+                       raise Exception("Unsupported surface node type {} on material {}".format(surface_node.type, self.name))
 
                sampler_settings = None
                for p in self.properties:
@@ -146,7 +146,7 @@ class Material:
                                if sampler_settings is None:
                                        sampler_settings = settings
                                elif settings!=sampler_settings:
-                                       raise Exception("Conflicting sampler settings in material textures")
+                                       raise Exception("Material {} has conflicting texture sampler settings".format(self.name))
 
        def create_property(self, *args):
                prop = None