Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff2fe35846 | ||
|
|
f6fa646a63 | ||
|
|
16471344f0 | ||
|
|
172249dfff | ||
|
|
0b30161cd7 | ||
|
|
e66f7f98e2 | ||
|
|
879c3cbaf6 |
38
README.md
38
README.md
@@ -23,18 +23,6 @@ For Blender 4.2 and higher, download the latest version from the [Blender Extens
|
||||
|
||||
For Blender 4.1 and lower, see [Legacy Compatibility](#legacy-compatibility).
|
||||
|
||||
# Legacy Compatibility
|
||||
Below is a table of the latest addon versions that are compatible with older versions of Blender. These versions are no longer maintained and may contain bugs that have been fixed in newer versions. It is recommended to use the latest version of the addon for the best experience.
|
||||
|
||||
Critical bug fixes may be issued for legacy addon versions that are under [Blender's LTS maintenance period](https://www.blender.org/download/lts/). Once the LTS period has ended, legacy addon versions will no longer be supported by the maintainers of this repository, although the releases will still be available for download.
|
||||
|
||||
| Blender Version| Addon Version | Long Term Support |
|
||||
|-|--------------------------------------------------------------------------------|-----------------|
|
||||
| [4.1](https://www.blender.org/download/releases/4-1/) | [7.0.0](https://github.com/DarklightGames/io_scene_psk_psa/releases/tag/7.0.0) | No |
|
||||
| [4.0](https://www.blender.org/download/releases/4-0/) | [6.2.1](https://github.com/DarklightGames/io_scene_psk_psa/releases/tag/6.2.1) | No |
|
||||
| [3.4 - 3.6](https://www.blender.org/download/lts/3-6/) | [5.0.6](https://github.com/DarklightGames/io_scene_psk_psa/releases/tag/5.0.6) | June 2025 |
|
||||
| [2.93 - 3.3](https://www.blender.org/download/releases/3-3/) | [4.3.0](https://github.com/DarklightGames/io_scene_psk_psa/releases/tag/4.3.0) | ~~September 2024~~ |
|
||||
|
||||
# Usage
|
||||
## Exporting a PSK
|
||||
1. Select the mesh objects you wish to export.
|
||||
@@ -78,4 +66,28 @@ The PSK format does not support vertex normals and instead uses [smoothing group
|
||||
## Why are the mesh normals not accurate when importing a PSK extracted from [UE Viewer](https://www.gildor.org/en/projects/umodel)?
|
||||
If preserving the mesh normals of models is important for your workflow, it is *not recommended* to export PSK files from UE Viewer. This is because UE Viewer makes no attempt to reconstruct the original [smoothing groups](https://en.wikipedia.org/wiki/Smoothing_group). As a result, the normals of imported PSK files will be incorrect when imported into Blender and will need to be manually fixed.
|
||||
|
||||
There is a [pull request](https://github.com/gildor2/UEViewer/pull/277) to add support for exporting explicit normals from UE Viewer in the future, although UEViewer's maintainer has seemingly abandoned the project.
|
||||
There is a [pull request](https://github.com/gildor2/UEViewer/pull/277) to add support for exporting explicit normals from UE Viewer, although UEViewer's maintainer has seemingly abandoned the project.
|
||||
|
||||
# Legacy Compatibility
|
||||
Below is a table of the latest addon versions that are compatible with older versions of Blender. These versions are no longer maintained and may contain bugs that have been fixed in newer versions. It is recommended to use the latest version of the addon for the best experience.
|
||||
|
||||
Critical bug fixes may be issued for legacy addon versions that are under [Blender's LTS maintenance period](https://www.blender.org/download/lts/). Once the LTS period has ended, legacy addon versions will no longer be supported by the maintainers of this repository, although the releases will still be available for download.
|
||||
|
||||
| Blender Version| Addon Version | Long Term Support |
|
||||
|-|--------------------------------------------------------------------------------|-----------------|
|
||||
| [4.1](https://www.blender.org/download/releases/4-1/) | [7.0.0](https://github.com/DarklightGames/io_scene_psk_psa/releases/tag/7.0.0) | No |
|
||||
| [4.0](https://www.blender.org/download/releases/4-0/) | [6.2.1](https://github.com/DarklightGames/io_scene_psk_psa/releases/tag/6.2.1) | No |
|
||||
| [3.4 - 3.6](https://www.blender.org/download/lts/3-6/) | [5.0.6](https://github.com/DarklightGames/io_scene_psk_psa/releases/tag/5.0.6) | June 2025 |
|
||||
| [2.93 - 3.3](https://www.blender.org/download/releases/3-3/) | [4.3.0](https://github.com/DarklightGames/io_scene_psk_psa/releases/tag/4.3.0) | ~~September 2024~~ |
|
||||
|
||||
|
||||
# Testing
|
||||
To execute the automated tests, run:
|
||||
|
||||
```
|
||||
./test.sh
|
||||
````
|
||||
|
||||
This will create a [Docker](https://www.docker.com/) container with and run the tests inside it. The tests are executed using [pytest](https://docs.pytest.org/en/stable/) and the results will be displayed in the terminal.
|
||||
|
||||
For now, the tests are not exhaustive and primarily focus on sanity checking the most common use cases (PSK & PSA import). New tests will likely be made to cover new features and prevent further regressions of reported issues.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
schema_version = "1.0.0"
|
||||
id = "io_scene_psk_psa"
|
||||
version = "8.1.1"
|
||||
version = "8.1.2"
|
||||
name = "Unreal PSK/PSA (.psk/.psa)"
|
||||
tagline = "Import and export PSK and PSA files used in Unreal Engine"
|
||||
maintainer = "Colin Basnett <cmbasnett@gmail.com>"
|
||||
|
||||
@@ -179,7 +179,7 @@ def build_psk(context: Context, input_objects: PskInputObjects, options: PskBuil
|
||||
|
||||
for material in materials:
|
||||
psk_material = Psk.Material()
|
||||
psk_material.name = convert_string_to_cp1252_bytes(material.name)
|
||||
psk_material.name = convert_string_to_cp1252_bytes(material.name if material else 'None')
|
||||
psk_material.texture_index = len(psk.materials)
|
||||
psk_material.poly_flags = triangle_type_and_bit_flags_to_poly_flags(material.psk.mesh_triangle_type,
|
||||
material.psk.mesh_triangle_bit_flags)
|
||||
@@ -421,6 +421,9 @@ def build_psk(context: Context, input_objects: PskInputObjects, options: PskBuil
|
||||
|
||||
context.window_manager.progress_end()
|
||||
|
||||
# https://github.com/DarklightGames/io_scene_psk_psa/issues/129.
|
||||
psk.sort_and_normalize_weights()
|
||||
|
||||
result.psk = psk
|
||||
|
||||
return result
|
||||
|
||||
@@ -113,6 +113,31 @@ class Psk(object):
|
||||
def has_morph_data(self):
|
||||
return len(self.morph_infos) > 0
|
||||
|
||||
def sort_and_normalize_weights(self):
|
||||
self.weights.sort(key=lambda x: x.point_index)
|
||||
|
||||
weight_index = 0
|
||||
weight_total = len(self.weights)
|
||||
|
||||
while weight_index < weight_total:
|
||||
point_index = self.weights[weight_index].point_index
|
||||
weight_sum = self.weights[weight_index].weight
|
||||
point_weight_total = 1
|
||||
|
||||
# Calculate the sum of weights for the current point_index.
|
||||
for i in range(weight_index + 1, weight_total):
|
||||
if self.weights[i].point_index != point_index:
|
||||
break
|
||||
weight_sum += self.weights[i].weight
|
||||
point_weight_total += 1
|
||||
|
||||
# Normalize the weights for the current point_index.
|
||||
for i in range(weight_index, weight_index + point_weight_total):
|
||||
self.weights[i].weight /= weight_sum
|
||||
|
||||
# Move to the next group of weights.
|
||||
weight_index += point_weight_total
|
||||
|
||||
def __init__(self):
|
||||
self.points: List[Vector3] = []
|
||||
self.wedges: List[Psk.Wedge] = []
|
||||
|
||||
@@ -307,7 +307,8 @@ def create_psx_bones(
|
||||
bones: List[Tuple[PsxBone, Optional[Object]]] = []
|
||||
|
||||
if export_space != 'WORLD' and len(armature_objects) > 1:
|
||||
raise RuntimeError('When exporting multiple armatures, the Export Space must be World')
|
||||
armature_object_names = [armature_object.name for armature_object in armature_objects]
|
||||
raise RuntimeError(f'When exporting multiple armatures, the Export Space must be World. The following armatures are attempting to be exported: {armature_object_names}')
|
||||
|
||||
coordinate_system_matrix = get_coordinate_system_transform(forward_axis, up_axis)
|
||||
coordinate_system_default_rotation = coordinate_system_matrix.to_quaternion()
|
||||
|
||||
2
test.sh
Executable file
2
test.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
# usr/bin/env bash
|
||||
docker run -it --volume ${PWD}:/io_scene_psk_psa --volume ${PWD}/io_scene_psk_psa:/addons/io_scene_psk_psa --volume ${PWD}/tests:/tests $(docker build -q .)
|
||||
@@ -1,4 +1,6 @@
|
||||
# This file is meant to be executed inside a Docker container.
|
||||
# usr/bin/env bash
|
||||
# This file is meant to be executed from inside a Docker container.
|
||||
# To run tests on the host system, use the `test.sh` script in the root directory.
|
||||
export BLENDER_EXECUTABLE=$(cat /blender_executable_path)
|
||||
pytest --cov-report xml --cov=/root/.config/blender -svv tests --blender-executable $BLENDER_EXECUTABLE --blender-addons-dirs ../addons
|
||||
# Fixes the paths in the coverage report to be relative to the current directory.
|
||||
|
||||
Reference in New Issue
Block a user