Compare commits

...

6 Commits
8.1.0 ... 8.1.1

Author SHA1 Message Date
Colin Basnett
2e7814804d Incremented version to 8.1.1 2025-04-10 12:13:10 -07:00
Colin Basnett
2f972a31df Merge branch 'master' of https://github.com/DarklightGames/io_scene_psk_psa 2025-04-10 12:12:13 -07:00
Colin Basnett
18915b3d86 Fixed a logic error that would incorrectly always conjugate the rotation of the root bone 2025-04-10 12:12:07 -07:00
Colin Basnett
5ea7e23cb9 Update main.yml 2025-04-07 14:16:28 -07:00
Colin Basnett
385acd40bb Update main.yml 2025-04-07 11:31:42 -07:00
Colin Basnett
5cfb883a32 Minor README cleanup & added pycov for local testing 2025-04-06 00:44:54 -07:00
8 changed files with 32 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
name: Build Extension name: tests
on: on:
workflow_dispatch: workflow_dispatch:

7
.vscode/tasks.json vendored
View File

@@ -6,7 +6,12 @@
{ {
"label": "io_scene_psk_psa: test", "label": "io_scene_psk_psa: test",
"type": "shell", "type": "shell",
"command": "docker run -it --volume ${PWD}/io_scene_psk_psa:/addons/io_scene_psk_psa --volume ${PWD}/tests:/tests $(docker build -q .)" "command": "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 .)",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
} }
] ]
} }

View File

@@ -13,16 +13,16 @@ RUN pip install blender-downloader
# Set BLENDER_EXECUTABLE and BLENDER_PYTHON as environment variables # Set BLENDER_EXECUTABLE and BLENDER_PYTHON as environment variables
RUN BLENDER_EXECUTABLE=$(blender-downloader $BLENDER_VERSION --extract --remove-compressed --print-blender-executable) && \ RUN BLENDER_EXECUTABLE=$(blender-downloader $BLENDER_VERSION --extract --remove-compressed --print-blender-executable) && \
BLENDER_PYTHON=$(pytest-blender --blender-executable "${BLENDER_EXECUTABLE}") && \ BLENDER_PYTHON=$(pytest-blender --blender-executable "${BLENDER_EXECUTABLE}") && \
echo "Blender executable: $BLENDER_EXECUTABLE" && \
echo "Blender Python: $BLENDER_PYTHON" && \
echo "export BLENDER_EXECUTABLE=${BLENDER_EXECUTABLE}" >> /etc/environment && \ echo "export BLENDER_EXECUTABLE=${BLENDER_EXECUTABLE}" >> /etc/environment && \
echo "export BLENDER_PYTHON=${BLENDER_PYTHON}" >> /etc/environment && \ echo "export BLENDER_PYTHON=${BLENDER_PYTHON}" >> /etc/environment && \
echo $BLENDER_EXECUTABLE > /blender_executable_path echo $BLENDER_EXECUTABLE > /blender_executable_path
RUN pip install pytest-cov
# Source the environment variables and install Python dependencies # Source the environment variables and install Python dependencies
RUN . /etc/environment && \ RUN . /etc/environment && \
$BLENDER_PYTHON -m ensurepip && \ $BLENDER_PYTHON -m ensurepip && \
$BLENDER_PYTHON -m pip install pytest $BLENDER_PYTHON -m pip install pytest pytest-cov
# Persist BLENDER_EXECUTABLE as an environment variable # Persist BLENDER_EXECUTABLE as an environment variable
RUN echo $(cat /blender_executable_path) > /tmp/blender_executable_path_env && \ RUN echo $(cat /blender_executable_path) > /tmp/blender_executable_path_env && \
@@ -30,4 +30,5 @@ RUN echo $(cat /blender_executable_path) > /tmp/blender_executable_path_env && \
ENV BLENDER_EXECUTABLE /tmp/blender_executable_path_env ENV BLENDER_EXECUTABLE /tmp/blender_executable_path_env
ENTRYPOINT [ "/bin/bash", "-c" ] ENTRYPOINT [ "/bin/bash", "-c" ]
CMD ["export BLENDER_EXECUTABLE=$(cat /blender_executable_path) && echo $BLENDER_EXECUTABLE && pytest -svv tests --blender-executable $BLENDER_EXECUTABLE --blender-addons-dirs addons"] WORKDIR /io_scene_psk_psa
CMD ["source tests/test.sh"]

View File

@@ -1,6 +1,5 @@
[![Blender](https://img.shields.io/badge/Blender->=2.9-blue?logo=blender&logoColor=white)](https://www.blender.org/download/ "Download Blender") [![Blender](https://img.shields.io/badge/Blender%20Extension-Download-blue?logo=blender&logoColor=white)](https://extensions.blender.org/add-ons/io-scene-psk-psa/ "Download Blender")
[![GitHub release](https://img.shields.io/github/release/DarklightGames/io_scene_psk_psa?include_prereleases=&sort=semver&color=blue)](https://github.com/DarklightGames/io_scene_psk_psa/releases/) [![tests](https://github.com/DarklightGames/io_scene_psk_psa/actions/workflows/main.yml/badge.svg)](https://github.com/DarklightGames/io_scene_psk_psa/actions/workflows/main.yml)
[![Build Extension](https://github.com/DarklightGames/io_scene_psk_psa/actions/workflows/main.yml/badge.svg)](https://github.com/DarklightGames/io_scene_psk_psa/actions/workflows/main.yml)
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/L4L3853VR) [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/L4L3853VR)
@@ -20,7 +19,7 @@ This software is licensed under the [GPLv3](https://www.gnu.org/licenses/gpl-3.0
* Support for exporting instance collections. * Support for exporting instance collections.
# Installation # Installation
For Blender 4.2 and higher, it is recommended to download the latest version from the [Blender Extensions](https://extensions.blender.org/add-ons/io-scene-psk-psa/) platform. For Blender 4.2 and higher, download the latest version from the [Blender Extensions](https://extensions.blender.org/add-ons/io-scene-psk-psa/) platform.
For Blender 4.1 and lower, see [Legacy Compatibility](#legacy-compatibility). For Blender 4.1 and lower, see [Legacy Compatibility](#legacy-compatibility).
@@ -69,7 +68,7 @@ The PSA importer creates [Actions](https://docs.blender.org/manual/en/latest/ani
## Why are imported PSKs too big/too small? ## Why are imported PSKs too big/too small?
The PSK format, unlike other more modern formats, has no explicit or implicit unit system. Each game has its own convention as to what the base distance unit will represent. As such, this addon makes no assumptions as to the unit scale of the imported PSKs. If you think that your models are being imported into Blender either too big or too small, there are a couple ways to remedy this. The PSK format, unlike other more modern formats, has no explicit or implicit unit system. Each game has its own convention as to what the base distance unit will represent. As such, this addon makes no assumptions as to the unit scale of the imported PSKs. If you think that your models are being imported into Blender either too big or too small, there are a couple ways to remedy this.
The method I prefer is to simply change the Blender [scene properties](https://docs.blender.org/manual/en/4.4/scene_layout/scene/properties.html#units) to match the unit system and scale for the game you're using. This is non-destructive and ensures that the actual raw unit scaling of any PSK or PSA exports from Blender will match the source file from which it was derived. The method I prefer is to simply change the Blender [scene properties](https://docs.blender.org/manual/en/4.4/scene_layout/scene/properties.html#units) to match the unit system and scale for the game you're using. This is non-destructive and ensures that the unit scaling of any PSK or PSA exports from Blender will match the source file from which it was derived.
The second option is to simply change the `Scale` value on the PSK import dialog. This will scale the armature by the factor provided. Note that this is more destructive, but may be preferable if you don't intend on exporting PSKs or PSAs to a game engine. The second option is to simply change the `Scale` value on the PSK import dialog. This will scale the armature by the factor provided. Note that this is more destructive, but may be preferable if you don't intend on exporting PSKs or PSAs to a game engine.
@@ -79,4 +78,4 @@ 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)? ## 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. 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. 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.

View File

@@ -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 = "8.1.0" version = "8.1.1"
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>"

View File

@@ -91,7 +91,7 @@ def _get_pose_bone_location_and_rotation(
else: else:
is_child_bone = pose_bone.parent is not None is_child_bone = pose_bone.parent is not None
if is_child_bone is not None: if is_child_bone:
rotation.conjugate() rotation.conjugate()
return location, rotation return location, rotation

View File

@@ -3,4 +3,10 @@ name = "io_scene_psk_psa"
[pytest] [pytest]
blender-addons-dirs = "io_scene_psk_psa" blender-addons-dirs = "io_scene_psk_psa"
testpaths = "tests" testpaths = "../tests"
[tool.coverage.run]
branch = true
[tool.coverage.report]
ignore_errors = true

6
tests/test.sh Normal file
View File

@@ -0,0 +1,6 @@
# This file is meant to be executed inside a Docker container.
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.
sed -i 's|/root/.config/blender||g' coverage.xml
sed -i 's|4.4/scripts/addons/io_scene_psk_psa/||g' coverage.xml