From 4d41f1af834d2f49953419379ad759b3ef9345eb Mon Sep 17 00:00:00 2001 From: Colin Basnett Date: Fri, 1 Mar 2024 15:14:37 -0800 Subject: [PATCH] When exporting PSKs, armatures with no bones are now more sensibly handled umodel, for some reason, exports some models with no bones. For compatibility and convenience, an armature with no bones may as well not exist, so we treat it as though it doesn't on export, and a single fake root bone is added for maximum compatibility. --- io_scene_psk_psa/psk/builder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/io_scene_psk_psa/psk/builder.py b/io_scene_psk_psa/psk/builder.py index 4ab52d5..05d1654 100644 --- a/io_scene_psk_psa/psk/builder.py +++ b/io_scene_psk_psa/psk/builder.py @@ -76,9 +76,9 @@ def build_psk(context, options: PskBuildOptions) -> PskBuildResult: psk = Psk() bones = [] - if armature_object is None: - # If the mesh has no armature object, simply assign it a dummy bone at the root to satisfy the requirement - # that a PSK file must have at least one bone. + if armature_object is None or len(armature_object.data.bones) == 0: + # If the mesh has no armature object or no bones, simply assign it a dummy bone at the root to satisfy the + # requirement that a PSK file must have at least one bone. psk_bone = Psk.Bone() psk_bone.name = bytes('root', encoding='windows-1252') psk_bone.flags = 0