]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/export_mesh.py
Fix exporting meshes without UV coordinates
[libs/gl.git] / blender / io_mspgl / export_mesh.py
index 39bf87b51e028d97ae24ace20633fbd75879570b..f429ff3199b290d9b2a23e969e3ac3497435d2e5 100644 (file)
@@ -194,6 +194,15 @@ class MeshExporter:
        def export(self, context, out_file):
                if self.compound:
                        objs = context.selected_objects
+                       check = objs
+                       while check:
+                               children = []
+                               for o in check:
+                                       for c in o.children:
+                                               if c.compound:
+                                                       children.append(c)
+                               objs += children
+                               check = children
                else:
                        objs = [context.active_object]
 
@@ -206,7 +215,7 @@ class MeshExporter:
                from .mesh import Mesh
                from .util import Progress
 
-               progress = Progress()
+               progress = Progress(context)
                progress.set_task("Preparing", 0.0, 0.0)
 
                mesh = None
@@ -303,7 +312,7 @@ class MeshExporter:
                fmt.append("VERTEX3")
                out_file.begin("vertices", *fmt)
                normal = None
-               uvs = [None]*(max(u[0] for u in texunits)+1)
+               uvs = {}
                tan = None
                bino = None
                group = None
@@ -312,7 +321,7 @@ class MeshExporter:
                                out_file.write("normal3", *v.normal)
                                normal = v.normal
                        for i, u in texunits:
-                               if v.uvs[i]!=uvs[i]:
+                               if v.uvs[i]!=uvs.get(i):
                                        if u.unit==0 or force_unit0:
                                                out_file.write("texcoord2", *v.uvs[i])
                                        else: