glTF exporter: fix resolve uvmap index, using now correct mesh

This commit is contained in:
Julien Duroure 2022-09-25 16:56:06 +02:00
parent 3908254f09
commit bccd6c669d
2 changed files with 10 additions and 7 deletions

View File

@ -4,7 +4,7 @@
bl_info = {
'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
"version": (3, 4, 18),
"version": (3, 4, 19),
'blender': (3, 3, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',

View File

@ -166,12 +166,15 @@ def __gather_texture_transform_and_tex_coord(primary_socket, export_settings):
use_active_uvmap = True
if node and node.type == 'UVMAP' and node.uv_map:
# Try to gather map index.
for blender_mesh in bpy.data.meshes:
i = blender_mesh.uv_layers.find(node.uv_map)
if i >= 0:
texcoord_idx = i
use_active_uvmap = False
break
node_tree = node.id_data
for mesh in bpy.data.meshes:
for material in mesh.materials:
if material.node_tree == node_tree:
i = mesh.uv_layers.find(node.uv_map)
if i >= 0:
texcoord_idx = i
use_active_uvmap = False
break
return texture_transform, texcoord_idx or None, use_active_uvmap