From 9438a35cd1f4d2dca27b910ada25b358317b0dc0 Mon Sep 17 00:00:00 2001 From: Colin Basnett Date: Wed, 24 Jan 2024 18:46:03 -0800 Subject: [PATCH] Fixed a bug where any invalid faces would result in import failure if also importing vertex colors --- io_scene_psk_psa/psk/importer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/io_scene_psk_psa/psk/importer.py b/io_scene_psk_psa/psk/importer.py index 530ba7e..2594e8f 100644 --- a/io_scene_psk_psa/psk/importer.py +++ b/io_scene_psk_psa/psk/importer.py @@ -204,9 +204,12 @@ def import_psk(psk: Psk, context, options: PskImportOptions) -> PskImportResult: pass # Map the PSK vertex colors to the face corners. - face_corner_colors = np.full((len(psk.faces * 3), 4), 1.0) + face_count = len(psk.faces) - len(invalid_face_indices) + face_corner_colors = np.full((face_count * 3, 4), 1.0) face_corner_color_index = 0 for face_index, face in enumerate(psk.faces): + if face_index in invalid_face_indices: + continue for wedge_index in reversed(face.wedge_indices): face_corner_colors[face_corner_color_index] = psk_vertex_colors[wedge_index] face_corner_color_index += 1