]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/mesh.py
Improve error reporting in the Blender exporter
[libs/gl.git] / blender / io_mspgl / mesh.py
index 3f9ab02e2bd3dabf8493088b114f398c77983659..8009191f080a045468c36908cee738a988e562e4 100644 (file)
@@ -207,7 +207,7 @@ class Mesh:
                edge_map = {e.key: e for e in self.edges}
                for f in self.faces:
                        if len(f.vertices)>4:
-                               raise ValueError("Ngons are not supported")
+                               raise ValueError("Unsupported face on mesh {}: N-gon".format(self.name))
 
                        f.vertices = [self.vertices[i] for i in f.vertices]
                        for v in f.vertices:
@@ -252,10 +252,10 @@ class Mesh:
 
        def splice(self, other):
                if len(self.uv_layers)!=len(other.uv_layers):
-                       raise ValueError("Meshes have incompatible UV layers")
+                       raise ValueError("Meshes {} and {} have incompatible UV layers".format(self.name, other.name))
                for i, u in enumerate(self.uv_layers):
                        if u.name!=other.uv_layers[i].name:
-                               raise ValueError("Meshes have incompatible UV layers")
+                               raise ValueError("Meshes {} and {} have incompatible UV layers".format(self.name, other.name))
 
                # Merge materials and form a lookup from source material indices to the
                # merged material list
@@ -418,7 +418,7 @@ class Mesh:
        def apply_material_atlas(self, material_atlas):
                for m in self.materials:
                        if m.name not in material_atlas.material_names:
-                               raise Exception("Material atlas is not compatible with Mesh")
+                               raise Exception("Material atlas {} is not compatible with Mesh {}".format(material_atlas.name, self.name))
 
                if self.use_uv=='NONE':
                        return
@@ -480,7 +480,7 @@ class Mesh:
                                progress.pop_task()
                                prog_step = 2
                        else:
-                               raise Exception("Tangent UV layer not found")
+                               raise Exception("Invalid configuration on mesh {}: No tangent UV layer".format(self.name))
 
                # Split by the remaining UV layers
                for i, u in enumerate(self.uv_layers):
@@ -797,7 +797,7 @@ class Mesh:
 
 def create_mesh_from_object(context, obj, material_atlas, progress):
        if obj.type!="MESH":
-               raise Exception("Object is not a mesh")
+               raise Exception("Object {} is not a mesh".format(obj.name))
 
        progress.push_task("Preparing mesh", 0.0, 0.2)