glTF exporter: set udim material names with tile number

This commit is contained in:
Julien Duroure 2024-08-30 06:37:34 +02:00
parent 69ab986370
commit 58141b7396
3 changed files with 7 additions and 4 deletions

View File

@ -5,7 +5,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": (4, 3, 17),
"version": (4, 3, 18),
'blender': (4, 2, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',

View File

@ -773,8 +773,8 @@ class PrimitiveCreator:
self.export_settings['log'].warning(
'We are not managing this case (UDIM for {})'.format(tex))
self.additional_materials.append(
(new_material, material_info, int(str(id(base_material)) + str(u) + str(v))))
self.additional_materials.append((new_material, material_info, int(
str(id(base_material)) + str(u) + str(v)), "10" + str(v) + str(u + 1)))
# Now, we need to add additional Vertex Color if needed
if self.export_settings['gltf_all_vertex_colors'] is True:

View File

@ -75,7 +75,7 @@ def gather_primitives(
export_settings)
else:
# UDIM case
base_material, material_info, unique_material_id = udim_material
base_material, material_info, unique_material_id, tile = udim_material
material = get_final_material(
blender_mesh,
unique_material_id,
@ -84,6 +84,9 @@ def gather_primitives(
material_info["uv_info"],
export_settings)
# Force change name of material to get the tile number in the name
material.name = material.name + "." + tile
primitive = gltf2_io.MeshPrimitive(
attributes=internal_primitive['attributes'],
extensions=__gather_extensions(