1
0
mirror of https://github.com/DarklightGames/io_scene_psk_psa.git synced 2024-12-18 01:05:57 +01:00

Fixed a bug where any invalid faces would result in import failure if also importing vertex colors

This commit is contained in:
Colin Basnett 2024-01-24 18:46:03 -08:00
parent 5a870104f1
commit 9438a35cd1

View File

@ -204,9 +204,12 @@ def import_psk(psk: Psk, context, options: PskImportOptions) -> PskImportResult:
pass pass
# Map the PSK vertex colors to the face corners. # 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 face_corner_color_index = 0
for face_index, face in enumerate(psk.faces): for face_index, face in enumerate(psk.faces):
if face_index in invalid_face_indices:
continue
for wedge_index in reversed(face.wedge_indices): for wedge_index in reversed(face.wedge_indices):
face_corner_colors[face_corner_color_index] = psk_vertex_colors[wedge_index] face_corner_colors[face_corner_color_index] = psk_vertex_colors[wedge_index]
face_corner_color_index += 1 face_corner_color_index += 1