From 20c8a39f235a31c90799dd073b3f68c227d0b13c Mon Sep 17 00:00:00 2001 From: Colin Basnett Date: Sun, 17 Aug 2025 13:19:36 -0700 Subject: [PATCH] Fixed `is_action_for_object` failing when action had multiple slots --- io_scene_psk_psa/psa/export/operators.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/io_scene_psk_psa/psa/export/operators.py b/io_scene_psk_psa/psa/export/operators.py index d969cbb..ced6e17 100644 --- a/io_scene_psk_psa/psa/export/operators.py +++ b/io_scene_psk_psa/psa/export/operators.py @@ -35,7 +35,7 @@ def get_sequences_propnames_from_source(sequence_source: str) -> Tuple[str, str] def is_action_for_object(obj: Object, action: Action): - if action is None or len(action.fcurves) == 0: + if len(action.fcurves) == 0: return False if obj is None or obj.animation_data is None or obj.type != 'ARMATURE': @@ -43,14 +43,18 @@ def is_action_for_object(obj: Object, action: Action): armature_data = typing_cast(Armature, obj.data) bone_names = set([x.name for x in armature_data.bones]) - - for fcurve in action.fcurves: - match = re.match(r'pose\.bones\[\"([^\"]+)\"](\[\"([^\"]+)\"])?', fcurve.data_path) - if not match: - continue - bone_name = match.group(1) - if bone_name in bone_names: - return True + + # The nesting here is absolutely bonkers. + for layer in action.layers: + for strip in layer.strips: + for channelbag in strip.channelbags: + for fcurve in channelbag.fcurves: + match = re.match(r'pose\.bones\[\"([^\"]+)\"](\[\"([^\"]+)\"])?', fcurve.data_path) + if not match: + continue + bone_name = match.group(1) + if bone_name in bone_names: + return True return False