Fix #135: Extra UV maps have incorrect data

This was caused by a regression caused by 29831d7f09.

The test for importing extra UVs has been updated to check that the data is different between the different UV layers.
This commit is contained in:
Colin Basnett
2025-11-08 18:27:40 -08:00
parent 75660f9dc1
commit 93083f09f8
3 changed files with 10 additions and 3 deletions

View File

@@ -210,8 +210,9 @@ def import_psk(psk: Psk, context: Context, name: str, options: PskImportOptions)
for face_index, face in enumerate(psk.faces):
if face_index in invalid_face_indices:
continue
for wedge in map(lambda i: psk.wedges[i], reversed(face.wedge_indices)):
uv_layer_data[uv_layer_data_index] = wedge.u, 1.0 - wedge.v
for wedge_index in reversed(face.wedge_indices):
u, v = psk.extra_uvs[wedge_index_offset + wedge_index]
uv_layer_data[uv_layer_data_index] = u, 1.0 - v
uv_layer_data_index += 1
wedge_index_offset += len(psk.wedges)
uv_layer = mesh_data.uv_layers.new(name=f'EXTRAUV{extra_uv_index}')

View File

@@ -67,7 +67,7 @@ def read_psk(path: str) -> Psk:
case b'MRPHDATA':
_read_types(fp, Psk.MorphData, section, psk.morph_data)
case _:
if section.name.startswith(b'EXTRAUVS'):
if section.name.startswith(b'EXTRAUV'):
_read_types(fp, Vector2, section, psk.extra_uvs)
else:
# Section is not handled, skip it.