Skip to content

Commit

Permalink
Merge pull request #2292 from KhronosGroup/udim_material_name
Browse files Browse the repository at this point in the history
Fix #2289 - udim material names with tile number
  • Loading branch information
julienduroure committed Aug 30, 2024
2 parents defbc29 + b78af3b commit 1b8cabf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addons/io_scene_gltf2/blender/exp/primitive_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ def manage_material_info(self):
else:
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
Expand Down
5 changes: 4 additions & 1 deletion addons/io_scene_gltf2/blender/exp/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ def gather_primitives(
material = get_final_material(blender_mesh, blender_mat, internal_primitive['uvmap_attributes_index'], base_material, material_info["uv_info"], 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, internal_primitive['uvmap_attributes_index'], base_material, 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(blender_mesh, internal_primitive['material'], internal_primitive['uvmap_attributes_index'], export_settings),
Expand Down

0 comments on commit 1b8cabf

Please sign in to comment.