Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5edebd3477 | ||
|
|
5cfff529b2 | ||
|
|
127338b6ac |
@@ -1,6 +1,6 @@
|
|||||||
schema_version = "1.0.0"
|
schema_version = "1.0.0"
|
||||||
id = "io_scene_psk_psa"
|
id = "io_scene_psk_psa"
|
||||||
version = "9.0.1"
|
version = "9.0.2"
|
||||||
name = "Unreal PSK/PSA (.psk/.psa)"
|
name = "Unreal PSK/PSA (.psk/.psa)"
|
||||||
tagline = "Import and export PSK and PSA files used in Unreal Engine"
|
tagline = "Import and export PSK and PSA files used in Unreal Engine"
|
||||||
maintainer = "Colin Basnett <cmbasnett@gmail.com>"
|
maintainer = "Colin Basnett <cmbasnett@gmail.com>"
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ def _get_pose_bone_location_and_rotation(
|
|||||||
|
|
||||||
if is_false_root_bone:
|
if is_false_root_bone:
|
||||||
pose_bone_matrix = coordinate_system_transform
|
pose_bone_matrix = coordinate_system_transform
|
||||||
elif pose_bone.parent is not None:
|
elif pose_bone is not None and pose_bone.parent is not None:
|
||||||
pose_bone_matrix = pose_bone.matrix
|
pose_bone_matrix = pose_bone.matrix
|
||||||
pose_bone_parent_matrix = pose_bone.parent.matrix
|
pose_bone_parent_matrix = pose_bone.parent.matrix
|
||||||
pose_bone_matrix = pose_bone_parent_matrix.inverted() @ pose_bone_matrix
|
pose_bone_matrix = pose_bone_parent_matrix.inverted() @ pose_bone_matrix
|
||||||
|
|||||||
@@ -201,7 +201,6 @@ def import_psk(psk: Psk, context: Context, name: str, options: PskImportOptions)
|
|||||||
|
|
||||||
# Extra UVs
|
# Extra UVs
|
||||||
if psk.has_extra_uvs and options.should_import_extra_uvs:
|
if psk.has_extra_uvs and options.should_import_extra_uvs:
|
||||||
wedge_index_offset = 0
|
|
||||||
for extra_uv_index, extra_uvs in enumerate(psk.extra_uvs):
|
for extra_uv_index, extra_uvs in enumerate(psk.extra_uvs):
|
||||||
uv_layer_data = np.zeros((face_count * 3, 2), dtype=np.float32)
|
uv_layer_data = np.zeros((face_count * 3, 2), dtype=np.float32)
|
||||||
uv_layer_data_index = 0
|
uv_layer_data_index = 0
|
||||||
@@ -209,10 +208,9 @@ def import_psk(psk: Psk, context: Context, name: str, options: PskImportOptions)
|
|||||||
if face_index in invalid_face_indices:
|
if face_index in invalid_face_indices:
|
||||||
continue
|
continue
|
||||||
for wedge_index in reversed(face.wedge_indices):
|
for wedge_index in reversed(face.wedge_indices):
|
||||||
u, v = extra_uvs[wedge_index_offset + wedge_index]
|
u, v = extra_uvs[wedge_index]
|
||||||
uv_layer_data[uv_layer_data_index] = u, 1.0 - v
|
uv_layer_data[uv_layer_data_index] = u, 1.0 - v
|
||||||
uv_layer_data_index += 1
|
uv_layer_data_index += 1
|
||||||
wedge_index_offset += len(psk.wedges)
|
|
||||||
uv_layer = mesh_data.uv_layers.new(name=f'EXTRAUV{extra_uv_index}')
|
uv_layer = mesh_data.uv_layers.new(name=f'EXTRAUV{extra_uv_index}')
|
||||||
uv_layer.uv.foreach_set('vector', uv_layer_data.ravel())
|
uv_layer.uv.foreach_set('vector', uv_layer_data.ravel())
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ def rgb_to_srgb(c: float) -> float:
|
|||||||
|
|
||||||
|
|
||||||
def get_nla_strips_in_frame_range(animation_data: AnimData, frame_min: float, frame_max: float):
|
def get_nla_strips_in_frame_range(animation_data: AnimData, frame_min: float, frame_max: float):
|
||||||
if animation_data is None:
|
|
||||||
return
|
|
||||||
for nla_track in animation_data.nla_tracks:
|
for nla_track in animation_data.nla_tracks:
|
||||||
if nla_track.mute:
|
if nla_track.mute:
|
||||||
continue
|
continue
|
||||||
|
|||||||
BIN
io_scene_psk_psa/wheels/psk_psa_py-0.0.1-py3-none-any.whl
Normal file
BIN
io_scene_psk_psa/wheels/psk_psa_py-0.0.1-py3-none-any.whl
Normal file
Binary file not shown.
BIN
tests/data/SK_1033_1033001.pskx
LFS
Normal file
BIN
tests/data/SK_1033_1033001.pskx
LFS
Normal file
Binary file not shown.
@@ -8,6 +8,7 @@ SUZANNE_FILEPATH = 'tests/data/Suzanne.psk'
|
|||||||
SARGE_FILEPATH = 'tests/data/CS_Sarge_S0_Skelmesh.pskx'
|
SARGE_FILEPATH = 'tests/data/CS_Sarge_S0_Skelmesh.pskx'
|
||||||
SLURP_MONSTER_AXE_FILEPATH = 'tests/data/Slurp_Monster_Axe_LOD0.psk'
|
SLURP_MONSTER_AXE_FILEPATH = 'tests/data/Slurp_Monster_Axe_LOD0.psk'
|
||||||
BAT_FILEPATH = 'tests/data/Bat.psk'
|
BAT_FILEPATH = 'tests/data/Bat.psk'
|
||||||
|
BLACK_WIDOW_FILEPATH = 'tests/data/SK_1033_1033001.pskx'
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
@@ -230,6 +231,38 @@ def test_psk_import_extra_uvs():
|
|||||||
assert mesh_data.uv_layers[1].uv[0].vector.y == 0.999969482421875
|
assert mesh_data.uv_layers[1].uv[0].vector.y == 0.999969482421875
|
||||||
|
|
||||||
|
|
||||||
|
def test_psk_import_many_extra_uvs():
|
||||||
|
assert bpy.ops.psk.import_file(
|
||||||
|
filepath=BLACK_WIDOW_FILEPATH,
|
||||||
|
components='MESH',
|
||||||
|
should_import_vertex_colors=False,
|
||||||
|
should_import_vertex_normals=False,
|
||||||
|
should_import_shape_keys=False,
|
||||||
|
) == {'FINISHED'}
|
||||||
|
|
||||||
|
mesh_object = bpy.data.objects.get('SK_1033_1033001', None)
|
||||||
|
assert mesh_object is not None, "Mesh object not found in the scene"
|
||||||
|
assert mesh_object.type == 'MESH', "Mesh object type should be MESH"
|
||||||
|
|
||||||
|
mesh_data = typing_cast(Mesh, mesh_object.data)
|
||||||
|
assert mesh_data is not None, "Mesh data not found in the scene"
|
||||||
|
assert len(mesh_data.uv_layers) == 4, "Mesh should have two UV layers"
|
||||||
|
|
||||||
|
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'"
|
||||||
|
assert mesh_data.uv_layers[2].name == 'EXTRAUV1', "Third UV layer should be named 'EXTRAUV1'"
|
||||||
|
assert mesh_data.uv_layers[3].name == 'EXTRAUV2', "Fourth UV layer should be named 'EXTRAUV2'"
|
||||||
|
|
||||||
|
|
||||||
|
def test_psk_import_multiple_extra_uvs():
|
||||||
|
assert bpy.ops.psk.import_file(
|
||||||
|
filepath=SARGE_FILEPATH,
|
||||||
|
components='MESH',
|
||||||
|
should_import_vertex_colors=True,
|
||||||
|
vertex_color_space='LINEAR',
|
||||||
|
) == {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
def test_psk_import_materials():
|
def test_psk_import_materials():
|
||||||
assert bpy.ops.psk.import_file(
|
assert bpy.ops.psk.import_file(
|
||||||
filepath=SARGE_FILEPATH,
|
filepath=SARGE_FILEPATH,
|
||||||
|
|||||||
Reference in New Issue
Block a user