Compare commits
8 Commits
scale_keys
...
7.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d107a56007 | ||
|
|
a5bef57c8d | ||
|
|
44a55fc698 | ||
|
|
09cc9e5d51 | ||
|
|
d92f2d77d2 | ||
|
|
9c8b9d922b | ||
|
|
20b072f87b | ||
|
|
bd667d4833 |
@@ -5,12 +5,13 @@
|
|||||||
|
|
||||||
This Blender addon allows you to import and export meshes and animations to and from the [PSK and PSA file formats](https://wiki.beyondunreal.com/PSK_%26_PSA_file_formats) used in many versions of the Unreal Engine.
|
This Blender addon allows you to import and export meshes and animations to and from the [PSK and PSA file formats](https://wiki.beyondunreal.com/PSK_%26_PSA_file_formats) used in many versions of the Unreal Engine.
|
||||||
|
|
||||||
## Compatibility
|
# Compatibility
|
||||||
|
|
||||||
| Blender Version | Addon Version | Long Term Support |
|
| Blender Version | Addon Version | Long Term Support |
|
||||||
|--------------------------------------------------------------|--------------------------------------------------------------------------------|-------------------|
|
|------------------------------------------------------------|--------------------------------------------------------------------------------|-------------------|
|
||||||
| 4.0+ | [latest](https://github.com/DarklightGames/io_scene_psk_psa/releases/latest) | TBD |
|
| [4.1](https://www.blender.org/download/releases/4-1/) | [latest](https://github.com/DarklightGames/io_scene_psk_psa/releases/latest) | TBD |
|
||||||
| [3.4 - 3.6](https://www.blender.org/download/lts/3-6/) | [5.0.5](https://github.com/DarklightGames/io_scene_psk_psa/releases/tag/5.0.5) | ✅️ June 2025 |
|
| [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) | TBD |
|
||||||
|
| [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 |
|
| [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 |
|
||||||
|
|
||||||
Bug fixes will 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 we will accept pull requests for bug fixes.
|
Bug fixes will 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 we will accept pull requests for bug fixes.
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ from bpy.app.handlers import persistent
|
|||||||
bl_info = {
|
bl_info = {
|
||||||
'name': 'PSK/PSA Importer/Exporter',
|
'name': 'PSK/PSA Importer/Exporter',
|
||||||
'author': 'Colin Basnett, Yurii Ti',
|
'author': 'Colin Basnett, Yurii Ti',
|
||||||
'version': (6, 2, 0),
|
'version': (7, 0, 0),
|
||||||
'blender': (4, 0, 0),
|
'blender': (4, 1, 0),
|
||||||
'description': 'PSK/PSA Import/Export (.psk/.psa)',
|
'description': 'PSK/PSA Import/Export (.psk/.psa)',
|
||||||
'warning': '',
|
'warning': '',
|
||||||
'doc_url': 'https://github.com/DarklightGames/io_scene_psk_psa',
|
'doc_url': 'https://github.com/DarklightGames/io_scene_psk_psa',
|
||||||
|
|||||||
@@ -71,7 +71,8 @@ class PSA_PG_import(PropertyGroup):
|
|||||||
('EXACT', 'Exact', 'Bone names must match exactly.', 'EXACT', 0),
|
('EXACT', 'Exact', 'Bone names must match exactly.', 'EXACT', 0),
|
||||||
('CASE_INSENSITIVE', 'Case Insensitive', 'Bones names must match, ignoring case (e.g., the bone PSA bone '
|
('CASE_INSENSITIVE', 'Case Insensitive', 'Bones names must match, ignoring case (e.g., the bone PSA bone '
|
||||||
'\'root\' can be mapped to the armature bone \'Root\')', 'CASE_INSENSITIVE', 1),
|
'\'root\' can be mapped to the armature bone \'Root\')', 'CASE_INSENSITIVE', 1),
|
||||||
)
|
),
|
||||||
|
default='CASE_INSENSITIVE'
|
||||||
)
|
)
|
||||||
fps_source: EnumProperty(name='FPS Source', items=(
|
fps_source: EnumProperty(name='FPS Source', items=(
|
||||||
('SEQUENCE', 'Sequence', 'The sequence frame rate matches the original frame rate', 'ACTION', 0),
|
('SEQUENCE', 'Sequence', 'The sequence frame rate matches the original frame rate', 'ACTION', 0),
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ def import_psa(context: Context, psa_reader: PsaReader, armature_object: Object,
|
|||||||
if armature_bone_index is not None:
|
if armature_bone_index is not None:
|
||||||
# Ensure that no other PSA bone has been mapped to this armature bone yet.
|
# Ensure that no other PSA bone has been mapped to this armature bone yet.
|
||||||
if armature_bone_index not in armature_to_psa_bone_indices:
|
if armature_bone_index not in armature_to_psa_bone_indices:
|
||||||
psa_to_armature_bone_indices[psa_bone_index] = armature_bone_names.index(psa_bone_name)
|
psa_to_armature_bone_indices[psa_bone_index] = armature_bone_index
|
||||||
armature_to_psa_bone_indices[armature_bone_index] = psa_bone_index
|
armature_to_psa_bone_indices[armature_bone_index] = psa_bone_index
|
||||||
else:
|
else:
|
||||||
# This armature bone has already been mapped to a PSA bone.
|
# This armature bone has already been mapped to a PSA bone.
|
||||||
@@ -172,7 +172,7 @@ def import_psa(context: Context, psa_reader: PsaReader, armature_object: Object,
|
|||||||
|
|
||||||
# Create intermediate bone data for import operations.
|
# Create intermediate bone data for import operations.
|
||||||
import_bones = []
|
import_bones = []
|
||||||
import_bones_dict = dict()
|
psa_bone_names_to_import_bones = dict()
|
||||||
|
|
||||||
for (psa_bone_index, psa_bone), psa_bone_name in zip(enumerate(psa_reader.bones), psa_bone_names):
|
for (psa_bone_index, psa_bone), psa_bone_name in zip(enumerate(psa_reader.bones), psa_bone_names):
|
||||||
if psa_bone_index not in psa_to_armature_bone_indices:
|
if psa_bone_index not in psa_to_armature_bone_indices:
|
||||||
@@ -182,17 +182,22 @@ def import_psa(context: Context, psa_reader: PsaReader, armature_object: Object,
|
|||||||
import_bone = ImportBone(psa_bone)
|
import_bone = ImportBone(psa_bone)
|
||||||
import_bone.armature_bone = armature_data.bones[psa_bone_name]
|
import_bone.armature_bone = armature_data.bones[psa_bone_name]
|
||||||
import_bone.pose_bone = armature_object.pose.bones[psa_bone_name]
|
import_bone.pose_bone = armature_object.pose.bones[psa_bone_name]
|
||||||
import_bones_dict[psa_bone_name] = import_bone
|
psa_bone_names_to_import_bones[psa_bone_name] = import_bone
|
||||||
import_bones.append(import_bone)
|
import_bones.append(import_bone)
|
||||||
|
|
||||||
|
bones_with_missing_parents = []
|
||||||
|
|
||||||
for import_bone in filter(lambda x: x is not None, import_bones):
|
for import_bone in filter(lambda x: x is not None, import_bones):
|
||||||
armature_bone = import_bone.armature_bone
|
armature_bone = import_bone.armature_bone
|
||||||
|
has_parent = armature_bone.parent is not None
|
||||||
if armature_bone.parent is not None and armature_bone.parent.name in psa_bone_names:
|
if has_parent:
|
||||||
import_bone.parent = import_bones_dict[armature_bone.parent.name]
|
if armature_bone.parent.name in psa_bone_names:
|
||||||
|
import_bone.parent = psa_bone_names_to_import_bones[armature_bone.parent.name]
|
||||||
|
else:
|
||||||
|
# Add a warning if the parent bone is not in the PSA.
|
||||||
|
bones_with_missing_parents.append(armature_bone)
|
||||||
# Calculate the original location & rotation of each bone (in world-space maybe?)
|
# Calculate the original location & rotation of each bone (in world-space maybe?)
|
||||||
if import_bone.parent is not None:
|
if has_parent:
|
||||||
import_bone.original_location = armature_bone.matrix_local.translation - armature_bone.parent.matrix_local.translation
|
import_bone.original_location = armature_bone.matrix_local.translation - armature_bone.parent.matrix_local.translation
|
||||||
import_bone.original_location.rotate(armature_bone.parent.matrix_local.to_quaternion().conjugated())
|
import_bone.original_location.rotate(armature_bone.parent.matrix_local.to_quaternion().conjugated())
|
||||||
import_bone.original_rotation = armature_bone.matrix_local.to_quaternion()
|
import_bone.original_rotation = armature_bone.matrix_local.to_quaternion()
|
||||||
@@ -204,6 +209,12 @@ def import_psa(context: Context, psa_reader: PsaReader, armature_object: Object,
|
|||||||
|
|
||||||
import_bone.post_rotation = import_bone.original_rotation.conjugated()
|
import_bone.post_rotation = import_bone.original_rotation.conjugated()
|
||||||
|
|
||||||
|
# Warn about bones with missing parents.
|
||||||
|
if len(bones_with_missing_parents) > 0:
|
||||||
|
count = len(bones_with_missing_parents)
|
||||||
|
message = f'{count} bone(s) have parents that are not present in the PSA:\n' + str([x.name for x in bones_with_missing_parents])
|
||||||
|
result.warnings.append(message)
|
||||||
|
|
||||||
context.window_manager.progress_begin(0, len(sequences))
|
context.window_manager.progress_begin(0, len(sequences))
|
||||||
|
|
||||||
# Create and populate the data for new sequences.
|
# Create and populate the data for new sequences.
|
||||||
|
|||||||
Reference in New Issue
Block a user