Compare commits

...

5 Commits

Author SHA1 Message Date
Colin Basnett
37f7cc4d9f Increment version to 8.2.4 2025-11-08 18:28:21 -08:00
Colin Basnett
93083f09f8 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.
2025-11-08 18:27:40 -08:00
Colin Basnett
75660f9dc1 Incremented version to 8.2.3 2025-10-31 12:43:09 -07:00
Colin Basnett
5421ac5151 Removed debugging code 2025-10-31 12:42:14 -07:00
Colin Basnett
9dcbb74058 Fix for missing transform source and broken scale controls on PSK export dialog 2025-10-31 12:41:14 -07:00
5 changed files with 30 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
schema_version = "1.0.0"
id = "io_scene_psk_psa"
version = "8.2.2"
version = "8.2.4"
name = "Unreal PSK/PSA (.psk/.psa)"
tagline = "Import and export PSK and PSA files used in Unreal Engine"
maintainer = "Colin Basnett <cmbasnett@gmail.com>"

View File

@@ -241,7 +241,7 @@ def get_psk_build_options_from_property_group(scene: Scene, pg: PskExportMixin)
match pg.transform_source:
case 'SCENE':
transform_source = getattr(scene, 'psx_export')
case 'SELF':
case 'CUSTOM':
transform_source = pg
case _:
assert False, f'Invalid transform source: {pg.transform_source}'
@@ -486,9 +486,24 @@ class PSK_OT_export(Operator, ExportHelper):
flow.use_property_split = True
flow.use_property_decorate = False
flow.prop(pg, 'export_space')
flow.prop(pg, 'scale')
flow.prop(pg, 'forward_axis')
flow.prop(pg, 'up_axis')
flow.prop(pg, 'transform_source')
flow = transform_panel.grid_flow(row_major=True)
flow.use_property_split = True
flow.use_property_decorate = False
match pg.transform_source:
case 'SCENE':
transform_source = getattr(context.scene, 'psx_export')
flow.enabled = False
case 'CUSTOM':
transform_source = pg
case _:
assert False, f'Invalid transform source: {pg.transform_source}'
flow.prop(transform_source, 'scale')
flow.prop(transform_source, 'forward_axis')
flow.prop(transform_source, 'up_axis')
# Extended Format
extended_format_header, extended_format_panel = layout.panel('Extended Format', default_closed=False)

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.

View File

@@ -220,6 +220,12 @@ def test_psk_import_extra_uvs():
assert mesh_data.uv_layers[0].name == 'UVMap', "First UV layer should be named 'UVMap'"
assert mesh_data.uv_layers[1].name == 'EXTRAUV0', "Second UV layer should be named 'EXTRAUV0'"
# Verify that the data is actually different
assert mesh_data.uv_layers[0].uv[0].vector.x == 0.92480468750
assert mesh_data.uv_layers[0].uv[0].vector.y == 0.90533447265625
assert mesh_data.uv_layers[1].uv[0].vector.x == 3.0517578125e-05
assert mesh_data.uv_layers[1].uv[0].vector.y == 0.999969482421875
def test_psk_import_materials():
assert bpy.ops.psk.import_file(