]> git.tdb.fi Git - libs/gl.git/commitdiff
Use unit 0 UVs for exporting TBNs if no UV layer is specified
authorMikko Rasa <tdb@tdb.fi>
Tue, 13 Apr 2021 09:43:56 +0000 (12:43 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 13 Apr 2021 09:43:56 +0000 (12:43 +0300)
blender/io_mspgl/mesh.py

index 8f19676ac1127627e2a78771e949d89a9ce5b9c4..754e6ffc2d35460c0e474e7fc02e70b3e62c9568 100644 (file)
@@ -451,10 +451,15 @@ class Mesh:
                # remains intact for TBN vector computation
                tbn_layer_index = -1
                if self.tbn_vecs:
-                       uv_names = [u.name for u in self.uv_layers]
-                       if self.tbn_uvtex in uv_names:
+                       if self.tbn_uvtex:
+                               uv_names = [u.name for u in self.uv_layers]
+                               if self.tbn_uvtex in uv_names:
+                                       tbn_layer_index = uv_names.index(self.tbn_uvtex)
+                       elif self.uv_layers[0].unit==0:
+                               tbn_layer_index = 0
+
+                       if tbn_layer_index>=0:
                                prog_count += 1
-                               tbn_layer_index = uv_names.index(self.tbn_uvtex)
                                progress.push_task_slice("Computing TBN", 0, prog_count)
                                self.split_vertices(self.find_uv_group, progress, tbn_layer_index)
                                progress.set_task_slice(self.tbn_uvtex, 1, prog_count)