From 8350e7ba2b75f6a5325e7097a3a956661cb4b3b7 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 13 Apr 2021 12:43:56 +0300 Subject: [PATCH] Use unit 0 UVs for exporting TBNs if no UV layer is specified --- blender/io_mspgl/mesh.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/blender/io_mspgl/mesh.py b/blender/io_mspgl/mesh.py index 8f19676a..754e6ffc 100644 --- a/blender/io_mspgl/mesh.py +++ b/blender/io_mspgl/mesh.py @@ -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) -- 2.45.2